liana-py
liana-py copied to clipboard
Inferred Network: multiple edges between same source-target pair
Hi,
following the DEA for CCC tutorial, I am having difficulty in properly saving the resulting network The call cn.methods.carnival.visualize_network(df_res)
result in a graphviz.graphs.Digraph object
I save it to a file doing the following p = cn.methods.carnival.visualize_network(df_res) p.render(locplotDIR + '/potential_regulatory_cascade', format='pdf')
As a result I get 2 files, one is the PDF (attached). You can see I get multiple edges for the same pair of nodes, some edges are black, some blue and some red.
I have multiple edges because the resulting df_res , from running li.mt.find_causalnet, has multiple entries for the same source-target pair. For instance, the Insr-Ptpn11 has 5 edges, 4 red and one black. The df_res shows source source_type source_weight source_pred_val target target_type target_weight target_pred_val edge_type edge_pred_val 33 Insr input 1.08968 1.0 Ptpn11 unmeasured 0.0 1.0 1 1.0 31 Insr input 1.08968 1.0 Ptpn11 unmeasured 0.0 1.0 1 1.0 29 Insr input 1.08968 1.0 Ptpn11 unmeasured 0.0 1.0 1 1.0 30 Insr input 1.08968 1.0 Ptpn11 unmeasured 0.0 1.0 1 1.0 28 Insr input 1.08968 1.0 Ptpn11 unmeasured 0.0 1.0 1 1.0
I should also point out that I had to run li.mt.find_causalnet using the SCIPY solver, for a license version issue on the cluster. df_res, problem = li.mt.find_causalnet(prior_graph, input_scores, output_scores, node_weights, node_cutoff=0.1, max_penalty=1, min_penalty=0.01, edge_penalty=0.1, verbose=True, max_runs=50, stable_runs=10, solver='SCIPY') The solutions are described as Optimal.
I am not sure why I get the same row multiple times. And I am not sure about the color scheme. Could you please clarify ?
Also, is 'render' the best way to save the network to file as image ?
Thanks