dotools_py.get.log2fc#
- dotools_py.get.log2fc(adata, group_by, reference, groups=None, features=None, layer=None)[source]#
Calculate the log2foldchanges for a set of groups.
- Parameters:
- adata
AnnData Annotated data matrix.
- group_by
str Column in
obsto group by.- reference
str Reference condition to use for the calculation.
- groups
str|list|None(default:None) Alternative condititons to use. If
None, all the condititons will be used.- features
str|list|None(default:None) Features to use for calculating the log2foldchanges. If set to
Noneall features will be used.- layer
str|None(default:None) Layer in the AnnData to use for the calculation.
- adata
- Return type:
- Returns:
Returns a DataFrame with the log2-foldchanges. One column will be added for each condition in
groups
Example
>>> import dotools_py as do >>> adata = do.dt.example_10x_processed() >>> df = do.get.log2fc(adata, group_by="condition", reference="healthy") >>> df.head(5) genes log2fc_disease 0 ATP2A1-AS1 26.073313 1 STK17A -0.429677 2 C19orf18 0.775196 3 TPP2 -22.599501 4 MFSD1 -1.669137