This function is used to build a object suitable to be used
with Methyl-IT countTest2
function.
glmDataSet(GR = NULL, counts = NULL, colData = NULL)
A GRanges-class
object with the count
matrix of DMPs in the metacolumns (see 'counts'). If provided, then
leave parameter 'counts = NULL'.
Count matrix of DMPs with minimal dimensions 1 (row) x 4 (columns). Column names must corresponds to the rownames from parameter 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.
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
Data set constructor for class glmDataSet also validate the object
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)
#> RangedGlmDataSet with 125 regions and 4 columns (individuals) with factor levels 'A' and 'B'
#> The accessible objects in the dataset are:
#> Length Class Mode
#> GR 125 GRanges S4
#> counts 500 -none- numeric
#> colData 1 data.frame list
#> sampleNames 4 -none- character
#> levels 2 -none- character
#> optionData 0 -none- NULL
#>