simulate_poly_spectra: simulate_poly_spectra

Description Usage Arguments Value Examples

View source: R/SpecFunctions.R

Description

This function takes simulated m/z and intensities of peaks from create_insilico_mixture_template and modifies them based on given parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
simulate_poly_spectra(
  sim.template,
  mixture.ratio,
  spectrum.name = "Spectrum",
  mixture.missing.prob.peak = 0.05,
  noise.peak.ratio = 0.05,
  snr.basepeak = 500,
  noise.cv = 0.25,
  mz.range = c(1000, 2200)
)

Arguments

sim.template

A data frame which contains m/z, log intensitiy, normalized intensity values and missing rates of peaks. There are also species and strain information. An object of create_insilico_mixture_template.

mixture.ratio

A list of bacterial mixture ratios for given bacterial species in sim.template.

spectrum.name

A character. An user can define the spectrum name. (Default: 'Spectrum').

mixture.missing.prob.peak

A real value. The missing probability caused by mixing multiple bacteria species. (Default: 0.05)

noise.peak.ratio

A ratio between the numbers of noise and signal peaks. (Default: 0.05)

snr.basepeak

A (base peak) signal to noise ratio. (Default: 500)

noise.cv

A coefficient of variation of noise peaks. (Default: 0.25)

mz.range

A range of m/z values. (Default: c(1000,2200))

Value

A data frame that contains m/z values of peaks, normalized intensities of peaks, species names, and strain names. A modified version of sim.template.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
spectra.processed.A <- process_monospectra(
   file=system.file("extdata", "listA.txt", package="MGMS2"),
   mass.range=c(1000,2200))
spectra.processed.B <- process_monospectra(
   file=system.file("extdata", "listB.txt", package="MGMS2"),
   mass.range=c(1000,2200))
spectra.processed.C <- process_monospectra(
   file=system.file("extdata", "listC.txt", package="MGMS2"),
   mass.range=c(1000,2200))
spectra.mono.summary.A <- summarize_monospectra(
   processed.obj=spectra.processed.A,
   species='A', directory=tempdir())
spectra.mono.summary.B <- summarize_monospectra(
   processed.obj=spectra.processed.B,
   species='B', directory=tempdir())
spectra.mono.summary.C <- summarize_monospectra(
   processed.obj=spectra.processed.C,
   species='C', directory=tempdir())
mono.info=gather_summary(c(spectra.mono.summary.A, spectra.mono.summary.B, spectra.mono.summary.C))
mixture.ratio <- list()
mixture.ratio['A']=1
mixture.ratio['B']=0.5
mixture.ratio['C']=0
sim.template <- create_insilico_mixture_template(mono.info)
insilico.spectrum <- simulate_poly_spectra(sim.template, mixture.ratio)

MGMS2 documentation built on April 24, 2020, 9:06 a.m.