If this matrix is multiplied with a count table (e.g. obtained by GetTable), either the average (average=TRUE) or the sum (average=FALSE) of all columns (samples or cells) belonging to the same Condition is computed.

Usage

GetSummarizeMatrix(x, ...)

# S3 method for grandR
GetSummarizeMatrix(x, no4sU = FALSE, columns = NULL, average = TRUE, ...)

# S3 method for default
GetSummarizeMatrix(x, subset = NULL, average = TRUE, ...)

Arguments

x

A grandR object or a named vector (the names indicate the sample names, the value the conditions to be summarized)

...

further arguments to be passed to or from other methods.

no4sU

Use no4sU columns (TRUE) or not (FALSE)

columns

which columns (i.e. samples or cells) to return (see details)

average

matrix to compute the average (TRUE) or the sum (FALSE)

subset

logical vector of which elements of the vector v to use (or NULL: use all)

Value

A matrix to be multiplied with a count table

Details

Columns can be given as a logical, integer or character vector representing a selection of the columns (samples or cells). The expression is evaluated in an environment having the Coldata, i.e. you can use names of Coldata as variables to conveniently build a logical vector (e.g., columns=Condition="x").

The method for grandR object simply calls the general method

Examples

sars <- ReadGRAND(system.file("extdata", "sars.tsv.gz", package = "grandR"),
design=c("Condition",Design$dur.4sU,Design$Replicate))
#> Warning: Duplicate gene symbols (n=1, e.g. MATR3) present, making unique!

GetSummarizeMatrix(sars)
#>              Mock SARS
#> Mock.no4sU.A  0.0  0.0
#> Mock.1h.A     0.2  0.0
#> Mock.2h.A     0.2  0.0
#> Mock.2h.B     0.2  0.0
#> Mock.3h.A     0.2  0.0
#> Mock.4h.A     0.2  0.0
#> SARS.no4sU.A  0.0  0.0
#> SARS.1h.A     0.0  0.2
#> SARS.2h.A     0.0  0.2
#> SARS.2h.B     0.0  0.2
#> SARS.3h.A     0.0  0.2
#> SARS.4h.A     0.0  0.2
head(as.matrix(GetTable(sars)) %*% GetSummarizeMatrix(sars))   # average by matrix multiplication
#>           Mock   SARS
#> UHMK1   5158.4  972.4
#> ATF3     151.6  267.2
#> PABPC4  6105.4 1461.2
#> ROR1    2659.6  688.0
#> ZC3H11A 2260.4  950.2
#> ZBED6   2229.6  935.2
head(GetTable(sars,summarize = TRUE))                          # shortcut, does the same
#>           Mock   SARS
#> UHMK1   5158.4  972.4
#> ATF3     151.6  267.2
#> PABPC4  6105.4 1461.2
#> ROR1    2659.6  688.0
#> ZC3H11A 2260.4  950.2
#> ZBED6   2229.6  935.2

# See the data-matrices-and-analysis-results vignette for more examples!