scFates.tl.test_covariate#
- scFates.tl.test_covariate(adata, group_key, features=None, seg=None, layer=None, trend_test=False, nested=False, fdr_cut=0.01, n_jobs=1, n_map=1, copy=False)#
Test for branch differential gene expression between covariates on the same trajectory path.
Test of amplitude difference
The same is used as in
scFates.tl.test_fork(). This uses the following model :\(g_{i} \\sim\ s(pseudotime)+s(pseudotime):Covariate+Covariate\)
Where \(s(.)\) denotes the penalized regression spline function and \(s(pseudotime):Covariate\) denotes interaction between the smoothed pseudotime and covariate terms. From this interaction term, the p-value is extracted.
Test of trend difference
Inspired from a preprint [Ji22], this test compares the following full model:
\(g_{i} \\sim\ s(pseudotime)+s(pseudotime):Covariate+Covariate\)
to the following reduced one:
\(g_{i} \\sim\ s(pseudotime)+Covariate\)
Comparison is done using ANOVA
Nested test
This performs two tests: 1. Shared trend: \(g_{i} \\sim\ s(pseudotime)+Covariate\) vs \(g_{i} \\sim\ Covariate\) 2. Specific trend: \(g_{i} \\sim\ s(pseudotime)+s(pseudotime):Covariate+Covariate\) vs \(g_{i} \\sim\ s(pseudotime)+Covariate\)
- Parameters:
- adata
AnnData Annotated data matrix.
- group_key
str key in .obs for the covariates to test.
- features
Optional[Iterable] (default:None) Which features to test (all significants by default).
- seg
Optional[str] (default:None) In the case of a tree, which segment to use for such test.
- layer
Optional[str] (default:None) layer to use for the test
- trend_test
bool(default:False) Whether to perform the trend test instead of amplitude test.
- nested
bool(default:False) Whether to perform the nested suite of tests (shared and specific trends).
- n_jobs
int(default:1) number of cpu processes used to perform the test.
- n_map
int(default:1) number of cell mappings from which to do the test (not implemented yet).
- copy
bool(default:False) Return a copy instead of writing to adata.
- adata
- Returns:
adata : anndata.AnnData if copy=True it returns or else add fields to adata:
- .var[‘cov_pval’ or ‘covtrend_pval’]
pvalues extracted from tests.
- .var[‘cov_fdr’ or ‘covtrend_fdr’]
FDR extracted from the pvalues.
- .var[‘cov_signi’ or ‘covtrend_signi’]
is the feature significant.
- .var[‘A->B_lfc’]
logfoldchange in expression between covariate A and B.
- .var[‘{covariate}_lfc’]
logfoldchange in expression between covariate and the rest of the cells.
If nested=True: .var[‘shared_pval’] and .var[‘spec_pval’]
pvalues for shared and specific trends.