Learn R Programming

MultiDataSet (version 1.0.2)

prepareMethylationSet: Generating a MethylationSet

Description

This function creates a MethylationSet using from a matrix of beta values and a data.frame of phenotypes.

Usage

prepareMethylationSet(matrix, phenotypes, annotation = "IlluminaHumanMethylation450kanno.ilmn12.hg19", chromosome = "chr", position = "pos", genes = "UCSC_RefGene_Name", group = "UCSC_RefGene_Group", filterNA_threshold = 0.05, verbose = FALSE)

Arguments

matrix
Data.frame or a matrix with samples on the columns and cpgs on the rows. A minfi object can be used to.
phenotypes
Data.frame or vector with the phenotypic features of the samples. Samples will be in the rows and variables in the columns. If matrix is a minfi object, phenotypes can be taken from it.
annotation
Character with the name of the annotation package or data.frame or AnnotationDataFrame with the annotation.
chromosome
Character with the column containing chromosome name in the annotation data.
position
chromosome Character with the column containing position coordinate in the annotation data.
genes
Character with the column containing gene names related to the methylation site in the annotation data. (Optional)
group
Character with the column containing the position of the probe related to the gene named in gene column. (Optional)
filterNA_threshold
Numeric with the maximum percentage of NA allowed for each of the probes. If 1, there will be no filtering, if 0 all probes containing at least a NA will be filtered.
verbose
Logical value. If TRUE, it writes out some messages indicating progress. If FALSE nothing should be printed.

Value

MethylationSet with phenotypes and annotation.

Details

prepareMethylationSet is a useful wrapper to create MethylationSet. Rigth now, prepareMethylationSet supports two entry points: a minfi object and a matrix of betas.

Phenotypes are compulsory and can be supplied as data.frame or AnnotatedDataFrame.

By default, annotation is taken from minfi package and IlluminaHumanMethylation450kanno.ilmn12.hg19 package is used, being the default arguments adapted to use this annotation. To use this annotation, IlluminaHumanMethylation450kanno.ilmn12.hg19 must be installed and methylation sites must be named like in Illumina 450k chip. Use of this annotation ensures correct results in all the analysis.

If custom annotation is desired, there are two compulsory features: chromosomes and positions. Chromosomes should be supplied in the character form (e.g. chr1). Two additional features will be used during the presentation of results but not during the analyses: genes and group. Genes are the gene names of the genes around the cpg site and group defines the groups of the genes. Both columns will appear in the results but they are not used through the workflow. It should be noticed that BlockFinder only supports minfi annotation, so it is not advised to be used with custom annotation.

Examples

Run this code
if (require(minfiData)){
 betas <- getBeta(MsetEx)[1:1000, ]
 pheno <- pData(MsetEx)
 set <- prepareMethylationSet(betas, pheno)
 }

Run the code above in your browser using DataLab