construct_contrasts: Construct 'contrasts' matrix for comparison

Description Usage Arguments Value See Also Examples

Description

construct_contrasts is a wrapper function to limma::makeContrasts. It allows to specify which comparisons from the linear model fit are to be extracted.

Usage

1
2
3
4
construct_contrasts(design, ...)

## Default S3 method:
construct_contrasts(design, ...)

Arguments

design

A design matrix. See construct_design.

...

A set of contrasts that should be constructed, preferably in the format name1 = expression1, name2 = expression2, ... as it makes it clearer to understand the comparisons when looking at the code later on. See Examples section for more.

See limma::makeContrasts for other possible ways to specify contrasts.

Value

An object of class matrix with columns corresponding to contrasts

See Also

rnaseq, gather_counts show_counts limma_dge edger_dge construct_design write_dge as.dgelist as.eset density_plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
path = system.file("tests", package="ganalyse")

# ----- fpkm ----- # 
fpkm_path = file.path(path, "fpkm", "annotation.txt")
fpkm_obj = rnaseq(fpkm_path, format="fpkm", experiment="sample")
fpkm_counts = gather_counts(fpkm_obj, by="gene-id", log_base=2L)
fpkm_design = construct_design(fpkm_counts, ~ 0 + condition)
fpkm_contrasts = construct_contrasts(
                     design = fpkm_design, 
                     treatA.vs.control = conditiontreatA-conditioncontrol, 
                     treatB.vs.control = conditiontreatB-conditioncontrol
                 )

# ----- raw ----- # 
raw_path = file.path(path, "raw", "annotation.txt")
raw_obj = rnaseq(raw_path, format="raw", experiment="sample")
raw_counts = gather_counts(raw_obj, by="gene-id", threshold=1L)
raw_design = construct_design(raw_counts, ~ 0 + condition)
raw_contrasts = construct_contrasts(
                     design = raw_design, 
                     treatA.vs.control = conditiontreatA-conditioncontrol, 
                     treatB.vs.control = conditiontreatB-conditioncontrol
                 )

asrinivasan-oa/ganalyse documentation built on May 12, 2019, 5:38 a.m.