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

Only displaying tests that are significant #110

Closed
JasonMendoza2008 opened this issue Feb 13, 2023 · 6 comments
Closed

Only displaying tests that are significant #110

JasonMendoza2008 opened this issue Feb 13, 2023 · 6 comments

Comments

@JasonMendoza2008
Copy link
Contributor

The tests that are displayed are defined by what's fed into the argument pairs of Annotator but we don't know prior to running apply_and_annotate what tests are significant. I don't think there's an easy way to eliminate from the list fed to pairs the pairs that are not significant.

@biagio-lunit
Copy link

I was going to ask for a similar feature. I would like to filter p-values before we know the answer. In my case, I want to show only NS, which I cannot know prior to run the code and it is hard work to select pairs one-by-one afterwards. I would like to automate this process.

@JasonMendoza2008
Copy link
Contributor Author

It would be welcome to have both features indeed, with an optional parameter which, by default, would not filter anything. I don't have enough knowledge of the package to dive into the code unfortunately.

@pdec
Copy link

pdec commented Feb 22, 2023

+1

This might be a workaround to annotate only the significant p-values BUT it affects the p-values in multiple test corrections.

# create annotator
annotator = Annotator(axs, pairs, data=df, x=x, y=y, order=order)
# configure
annotator.configure(test=test, comparisons_correction=corr, text_format='star', loc='inside')
# apply ONLY tests
annotator.apply_test()
# pick the pairs producing significant p-value
sig_pairs = [annotator.pairs[i] for i, x in enumerate(annotator.get_annotations_text()) if x != "ns"]
# decide what to do
if len(sig_pairs) == len(pairs): # all pairs gave significant p-values -> annotate
    annotator.annotate()
elif len(sig_pairs) == 0: # there are no significant pairs so don't add anything to the plot
    pass
else:  # some pairs were not significant -> use only those
    annotator = Annotator(axs, sig_pairs, data=df, x=x, y=y, order=order)
    annotator.configure(test=test, comparisons_correction=corr, text_format='star', loc='inside')
    annotator.apply_and_annotate()

@trevismd
Copy link
Owner

For hiding non significant results, we merged #95 into our dev branch, so you can check it out. Just pass hide_non_significant=True when creating the Annotator.

@JasonMendoza2008
Copy link
Contributor Author

JasonMendoza2008 commented Jul 28, 2023

Shouldn't this issue be closed? It has been working for a while on the dev branch.
PR #127 corrects a bugfix related to this issue but otherwise it seems fine.

EDIT: I'll let @trevismd close it if deemed adequate.

@trevismd
Copy link
Owner

trevismd commented Oct 1, 2023

Merged today and released in v0.6.0!

@trevismd trevismd closed this as completed Oct 1, 2023
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

4 participants