correlate_with_expr: Correlate CNV Profiles with Gene Expression Data

View source: R/correlate_with_expr.R

correlate_with_exprR Documentation

Correlate CNV Profiles with Gene Expression Data

Description

Computes Pearson correlations between CNV segment means and RNA expression values for each gene present in both datasets. RNA data is log2-transformed prior to analysis. Three result files are written: all correlations, those with p-value < 0.05, and those with both p-value < 0.05 and correlation coefficient > 0.8.

Usage

correlate_with_expr(cnv_file, rna_file)

Arguments

cnv_file

Character. Path to the CNV matrix CSV file (output of create_CNVMatrix). Rows are samples; first column is sample IDs; remaining columns are gene symbols.

rna_file

Character. Path to the RNA expression CSV file. Rows are genes; first column is gene names; remaining columns are sample IDs (trimmed to 12 characters for TCGA-style matching).

Details

Sample IDs in the RNA file are trimmed to 12 characters to match TCGA-style identifiers. Infinite values from log2(0) are replaced with 0. Pearson correlation is computed using stats::cor.test with use = "complete.obs". This function is cancer-type agnostic.

Value

A named list with three data frames:

all_correlations

All computed Pearson correlations with columns gene, cor_val, p.value.

significant

Subset where p.value < 0.05.

high_correlation

Subset where p.value < 0.05 AND cor_val > 0.8.

Results are also written to CSV files in the temporary directory.

References

Chin L, et al. (2011). Making sense of cancer genomic data. Genes Dev, 25(6):534-555.

Examples

cnv_file <- system.file("extdata", "cnv_matrix.csv", package = "RiskyCNV")
rna_file <- system.file("extdata", "rna_data.csv",   package = "RiskyCNV")
results  <- correlate_with_expr(
  cnv_file = cnv_file,
  rna_file = rna_file
)
head(results$all_correlations)


RiskyCNV documentation built on June 5, 2026, 5:07 p.m.