"Using SCIPY to compute the matrix exponential, t=0.1...\n") # No kernel supplied: use SCIPY to generate a kernel on the fly, and then use it # for subsequent diffusion operations if path.exists('tiedie_kernel.pkl'): fh = open('tiedie_kernel.pkl', 'rb') diffuser = pickle.load(fh) fh.close() else: diffuser = SciPYKernel(opts.network) pk_file = open('tiedie_kernel.pkl', 'wb') pickle.dump(diffuser, pk_file) pk_file.close() # Check to make sure the node universe matches the k_labels = diffuser.getLabels() if len(network_nodes) != len(k_labels) or len( network_nodes.intersection(k_labels)) != len(k_labels): sys.stderr.write( "Error: the universe of gene/node labels in the network file doesn't match the supplied kernel file!\n" ) sys.exit(1) sys.stderr.write("Diffusing Heats...\n") # Separately perform diffusion for each input set up_heats_diffused = diffuser.diffuse(up_heats, reverse=False) down_heats_diffused = diffuser.diffuse(down_heats, reverse=True) # Extract a subnetwork solution from the diffused heats, the set of nodes found, the Relevance score for this network solution # and the heat scores for all linker genes subnet_soln, subnet_soln_nodes, alpha_score, linker_scores = extractSubnetwork(