glmDataSet: Data set constructor for class glmDataSet

glmDataSetR Documentation

Data set constructor for class glmDataSet

Description

This function is used to build a object suitable to be used with Methyl-IT countTest2 function.

Usage

glmDataSet(GR = NULL, counts = NULL, colData = NULL)

Arguments

GR

A GRanges-class object with the count matrix of DMPs in the metacolumns (see 'counts'). If provided, then leave parameter 'counts = NULL'.

counts

Count matrix of DMPs with minimal dimensions 1 (row) x 4 (columns). Column names must corresponds to the rownames from parameter colData.

colData

A data frame with one column named 'condition', which must be a factor with exactly two levels. The rownames of colData individual samples. The row names of colData must correspond to th column names of the count matrix.

Details

Data set constructor for class glmDataSet also validate the object

Value

An object from 'RangedGlmDataSet' class containing these attributes: 'GR': the GRanges of the object, 'counts': the counts for each sample at that genomic position, 'colData': the condition of each sample, treatment or control, 'sampleNames': the names of the samples, 'levels': the values (perhaps TT and CT for treatment and control) permitted in the colData attribute, optionData: additional metadata or NULL

Author(s)

Robersy Sanchez

Examples

set.seed(133) # Set a seed
## A GRanges object with the count matrix in the metacolumns is created
countData <- matrix(sample.int(200, 500, replace = TRUE), ncol = 4)
colnames(countData) <- c('A1','A2','B1','B2')
start <- seq(1, 25e4, 2000)
end <- start + 1000
chr <- c(rep('chr1', 70), rep('chr2', 55))
GR <- GRanges(seqnames = chr, IRanges(start = start, end = end))
mcols(GR) <- countData

## Gene IDs
names(GR) <- paste0('gene', 1:length(GR))

## An experiment design is set.
colData <- data.frame(condition = factor(c('A','A','B','B')),
c('A1','A2','B1','B2'), row.names = 2)

## A RangedGlmDataSet is created
glmDataSet(GR = GR, colData = colData)


genomaths/MethylIT documentation built on Feb. 3, 2024, 1:24 a.m.