computeHVG: Compute Highly Variable Genes

Description Usage Arguments Value Examples

View source: R/variable_genes.R

Description

Compute Highly Variable Genes

Usage

1
2
3
4
5
6
7
8
computeHVG(
  expression_matrix,
  reverse_log_scale = T,
  log_base = exp(1),
  expression_threshold = 0,
  nr_expression_groups = 20,
  zscore_threshold = 1.5
)

Arguments

expression_matrix

Expression matrix

reverse_log_scale

Reverse log-scale of expression values

log_base

If reverse_log_scale is TRUE, which log base was used?

expression_threshold

Expression threshold to consider a gene detected

nr_expression_groups

Number of expression groups for cov_groups

zscore_threshold

Z-score to select hvg for cov_groups

Value

Character vector of highly variable genes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
set.seed(0)
requireNamespace("Matrix")

## generate (meaningless) counts
c1 <- stats::rpois(5e3, 1)
c2 <- stats::rpois(5e3, 2)
m <- t(
  rbind(
    matrix(c1, nrow = 20),
    matrix(c2, nrow = 20)
  )
)

## construct an expression matrix m
colnames(m) <- paste0('cell', 1:ncol(m))
rownames(m) <- paste0('gene', 1:nrow(m))
m <- log(m/colSums(m)*1e4 + 1)
m <- methods::as(m, 'dgCMatrix')

## calculate HVGs
hvgs <- computeHVG(m)

rescue documentation built on July 18, 2020, 5:06 p.m.

Related to computeHVG in rescue...