Commit eb2ded38 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

Divide the memory use by 7; computation time reduced by 10 sec

parent d24e365e
......@@ -230,9 +230,9 @@ def build_interactions(filtered_macs, binary_interactions):
filtered_binary_interactions: Interactions between molecules of interest and frontier places that are not genes in trajectories
"""
genes_stimuli_interactions = list()
genes_interactions = list()
stimulis_interactions = list()
genes_stimuli_interactions = Counter()
genes_interactions = Counter()
stimulis_interactions = Counter()
# All genes in frontier places
all_genes = set()
# All other entities in frontier places
......@@ -254,11 +254,11 @@ def build_interactions(filtered_macs, binary_interactions):
# For every solution composed of frontier places,
# compute binary interactions between:
# genes and stimulis
genes_stimuli_interactions += list(it.product(genes, stimuli))
genes_stimuli_interactions.update(it.product(genes, stimuli))
# genes two by two
genes_interactions += list(it.combinations(genes, 2))
genes_interactions.update(it.combinations(genes, 2))
# stimulis two by two
stimulis_interactions += list(it.combinations(stimuli, 2))
stimulis_interactions.update(it.combinations(stimuli, 2))
# print("genes/stimulis interactions:", genes_stimuli_interactions)
# print("genes interactions:", genes_interactions)
......@@ -312,20 +312,13 @@ def build_interactions(filtered_macs, binary_interactions):
filtered_binary_interactions
def build_graph(all_genes, all_stimuli, genes_interactions,
stimulis_interactions,
genes_stimuli_interactions,
filtered_binary_interactions):
def build_graph(all_genes, all_stimuli, unique_genes_interactions,
unique_stimulis_interactions,
unique_genes_stimuli_interactions,
unique_filtered_binary_interactions):
"""
"""
unique_genes_interactions = Counter(genes_interactions)
unique_stimulis_interactions = Counter(stimulis_interactions)
unique_genes_stimuli_interactions = Counter(genes_stimuli_interactions)
unique_filtered_binary_interactions = filtered_binary_interactions
#print(unique_genes_interactions, unique_stimulis_interactions,
# unique_genes_stimuli_interactions, unique_filtered_binary_interactions)
# Counter update...
nodes_count = Counter(it.chain(*unique_genes_interactions.keys()))
nodes_count.update(it.chain(*unique_stimulis_interactions.keys()))
......
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