Commit 5bb97919 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[cmd] get common graph info: add number of events and genes

parent 7ce33225
......@@ -412,13 +412,25 @@ def queries_2_common_graph(output_dir, model_file, path,
if make_json or make_csv:
# Export to json file (similaire à model_graph_info() ...)
# Get 2 lists: 1: frontiers; 2: events
unzipped_solutions = list(zip(*solutions))
# Frontiers
frontiers = set(it.chain(*[sol.split() for sol, _ in solutions]))
frontiers = set(it.chain(*[sol.split() for sol in unzipped_solutions[0]]))
# Events
events = set(it.chain(*it.chain(*unzipped_solutions[1])))
# Genes
# brutal but effective as long as the nodes of a model do not have
# the information in hard in one of their attributes
genes = [name for name in frontiers if "_gene" in name]
solutions_info = {
'modelFile': model_file,
'query': query,
'solutions': len(solutions), # nb trajectories/solutions
'boundaries': len(frontiers), # frontier places
'boundaries': len(frontiers),
'events': len(events),
'genes': len(genes),
}
# Advanced metrics
get_solutions_graph_data(graph, solutions_info, True)
......@@ -443,11 +455,14 @@ def queries_2_common_graph(output_dir, model_file, path,
# Init the CSV file now
import csv
f_d = open(output_dir + 'graphs_summary.csv', 'w')
# Get a subset of solutions_info keys
writer = csv.DictWriter(
f_d,
[
"query", "solutions", "boundaries", "graph_nodes", "graph_edges",
"strongly_connected", "max_degree", "min_degree", "average_degree"
"query", "solutions", "boundaries", "events", "genes",
"graph_nodes", "graph_edges",
"strongly_connected",
"max_degree", "min_degree", "average_degree",
],
extrasaction="ignore", # Ignore unknown fieldnames
delimiter=str(';'),
......
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