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 explore the result? #14

Open
LJZYaaa opened this issue Sep 22, 2024 · 5 comments
Open

How to explore the result? #14

LJZYaaa opened this issue Sep 22, 2024 · 5 comments

Comments

@LJZYaaa
Copy link

LJZYaaa commented Sep 22, 2024

Hi, very gald to have the chance to use flowsig to explore cellchat between database!
But when i run-throught the code in your tutorial, i feel confuse about the result. there are no guidelines in the tutorial to help the user explore and understand the result. feel no user-friendly :)
So could you ples give some advices to visualize the output ? @axelalmet

@axelalmet
Copy link
Owner

Hello LJZYaaa,

You're right, the plotting functionality and documentation is dreadfully lacking. I just updated flowsig to finally include some plotting functions. I plan on adding a new notebook demonstrating the different ways to plot results and updating the README.md as well by the end of this week, but in the meantime, these functions may be of use to you:

  1. If you want to see which variables are differentially flowing (inflowing) or outflowing, for the pancreatic islets scRNA-seq example outlined in the README, you can run:
fig, ax = plt.subplots(figsize=(6, 4))
fs.pl.plot_differentially_flowing_signals(adata,
                                        condition_key = 'Condition',
                                        pert_key = 'IFNg',
                                        var_type = 'outflow',
                                        flowsig_expr_key = 'X_flow_orig',
                                        flowsig_network_key = 'flowsig_network_orig',
                                        qval_threshold = 0.05,
                                        logfc_threshold = 0.5,
                                        label_lowqval = True,
                                        ax=ax
                                        )
plt.show()

Setting pert_key='IFNg orients results so that those upregulated in the perturbed condition have positive log fold change. Note also that you also need to set flowsig_expr_key = 'X_flow_orig' and flowsig_network_key = 'flowsig_network_orig' to visualise both significant and non-significant variables.

  1. To plot the global intercellular flow network, you can run something like this:
flow_network = fs.tl.construct_intercellular_flow_network(adata,
                                                            flowsig_network_key = 'flowsig_network',
                                                            adjacency_key = 'adjacency_validated_filtered')

fig, ax = plt.subplots(figsize=(6, 4))
fs.pl.plot_intercellular_flows(adata,
                                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,
                                ax=ax)
plt.show()

This command plots the entire intercellular flow network. If you want to look at the flows induced by a specific inflow variable, you can set inflow_vars, e.g.,

fig, ax = plt.subplots(figsize=(6, 4))
fs.pl.plot_intercellular_flows(adata,
                                flow_network = flow_network,
                                inflow_vars = ['SSTR2'], 
                                flowsig_network_key = 'flowsig_network',
                                align_mode = 'horizontal',
                                width_scale = 2.0,
                                x_margin_offset = 0.3,
                                y_margin_offset = 0.0,
                                ax=ax)
plt.show()

You can also specify module_vars and/or outflow_vars.

More details will come ASAP!

@LJZYaaa
Copy link
Author

LJZYaaa commented Sep 25, 2024

Glad to recevice your reply, and can't wait to use the new version of flowsig!
Hope anything goes well on you ^^

@wolfQK
Copy link

wolfQK commented Sep 26, 2024

Hi axelalmet,
Could you please let me know when you might be able to update the code for the visualization part? I really appreciate your work and look forward to the update.
Thank you very much!
@axelalmet

@Wenbin1994
Copy link

Hi! Thank you for making this tool. Excuse me, how do I reproduce the figures from the article, such as Fig3c, Fig4a, Fig5a and b, and how do I take the transcription factors from the GEM module and make figures similar to Fig6d, e and f?

@XiaolongYang-HZAU
Copy link

Thank you for developing such an excellent software! I also hope to replicate the visualization of Fig6 in your article. Is there currently visualization provided in the package, or would you be able to update the visualization section in the tutorial? Thank you very much!

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

5 participants