Closed hima111997 closed 7 months ago
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
how can i filter the results of interactions based on their proportion to enhance the plot?