View source: R/calc_Minkowski_distances.R
calc_Minkowski_distances | R Documentation |
Function returns Minkowski distances for kNN-graphs constructed from counts matrix in sce (stored in assay logcounts) using specified genes.
calc_Minkowski_distances(
sce,
genes,
batch = NULL,
n.neigh = 5,
nPC = NULL,
genes.predict = rownames(sce),
p.minkowski = 3,
genes.discard = NULL,
genes.discard_prefix = NULL,
...
)
sce |
SingleCellExperiment object containing gene counts matrix (stored in 'logcounts' assay). |
genes |
Character vector containing genes that are used to construct kNN-graph. |
batch |
Name of the field in colData(sce) to specify batch. Default batch=NULL if no batch is applied. |
n.neigh |
Positive integer > 1, specifying number of neighbors to use for kNN-graph. Default n.neigh=5. |
nPC |
Scalar (or NULL) specifying number of PCs to use for kNN-graph. Default nPC=NULL (no PCA). |
genes.predict |
Character vector containing genes for which we want to calculate Minkowsky distances. Default genes.predict = rownames(sce). |
p.minkowski |
Order of Minkowski distance. Default p.minkowski=3. |
genes.discard |
Character vector containing genes to be excluded from candidates (note that they still will be used for graphs construction. If you want to exclude them from graph construction as well, just discard them prior in sce object). Default = NULL and no genes will be discarded. |
genes.discard_prefix |
Character vector containing prefixes of genes to be excluded (e.g. Rpl for L ribosomal proteins. Note that they still will be used for graphs construction. If you want to exclude them from graph construction as well, just discard them prior in sce object). Default = NULL and no genes will be discarded. |
... |
Additional arguments |
data.frame, field 'gene' to gene from genes.predict; field 'dist' corresponds to calculated Minkowski distance.
require(SingleCellExperiment)
n_row = 1000
n_col = 100
sce = SingleCellExperiment(assays = list(logcounts = matrix(rnorm(n_row*n_col), ncol=n_col)))
rownames(sce) = as.character(1:n_row)
colnames(sce) = c(1:n_col)
sce$cell = colnames(sce)
genes = rownames(sce)
out = calc_Minkowski_distances(sce, genes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.