forked from velocyto-team/velocyto.R
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgene.relative.velocity.estimates.Rd
97 lines (68 loc) · 4.47 KB
/
gene.relative.velocity.estimates.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/momentum_routines.R
\name{gene.relative.velocity.estimates}
\alias{gene.relative.velocity.estimates}
\title{Estimate RNA velocity using gene-relative slopes}
\usage{
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)
}
\arguments{
\item{emat}{- spliced (exonic) count matrix}
\item{nmat}{- unspliced (nascent) count matrix}
\item{deltaT}{- amount of time to project the cell forward}
\item{smat}{- optional spanning read matrix (used in offset calculations)}
\item{steady.state.cells}{- optional set of steady-state cells on which the gamma should be estimated (defaults to all cells)}
\item{kCells}{- number of k nearest neighbors (NN) to use in slope calculation smoothing}
\item{cellKNN}{- optional pre-calculated cell KNN matrix}
\item{kGenes}{- number of genes (k) to use in gene kNN pooling}
\item{old.fit}{- optional old result (in this case the slopes and offsets won't be recalculated, and the same kNN graphs will be used)}
\item{mult}{- library scaling factor (1e6 in case of FPM)}
\item{min.nmat.smat.correlation}{- minimum required Spearman rank correlation between n and s counts of a gene}
\item{min.nmat.emat.correlation}{- minimum required Spearman rank correlation between n and e counts of a gene}
\item{min.nmat.emat.slope}{- minimum sloope of n~e regression}
\item{zero.offset}{- should offset be set to zero, or determined (through smat regression or using near-0 e cases)}
\item{deltaT2}{- scaling of the projected difference vector (normally should be set to 1)}
\item{fit.quantile}{perform gamma fit on a top/bottom quantiles of expression magnitudes}
\item{diagonal.quantiles}{whether extreme quantiles should be computed diagonally}
\item{show.gene}{an optional name of a gene for which the velocity estimation details should be shown (instead of estimating all velocities)}
\item{do.par}{whether the graphical device parameters should be reset as part of show.gene (default=TRUE)}
\item{cell.dist}{- cell distance to use in cell kNN pooling calculations}
\item{emat.size}{- pre-calculated cell sizes for the emat (spliced) matrix}
\item{nmat.size}{- pre-calculated cell sizes for the nmat (unspliced) matrix}
\item{cell.emb}{- cell embedding to be used in show.gene function}
\item{cell.colors}{- cell colors to be used in show.gene function}
\item{expression.gradient}{- color palette used to show the expression magnitudes in show.gene function}
\item{residual.gradient}{- color palette used to show the u residuals in show.gene function}
\item{n.cores}{- number of cores to use}
\item{verbose}{- output messages about progress}
}
\value{
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)
}
\description{
Estimate RNA velocity using gene-relative slopes
}
\examples{
\dontrun{
# 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)
}
}