pertpy icon indicating copy to clipboard operation
pertpy copied to clipboard

How to plot the 0 value during different comparisons?

Open mainharryHR opened this issue 1 year ago • 11 comments

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!

mainharryHR avatar May 20 '24 15:05 mainharryHR

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

Zethson avatar May 20 '24 15:05 Zethson

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.

mainharryHR avatar May 20 '24 15:05 mainharryHR

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!

Zethson avatar May 20 '24 16:05 Zethson

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

mainharryHR avatar May 20 '24 21:05 mainharryHR

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?

Zethson avatar May 20 '24 21:05 Zethson

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

mainharryHR avatar May 20 '24 21:05 mainharryHR

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

Zethson avatar May 20 '24 22:05 Zethson

@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

mainharryHR avatar May 20 '24 22:05 mainharryHR

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

Zethson avatar May 20 '24 22:05 Zethson

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

Zethson avatar May 29 '24 17:05 Zethson

@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

mainharryHR avatar May 29 '24 17:05 mainharryHR

Hi @mainharryHR! Happy to report that the functionality you requested is now incorporated into pertpy. The coda.plot_effects_barplot method includes a parameter, plot_zero_covariate, which, if set to True, will also return "empty" plots, i.e., plots with zero bar height for conditions where no credible effects were found. Please note that plot_zero_covariate is set to True by default. I hope this helps with your analysis! Best, Lilly

Lilly-May avatar Oct 11 '24 12:10 Lilly-May