scNMFSet-class: Class 'scNMFSet' for storing input data and results

Description Usage Arguments Value Methods (by generic) Slots Examples

Description

S4 class derived from SingleCellExperiment that can store single-cell count matrix, gene and cell annotation data frames, and factorization factors as well as quality measures for rank determination.

Usage

1
2
## S4 method for signature 'scNMFSet,ANY'
plot(x)

Arguments

x

Object containing measure

Value

Object of class scNMFSet

NULL

Methods (by generic)

Slots

assays

Named list for count matrix counts.

rowData

DataFrame for gene (feature) names and annotations in columns.

colData

DataFrame for cell IDs and other annotations in columns (e.g., barcodes, cell types).

ranks

Vector for rank values for which factorization has been performed.

basis

List (of length equal to that of ranks) of basis matrices W from factorization; dimension nrow x rank, where nrow is no. of rows in count.

coeff

List (of length equal to that of ranks) of coefficient matrices H from factorization; dimension rank x ncol, where ncol is no. of columns in count.

measure

Data frame of factorization quality measures for each rank (likelihood and dispersion).

Other slots inherited from SingleCellExperiment class are not explicitly used.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library(S4Vectors)
# toy matrix
ngenes <- 8 
ncells <- 5
mat <- matrix(rpois(n=ngenes*ncells,lambda=3),ngenes,ncells)

abc <- letters[seq_len(ngenes)]
ABC <- LETTERS[seq_len(ncells)] 
genes <- DataFrame(gene_id=abc)
cells <- DataFrame(cell_id=ABC)
rownames(mat) <- rownames(genes) <- abc
colnames(mat) <- rownames(cells) <- ABC

# create scNMFSet object
s <- scNMFSet(count=mat,rowData=genes,colData=cells)
# alternative ways
s2 <- scNMFSet(count=mat)
s2 <- scNMFSet(assays=list(counts=mat))        

# show dimensions
dim(s)

# show slots
rowData(s)

# modify slots
colData(s) <- DataFrame(cell_id=seq_len(ncells),
              cell_type=c(rep('tissue1',2),
                          rep('tissue2',ncells-2)))
colData(s)

ccfindR documentation built on Nov. 8, 2020, 5:12 p.m.