dotools_py.tl.DGEAnalysis#
- class dotools_py.tl.DGEAnalysis(adata, groupby, batch_key='batch', pseudobulk_mode='sum', pseudobulk_groups=None, technical_replicates=None, is_pseudobulk=False)[source]#
Class to perform differential gene expression (DGE) at the single-cell or sample level for AnnData objects.
At the sample (pseudobulk) level, the available methods are EdgeR, DESeq2, and t-test. At the single-cell level, the available methods are wilcoxon, MAST, t-test, t-test with overestimated variance, and logistic regression.
- Parameters:
- adata
AnnData Annotated data matrix.
- groupby
str Column in
adata.obsto use for testing.- batch_key
str(default:'batch') Column in
adata.obscontaining batch information.- pseudobulk_mode
Literal['sum','mean'] (default:'sum') Method used to generate pseudobulk counts.
- pseudobulk_groups
str|None(default:None) Column in
adata.obsused to additionally group observations when generating pseudobulk profiles (e.g. cell type annotation). Differential gene expression is performed for the groups ingroup_bywithin each category ofpseudobulk_groups.- technical_replicates
int(default:None) Number of technical replicates to generate for each sample (experimental).
- adata
Examples
>>> import dotools_py as do >>> adata = do.dt.example_10x_processed() >>> tester = do.tl.DGEAnalysis(adata, group_by="condition") >>> tester.find_methods("single-cell") ['logreg', 'mast', 'ttest', 'ttest_overtim_var', 'wilcoxon'] >>> tester.find_methods("pseudobulk") ['cluster_ttest', 'deseq', 'edger']
Attributes table#
Get DGE results. |
Methods table#
|
Differential Gene Expression Analysis with T-test. |
|
Differential Gene Expression Analysis with DESeq2. |
|
Differential Gene Expression Analysis with EdgeR. |
|
Get list with pseudobulk or single-cell methods |
|
Differential Gene Expression Analysis with logistic regression. |
|
Run the Mast Test. |
|
Differential Gene Expression Analysis with Wilcoxon. |
|
Differential Gene Expression Analysis with t-test with overestimated variance. |
|
Differential Gene Expression Analysis with Wilcoxon. |
Attributes#
Methods#
- DGEAnalysis.cluster_ttest(reference, groups, equal_var=True, layer=None)[source]#
Differential Gene Expression Analysis with T-test.
- DGEAnalysis.deseq(design, reference, groups, sample_min_cells=10, sample_min_counts=100, gene_min_count=0, gene_min_total_count=0, layer='counts')[source]#
Differential Gene Expression Analysis with DESeq2.
- Parameters:
- design
str Design for the test.
- reference
str Control condition.
- groups
str|list Alternative conditions to test against.
- sample_min_cells
int(default:10) Minimum number of cells to retain a pseudobulk sample,
- sample_min_counts
int(default:100) Minimum number of counts to retain a pseudobulk sample.
- gene_min_count
int(default:0) Minimum number of counts to retain a gene.
- gene_min_total_count
int(default:0) Minimum number of total counts to retain a gene.
- layer
str(default:'counts') Layer in AnnData to use.
- design
- Returns:
Returns None.
- DGEAnalysis.edger(design, reference, groups, sample_min_cells=10, sample_min_counts=100, gene_min_count=0, gene_min_total_count=0, layer='counts')[source]#
Differential Gene Expression Analysis with EdgeR.
- Parameters:
- design
str|DataFrame Design for the test.
- reference
str Control condition.
- groups
str|list Alternative conditions to test against.
- sample_min_cells
int(default:10) Minimum number of cells to retain a pseudobulk sample,
- sample_min_counts
int(default:100) Minimum number of counts to retain a pseudobulk sample.
- gene_min_count
int(default:0) Minimum number of counts to retain a gene.
- gene_min_total_count
int(default:0) Minimum number of total counts to retain a gene.
- layer
str(default:'counts') Layer with raw counts. Set to
Noneif raw counts are in X
- design
- Return type:
- Returns:
Returns None.
- classmethod DGEAnalysis.find_methods(label)[source]#
Get list with pseudobulk or single-cell methods
- DGEAnalysis.logreg(reference='rest', groups=None, logcounts=True, layer=None)[source]#
Differential Gene Expression Analysis with logistic regression.
- DGEAnalysis.ttest(reference='rest', groups=None, logcounts=True, layer=None)[source]#
Differential Gene Expression Analysis with Wilcoxon.
- DGEAnalysis.ttest_overtim_var(reference='rest', groups=None, logcounts=True, layer=None)[source]#
Differential Gene Expression Analysis with t-test with overestimated variance.