Starlitnightly / omicverse

A python library for multi omics included bulk, single cell and spatial RNA-seq analysis.
https://starlitnightly.github.io/omicverse/
GNU General Public License v3.0
274 stars 32 forks source link

How to get the filtered dataframe with dds.foldchange_set? #58

Closed erwusht closed 5 months ago

erwusht commented 5 months ago

Hi, How do I get the filtered dataframe under dds.foldchange_set parameters?

And, the output of dds.foldchange_set(fc_threshold=-1, pval_threshold=0.05, logp_max=10), like Fold change threshold: 1.5340973642745421 is the raw foldchange of DEGs of the log2 foldchange of DEGs? If I would like to set the increased and decreased foldchange thresholds simultaneously, could I write like this fc_threshold=[-1.5, 1.5]?

Thank you very much!

Starlitnightly commented 5 months ago

Hi,

You can use result=dds.result.loc[dds.result['sig']!='normal'] to get the filtered dataframe in result. Besides, you can set fc_threshold=1.5 to set the increased and decreased foldchange thresholds simultaneously.

But more flexibly, you can manually go ahead and specify different upper and lower thresholds with just the following code:

dds.result['sig']='normal'
dds.result.loc[dds.result['log2FC']>1.5,'sig']='up'
dds.result.loc[dds.result['log2FC']<-1.5,'sig']='down'

Sincerely,

Zehua

erwusht commented 5 months ago

Thank you very much.