Title: | MAGAR: R-package to compute methylation Quantitative Trait Loci (methQTL) from DNA methylation and genotyping data |
---|---|
Description: | "Methylation-Aware Genotype Association in R" (MAGAR) computes methQTL from DNA methylation and genotyping data from matched samples. MAGAR uses a linear modeling stragety to call CpGs/SNPs that are methQTLs. MAGAR accounts for the local correlation structure of CpGs. |
Authors: | Michael Scherer [cre, aut] |
Maintainer: | Michael Scherer <[email protected]> |
License: | GPL-3 |
Version: | 1.15.0 |
Built: | 2024-10-30 07:43:04 UTC |
Source: | https://github.com/bioc/MAGAR |
This function computes CpG correlation blocks from correlations of CpGs across samples by Louvian clustering.
computeCorrelationBlocks( meth.data, annotation, cor.threshold = qtlGetOption("cluster.cor.threshold"), sd.gauss = qtlGetOption("standard.deviation.gauss"), absolute.cutoff = qtlGetOption("absolute.distance.cutoff"), max.cpgs = qtlGetOption("max.cpgs"), assembly = "hg19", chromosome = "chr1" )
computeCorrelationBlocks( meth.data, annotation, cor.threshold = qtlGetOption("cluster.cor.threshold"), sd.gauss = qtlGetOption("standard.deviation.gauss"), absolute.cutoff = qtlGetOption("absolute.distance.cutoff"), max.cpgs = qtlGetOption("max.cpgs"), assembly = "hg19", chromosome = "chr1" )
meth.data |
A |
annotation |
The genomic annotations of the CpG positions. |
cor.threshold |
The correlation threshold used to discard edges from the correlation-based network. |
sd.gauss |
Standard deviation of the Gauss distribution used to weight the distance |
absolute.cutoff |
Absolute distance cutoff after which no methQTL interaction is to be considered. |
max.cpgs |
Maximum number of CpGs used in the computation (used to save memory). 40,000 is a reasonable default for machines with ~128GB of main memory. Should be smaller for smaller machines and larger for larger ones. |
assembly |
The assembly used |
chromosome |
The chromosome for which correlation block calling is to be performed |
This method performs clustering of the correlation matrix obtaind from the DNA methylation matrix. Correlations
are computed for each pair of CpGs across all the samples. We then compute a similarity matrix from this correlation
matrix and set correlations lower than the given threshold to 0. In the next step, we weight the correlations
by the distance between the CpGs: smaller distances get higher weights according to Gaussian distribution with
mean 0 and standard deviation as specified above. Furthermore, similarities of CpGs that are further than
absolute.distance.cutoff
away from one another are discarded.
We then compute the associated weighted, undirected graph from the similarity matrix and execute Louvain clustering on the graph. The resulting clusters of CpGs are returned.
A list representing the clustering of CpGs into correlation blocks. Each element is a cluster, which contains row indices of the DNA methylation matrix that correspond to this cluster.
Michael Scherer
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.data <- getMethData(meth.qtl) anno.meth <- getAnno(meth.qtl,"meth") cor.blocks <- computeCorrelationBlocks(meth.data[seq(1,10),],annotation=anno.meth[seq(1,10),])
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.data <- getMethData(meth.qtl) anno.meth <- getAnno(meth.qtl,"meth") cor.blocks <- computeCorrelationBlocks(meth.data[seq(1,10),],annotation=anno.meth[seq(1,10),])
Performs input for the given DNA methylation and genotyping data.
doImport( data.location, s.anno = NULL, assembly.meth = "hg19", assembly.geno = "hg19", tab.sep = ",", s.id.col = "sample_id", out.folder = tempdir(), ... )
doImport( data.location, s.anno = NULL, assembly.meth = "hg19", assembly.geno = "hg19", tab.sep = ",", s.id.col = "sample_id", out.folder = tempdir(), ... )
data.location |
Named character vector specifying the data location. The names correspond to:
|
s.anno |
Path to the sample annotation sheet. If |
assembly.meth |
Assembly used for the DNA methylation data. Typically is |
assembly.geno |
Assembly used for the genotyping data. If it is not the same as |
tab.sep |
The table separator used for the sample annotation sheet. |
s.id.col |
The column name of the sample annotation sheet that specifies the sample identifier. |
out.folder |
The output directory to store diagnostic plots |
... |
Futher parameters passed to e.g. |
Import of DNA methylation and genotyping data is done separately:
DNA methylation data is imported using the RnBeads
package. We
use a default option setting commonly used for DNA methylation data obtained from the Illumina BeadArray
series. If you want to specify further options, we refer to the rnb.options
.
Genotyping data is processed using PLINK. We focus on genotyping data generated
with the Illumina BeadArray series and use default options. For further option settings, you should consult
the qtlSetOption
documentation.
You can specify the import type using qtlSetOption
through the options
meth.data.type
and geno.data.type
.
This function internally uses doMethImport
and doGenoImport
An object of type MethQTLInput-class
with the methylation and genotyping information added.
Michael Scherer
meth.qtl.in <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl.in
meth.qtl.in <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl.in
Function to compute methQTL given DNA methylation and genotyping data.
doMethQTL( meth.qtl, sel.covariates = NULL, p.val.cutoff = 1e-05, ncores = 1, cluster.submit = FALSE, out.dir = getwd(), default.options = TRUE )
doMethQTL( meth.qtl, sel.covariates = NULL, p.val.cutoff = 1e-05, ncores = 1, cluster.submit = FALSE, out.dir = getwd(), default.options = TRUE )
meth.qtl |
An object of type |
sel.covariates |
Covariates as column names of the sample annotation sheet stored in |
p.val.cutoff |
The p-value cutoff used for methQTL calling |
ncores |
The number of cores used. |
cluster.submit |
Flag indicating if jobs are to be distributed among a SGE compute cluster |
out.dir |
Output directory |
default.options |
Flag indicating if default options for |
The process is split into 4 steps:
First the two matrices are split according to the chromosomes.
We then compute correlations among the CpGs and compute CpG correlation blocks.
In each of the CpG correlation blocks, linear models according to the linear.model.type
qtlSetOption
with the CpG methylation state of the reference CpG specified by
representative.cpg.computation
as output and the SNP genotype state and all possible covariates
as input are computed.
For each of the CpG correlation blocks, we report the p-value of the representative CpG.
Currently, if qtlGetOption('cluster.architecture')=='sge'
the function does not return
a MethQTLResult
object, but NULL
, since monitoring finished jobs is hard
through SLURM. After the jobs are finished (checked using squeue
), the results can
can be loaded from out.dir
using loadMethQTLResult
.
An object of type MethQTLResult-class
containing the called methQTL interactions.
Michael Scherer
doMethQTLChromosome
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl.res <- doMethQTL(meth.qtl,p.val.cutoff=0.01)
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl.res <- doMethQTL(meth.qtl,p.val.cutoff=0.01)
This functions computes the methQTL interactions for a single chromosome
doMethQTLChromosome( meth.qtl, chrom, sel.covariates = NULL, p.val.cutoff = 1e-05, out.dir = NULL, ncores = 1 )
doMethQTLChromosome( meth.qtl, chrom, sel.covariates = NULL, p.val.cutoff = 1e-05, out.dir = NULL, ncores = 1 )
meth.qtl |
An Object of type |
chrom |
Character vector represeting the chromosome to be investigated. |
sel.covariates |
Covariates as column names of the sample annotation sheet stored in |
p.val.cutoff |
The p-value used for methQTL calling |
out.dir |
Optional argument specifying the output directory |
ncores |
The number of cores to be used |
A data frame with seven columns:
The CpG ID chosen to be the representative CpG in the methQTL
The SNP ID (as rsNNNNNN) involved in the methQTL
The coefficient estimate of the linear model
The p-value associated with the coefficient estimate
The chromosome name
The genomic position of the CpG
The genomic position of the SNP
The distance between the CpG and the SNP
Michael Scherer
doMethQTL
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl.res <- doMethQTLChromosome(meth.qtl,chrom="chr18",p.val.cutoff=0.01)
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl.res <- doMethQTLChromosome(meth.qtl,chrom="chr18",p.val.cutoff=0.01)
This functions filters the methQTL results according to a given p-value cutoff
## S4 method for signature 'MethQTLResult' filterPval(object, p.val.cutoff = 0.01)
## S4 method for signature 'MethQTLResult' filterPval(object, p.val.cutoff = 0.01)
object |
The |
p.val.cutoff |
The p-value cutoff to be employed |
The filtered MethQTLResult-class
object
Michael Scherer
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res <- filterPval(meth.qtl.res) meth.qtl.res
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res <- filterPval(meth.qtl.res) meth.qtl.res
Returns genomic annotation information for the given dataset.
## S4 method for signature 'MethQTLInput' getAnno(object, type = "meth") ## S4 method for signature 'MethQTLResult' getAnno(object, type = "meth")
## S4 method for signature 'MethQTLInput' getAnno(object, type = "meth") ## S4 method for signature 'MethQTLResult' getAnno(object, type = "meth")
object |
An object of class |
type |
The type of annotation to be returned. Can either be |
The genomic annotation as a data.frame
.
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) head(getAnno(meth.qtl,"meth")) head(getAnno(meth.qtl,"geno")) meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) head(getAnno(meth.qtl.res,"meth")) head(getAnno(meth.qtl.res,"geno"))
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) head(getAnno(meth.qtl,"meth")) head(getAnno(meth.qtl,"geno")) meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) head(getAnno(meth.qtl.res,"meth")) head(getAnno(meth.qtl.res,"geno"))
Returns the correlation blocks defined for the given dataset
## S4 method for signature 'MethQTLResult' getCorrelationBlocks(object)
## S4 method for signature 'MethQTLResult' getCorrelationBlocks(object)
object |
An object of class |
A list
object containing the correlation blocks.
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) head(getCorrelationBlocks(meth.qtl.res))
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) head(getCorrelationBlocks(meth.qtl.res))
Returns genotyping information for the given dataset.
## S4 method for signature 'MethQTLInput' getGeno(object, site = NULL, sample = NULL)
## S4 method for signature 'MethQTLInput' getGeno(object, site = NULL, sample = NULL)
object |
An object of class |
site |
The sites to be selected either as a numeric or logical vector. If |
sample |
The samples to be selected either as a numeric or logical vector. If |
The genotyping matrix either as a matrix of HDF5Matrix
.
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) head(getGeno(meth.qtl))
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) head(getGeno(meth.qtl))
Returns methylation information for the given dataset.
## S4 method for signature 'MethQTLInput' getMethData(object, site = NULL, sample = NULL)
## S4 method for signature 'MethQTLInput' getMethData(object, site = NULL, sample = NULL)
object |
An object of class |
site |
The sites to be selected either as a numeric or logical vector. If |
sample |
The samples to be selected either as a numeric or logical vector. If |
The methylation matrix either as a matrix of HDF5Matrix
.
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) head(getMethData(meth.qtl))
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) head(getMethData(meth.qtl))
This function merges the QTLs given and returns the methQTL table in a merged format.
getOverlappingQTL(meth.qtl.list, type = "SNP")
getOverlappingQTL(meth.qtl.list, type = "SNP")
meth.qtl.list |
A list of |
type |
The type of annotation to be overlapped. Needs to be |
A data.frame
with the methQTL interactions and an additional column specifying where the interaction
displayed has been found. This value is generated from the names()
argument of meth.qtl.list
.
Michael Scherer
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 res <- getOverlappingQTL(list(A=meth.qtl.res.1,B=meth.qtl.res.2),type="SNP")
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 res <- getOverlappingQTL(list(A=meth.qtl.res.1,B=meth.qtl.res.2),type="SNP")
This function overlaps results from a list of MethQTLResults and returns the union of all the input data points used.
getOverlapUniverse(meth.qtl.res, type)
getOverlapUniverse(meth.qtl.res, type)
meth.qtl.res |
An object of type |
type |
The type of annotation to be overlapped. Needs to be |
A list with two GRanges objects, one containing the overlapped set and the other the
union of input data points as elements 'all.qtl'
and 'all.input'
Michael Scherer
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 res <- getOverlapUniverse(list(A=meth.qtl.res.1,B=meth.qtl.res.2),type="SNP")
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 res <- getOverlapUniverse(list(A=meth.qtl.res.1,B=meth.qtl.res.2),type="SNP")
Returns phenotypic information for the given dataset.
## S4 method for signature 'MethQTLInput' getPheno(object)
## S4 method for signature 'MethQTLInput' getPheno(object)
object |
An object of class |
The phenotypic data either as a data.frame
.
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) head(getPheno(meth.qtl))
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) head(getPheno(meth.qtl))
Returns the methQTL results stores in the object.
## S4 method for signature 'MethQTLResult' getResult(object, cor.blocks = NULL, na.rm = FALSE)
## S4 method for signature 'MethQTLResult' getResult(object, cor.blocks = NULL, na.rm = FALSE)
object |
An of type |
cor.blocks |
Correlation blocks as obtained using |
na.rm |
Flag indicating if rows containing NA values are to be removed from the result. |
The methQTL results as a data.frame
with each row being a methQTL.
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) head(getResult(meth.qtl.res))
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) head(getResult(meth.qtl.res))
Returns the methQTL results in the format used as input to GWAS-map and stores in the object.
## S4 method for signature 'MethQTLResult' getResultGWASMap(object, meth.qtl)
## S4 method for signature 'MethQTLResult' getResultGWASMap(object, meth.qtl)
object |
An of type |
meth.qtl |
An object of type |
The methQTL results as a data.frame
with each row being a methQTL.
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) head(getResultGWASMap(meth.qtl.res,meth.qtl))
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) head(getResultGWASMap(meth.qtl.res,meth.qtl))
Returns the samples of the given dataset.
## S4 method for signature 'MethQTLInput' getSamples(object)
## S4 method for signature 'MethQTLInput' getSamples(object)
object |
An object of class |
The samples of the dataset as a character vector.
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) getSamples(meth.qtl)
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) getSamples(meth.qtl)
This function returns the methQTL interactions specific for a result
getSpecificQTL(meth.qtl.res, meth.qtl.background, type = "SNP")
getSpecificQTL(meth.qtl.res, meth.qtl.background, type = "SNP")
meth.qtl.res |
An object of type |
meth.qtl.background |
The background set as a list of |
type |
The type of annotation to be overlapped. Needs to be |
A data.frame
of methQTL interactions sorted by the effect size.
Michael Scherer
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 res <- getSpecificQTL(meth.qtl.res.1,list(A=meth.qtl.res.1,B=meth.qtl.res.2),type="SNP")
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 res <- getSpecificQTL(meth.qtl.res.1,list(A=meth.qtl.res.1,B=meth.qtl.res.2),type="SNP")
Replaces missing values in the DNA methylation data matrix by imputed values
## S4 method for signature 'MethQTLInput' imputeMeth(object)
## S4 method for signature 'MethQTLInput' imputeMeth(object)
object |
An object of class |
The object with imputed values.
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl.imp <- imputeMeth(meth.qtl)
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl.imp <- imputeMeth(meth.qtl)
This function combines a list of MethQTLResult-class
objects.
joinMethQTLResult(obj.list)
joinMethQTLResult(obj.list)
obj.list |
A list of |
An object of type MethQTLResult-class
containing the combined information
Michael Scherer
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 meth.qtl.res <- joinMethQTLResult(list(meth.qtl.res.1,meth.qtl.res.2))
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 meth.qtl.res <- joinMethQTLResult(list(meth.qtl.res.1,meth.qtl.res.2))
This functions load a MethQTLInput-class
object from disk.
loadMethQTLInput(path)
loadMethQTLInput(path)
path |
Path to the directory that has been created by |
The object of type MethQTLInput-class
that has been stored on disk.
Michael Scherer
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl
This functions load a MethQTLResult-class
object from disk.
loadMethQTLResult(path)
loadMethQTLResult(path)
path |
Path to the directory that has been created by |
The object of type MethQTLResult-class
that has been stored on disk.
Michael Scherer
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res
Class storing methQTL input data, such as DNA methylation and genotyping data, as well as sample metadata
This class is the basis for computing methQTLs in the methQTL-package. It stores all the relevant information including methylation data and genotype data as a matrix or HDF5Matrix, the phenotypic data as a data frame and the genomic annotation of both the methylation sites and the SNP data.
meth.data
The methylation data as a numeric matrix of beta values or as an object of type HDF5Matrix
geno.data
The genotyping data as a numeric matrix of SNP genotypes (0=homozygote reference,
1=heterozygote, 2=homozygote alternative allele) or as an object of type HDF5Matrix
pheno.data
Phenotypic data describing the samples used in the study. Matches the dimensions of
both meth.data
and geno.data
anno.meth
Genomic annotation of the methylation sites as a data.frame
. Has the same number
of rows as meth.data
.
anno.geno
Genomic annotation of the SNPs as a data.frame
. Has the same number of rows as
geno.data
.
samples
The sample identifiers used both for meth.data
and geno.data
, and as the rownames of
pheno.data
.
assembly
The genome assembly used.
platform
The platform used to compute the methylation data.
disk.dump
Flag indicating if the matrices are stored on disk rather than in memory.
imputed
Flag indicating if genotype dataset has been imputed.
getMeth
Returns the methylation matrix.
getGeno
Returns the genotyping matrix.
getPheno
Returns the phenotypic information.
getAnno
Returns the genomic annotation.
saveMethQTLInput
Stores the object on disk.
imputeMeth
Imputes the DNA methylation data matrix
Michael Scherer
Class storing methQTL analysis results and the associated genomic annotations
This class stores the results of the methQTL analysis. It stores a data.frame
with the methQTL results,
and associated genomic annotations for both the methylation sites and SNPs.
result.frame
The methQTL results as a data.frame
anno.meth
Genomic annotation of the methylation sites as a data.frame
.
anno.geno
Genomic annotation of the SNPs as a data.frame
.
correlation.blocks
Correlation blocks determined from the methylation matrix.
method
The method used to call methQTL.
rep.type
Method used to determine representative CpGs from correlation blocks.
chr
Optional argument specifying if methQTL were called on a single chromosome.
Michael Scherer
Overlaps the input annotations
overlapInputs(meth.qtl.list, type)
overlapInputs(meth.qtl.list, type)
meth.qtl.list |
A list of |
type |
The type of annotation to be overlapped. Needs to be |
A data frame containing the annotations of the unique input values.
Michael Scherer
meth.qtl.1 <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl.2 <- meth.qtl.1 res <- overlapInputs(list(A=meth.qtl.1,B=meth.qtl.2),type="SNP")
meth.qtl.1 <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) meth.qtl.2 <- meth.qtl.1 res <- overlapInputs(list(A=meth.qtl.1,B=meth.qtl.2),type="SNP")
This function overlaps a list of methQTLs to determine which interactions are common.
overlapQTLs(meth.qtl.result.list, type)
overlapQTLs(meth.qtl.result.list, type)
meth.qtl.result.list |
A named list with each entry being an object of type |
type |
Determines if either the SNP (default), the CpG, or the correlation block
|
A list with length(meth.qtl.result.list)
elements, containing IDs of methQTL
interactions according to the option type
.
Michael Scherer
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 res <- overlapQTLs(list(A=meth.qtl.res.1,B=meth.qtl.res.2),type="SNP")
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 res <- overlapQTLs(list(A=meth.qtl.res.1,B=meth.qtl.res.2),type="SNP")
This files contains code to generate the options of the methQTL package.
QTL.OPTIONS
QTL.OPTIONS
An object of class environment
of length 36.
This functions performs enrichment analysis using the Fisher's test for the methQTLs detected with respect to different genomic annotations.
qtlAnnotationEnrichment( meth.qtl.res, type = "SNP", annotation = "cpgislands", assembly = "hg19" )
qtlAnnotationEnrichment( meth.qtl.res, type = "SNP", annotation = "cpgislands", assembly = "hg19" )
meth.qtl.res |
An object of type |
type |
The type of methQTL to be visualized. Can be either |
annotation |
The genomic annotation to be used. Can be the ones available in |
assembly |
The assembly used. Only |
We use all data points that have been used to calculate methQTLs as the background
and compare the overlaps with the annotation of interest in comparison to the methQTLs that
have been computed in case a MethQTLResult-class
is provided. If a list of MethQTLResult-class
objects
is provided, the intersection between the methQTLs from all objects in the list is compared with the union of all interactions
that have been tested.
A list of two p-values named 'enrichment'
for overrepresentation and 'depletion'
for underrepresentation
Michael Scherer
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) res <- qtlAnnotationEnrichment(meth.qtl.res)
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) res <- qtlAnnotationEnrichment(meth.qtl.res)
This function tests for enrichment of a specific base substitution in the methQTL interactions.
qtlBaseSubstitutionEnrichment(meth.qtl.res, merge = FALSE)
qtlBaseSubstitutionEnrichment(meth.qtl.res, merge = FALSE)
meth.qtl.res |
An object of type |
merge |
Flag indicating if 5' and 3' substitutions are to be merged or to be analyzed separately. |
The names of the list are e.g. A_G
, which refers to a replacement of the reference base A
with an A
. Enrichment is computed using Fisher's exact test, using all SNP that have been used
as input as the background.
A list with one element for each potential base substitution containing the enrichment p-value.
Michael Scherer
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) res <- qtlBaseSubstitutionEnrichment(meth.qtl.res)
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) res <- qtlBaseSubstitutionEnrichment(meth.qtl.res)
Computes a scatterplot between CpG-SNP distance with both effect size and p-value
qtlDistanceScatterplot(meth.qtl.result, out.dir = NULL, out.name = NULL)
qtlDistanceScatterplot(meth.qtl.result, out.dir = NULL, out.name = NULL)
meth.qtl.result |
An object of type |
out.dir |
If specified, the plot is stored as a pdf in this directory |
out.name |
Optional name for the resulting plot |
An object of type ggplot
comparing the distance between CpG and SNP. Negative values indicate that the
SNP is downstream of the CpG.
Michael Scherer
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) qtlDistanceScatterplot(meth.qtl.res)
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) qtlDistanceScatterplot(meth.qtl.res)
qtlGetOption Print the value of the global option
qtlGetOption(names)
qtlGetOption(names)
names |
string or character vector containing the names of the options to be printed. All options are listed in |
the option for the specified option
Michael Scherer
qtlGetOption("cluster.cor.threshold")
qtlGetOption("cluster.cor.threshold")
This function reads an option setting from a JSON file and applies them to the current session
qtlJSON2options(path)
qtlJSON2options(path)
path |
Path to a JSON file containing the options to be specified |
None
Michael Scherer
qtlJSON2options(system.file("extdata","qtl_options_probesEPIC.json",package="MAGAR"))
qtlJSON2options(system.file("extdata","qtl_options_probesEPIC.json",package="MAGAR"))
This function creates a manhattan plot for the given methQTL result
qtlManhattanPlot(meth.qtl.result, type = "CpG", stat = "p.val.adj.fdr")
qtlManhattanPlot(meth.qtl.result, type = "CpG", stat = "p.val.adj.fdr")
meth.qtl.result |
An object of type |
type |
Determines if either the CpG (default) or the SNP is to be visualized |
stat |
Determines the statistic that is to be visualized. Can be either |
A plot is shown that contains chromosome-wise interactions.
None
Michael Scherer
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) qtlManhattanPlot(meth.qtl.res)
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) qtlManhattanPlot(meth.qtl.res)
This function stores the current options setting as a JSON file at the specified path
qtlOptions2JSON(path = file.path(getwd(), "methQTL_options.json"))
qtlOptions2JSON(path = file.path(getwd(), "methQTL_options.json"))
path |
A filename, to which the option setting is to be saved |
None
Michael Scherer
qtlSetOption('cluster.cor.threshold'=0.5) qtlOptions2JSON("my_opts.json") qtlJSON2options("my_opts.json")
qtlSetOption('cluster.cor.threshold'=0.5) qtlOptions2JSON("my_opts.json") qtlJSON2options("my_opts.json")
This function returns an enrichment plot for the different base substitutions.
qtlPlotBaseSubstitution(meth.qtl.res, ...)
qtlPlotBaseSubstitution(meth.qtl.res, ...)
meth.qtl.res |
An object of type |
... |
Further parameters passed to |
None
Michael Scherer
qtlBaseSubstitutionEnrichment
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) qtlPlotBaseSubstitution(meth.qtl.res)
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) qtlPlotBaseSubstitution(meth.qtl.res)
This functions returns a histogram comprising the (genomic) sizes of the correlation blocks in the given objet.
qtlPlotClusterSize(meth.qtl.res, type = "count")
qtlPlotClusterSize(meth.qtl.res, type = "count")
meth.qtl.res |
An object of type |
type |
Either |
An object of type ggplot containing the histogram as a plot
Michael Scherer
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) qtlPlotClusterSize(meth.qtl.res)
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) qtlPlotClusterSize(meth.qtl.res)
Compares the methylation states of a given CpG for the genotype states availabe at the given SNP
qtlPlotSNPCpGInteraction( meth.qtl, cpg = NULL, snp = NULL, out.dir = NULL, meth.qtl.res = NULL, out.name = NULL )
qtlPlotSNPCpGInteraction( meth.qtl, cpg = NULL, snp = NULL, out.dir = NULL, meth.qtl.res = NULL, out.name = NULL )
meth.qtl |
An object of type |
cpg |
The CpG identifier as a character (e.g. cg12345678) |
snp |
The SNP identifier as a character (e.g. rs12345678) |
out.dir |
If specified, the plot is stored as a pdf in this directory |
meth.qtl.res |
An optional argument of type |
out.name |
Optional name for the resulting plot |
An object of type ggplot
comparing the CpG methylation states as boxplots across the different genotype states
Michael Scherer
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) qtlPlotSNPCpGInteraction(meth.qtl,cpg="cg19565884",snp="rs149871695")
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) qtlPlotSNPCpGInteraction(meth.qtl,cpg="cg19565884",snp="rs149871695")
Change global options for methQTL calculation
qtlSetOption( rnbeads.options = NULL, meth.data.type = "idat.dir", geno.data.type = "plink", rnbeads.report = "temp", rnbeads.qc = FALSE, hdf5dump = FALSE, hardy.weinberg.p = 0.001, db.snp.ref = NULL, minor.allele.frequency = 0.05, missing.values.samples = 0.05, plink.geno = 0.1, impute.geno.data = FALSE, n.prin.comp = NULL, plink.path = NULL, fast.qtl.path = NULL, bgzip.path = NULL, tabix.path = NULL, correlation.type = "pearson", cluster.cor.threshold = 0.25, standard.deviation.gauss = 250, absolute.distance.cutoff = 5e+05, linear.model.type = "classial.linear", representative.cpg.computation = "row.medians", meth.qtl.type = "oneVSall", max.cpgs = 40000, cluster.architecture = "sge", cluster.config = c(h_vmem = "5G", mem_free = "5G"), n.permutations = 1000, compute.cor.blocks = TRUE, recode.allele.frequencies = FALSE, vcftools.path = NULL, imputation.user.token = NULL, imputation.reference.panel = "[email protected]", imputation.phasing.method = "shapeit", imputation.population = "eur" )
qtlSetOption( rnbeads.options = NULL, meth.data.type = "idat.dir", geno.data.type = "plink", rnbeads.report = "temp", rnbeads.qc = FALSE, hdf5dump = FALSE, hardy.weinberg.p = 0.001, db.snp.ref = NULL, minor.allele.frequency = 0.05, missing.values.samples = 0.05, plink.geno = 0.1, impute.geno.data = FALSE, n.prin.comp = NULL, plink.path = NULL, fast.qtl.path = NULL, bgzip.path = NULL, tabix.path = NULL, correlation.type = "pearson", cluster.cor.threshold = 0.25, standard.deviation.gauss = 250, absolute.distance.cutoff = 5e+05, linear.model.type = "classial.linear", representative.cpg.computation = "row.medians", meth.qtl.type = "oneVSall", max.cpgs = 40000, cluster.architecture = "sge", cluster.config = c(h_vmem = "5G", mem_free = "5G"), n.permutations = 1000, compute.cor.blocks = TRUE, recode.allele.frequencies = FALSE, vcftools.path = NULL, imputation.user.token = NULL, imputation.reference.panel = "[email protected]", imputation.phasing.method = "shapeit", imputation.population = "eur" )
rnbeads.options |
Path to an XML file specifying the RnBeads options used for data import. The default options are suitable for Illumina Beads Array data sets. |
meth.data.type |
Type of DNA methylation data used. Choices are listed in |
geno.data.type |
The type of data to be imported. Can be either |
rnbeads.report |
Path to an existing directory, in which the preprocessing report of RnBeads is to be stored. Defaults to the temporary file. |
rnbeads.qc |
Flag indicating if the quality control module of RnBeads is to be executed. |
hdf5dump |
Flag indicating, if large matrices are to be stored on disk rather than in main memory using the
|
hardy.weinberg.p |
P-value used for the markers to be excluded if they do not follow the
Hardy-Weinberg equilibrium as implemented in |
db.snp.ref |
Path to a locally stored version of dbSNP[3]. If this option is specified, the reference allele
is determined from this file instead of from the allele frequencies of the dataset. This circumvents problems
with some imputation methods. If |
minor.allele.frequency |
Threshold for the minor allele frequency of the SNPs to be used in the analysis. |
missing.values.samples |
Threshold specifying how much missing values per SNP are allowed across the samples to be included in the analyis. |
plink.geno |
Threshold for missing values per SNP |
impute.geno.data |
Flag indicating if imputation of genotyping data is to be perfomed using the Michigan imputation server (https://imputationserver.sph.umich.edu/index.html)[2]. |
n.prin.comp |
Number of principal components of the genetic data to be used as covariates
in the methQTL calling. |
plink.path |
Path to an installation of PLINK (also comes with the package) |
fast.qtl.path |
Path to an installation of fastQTL (comes with the package for Linux) |
bgzip.path |
Path to an installation of BGZIP (comes with the package for Linux) |
tabix.path |
Path to an installation of TABIX (comes with the package for Linux) |
correlation.type |
The type of correlation to be used. Please note that for |
cluster.cor.threshold |
Threshold for CpG methylatin state correlation to be considered as connected in the distance graph used to compute the correlation clustering. |
standard.deviation.gauss |
Standard deviation of the Gauss distribution used to weight the correlation according to its distance. |
absolute.distance.cutoff |
Distance cutoff after which a CpG correlation is not considered anymore. |
linear.model.type |
Linear model type to be used. Can be either |
representative.cpg.computation |
Option specifying how reference CpGs per correlation block are to be computed. Available
options are |
meth.qtl.type |
Option specifying how a methQTL interaction is computed. Since the package is based on correlation
blocks, a single correlation block can be associated with either one SNP ( |
max.cpgs |
Maximum number of CpGs used in the computation (used to save memory). 40,000 is a reasonable default for machines with ~128GB of main memory. Should be smaller for smaller machines and larger for larger ones. |
cluster.architecture |
The type of HPC cluster architecture present. Currently supported are |
cluster.config |
Resource parameters needed to setup an SGE or SLURM cluster job. Includes |
n.permutations |
The number of permutations used to correct the p-values for multiple testing. See (http://fastqtl.sourceforge.net/) for further information. |
compute.cor.blocks |
Flag indicating if correlation blocks are to be called. If |
recode.allele.frequencies |
Flag indicating if the reference allele is to be redefined according to the frequenciess found in the cohort investigated. |
vcftools.path |
Path to the installation of VCFtools. Necessary is the vcf-sort function in this folder. |
imputation.user.token |
The user token that is required for authorization with the Michigan imputation server. Please have a look at https://imputationserver.sph.umich.edu, create a user account and request a user token for access in your user profile. |
imputation.reference.panel |
The reference panel used for imputation. Please see https://imputationserver.readthedocs.io/en/latest/reference-panels/ for further information which panels are supported by the Michigan imputation server. |
imputation.phasing.method |
The phasing method employed by the Michigan imputation server. See https://imputationserver.readthedocs.io/en/latest/api/ for further information. |
imputation.population |
The population for the phasing method required by the Michigan imputation server. See https://imputationserver.readthedocs.io/en/latest/api/ for further information. |
None
Michael Scherer
1. Ongen, H., Buil, A., Brown, A. A., Dermitzakis, E. T., & Delaneau, O. (2016). Fast and efficient QTL mapper for thousands of molecular phenotypes. Bioinformatics, 32(10), 1479–1485. https://doi.org/10.1093/bioinformatics/btv722 2. Das S, Forer L, Schönherr S, Sidore C, Locke AE, et al. (2016). Next-generation genotype imputation service and methods. Nature Genetics 48, 1284–1287, https://doi.org/10.1038/ng.3656 3. Sherry, S. T. et al. (2001). dbSNP: the NCBI database of genetic variation. Nucleic Acids Res. 29, 308–311, https://doi.org/10.1093/nar/29.1.308.
qtlGetOption("rnbeads.report") qtlSetOption(rnbeads.report=getwd()) qtlGetOption("rnbeads.report")
qtlGetOption("rnbeads.report") qtlSetOption(rnbeads.report=getwd()) qtlGetOption("rnbeads.report")
This function performs TFBS enrichment analysis for the methQTL SNPs/CpGs detected and returns overrepresented binding motifs.
qtlTFBSMotifEnrichment( meth.qtl.res, type = "SNP", size = 500, assembly = "hg19", subsample = 1e+05, out.dir = getwd(), ... )
qtlTFBSMotifEnrichment( meth.qtl.res, type = "SNP", size = 500, assembly = "hg19", subsample = 1e+05, out.dir = getwd(), ... )
meth.qtl.res |
An object of type |
type |
The type of methQTL to be visualized. Can be either |
size |
Motif enrichment is only supported for genomic regions. Therefore, we resize the invididual methQTL to genomic regions using a width of this size around the site of interest. |
assembly |
The assembly used. Only |
subsample |
Integer specifying how many of the regions are to be subsamples from the universe. |
out.dir |
The output directory in which resulting plots will be stored. |
... |
Further parameters passed to |
This function is in part based on the tutorial for Motif discovery in https://compgenomr.github.io/book/motif-discovery.html.
We use all data points that have been used to calculate methQTLs as the background
and compare the overlaps with the annotation of interest in comparison to the methQTLs that
have been computed in case a MethQTLResult-class
is provided. If a list of MethQTLResult-class
objects
is provided, the intersection between the methQTLs from all objects in the list is compared with the union of all interactions
that have been tested.
A plot describing the TFB motif enrichment
Michael Scherer
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) res <- qtlTFBSMotifEnrichment(meth.qtl.res)
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) res <- qtlTFBSMotifEnrichment(meth.qtl.res)
This function creates an UpSet plot from the given methQTL results
qtlUpsetPlot(meth.qtl.result.list, type = "SNP", ...)
qtlUpsetPlot(meth.qtl.result.list, type = "SNP", ...)
meth.qtl.result.list |
A named list with each entry being an object of type |
type |
Determines if either the SNP (default), the CpG, or the correlation block
|
... |
Further argument passed to |
The plot is directly drawn and can be stored on disk using the known R graphic devices
None
Michael Scherer
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 qtlUpsetPlot(list(A=meth.qtl.res.1,B=meth.qtl.res.2))
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 qtlUpsetPlot(list(A=meth.qtl.res.1,B=meth.qtl.res.2))
This function overlaps correlation blocks for a list of methQTL results
qtlUpSetPlotCorBlocks(meth.qtl.res.list, ...)
qtlUpSetPlotCorBlocks(meth.qtl.res.list, ...)
meth.qtl.res.list |
A list of |
... |
Further argument passed to |
This function draws an UpSetPlot for the overlaps directly from to the open graphics device
None
Michael Scherer
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 qtlUpSetPlotCorBlocks(list(A=meth.qtl.res.1,B=meth.qtl.res.2))
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 qtlUpSetPlotCorBlocks(list(A=meth.qtl.res.1,B=meth.qtl.res.2))
This function overlaps the tagCpGs for a list of methQTL results
qtlUpSetPlotTagCpGs(meth.qtl.res.list, ...)
qtlUpSetPlotTagCpGs(meth.qtl.res.list, ...)
meth.qtl.res.list |
A list of |
... |
Further argument passed to |
This function draws an UpSetPlot for the overlaps directly from to the open graphics device
None
Michael Scherer
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 qtlUpSetPlotTagCpGs(list(A=meth.qtl.res.1,B=meth.qtl.res.2))
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 qtlUpSetPlotTagCpGs(list(A=meth.qtl.res.1,B=meth.qtl.res.2))
This function creates a venn plot from a list of methQTL results, showing the overlap between the interactions
qtlVennPlot( meth.qtl.result.list, out.folder, type = "SNP", out.name = NULL, ... )
qtlVennPlot( meth.qtl.result.list, out.folder, type = "SNP", out.name = NULL, ... )
meth.qtl.result.list |
A named list with each entry being an object of type |
out.folder |
Required argument specifying the location to store the resulting plot |
type |
Determines if either the SNP (default), the CpG, or the correlation block
|
out.name |
Optional argument for the name of the plot on disk (ending needs to be .png) |
... |
Further argument passed to |
The plot can be stored on disk using out.folder
and out.name
None
Michael Scherer
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 qtlVennPlot(list(A=meth.qtl.res.1,B=meth.qtl.res.2),out.folder=getwd())
meth.qtl.res.1 <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) meth.qtl.res.2 <- meth.qtl.res.1 qtlVennPlot(list(A=meth.qtl.res.1,B=meth.qtl.res.2),out.folder=getwd())
This functions stores a MethQTLInput object in disk.
## S4 method for signature 'MethQTLInput' saveMethQTLInput(object, path)
## S4 method for signature 'MethQTLInput' saveMethQTLInput(object, path)
object |
The |
path |
A path to a non-existing directory for files to be stored. |
None
Michael Scherer
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) saveMethQTLInput(meth.qtl,"MethQTLInput")
meth.qtl <- loadMethQTLInput(system.file("extdata","reduced_methQTL",package="MAGAR")) saveMethQTLInput(meth.qtl,"MethQTLInput")
This functions stores a MethQTLInput object in disk.
## S4 method for signature 'MethQTLResult' saveMethQTLResult(object, path)
## S4 method for signature 'MethQTLResult' saveMethQTLResult(object, path)
object |
The |
path |
A path to a non-existing directory for files to be stored. |
None
Michael Scherer
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) saveMethQTLResult(meth.qtl.res,"MethQTLResult")
meth.qtl.res <- loadMethQTLResult(system.file("extdata","MethQTLResult_chr18",package="MAGAR")) saveMethQTLResult(meth.qtl.res,"MethQTLResult")