construct_design: Construct design matrix

Description Usage Arguments Details Value See Also Examples

Description

construct_design is a helper/wrapper function for easy construction of design matrices directly from an object of class raw/raw_counts or fpkm/fpkm_counts.

Please refer to the Details section for more.

Note that you can construct the design matrix directly (usually using model.matrix) without using construct_design.

Usage

1

Arguments

x

A fpkm_counts or raw_counts object.

formula

Formula to construct the model matrix with.

Details

To describe treatment conditions, a design matrix is required. It is constructed by providing a formula using the columns in the input raw/raw_counts or fpkm/fpkm_counts object that correspond to the groups and/or treatment each sample belongs to.

If the columns do not already exist in the input object, it should be added first before calling construct_design.

Please ensure that columns that are categorical are of type factor with appropriate reference level (see relevel). See Examples for more.

Value

An object of class matrix is returned.

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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))

# ----- 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))

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