OpenMS
SiriusMSConverter.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Oliver Alka, Axel Walter $
6 // $Authors: Oliver Alka $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
14 #include <fstream>
15 
16 namespace OpenMS
17 {
18 
19  class OPENMS_DLLAPI SiriusMSFile
20  {
21 public:
22 
25  {
26  public:
33  };
34 
38  {
39  public:
41  double pmass;
42  double pint_mono;
43  double rt;
44  double fmz;
47  int charge;
53  std::vector<String> native_ids;
55  std::vector<String> m_ids;
57  std::vector<String> scan_indices;
58  std::vector<String> specrefs;
59  int file_index;
60  };
61 
83  static void store(const MSExperiment& spectra,
84  std::ofstream& os,
85  const FeatureMapping::FeatureToMs2Indices& feature_mapping,
86  const bool& feature_only,
87  const int& isotope_pattern_iterations,
88  const bool no_masstrace_info_isotope_pattern,
89  std::vector<SiriusMSFile::CompoundInfo>& v_cmpinfo,
90  const size_t& file_index);
97  static void saveFeatureCompoundInfoAsTSV(const std::vector<SiriusMSFile::CompoundInfo>& v_cmpinfo,
98  const std::string& filename);
99 
100  protected:
126  static void writeMsFile_(std::ofstream& os,
127  const MSExperiment& spectra,
128  const std::vector<size_t>& ms2_spectra_index,
129  const SiriusMSFile::AccessionInfo& ainfo,
130  const StringList& adducts,
131  const std::vector<String>& v_description,
132  const std::vector<String>& v_sumformula,
133  const std::vector<std::pair<double,double>>& f_isotopes,
134  int& feature_charge,
135  uint64_t& feature_id,
136  const double& feature_rt,
137  const double& feature_mz,
138  bool& writecompound,
139  const bool& no_masstrace_info_isotope_pattern,
140  const int& isotope_pattern_iterations,
141  int& count_skipped_spectra,
142  int& count_assume_mono,
143  int& count_no_ms1,
144  std::vector<SiriusMSFile::CompoundInfo>& v_cmpinfo,
145  const size_t& file_index);
154  static Int getHighestIntensityPeakInMZRange_(double test_mz,
155  const MSSpectrum& spectrum,
156  double tolerance,
157  bool ppm);
158 
168  static std::vector<Peak1D> extractPrecursorIsotopePattern_(const double& precursor_mz,
169  const MSSpectrum& precursor_spectrum,
170  int& iterations,
171  const int& charge);
172 
173 
174 
175  };
176 
177 } // namespace OpenMS
Stores preprocessed feature mapping information.
Definition: FeatureMapping.h:33
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:45
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
Definition: SiriusMSConverter.h:20
static void writeMsFile_(std::ofstream &os, const MSExperiment &spectra, const std::vector< size_t > &ms2_spectra_index, const SiriusMSFile::AccessionInfo &ainfo, const StringList &adducts, const std::vector< String > &v_description, const std::vector< String > &v_sumformula, const std::vector< std::pair< double, double >> &f_isotopes, int &feature_charge, uint64_t &feature_id, const double &feature_rt, const double &feature_mz, bool &writecompound, const bool &no_masstrace_info_isotope_pattern, const int &isotope_pattern_iterations, int &count_skipped_spectra, int &count_assume_mono, int &count_no_ms1, std::vector< SiriusMSFile::CompoundInfo > &v_cmpinfo, const size_t &file_index)
Internal structure to write the .ms file (called in store function)
String sf_type
sourcefile type for mztab-m
Definition: SiriusMSConverter.h:28
static std::vector< Peak1D > extractPrecursorIsotopePattern_(const double &precursor_mz, const MSSpectrum &precursor_spectrum, int &iterations, const int &charge)
Extract precursor isotope pattern if no feature information is available based on C12C13 distance.
String native_id_accession
nativeID accession for mztab-m
Definition: SiriusMSConverter.h:31
std::vector< String > native_ids
native ids of the associated spectra
Definition: SiriusMSConverter.h:53
String m_ids_id
concatenated list of native ids and identifier for multiple possible identification via AMS ("|" sepa...
Definition: SiriusMSConverter.h:56
String source_file
sourcefile for mztab-m
Definition: SiriusMSConverter.h:51
String native_ids_id
concatenated list of the associated spectra
Definition: SiriusMSConverter.h:54
String specref_format
spectra ref format for mztab-m
Definition: SiriusMSConverter.h:50
String native_id_type
nativeID type for mztab-m
Definition: SiriusMSConverter.h:32
String sf_accession
sourcefile accessions for mztab-m
Definition: SiriusMSConverter.h:30
String source_format
format of the sourcefile for mztab-m
Definition: SiriusMSConverter.h:52
double pint_mono
parent/precursor intensity of the compound
Definition: SiriusMSConverter.h:42
String cmp
query_id used compound in .ms file
Definition: SiriusMSConverter.h:40
std::vector< String > scan_indices
index of the associated spectra
Definition: SiriusMSConverter.h:57
String formula
sumformula of the compound
Definition: SiriusMSConverter.h:46
String sf_filename
sourcefile name for mztab-m
Definition: SiriusMSConverter.h:29
String sf_path
sourcefile path for mztab-m
Definition: SiriusMSConverter.h:27
String ionization
adduct information
Definition: SiriusMSConverter.h:48
String des
description/name of the compound
Definition: SiriusMSConverter.h:49
int file_index
source file index >
Definition: SiriusMSConverter.h:59
static Int getHighestIntensityPeakInMZRange_(double test_mz, const MSSpectrum &spectrum, double tolerance, bool ppm)
Find highest intensity peak near target mz to test if within a margin of error.
double pmass
parent/precursor mass of the compound
Definition: SiriusMSConverter.h:41
double rt
retention time of the compound
Definition: SiriusMSConverter.h:43
int charge
precursor/feature charge
Definition: SiriusMSConverter.h:47
std::vector< String > specrefs
spectra reference for mztab-m
Definition: SiriusMSConverter.h:58
double fmz
annotated mass of a feature (if available)
Definition: SiriusMSConverter.h:44
std::vector< String > m_ids
native ids and identifier for multiple possible identification via AMS ("|" separator)
Definition: SiriusMSConverter.h:55
static void saveFeatureCompoundInfoAsTSV(const std::vector< SiriusMSFile::CompoundInfo > &v_cmpinfo, const std::string &filename)
Store CompoundInfo objects in tsv file format.
String fid
annotated feature_id (if available)
Definition: SiriusMSConverter.h:45
< class to store information about accessions
Definition: SiriusMSConverter.h:25
Definition: SiriusMSConverter.h:38
A more convenient string class.
Definition: String.h:34
static void store(const MSExperiment &spectra, std::ofstream &os, const FeatureMapping::FeatureToMs2Indices &feature_mapping, const bool &feature_only, const int &isotope_pattern_iterations, const bool no_masstrace_info_isotope_pattern, std::vector< SiriusMSFile::CompoundInfo > &v_cmpinfo, const size_t &file_index)
Internal structure used in SiriusExport that is used for the conversion of a MzMlFile to an internal ...
int Int
Signed integer type.
Definition: Types.h:72
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19