DGEList: DGEList Constructor

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/DGEList.R

Description

Creates a DGEList object from a table of counts (rows=features, columns=samples), group indicator for each column, library size (optional) and a table of feature annotation (optional).

Usage

1
2
3
DGEList(counts = matrix(0, 0, 0), lib.size = colSums(counts),
        norm.factors = rep(1,ncol(counts)), samples = NULL,
        group = NULL, genes = NULL, remove.zeros = FALSE)

Arguments

counts

numeric matrix of read counts.

lib.size

numeric vector giving the total count (sequence depth) for each library.

norm.factors

numeric vector of normalization factors that modify the library sizes.

samples

data frame containing information for each sample.

group

vector or factor giving the experimental group/condition for each sample/library.

genes

data frame containing annotation information for each gene.

remove.zeros

logical, whether to remove rows that have 0 total count.

Details

To facilitate programming pipelines, NULL values can be input for lib.size, norm.factors, samples or group, in which case the default value is used as if the argument had been missing.

Value

a DGEList object

Author(s)

edgeR team. First created by Mark Robinson.

See Also

DGEList-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ngenes <- 1000
nsamples <- 4
Counts <- matrix(rnbinom(ngenes*nsamples,mu=5,size=2),ngenes,nsamples)
rownames(Counts) <- 1:ngenes
y <- DGEList(counts=Counts, group=rep(1:2,each=2))
dim(y)
colnames(y)
y$samples
y$genes <- data.frame(Symbol=paste0("Gene",1:ngenes))
show(y)

Example output

Loading required package: limma
[1] 1000    4
[1] "Sample1" "Sample2" "Sample3" "Sample4"
        group lib.size norm.factors
Sample1     1     5180            1
Sample2     1     4977            1
Sample3     2     5220            1
Sample4     2     4912            1
An object of class "DGEList"
$counts
  Sample1 Sample2 Sample3 Sample4
1       1       6       0       2
2       4      10       6       1
3       7       6       2       4
4       5       8       0      13
5       3       4       3       7
995 more rows ...

$samples
        group lib.size norm.factors
Sample1     1     5180            1
Sample2     1     4977            1
Sample3     2     5220            1
Sample4     2     4912            1

$genes
  Symbol
1  Gene1
2  Gene2
3  Gene3
4  Gene4
5  Gene5
995 more rows ...

edgeR documentation built on Jan. 16, 2021, 2:03 a.m.