GenerateLMatrix: Generate a sample-level panel-context matrix

View source: R/L_matrix_Generation.R

GenerateLMatrixR Documentation

Generate a sample-level panel-context matrix

Description

Generate the sample-level L matrix from panel-context or panel-coordinate information and sample-panel annotations.

Usage

 GenerateLMatrix(Panel_context, Patient_Info, Class = c("SBS", "DBS"),
          SBS_order = c("COSMIC", "signeR"), ref.genome = "hg19")

Arguments

Panel_context

Either a panel-context matrix returned from GeneratePanelSize or a panel-coordinate data frame containing Chromosome, Start_Position, End_Position and SEQ_ASSAY_ID.

Patient_Info

A sample-panel annotation data frame containing SEQ_ASSAY_ID and either PATIENT_ID or SAMPLE_ID.

Class

A character string specifying the mutation class. Used when Panel_context is a panel-coordinate data frame.

SBS_order

Mutation-type order, either "COSMIC" or "signeR". Used for SBS analyses when Panel_context is a panel-coordinate data frame.

ref.genome

The reference genome, either "hg19" or "hg38". Used when Panel_context is a panel-coordinate data frame.

Details

GenerateLMatrix() links each sample to its specific sequencing assay, identified by SEQ_ASSAY_ID. For the standard preprocessing workflow, provide panel-coordinate information as the first argument and sample-panel annotation as the second argument. The function then calculates panel-level mutation-context opportunity counts internally and expands them to a sample-level L matrix.

For backward compatibility, the first argument can also be a panel-context matrix returned by GeneratePanelSize. In that lower-level workflow, GenerateLMatrix() only expands the provided panel-context matrix to the sample level.

BED target-region files can first be converted into SATS-compatible panel-coordinate tables with ReadBEDAsPanelInfo.

Value

A data frame (L matrix) of P by N, where P is the number of mutation channels (96 for SBS or 78 for DBS) and N is the number of tumors.

Author(s)

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

See Also

GeneratePanelSize, GenerateVMatrix, ReadBEDAsPanelInfo

Examples

data(SimData, package="SATS")

keep <- match(SimData$PatientInfo$SEQ_ASSAY_ID,
              unique(SimData$PanelEx$SEQ_ASSAY_ID), nomatch=0) > 0
PatientInfo <- SimData$PatientInfo[keep, ]

L_mat <- GenerateLMatrix(SimData$PanelEx, PatientInfo, Class="SBS",
                         SBS_order="COSMIC", ref.genome="hg19")

Panel_context <- GeneratePanelSize(genomic_information=SimData$PanelEx,
                                   Class="SBS", SBS_order="COSMIC")
L_mat2 <- GenerateLMatrix(Panel_context, PatientInfo)

stopifnot(identical(colnames(L_mat), colnames(L_mat2)))
stopifnot(identical(rownames(L_mat), rownames(L_mat2)))
# For more detailed usage, please refer to README and the user manual
# in https://github.com/binzhulab/SATS/tree/main.

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