finaliseCommonRareSignatureExposures: Finalise Common and Rare Signature Exposures

View source: R/rareSignaturesExtractionLib.R

finaliseCommonRareSignatureExposuresR Documentation

Finalise Common and Rare Signature Exposures

Description

This function is part of the pipeline for the extraction of rare signatures. After the rare signatures have been extracted and the corresponding samples identified using the rareSignatureExtraction function, this function fits the common and rare signatures into the sample catalogues and reports also a comparison between the normalised error withvs without rare signatures.

Usage

finaliseCommonRareSignatureExposures(
  outfileRoot,
  catalogues,
  commonSigs,
  listofsignatures = NULL,
  listofsamples = NULL,
  nboot = 200,
  threshold_percent = 5,
  threshold_p.value = 0.05,
  min_sample_muts = 100,
  nparallel = 1
)

Arguments

outfileRoot

output directory and base file name, for example outdir/BaseName. Multiple output files will be generated with filenames the chosen BaseName as prefix.

catalogues

original catalogues, channels as rows and samples as columns

commonSigs

common mutational signatures used for fitting, channels as rows, signatures as columns

listofsignatures

listofsignatures object obtained from the rareSignatureExtraction function. It contains the rare signatures extracted

listofsamples

listofsamples object obtained from the rareSignatureExtraction function. It contains the samples that have each of the rare signatures extracted

nboot

number of bootstraps for the signature fit

threshold_percent

minimum percentage of mutations in a sample that should be assigned to a signature

threshold_p.value

p-value to decide whether a signature exposure is statistically higher then the threshold_percent

min_sample_muts

minimum number of mutations in a sample to perform signature analysis. If a sample has less than min_sample_muts mutations, then all signature exposures are set to zero and all mutations are unsassigned

nparallel

number of parallel processes to use for the signature fit

Value

exposures and errors for the signature fit using common+rare signatures and common only signatures

Examples

resUnexpl <- unexplainedSamples(catalogues=catalogues,
                                sigs=signatures)
significant_residuals <- resUnexpl$all_residuals[,resUnexpl$which_significant]
clusterResiduals <- cataloguesClustering(significant_residuals,
                                         nclusters = 1:5)
resObj <- rareSignatureExtraction(catalogues=catalogues,
                                  commonSignatures=signatures,
                                  commonExposures=resUnexpl$exposures,
                                  residuals=resUnexpl$all_residuals,
                                  unexpl_samples=resUnexpl$unexplSamples,
                                  clusters=clusterResiduals$clusters_table[,"3"],
                                  useclusters=list=(c(1),c(3)),
                                  maxiter=c(100,1000))
finaliseCommonRareSignatureExposures(outfileRoot = "outdir/BaseName",
                                     catalogues = catalogues,
                                     commonSigs = signatures,
                                     listofsignatures = resObj$listofsignatures,
                                     listofsamples = resObj$listofsamples)

Nik-Zainal-Group/signature.tools.lib documentation built on April 13, 2025, 5:50 p.m.