importData: Import a data-frame or matrix, and associated metadata, to a...

Description Usage Arguments Details Value Author(s) Examples

View source: R/importData.R

Description

Import a data-frame or matrix, and associated metadata, to a SingleCellExperiment object.

Usage

1
2
3
4
5
6
7
importData(
  mat,
  assayname,
  metadata = NULL,
  downsampleVar = NULL,
  verbose = TRUE
)

Arguments

mat

A data-frame or matrix of expression values. Data-frames will be coerced to matrices.

assayname

Name of the SingleCellExperiment assay slot in which data will be stored.

metadata

Metadata associated with the data contained in 'mat'. A strict rule is enforced requiring that rownames(metadata) == rownames(mat).

downsampleVar

Downsample based on variance. Removes this proportion of variables (rows) based on lesser variance. This is applied on a per sample basis. If user wishes to apply this globally on the final merged dataset, then set this to 0 and remove based on variance manually after object creation.

verbose

Boolean (TRUE / FALSE) to print messages to console or not.

Details

Import a data-frame or matrix, and associated metadata, to a SingleCellExperiment object.

Value

A SingleCellExperiment object.

Author(s)

Kevin Blighe <kevin@clinicalbioinformatics.co.uk>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# create random data that follows a negative binomial
mat <- jitter(matrix(
  MASS::rnegbin(rexp(50000, rate=.1), theta = 4.5),
  ncol = 20))
colnames(mat) <- paste0('CD', 1:ncol(mat))
rownames(mat) <- paste0('cell', 1:nrow(mat))

metadata <- data.frame(
  group = rep('A', nrow(mat)),
  row.names = rownames(mat),
  stringsAsFactors = FALSE)

sce <- importData(mat,
  assayname = 'normcounts',
  metadata = metadata)

scDataviz documentation built on Nov. 8, 2020, 4:58 p.m.