scverse / pertpy

Perturbation Analysis in the scverse ecosystem.
https://pertpy.readthedocs.io/en/latest/
MIT License
92 stars 19 forks source link

How to plot the 0 value during different comparisons? #598

Open mainharryHR opened 1 month ago

mainharryHR commented 1 month ago

Description of feature

Dear team,

Thanks for the great package

I believe I have already generate all the comparisons. But when I try to plot, I only can see the one comparison, but not able to plot other comparisons. pt.pl.coda.effects_barplot(sccoda_data_control, "coda", "Cancer") plt.show()

AnnData object with n_obs × n_vars = 24 × 15 varm: 'intercept_df', 'effect_df_Cancer[T.No]', 'effect_df_Cancer[T.CRC]', "effect_df_C(Cancer, Treatment('Control'))[T.No]", "effect_df_C(Cancer, Treatment('Control'))[T.CRC]", "effect_df_C(Cancer, Treatment('No'))[T.Control]", "effect_df_C(Cancer, Treatment('No'))[T.CRC]"

Screenshot 2024-05-20 at 10 06 16

Any comments are welcome!

Zethson commented 1 month ago

I'm not sure what exactly you are referring to, but you may just not have any significant effects in the other comparisons

mainharryHR commented 1 month ago

I'm not sure what exactly you are referring to, but you may just not have any significant effects in the other comparisons

Thanks for the reply. Even for not significant effects, it is still good to plot 0. You are correct, other effects are 0, How should I plot the 0 effect? Thanks.

Zethson commented 1 month ago

Well, what is there to plot if the effect for a whole condition is 0? Just state that the effect was 0. If a condition has some, but not all 0s, it's plotted like what you showed above.

You can always plot an empty bar plot but I don't quite see the point...

Happy to learn about good ideas if you have any!

mainharryHR commented 1 month ago

Well, what is there to plot if the effect for a whole condition is 0? Just state that the effect was 0. If a condition has some, but not all 0s, it's plotted like what you showed above.

You can always plot an empty bar plot but I don't quite see the point...

Happy to learn about good ideas if you have any!

I always feel it is good to plot 0 than a missing figure. Missing figure can represent either 0 or missing value itself or forget to plot. :)

It seems the following argument can not plot the 0 value. I guess I need to extract the data and plot by another package. pt.pl.coda.effects_barplot(sccoda_data_No, modality_key="coda_No", covariates="Cancer") plt.show()

Many thanks!

Harry

Zethson commented 1 month ago

No, that's totally fair. We should at least print a message that for one condition there were no significant effects. I'm always open to PRs if you want to either:

  1. Add such a warning
  2. Also plot "empty" barplots where all values are 0

Would you be up for helping out?

mainharryHR commented 1 month ago

No, that's totally fair. We should at least print a message that for one condition there were no significant effects. I'm always open to PRs if you want to either:

  1. Add such a warning
  2. Also plot "empty" barplots where all values are 0

Would you be up for helping out?

I vote for 2: plot "empty" barplots where all values are 0. Cause we need a figure to show it is 0, that is important results as well.

If we can plot the figures in a separate window by each condition, it will add extra flexibilities for publication.
Thank you very much Harry

Zethson commented 1 month ago

@mainharryHR are you willing to submit a pull request for that?

mainharryHR commented 1 month ago

@mainharryHR are you willing to submit a pull request for that?

Yup. I do.

I tried to submit, but it seems only managers are allowed.

Best

Zethson commented 1 month ago

You can fork the repository and then make a pull request. There's tutorials out there that show how to do that. Thanks!

Zethson commented 1 month ago

@mainharryHR are you still up for a PR or not?

mainharryHR commented 1 month ago

@mainharryHR are you still up for a PR or not?

Thank you for following up. I tried to do a pull request and it was not successful. So I skipped that for now. At least I know if there is no plot, most likely they are not significant.

Many thanks and Have a great day! Harry