Commit 7aef0f71 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

Support of output_dir for build_graph

parent 65e3c86b
......@@ -354,7 +354,7 @@ def build_interactions(filtered_macs, binary_interactions):
def build_graph(all_genes, all_stimuli, unique_genes_interactions,
def build_graph(output_dir, all_genes, all_stimuli, unique_genes_interactions,
......@@ -382,6 +382,7 @@ def build_graph(all_genes, all_stimuli, unique_genes_interactions,
* stimuli: blue
* molecules of interest: yellow
:param output_dir: Output path.
:param all_genes: All genes in all the solutions
:param all_stimuli: All stimulis in all the solutions
:param genes_interactions: Interactions between genes in the same solution
......@@ -391,6 +392,7 @@ def build_graph(all_genes, all_stimuli, unique_genes_interactions,
:param molecule_stimuli_interactions: Counter interactions between molecules
of interest and frontier places that are not genes (stimuli)
in trajectories (i.e.: ``(molecule, stimulus)``).
:type output_dir: <str>
:type all_genes: <set>
:type all_stimuli: <set>
:type genes_interactions: <Counter>
......@@ -399,6 +401,8 @@ def build_graph(all_genes, all_stimuli, unique_genes_interactions,
:type molecule_stimuli_interactions: <Counter>
""""Building graph...")
# Count all nodes
nodes_count = Counter(it.chain(*unique_genes_interactions.keys()))
......@@ -438,7 +442,7 @@ def build_graph(all_genes, all_stimuli, unique_genes_interactions,
build_edge_data(unique_molecule_stimuli_interactions), color='yellow')
# Write graph
nx.write_graphml(G, "test.graphml")
nx.write_graphml(G, output_dir + "interaction_graph.graphml")
def json_2_interaction_graph(output_dir, molecules_of_interest, path):
......@@ -451,6 +455,13 @@ def json_2_interaction_graph(output_dir, molecules_of_interest, path):
More information about the graph and its legend:
:param output_dir: Output path.
:param molecules_of_interest: Iterable of molecules of interest.
:param path: Filepath/directory of a JSON solution file.
:type output_dir: <str>
:type molecules_of_interest: <tuple>
:type path: <str>
chrono_start = time.time()
......@@ -459,6 +470,7 @@ def json_2_interaction_graph(output_dir, molecules_of_interest, path):
# filter_trajectories: filtered_macs, binary_interactions
# build_interactions: data to unpack for build_graph
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment