computeCorrelationBlocks: computeCorrelationBlocks

View source: R/correlation_blocks.R

computeCorrelationBlocksR Documentation

computeCorrelationBlocks

Description

This function computes CpG correlation blocks from correlations of CpGs across samples by Louvian clustering.

Usage

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

Arguments

meth.data

A data.frame containing the methylation data with CpGs in the rows and samples in the columns.

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

Details

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.

Value

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.

Author(s)

Michael Scherer

Examples

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),])

MPIIComputationalEpigenetics/MAGAR documentation built on Dec. 6, 2024, 2:30 p.m.