rowsum: Sum Over Groups of Genes

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

Description

Condense the rows of a DGEList object so that counts are summed over specified groups of genes.

Usage

1
2
3
4
## S3 method for class 'DGEList'
rowsum(x, group, reorder=FALSE, na.rm=FALSE, ...)
## S3 method for class 'SummarizedExperiment'
rowsum(x, group, reorder=FALSE, na.rm=FALSE, ...)

Arguments

x

a DGEList object or a SummarizedExperiment object

group

a vector or factor giving the grouping, with one element per row of x. Missing values will be treated as another group and a warning will be given.

reorder

if TRUE, then the row.names of the resulting DGEList will be in order of sort(unique(group)), if FALSE, they will be in the order that groups were encountered.

na.rm

logical (TRUE or FALSE). Should NA (including NaN) values be discarded?

...

other arguments are not currently used

Details

If x is a SummarizedExperiment object, it is first converted into a DGEList object.

A new DGEList object is computed, with the same columns as x, but for which the rows correspond to the unique values of group. The counts for rows with the same group value are summed.

Columns of x$genes will be retained in the output if they contain group-level annotation. Columns that vary within groups will be dropped.

Value

DGEList object with the same number of columns as x and rows corresponding to the unique values of group.

Author(s)

Gordon Smyth

See Also

rowsum in the base package.

Examples

1
2
x <- DGEList(counts=matrix(1:8,4,2))
rowsum(x, group=c("A","A","B","B"))

Example output

Loading required package: limma
An object of class "DGEList"
$counts
  Sample1 Sample2
A       3      11
B       7      15

$samples
        group lib.size norm.factors
Sample1     1       10            1
Sample2     1       26            1

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