Description Usage Arguments Value Examples
View source: R/momentum_routines.R
Estimate RNA velocity using gene-relative slopes
1 2 3 4 5 6 7 8 9 10 | gene.relative.velocity.estimates(emat, nmat, deltaT = 1, smat = NULL,
steady.state.cells = colnames(emat), kCells = 10, cellKNN = NULL,
kGenes = 1, old.fit = NULL, mult = 1000,
min.nmat.smat.correlation = 0.05, min.nmat.emat.correlation = 0.05,
min.nmat.emat.slope = 0.05, zero.offset = FALSE, deltaT2 = 1,
fit.quantile = NULL, diagonal.quantiles = FALSE, show.gene = NULL,
do.par = TRUE, cell.dist = NULL, emat.size = NULL,
nmat.size = NULL, cell.emb = NULL, cell.colors = NULL,
expression.gradient = NULL, residual.gradient = NULL,
n.cores = defaultNCores(), verbose = TRUE)
|
emat |
- spliced (exonic) count matrix |
nmat |
- unspliced (nascent) count matrix |
deltaT |
- amount of time to project the cell forward |
smat |
- optional spanning read matrix (used in offset calculations) |
steady.state.cells |
- optional set of steady-state cells on which the gamma should be estimated (defaults to all cells) |
kCells |
- number of k nearest neighbors (NN) to use in slope calculation smoothing |
cellKNN |
- optional pre-calculated cell KNN matrix |
kGenes |
- number of genes (k) to use in gene kNN pooling |
old.fit |
- optional old result (in this case the slopes and offsets won't be recalculated, and the same kNN graphs will be used) |
mult |
- library scaling factor (1e6 in case of FPM) |
min.nmat.smat.correlation |
- minimum required Spearman rank correlation between n and s counts of a gene |
min.nmat.emat.correlation |
- minimum required Spearman rank correlation between n and e counts of a gene |
min.nmat.emat.slope |
- minimum sloope of n~e regression |
zero.offset |
- should offset be set to zero, or determined (through smat regression or using near-0 e cases) |
deltaT2 |
- scaling of the projected difference vector (normally should be set to 1) |
fit.quantile |
perform gamma fit on a top/bottom quantiles of expression magnitudes |
diagonal.quantiles |
whether extreme quantiles should be computed diagonally |
show.gene |
an optional name of a gene for which the velocity estimation details should be shown (instead of estimating all velocities) |
do.par |
whether the graphical device parameters should be reset as part of show.gene (default=TRUE) |
cell.dist |
- cell distance to use in cell kNN pooling calculations |
emat.size |
- pre-calculated cell sizes for the emat (spliced) matrix |
nmat.size |
- pre-calculated cell sizes for the nmat (unspliced) matrix |
cell.emb |
- cell embedding to be used in show.gene function |
cell.colors |
- cell colors to be used in show.gene function |
expression.gradient |
- color palette used to show the expression magnitudes in show.gene function |
residual.gradient |
- color palette used to show the u residuals in show.gene function |
n.cores |
- number of cores to use |
verbose |
- output messages about progress |
a list with velocity results, including the current normalized expression state ($current), projected ($projected) over a certain time ($deltaT), unscaled transcriptional change ($deltaE), fit results ($gamma, $ko, $sfit if spanning reads were used), optional cell pooling parameters ($cellKNN, $kCells), kNN-convolved normalized matrices (conv.nmat.norm and conv.emat.norm), library scale ($mult)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
# use min/max quantile gamma fit (recommended option when one can afford to do cell kNN smoothing)
# The example below uses k=5 cell kNN pooling, and top/bottom 2% exprssion quantiles
# emat and nmat are spliced (exonic) and unspliced (intronic) molecule/read count matirces
(preferably filtered for informative genes)
rvel <- gene.relative.velocity.estimates(emat,nmat,deltaT=1,kCells = 5,fit.quantile = 0.02)
# alternativly, the function can be used to visualize gamma fit and regression for a
particular gene. here we pass embedding (a matrix/data frame with rows named with cell names,
and columns corresponding to the x/y coordinates)
# and cell colors. old.fit is used to save calculation time.
gene.relative.velocity.estimates(emat,nmat,deltaT=1,kCells = 5,fit.quantile = 0.02,
old.fit=rvel,show.gene='Chga',cell.emb=emb,cell.colors=cell.colors)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.