create_CNVMatrix: Create a CNV Expression Matrix

View source: R/create_CNVMatrix.R

create_CNVMatrixR Documentation

Create a CNV Expression Matrix

Description

Takes an annotated CNV CSV file (output of annotate) and reshapes it into a wide-format matrix where rows are samples, columns are gene symbols, and values are mean segment means. Duplicate sample-gene combinations are resolved by taking the mean.

Usage

create_CNVMatrix(input_file)

Arguments

input_file

Character. Path to the input CSV file containing columns Sample, GeneSymbol, and Segment_Mean.

Details

Duplicate Sample-GeneSymbol combinations are summarised by taking their mean Segment_Mean before pivoting, avoiding list-column issues in the output. This function is cancer-type agnostic.

Value

A data frame in wide format with samples as rows and gene symbols as columns. Missing values are represented as NA. The matrix is also saved as a timestamped CSV file in the temporary directory.

Examples

annot_file <- system.file("extdata", "annotated_cnv.csv",
                           package = "RiskyCNV")
cnv_mat <- create_CNVMatrix(annot_file)
dim(cnv_mat)
head(cnv_mat)


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