GenerateSyntheticTumorsFromSigParams: Generate synthetic tumors based on signature parameters in...

View source: R/GenerateSyntheticTumorsFromSigParams.R

GenerateSyntheticTumorsFromSigParamsR Documentation

Generate synthetic tumors based on signature parameters in one or more cancer types

Description

Generate synthetic tumors based on signature parameters in one or more cancer types

Usage

GenerateSyntheticTumorsFromSigParams(
  seed,
  dir,
  cancer.types,
  samples.per.cancer.type,
  input.sigs,
  sig.params,
  distribution = NULL,
  sample.prefix.name = "SP.Syn.",
  tumor.marker.name = NULL,
  overwrite = TRUE,
  verbose = 0
)

Arguments

seed

A random seed to use.

dir

The directory in which to put the output; will be created if necessary.

cancer.types

A vector of character strings denoting different cancer types. See PCAWG7::CancerTypes() for example.

samples.per.cancer.type

Number of synthetic tumors to create for each cancer type. If it is one number, then generate the same number of synthetic tumors for each cancer.types. Or if it is a vector of numbers, then generate synthetic tumors for each cancer.type accordingly to the number specified in the vector. The length and order of samples.per.cancer.type should match that in cancer.types.

input.sigs

A matrix of signatures.

sig.params

A list of empirical signature parameters generated using real exposures for each cancer.types. This list should have names that match cancer.types. Users can use GenerateListOfSigParams to generate their own signature parameters.

distribution

Probability distribution used to generate synthetic exposures due to active mutational signatures. Can be neg.binom which stands for negative binomial distribution. If NULL (Default), then this function uses log normal distribution with base 10.

sample.prefix.name

Prefix name to add to the synthetic tumors.

tumor.marker.name

Tumor marker name to add to the synthetic tumors. E.g. "MSI", "POLE".

overwrite

If TRUE, overwrite existing directories and files.

verbose

If > 0 cat various messages.

Value

A list of three elements that comprise the synthetic data:

  1. ground.truth.catalog: Spectra catalog with rows denoting mutation types and columns denoting sample names.

  2. ground.truth.signatures: Signatures active in ground.truth.catalog.

  3. ground.truth.exposures: Exposures of ground.truth.signatures in ground.truth.catalog.

Note

See also GenerateSyntheticTumors which uses real exposure matrix instead of list of signature parameters to generate synthetic tumor.

Examples


# Generate synthetic tumors for DBS78 using log normal distribution
input.sigs.DBS78 <- cosmicsig::COSMIC_v3.2$signature$GRCh37$DBS78
real.exposures.DBS78 <- PCAWG7::exposure$PCAWG$DBS78
cancer.types <- PCAWG7::CancerTypes()[1:5]
sig.params <- SynSigGen::signature.params$DBS78
DBS78.sig.params <-
  GenerateListOfSigParams(real.exposures = real.exposures.DBS78,
                          cancer.types = cancer.types,
                          sig.params = sig.params)

DBS78.synthetic.tumors <-
  GenerateSyntheticTumorsFromSigParams(seed = 191906,
                                       dir = file.path(tempdir(), "DBS78.synthetic.tumors"),
                                       cancer.types = cancer.types,
                                       samples.per.cancer.type = 30,
                                       input.sigs = input.sigs.DBS78,
                                       sig.params = DBS78.sig.params,
                                       sample.prefix.name = "SP.Syn.")

# Generate synthetic tumors for Indel (ID) using negative binomial distribution
input.sigs.ID <- cosmicsig::COSMIC_v3.2$signature$GRCh37$ID
real.exposures.ID <- PCAWG7::exposure$PCAWG$ID
cancer.types <- PCAWG7::CancerTypes()[1:5]
sig.params <- SynSigGen::signature.params$ID
ID.sig.params <-
  GenerateListOfSigParams(real.exposures = real.exposures.ID,
                          cancer.types = cancer.types,
                          distribution = "neg.binom",
                          sig.params = sig.params)

ID.synthetic.tumors <-
  GenerateSyntheticTumorsFromSigParams(seed = 191906,
                                       dir = file.path(tempdir(), "ID.synthetic.tumors"),
                                       cancer.types = cancer.types,
                                       samples.per.cancer.type = 30,
                                       input.sigs = input.sigs.ID,
                                       sig.params = ID.sig.params,
                                       distribution = "neg.binom",
                                       sample.prefix.name = "SP.Syn.")

# Plot the synthetic catalog and exposures
ICAMS::PlotCatalogToPdf(catalog = DBS78.synthetic.tumors$ground.truth.catalog,
                        file = file.path(tempdir(), "DBS78.synthetic.catalog.pdf"))
mSigAct::PlotExposureToPdf(exposure = DBS78.synthetic.tumors$ground.truth.exposures,
                           file = file.path(tempdir(), "DBS78.synthetic.exposures.pdf"),
                           cex.xaxis = 0.7)

steverozen/SynSigGen documentation built on April 1, 2022, 8:54 p.m.