Skip to content

Commit

Permalink
Fix generate_net(): store ModuleColor as rgb string that can be corre…
Browse files Browse the repository at this point in the history
…ctly exported as .graphml. Rebuild phuego v1.1.0.
  • Loading branch information
hchen_codon committed Oct 26, 2023
1 parent 4258e14 commit f076fdb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Binary file modified dist/phuego-1.1.0-py3-none-any.whl
Binary file not shown.
Binary file modified dist/phuego-1.1.0.tar.gz
Binary file not shown.
13 changes: 9 additions & 4 deletions phuego/generate_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np
import pandas as pd
import os
import sys

def graph_to_df(module_net, seed, nodes_modules):
edges = []
Expand Down Expand Up @@ -202,9 +203,11 @@ def generate_nets(res_folder, network, uniprot_to_gene, kde_cutoff, rwr_threshol
module_identity = [module for module in modules if node[module] == 1.0]
module_net.vs[x]['ModuleLabel'] = "_".join(module_identity)
if len(module_identity) == 1:
module_net.vs[x]['ModuleColor'] = module_colors[module_identity[0]]
color = module_colors[module_identity[0]]
color_str = f"rgb({color[0]},{color[1]},{color[2]})"
module_net.vs[x]['ModuleColor'] = color_str
else:
module_net.vs[x]['ModuleColor'] = (255, 255, 255) # White
module_net.vs[x]['ModuleColor'] = "rgb(255, 255, 255)" # White
# Write the net.
fname = res_folder+"module_net_increased_"+i+"."+net_format
ig.write(module_net,fname,format=net_format)
Expand Down Expand Up @@ -297,9 +300,11 @@ def generate_nets(res_folder, network, uniprot_to_gene, kde_cutoff, rwr_threshol
module_identity = [module for module in modules if node[module] == 1.0]
module_net.vs[x]['ModuleLabel'] = "_".join(module_identity)
if len(module_identity) == 1:
module_net.vs[x]['ModuleColor'] = module_colors[module_identity[0]]
color = module_colors[module_identity[0]]
color_str = f"rgb({color[0]},{color[1]},{color[2]})"
module_net.vs[x]['ModuleColor'] = color_str
else:
module_net.vs[x]['ModuleColor'] = (255, 255, 255) # White
module_net.vs[x]['ModuleColor'] = "rgb(255, 255, 255)" # White

# Write the net.
fname = res_folder+"module_net_decreased_"+i+"."+net_format
Expand Down

0 comments on commit f076fdb

Please sign in to comment.