Skip to content

Library for mass spectrometry projects

License

Notifications You must be signed in to change notification settings

trishorts/mzLib

This branch is 2 commits ahead of, 4 commits behind smith-chem-wisc/mzLib:master.

Folders and files

NameName
Last commit message
Last commit date
Jan 31, 2025
Jan 31, 2025
Aug 25, 2016
Mar 9, 2022
Dec 12, 2023
Dec 12, 2023
Aug 25, 2016
Apr 21, 2022

Repository files navigation

mzLib

A library for mass spectrometry projects.

GitHub Action Builds codecov Coverity Scan Build Status NuGet Badge

image

NuGet packages are released here: https://www.nuget.org/packages/mzLib/

GitHub release tags are recoreded here: https://github.com/smith-chem-wisc/mzLib/releases

Usage

Reading Spectra Files

To read Thermo or mzML files, use

ThermoStaticData staticThermo = ThermoStaticData.LoadAllStaticData(@"spectra.raw");
ThermoDynamicData dynamicThermo = ThermoDynamicData.InitiateDynamicConnection(@"spectra.raw")
Mzml mzmlFile = Mzml.LoadAllStaticData(@"spectra.mzML");

Both filetypes implement the same interface that has all of the necessary functionality to interact with spectra files:

IMsDataFile<IMsDataScan<IMzSpectrum<IMzPeak>>> thermoFile = new ThermoRawFile(@"spectra.RAW");
IMsDataFile<IMsDataScan<IMzSpectrum<IMzPeak>>> mzmlFile = new Mzml(@"spectra.mzML");

Loading Databases From Online Sources

Loaders.LoadElements("elements.dat"); // void, loads elements into static PeriodicTable class 
IEnumerable<ModificationWithLocation> unimodMods = Loaders.LoadUnimod("unimod.dat");
IEnumerable<ModificationWithLocation> uniprotMods = Loaders.LoadUniprot("uniprot.dat");

Reading Protein Database Files

To read .fasta, .xml, or .xml.gz files, use

List<Protein> proteins = ProteinDbLoader.LoadProteinDb("proteins.xml", generateDecoys, allKnownModifications, IsContaminant, out unknownModifications);

The parameters are:

  • bool generateDecoys True if wish to generate decoy proteins.
  • IDictionary<string, IList<Modification>> allKnownModifications Dictionary of modifications with keys that correspond to modifications in the xml file.
  • bool IsContaminant True if it is a contaminant database
  • out Dictionary<string, Modification> unknownModifications An auxiliary output of modifications that were in the xml file but are not known.

Reading Modification Files

To load modifications from ptmlist formatted files use

IEnumerable<ModificationWithLocation> ptms = PtmListLoader.ReadMods("ptms.txt")

License

Code heavily borrowed from https://github.com/dbaileychess/CSMSL and distrubuted under the appropriate license, LGPL.

About

Library for mass spectrometry projects

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.9%
  • Gherkin 0.1%