corr_sample {RQdeltaCT}R Documentation

corr_sample

Description

This function performs correlation analysis of samples based on the data. Results are useful to gain insight into relationships between analyzed samples.

Usage

corr_sample(
  data,
  sel.Sample = "all",
  type = "upper",
  method = "pearson",
  add.coef = "black",
  order = "hclust",
  hclust.method = "average",
  size = 0.6,
  coef.size = 0.6,
  p.adjust.method = "BH",
  save.to.tiff = FALSE,
  dpi = 600,
  width = 15,
  height = 15,
  name.tiff = "corr_samples",
  save.to.txt = FALSE,
  name.txt = "corr_samples"
)

Arguments

data

Object returned from make_Ct_ready() or delta_Ct() functions.

sel.Sample

Character vector with names of samples to include, or "all" (default) to use all samples.

type

Character: type of displayed matrix, must be one of the 'full' (full matrix), 'upper' (upper triangular, default) or 'lower' (lower triangular).

method

Character: type of correlations to compute, can be "pearson" (default) for Pearson's correlation coefficients or "spearman" for Spearman's rank correlation coefficients.

add.coef

If correlation coefficients should be add to the plot, specify color of coefficients (default to "black"). If NULL, correlation coefficients will not be printed.

order

Character: method used for ordering the correlation matrix, inherited from corrplot::corrplot() function. Must be one of the "original" (original order), "AOE" (angular order of the eigenvectors), "FPC" (first principal component order), "hclust" (hierarchical clustering order, default), or "alphabet" (alphabetical order).

hclust.method

Character: name of method used for hclust agglomeration, must be one of "ward", ward.D", "ward.D2", "single", "complete", "average" (default), "mcquitty", "median" or "centroid".

size

Numeric: size of variable names and numbers in legend. Default to 0.6.

coef.size

Numeric: size of correlation coefficients. Default to 0.6.

p.adjust.method

Character: p value correction method for multiple testing, one of the "holm", "hochberg", "hommel", "bonferroni", "BH" (default), "BY","fdr", or "none". See documentation for stats::p.adjust() function for details.

save.to.tiff

Logical: if TRUE, plot will be saved as .tiff file. Default to FALSE.

dpi

Integer: resolution of saved .tiff file. Default to 600.

width

Numeric: width (in cm) of saved .tiff file. Default to 15.

height

Numeric: height (in cm) of saved .tiff file. Default to 15.

name.tiff

Character: name of saved .tiff file, without ".tiff" name of extension. Default to "corr_samples".

save.to.txt

Logical: if TRUE, correlation results (sorted by absolute values of correlation coefficients in descending order) will be saved to .txt file. Default to FALSE.

name.txt

character: name of saved .txt file, without ".txt" name of extension.. Default to "corr_samples".

Value

Plot illustrating correlation matrix (displayed on the graphic device) and data.frame with computed correlation coefficients and p values.

Examples

library(tidyverse)
library(Hmisc)
library(corrplot)
data(data.Ct)
data.CtF <- filter_Ct(data.Ct,
                      remove.Gene = c("Gene2","Gene5","Gene6","Gene9","Gene11"),
                      remove.Sample = c("Control08","Control16","Control22"))
data.CtF.ready <- make_Ct_ready(data.CtF, imput.by.mean.within.groups = TRUE)
data.dCt <- delta_Ct(data.CtF.ready, ref = "Gene8")
corr.samples <- corr_sample(data.CtF.ready)
head(corr.samples)


[Package RQdeltaCT version 1.3.0 Index]