Simulation Overview¶
This page summarises the typical workflow when using ViMMS to create new LC--MS/MS data. A simulation involves the following main components:
- Chemicals – virtual representations of compounds to be ionised. See Creating Chemicals for more details.
- Mass Spectrometer – either an in silico model (
IndependentMassSpectrometer
) or a real instrument. - Controller – defines the fragmentation strategy, for example Top‑N DDA.
- Environment – orchestrates interaction between the mass spectrometer and the controller.
Typical Workflow¶
from vimms.Chemicals import ChemicalMixtureCreator
from vimms.ChemicalSamplers import UniformMZFormulaSampler
from vimms.MassSpec import IndependentMassSpectrometer
from vimms.Controller import TopNController
from vimms.Environment import Environment
# 1. Generate chemicals
formula_sampler = UniformMZFormulaSampler(min_mz=100, max_mz=600)
cmc = ChemicalMixtureCreator(formula_sampler)
chemicals = cmc.sample(100, ms_levels=2)
# 2. Set up a virtual mass spectrometer
ms = IndependentMassSpectrometer(polarity="positive", chemicals=chemicals)
# 3. Choose a controller
controller = TopNController("positive", N=5, isolation_width=1)
# 4. Create and run the environment
env = Environment(ms, controller, min_time=0, max_time=1200)
env.run()
Running the environment produces a list of scans that can be written to mzML using Environment.write_mzML()
. Evaluation data can also be stored by setting save_eval=True
on the environment.
Adding Noise¶
The mass spectrometer accepts peak noise objects from vimms.Noise
to make simulated spectra more realistic. For example:
from vimms.Noise import GaussianPeakNoise
ms = IndependentMassSpectrometer("positive", chemicals, peak_noise=GaussianPeakNoise(0.01))
Further Reading¶
- Creating Chemicals explains how to generate chemical lists.
- Running Controllers describes available controllers and how to execute them.
- Chromatographic Models details column offsets and drift.
- Adding Noise shows how to generate more realistic spectra.
- Evaluating Simulations covers metrics and analysis utilities.
- Command Line Utilities lists helper scripts.