Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inferred Network: multiple edges between same source-target pair #163

Open
gianfilippo opened this issue Feb 8, 2025 · 2 comments
Open

Comments

@gianfilippo
Copy link

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

@dbdimitrov
Copy link
Collaborator

Hi @gianfilippo,

I really suggest using the gurobi solver - it's likely that spicy's inbuilt one (HIGHs) is just resulting in very unstable results. @pablormier can maybe confirm or suggest how to improve the solutions by HIGHs as I haven't used it much (besides running the tests and for the simple example in the tutorial).

I explain how to obtain access to gurobi, here:
https://liana-py.readthedocs.io/en/latest/notebooks/targeted.html#Installing-the-Gurobi-Solver:-A-Step-by-Step-Guide

Hope this helps!

@gianfilippo
Copy link
Author

The system manager updated the Gurobi license file. Now things look ok.

In general, I have to say that I am not sure I understand the choice to use the stat without considering the p-value. I feel that the interèpretation of the signalling pathways becomes more difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants