generateCorrelations: Generate a correlation matrix from user-supplied data

View source: R/generateCorrelations.R

generateCorrelationsR Documentation

Generate a correlation matrix from user-supplied data

Description

Generate a correlation matrix from user-supplied data

Usage

generateCorrelations(cts, transformed = FALSE, cores = 1)

Arguments

cts

a gene count matrix where rownames are genes and colnames are sample IDs.

transformed

Boolean. Indicates whether data is already transformed using VST or a similar approach. If TRUE, VST transformation with DESeq2 will not be performed. Default: FALSE

cores

Numeric. Number of cores to use for calculating size factors. NOTE: cores > 1 does not work on Windows. Detault: 1.

Details

This function performs the same normalization and transformation steps on a user-supplied dataset that were originally used to generate the data provided in the pre-calculated databases used by this package. The resulting correlation matrix can be supplied to analyzeSingleGenes() as an input. NOTE: the resulting matrix is very large and will take up ~8 GB of memory.

Value

Matrix with gene co-expression correlations.

Examples


if (! 'airway' in rownames(install.packages())) {
    if (!requireNamespace("BiocManager", quietly = TRUE))
        install.packages("BiocManager")
    BiocManager::install("airway")
}

if (! 'EnsDb.Hsapiens.v86' in rownames(install.packages())) {
    if (!requireNamespace("BiocManager", quietly = TRUE))
        install.packages("BiocManager")
    BiocManager::install("EnsDb.Hsapiens.v86")
}

if (! 'dplyr' in rownames(install.packages())) {
    install.packages("dplyr")
}

data(airway)
cts <- assay(airway)
ens2gene <- ensembldb::select(EnsDb.Hsapiens.v86, keys = rownames(cts),
                              columns = c("SYMBOL"), keytype = "GENEID") %>%
  dplyr::distinct(SYMBOL, .keep_all = TRUE) %>%
  dplyr::inner_join(y = data.frame("GENEID" = rownames(cts)))

cts <- cts[ens2gene$GENEID,]
rownames(cts) <- ens2gene$SYMBOL

corrMat <- generateCorrelations(cts)


Bishop-Laboratory/correlationAnalyzeR documentation built on June 28, 2022, 8:31 p.m.