View source: R/GenerateNoisyTumors.R
| GenerateNoisyTumors | R Documentation |
Generate noisy tumors from available exposures
GenerateNoisyTumors( seed, dir, input.exposure, signatures, n.binom.size = NULL, overwrite = TRUE )
seed |
A random seed to use. |
dir |
The directory in which to put the output; will be created if necessary. |
input.exposure |
A matrix of exposures. |
signatures |
A matrix of signatures. |
n.binom.size |
If non |
overwrite |
If TRUE, overwrite existing directories and files. |
A list with the elements
The numbers of mutations due to each signature after adding noise
The spectra based on the noisy signature exposures.
# 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]
ID.synthetic.tumors <-
GenerateSyntheticTumors(seed = 191906,
dir = file.path(tempdir(), "ID.synthetic.tumors"),
cancer.types = cancer.types,
samples.per.cancer.type = 30,
input.sigs = input.sigs.ID,
real.exposures = real.exposures.ID,
distribution = "neg.binom",
sample.prefix.name = "SP.Syn."
)
# Add noise to the exposures
ID.noisy.tumors <-
GenerateNoisyTumors(seed = 892513,
dir = file.path(tempdir(), "ID.noisy.tumors"),
input.exposure = ID.synthetic.tumors$ground.truth.exposures,
signatures = ID.synthetic.tumors$ground.truth.signatures,
n.binom.size = 1)
# Plot the synthetic and noisy catalog and exposures
ICAMS::PlotCatalogToPdf(catalog = ID.synthetic.tumors$ground.truth.catalog,
file = file.path(tempdir(), "ID.synthetic.catalog.pdf"))
mSigAct::PlotExposureToPdf(exposure = ID.synthetic.tumors$ground.truth.exposures,
file = file.path(tempdir(), "ID.synthetic.exposures.pdf"),
cex.xaxis = 0.7)
ICAMS::PlotCatalogToPdf(catalog = ID.noisy.tumors$spectra,
file = file.path(tempdir(), "ID.noisy.catalog.pdf"))
mSigAct::PlotExposureToPdf(exposure = ID.noisy.tumors$exposures,
file = file.path(tempdir(), "ID.noisy.exposures.pdf"),
cex.xaxis = 0.7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.