correlationmatrix: Create a correlation matrix of all samples in a...

View source: R/accessory_functions.R

correlationmatrixR Documentation

Create a correlation matrix of all samples in a QDNAseq-object

Description

correlationmatrix runs the R stats cor function on the segmented data in a QDNAseqobject and returns the correlation matrix. The adjusted version equalizes the segments for each individual comparison, either through twosamplecompare or templatefromequalsegments

Usage

correlationmatrix(object, trncname = FALSE)

correlationmatrixadjusted(object, trncname = FALSE, 
  equalsegments = FALSE, funtype = 'mean')

Arguments

object

QDNAseq-object

trncname

Logical. The name of the sample is retrieved from the object and used as title. If set to TRUE, trncname truncates the sample name from the first instance of "_" in the name. You can also specify the regular expression here, e.g. trncname = "-.*" truncates the name from the first dash. Default = FALSE

equalsegments

Logical or integer. If FALSE, the function will simply take all combined breakpoints and "resegment" both samples accordingly. When an integer is given, the function will create artificial segments that are all comprised of as many bins as entered with this argument, or 20 when set to TRUE. Default = FALSE

funtype

Character string. Specifies the function used to calculate new segment values. Alternative is "median". Default = "mean"

Details

Calculating and plotting correlation of segments between samples can be helpful to examine similarity / dissimilarity among samples.

Value

Returns a matrix with sample names defining both rows and columns and cells containing the pearson correlation of segment values of all bins of the intersecting samples.

Note

It is possible to visualize a correlation matrix with the R stats heatmap function. Although it is undoubtedly possible to adjust the function to give an interpretable plot, there are packages that facilitate this greatly. An example is the corrplot function from the eponymous package.

Author(s)

Jos B. Poell

See Also

twosamplecompare, templatefromequalsegments

Examples

## using segmented data from a QDNAseq-object
data("copyNumbersSegmented")
correlationmatrix(copyNumbersSegmented)
correlationmatrixadjusted(copyNumbersSegmented)

tgac-vumc/ACE documentation built on Nov. 29, 2022, 12:15 a.m.