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 can i filter the results of fp #184

Closed
hima111997 opened this issue Jan 22, 2024 · 1 comment
Closed

how can i filter the results of fp #184

hima111997 opened this issue Jan 22, 2024 · 1 comment

Comments

@hima111997
Copy link

image

how can i filter the results of interactions based on their proportion to enhance the plot?

@cbouy
Copy link
Member

cbouy commented Feb 13, 2024

Hi,

You can directly filter the pandas DataFrame output by fp.to_dataframe and input that to the Barcode class (which is run under the hood when calling fp.plot_barcode).

Here's an example:

from prolif.plotting.barcode import Barcode

# example: filter interaction that occur in less than 30% of frames
threshold = 0.3
df = fp.to_dataframe()
# only keep interactions occurring more frequently than the threshold
above_threshold_mask = df.mean() > threshold
df_filtered = df.loc[:, above_threshold_mask]
# plot
Barcode(df_filtered).display()

Feel free to reopen the issue if you have another related question

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