> RunVelocity
function (object, spliced = "spliced", unspliced = "unspliced",
ambiguous = NULL, spliced.average = 0.2, unspliced.average = 0.05,
reduction = "pca", group.by = "ident", cells = NULL, graph = NULL,
ncores = 1, verbose = TRUE, ...)
{
CheckPackage(package = "velocyto-team/velocyto.R", repository = "github")
clusters <- FetchData(object = object, vars = group.by)[,
, drop = TRUE]
names(x = clusters) <- colnames(x = object)
if (!is.factor(x = clusters)) {
clusters <- as.factor(x = clusters)
}
if (verbose) {
message("Filtering genes in the spliced matrix")
}
spliced.matrix <- velocyto.R::filter.genes.by.cluster.expression(emat = GetAssayData(object = object,
assay = spliced), clusters = clusters, min.max.cluster.average = spliced.average)
if (verbose) {
message("Filtering genes in the unspliced matrix")
}
unspliced.matrix <- velocyto.R::filter.genes.by.cluster.expression(emat = GetAssayData(object = object,
assay = unspliced), clusters = clusters, min.max.cluster.average = unspliced.average)
if (verbose) {
message("Calculating embedding distance matrix")
}
cell.dist <- as.dist(m = 1 - velocyto.R::armaCor(mat = t(x = Embeddings(object = object,
reduction = reduction))))
args <- list(...)
defaults <- as.list(x = formals(fun = velocyto.R::gene.relative.velocity.estimates))
args <- args[intersect(x = names(x = args), y = names(x = defaults))]
defaults.use <- setdiff(x = names(x = defaults), y = names(x = args))
args[defaults.use] <- defaults[defaults.use]
args$emat <- spliced.matrix
args$nmat <- unspliced.matrix
args$smat <- ambiguous %iff% GetAssayData(object = object,
assay = ambiguous)
args$steady.state.cells <- cells %||% colnames(x = object)
args$cell.dist <- cell.dist
args$cellKNN <- graph %iff% object[[graph]]
args$n.cores <- ncores
args$verbose <- verbose
sink(file = stderr(), type = "output")
on.exit(expr = sink())
cd <- do.call(what = velocyto.R::gene.relative.velocity.estimates,
args = args)
Tool(object = object) <- cd
return(object)
}
<bytecode: 0x000001ec81b7eb40>
<environment: namespace:SeuratWrappers>
里面有个gene.relative.velocity.estimates函数
所以,认为是deltaE
result <- as.data.frame(vel$deltaE)
result[1:5,1:5]
得到速率