GenerateVMatrix: Generate a Mutation Count Matrix from Mutation Records

View source: R/V_matrix_Generation.R

GenerateVMatrixR Documentation

Generate a Mutation Count Matrix from Mutation Records

Description

Generate an SBS96 or DBS78 mutation count matrix from a MAF-like mutation record table.

Usage

GenerateVMatrix(mutation_record, Class = c("SBS", "DBS"),
                ref.genome = "hg19", mutation_order = NULL)

Arguments

mutation_record

A MAF-like data frame containing mutation records.

Class

A character string specifying the mutation class. Must be either "SBS" for single base substitutions or "DBS" for double base substitutions.

ref.genome

The reference genome, either "hg19" or "hg38".

mutation_order

Optional character vector specifying the row order of the returned mutation count matrix. If NULL, SATS uses the row order of RefTMB$TMB_SBS_v3.4 for SBS or RefTMB$TMB_DBS_v3.4 for DBS.

Details

The mutation_record data frame must contain the columns Chromosome, Start_Position, End_Position, Variant_Type, Reference_Allele, Tumor_Seq_Allele2 and Tumor_Sample_Barcode. SBS analyses use records with Variant_Type == "SNP" and generate COSMIC-style 96-channel mutation contexts. DBS analyses use records with Variant_Type == "DNP" and generate 78 double-base substitution contexts.

This function is intended for MAF-like tabular mutation records. Simple single-sample VCF files can first be converted into this tabular format with ReadVCFAsMutationRecord.

Value

A numeric matrix with mutation contexts in rows and tumor samples in columns.

Author(s)

Donghyuk Lee <dhyuklee@pusan.ac.kr> and Bin Zhu <bin.zhu@nih.gov>

See Also

GenerateLMatrix, GeneratePanelSize, ReadVCFAsMutationRecord

Examples

dir <- system.file("extdata", "refitting_examples", package = "SATS")
sbs_file <- file.path(dir, "SBS_MAF_two_samples.txt")
sbs_mut <- read.table(sbs_file, header = TRUE, sep = "\t", quote = "",
                      stringsAsFactors = FALSE)

V_sbs <- GenerateVMatrix(sbs_mut, Class = "SBS", ref.genome = "hg19")
dim(V_sbs)

SATS documentation built on Sept. 16, 2026, 1:06 a.m.