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

How to identify the 'flow_network' in plot_intercellular_flows_from_inflows? #3

Open
changqinglu opened this issue Sep 3, 2024 · 3 comments

Comments

@changqinglu
Copy link

Hello, thank you for developing such an excellent tool for cell communication, Flowsig! I have used your example data, and when constructing the global intercellular flow network, I would like to ask how the main drivers of intercellular flows are determined. How are the 'inflow_vars' and 'flow_network' defined in this function? I would greatly appreciate your response. Thank you.
plot_intercellular_flows_from_inflows(
adata=adata,
inflow_vars=inflow_vars,
flow_network=flow_network,
flowsig_network_key='flowsig_network',
align_mode='horizontal',
width_scale=2.0,
x_margin_offset=0.3,
y_margin_offset=0.0
)

@axelalmet
Copy link
Owner

axelalmet commented Sep 5, 2024

Hello,

That's a very good question and I'm sorry for the late reply! To help answer this question properly, I plan on updating the repository to include the functions to generate the visualisations done in the paper and notebooks with visualisation examples. But effectively, if you have experience with NetworkX, we use the adjacency matrices to construct a DirectedGraph, e.g., via this function, and then visualise the intercellular flow networks as multipartite networks.

The main drivers of intercellular flows were chosen based on out-degree from inflow vars. You could also use something like network centrality or prior biological knowledge.

I'll try to update the repository by the end of week/start of next week! Thank you for your patience!

@changqinglu
Copy link
Author

Thank you very much for your reply! I used the code you provided to construct the intercellular flow network for the example dataset burkhardt21.

flow_network = fs.tl.construct_intercellular_flow_network(adata,
flowsig_network_key = 'flowsig_network',
adjacency_key = 'adjacency_validated_filtered')
The result is as follows:

flow_var_info = adata.uns['flowsig_network']['flow_var_info']
inflow_vars = flow_var_info.index[flow_var_info['Type'] == 'inflow'].tolist()
print(inflow_vars)
['CD74+CD44', 'IL6R+IL6ST', 'NCL', 'SSTR2']
inflow_vars_filtered = [node for node in inflow_vars if node in flow_network.nodes]
print("Filtered inflow_vars:", inflow_vars_filtered)
Filtered inflow_vars: ['CD74+CD44']

Does this mean that out of the four differential inflow signals ['CD74+CD44', 'IL6R+IL6ST', 'NCL', 'SSTR2'], only CD74+CD44 passed the validation and low-confidence edge filtering after learning the network? Is this how Fig. 4d in your paper was analyzed?

Looking forward to your reply!
image

@axelalmet
Copy link
Owner

Hello,

In short, no, the set of inflowing signals in the Figure you showed are supposed to be differentially inflowing. But I got the same "error" that you did.

I'm going to look into this, because I know it definitely wasn't the case for previous analysis, which means something went wrong when I translated the prototype code into the more general FlowSig package.

Sorry for this, I'll address this problem ASAP!

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