An algorithm for gene and gene set network inference