getCorrelation {methylKit} | R Documentation

## get correlation between samples in methylBase or methylBaseDB object

### Description

The functions returns a matrix of correlation coefficients and/or a set of scatterplots showing the relationship between samples. The scatterplots will contain also fitted lines using `lm()` for linear regression and `lowess` for polynomial regression.

### Usage

    getCorrelation(object,method="pearson",plot=FALSE,nrow)

    ## S4 method for signature 'methylBase'
    getCorrelation(object, method = c("pearson",
      "kendall", "spearman"), plot)

    ## S4 method for signature 'methylBaseDB'
    getCorrelation(object, method = "pearson",
      plot = FALSE, nrow = 2e+06)

### Arguments

`object` | a methylBase or methylBaseDB object
`method` | a character string indicating which correlation coefficient (or covariance) is to be computed (default:"pearson", other options are "kendall" and "spearman")
`plot` | scatterPlot if TRUE (default:FALSE)
`nrow` | a numeric giving the number of lines to read in of methylBaseDB object, defaults to 2e6

### Value

a correlation matrix object and plot scatterPlot

### Details

The argument 'nrow' is only evaluated if the input is a `methylBaseDB` object. If 'nrow' is not specified `getCorrelation` will read the first 2M records of the given object, but if you want to read all records 'nrow' has to be NULL. You should change 'nrow' if using `getCorrelation` with all records of the methylBaseDB object would take too long.

If the scatter plot is plotted, the red line in the plot is from linear regression fit and the green line is from polynomial regression fit with `stats::lowess`.

### Examples

    data(methylKit)

    getCorrelation(methylBase.obj,method="pearson",plot=FALSE)

    # create methylBaseDB
    methylBaseDB.obj <- unite(methylRawList.obj,save.db=TRUE,dbdir="methylDB")

    getCorrelation(methylBaseDB.obj,method="pearson",plot=FALSE,nrow=10000)

    # remove Database again
    rm(methylBaseDB.obj)
    unlink("methylDB",recursive=TRUE)

[Package methylKit version 1.12.0 Index]