calc_Minkowski_distances: calc_Minkowski_distances

View source: R/calc_Minkowski_distances.R

calc_Minkowski_distancesR Documentation

calc_Minkowski_distances

Description

Function returns Minkowski distances for kNN-graphs constructed from counts matrix in sce (stored in assay logcounts) using specified genes.

Usage

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,
  ...
)

Arguments

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

Value

data.frame, field 'gene' to gene from genes.predict; field 'dist' corresponds to calculated Minkowski distance.

Examples

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)


MarioniLab/geneBasisR documentation built on June 30, 2023, 2:04 p.m.