| OpenMS 2.5.0

SiriusMSConverter.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2020.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Oliver Alka $
32 // $Authors: Oliver Alka $
33 // --------------------------------------------------------------------------
34
35 #pragma once
36
37 #include <OpenMS/ANALYSIS/MAPMATCHING/FeatureMapping.h>
38 #include <OpenMS/KERNEL/StandardTypes.h>
39 #include <OpenMS/METADATA/SpectrumLookup.h>
40 #include <fstream>
41
42 namespace OpenMS
43 {
44
45 class OPENMS_DLLAPI SiriusMSFile
46 {
47 public:
48
49 // struct to store information about accessions
50 struct AccessionInfo
51 {
52 String sf_path;
53 String sf_type;
54 String sf_accession;
55 String native_id_accession;
56 String native_id_type;
57 };
58
59 // struct to store the compound information
60 // can be used to map compound and fragment annotated spectrum later on
61 struct CompoundInfo
62 {
63 String cmp;
64 double pmass;
65 double pint_mono;
66 double rt;
67 double fmz;
68 String fid;
69 String formula;
70 int charge;
71 String ionization;
72 String des;
73 String specref_format;
74 String source_file;
75 String source_format;
76 std::vector<String> native_ids;
77 std::vector<String> mids;
78 std::vector<String> scan_indices;
79 std::vector<String> specrefs;
80 };
81
104 static void store(const MSExperiment& spectra,
105 const OpenMS::String& msfile,
106 const FeatureMapping::FeatureToMs2Indices& feature_mapping,
107 const bool& feature_only,
108 const int& isotope_pattern_iterations,
109 const bool no_mt_info,
110 std::vector<SiriusMSFile::CompoundInfo>& v_cmpinfo);
111
112
113 protected:
138 static void writeMsFile_(std::ofstream& os,
139 const MSExperiment& spectra,
140 const std::vector<size_t>& ms2_spectra_index,
141 const SiriusMSFile::AccessionInfo& ainfo,
142 const StringList& adducts,
143 const std::vector<String>& v_description,
144 const std::vector<String>& v_sumformula,
145 const std::vector<std::pair<double,double>>& f_isotopes,
146 int& feature_charge,
147 uint64_t& feature_id,
148 const double& feature_rt,
149 const double& feature_mz,
150 bool& writecompound,
151 const bool& no_masstrace_info_isotope_pattern,
152 const int& isotope_pattern_iterations,
153 int& count_skipped_spectra,
154 int& count_assume_mono,
155 int& count_no_ms1,
156 std::vector<SiriusMSFile::CompoundInfo>& v_cmpinfo);
157
158
159
160 };
161
162 } // namespace OpenMS
163
OpenMS::SiriusMSFile::AccessionInfo::sf_accession
String sf_accession
sourcefile accessions for mztab-m
Definition: SiriusMSConverter.h:54
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::SiriusMSFile::CompoundInfo::pmass
double pmass
parent/precursor mass of the compound
Definition: SiriusMSConverter.h:64
OpenMS::SiriusMSFile::CompoundInfo::specrefs
std::vector< String > specrefs
spectra reference for mztab-m
Definition: SiriusMSConverter.h:79
OpenMS::SiriusMSFile::CompoundInfo::formula
String formula
sumformula of the compound
Definition: SiriusMSConverter.h:69
OpenMS::SiriusMSFile::CompoundInfo::specref_format
String specref_format
spectra ref format for mztab-m
Definition: SiriusMSConverter.h:73
OpenMS::SiriusMSFile::AccessionInfo
Definition: SiriusMSConverter.h:50
OpenMS::SiriusMSFile::CompoundInfo
Definition: SiriusMSConverter.h:61
OpenMS::SiriusMSFile::CompoundInfo::ionization
String ionization
adduct information
Definition: SiriusMSConverter.h:71
OpenMS::SiriusMSFile::CompoundInfo::scan_indices
std::vector< String > scan_indices
index of the associated spectra
Definition: SiriusMSConverter.h:78
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::SiriusMSFile::CompoundInfo::fid
String fid
annotated feature_id (if available)
Definition: SiriusMSConverter.h:68
StandardTypes.h
OpenMS::SiriusMSFile::CompoundInfo::charge
int charge
precursor/feature charge
Definition: SiriusMSConverter.h:70
SpectrumLookup.h
OpenMS::SiriusMSFile::CompoundInfo::cmp
String cmp
query_id used compound in .ms file
Definition: SiriusMSConverter.h:63
OpenMS::SiriusMSFile::CompoundInfo::source_file
String source_file
sourcefile for mztab-m
Definition: SiriusMSConverter.h:74
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::SiriusMSFile::CompoundInfo::des
String des
description/name of the compound
Definition: SiriusMSConverter.h:72
OpenMS::SiriusMSFile::CompoundInfo::mids
std::vector< String > mids
native ids and identifier for multiple possible identification via AMS
Definition: SiriusMSConverter.h:77
OpenMS::SiriusMSFile::CompoundInfo::rt
double rt
retention time of the compound
Definition: SiriusMSConverter.h:66
FeatureMapping.h
OpenMS::SiriusMSFile::CompoundInfo::native_ids
std::vector< String > native_ids
native ids of the associated spectra
Definition: SiriusMSConverter.h:76
OpenMS::SiriusMSFile
Definition: SiriusMSConverter.h:45
OpenMS::SiriusMSFile::AccessionInfo::sf_path
String sf_path
sourcefile path for mztab-m
Definition: SiriusMSConverter.h:52
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::SiriusMSFile::AccessionInfo::native_id_type
String native_id_type
nativeID type for mztab-m
Definition: SiriusMSConverter.h:56
OpenMS::FeatureMapping::FeatureToMs2Indices
Definition: FeatureMapping.h:48
OpenMS::SiriusMSFile::CompoundInfo::pint_mono
double pint_mono
parent/precursor intensity of the compound
Definition: SiriusMSConverter.h:65
OpenMS::SiriusMSFile::AccessionInfo::sf_type
String sf_type
sourcefile type for mztab-m
Definition: SiriusMSConverter.h:53
OpenMS::SiriusMSFile::CompoundInfo::source_format
String source_format
format of the sourcefile for mztab-m
Definition: SiriusMSConverter.h:75
OpenMS::SiriusMSFile::AccessionInfo::native_id_accession
String native_id_accession
nativeID accession for mztab-m
Definition: SiriusMSConverter.h:55
OpenMS::SiriusMSFile::CompoundInfo::fmz
double fmz
annotated mass of a feature (if available)
Definition: SiriusMSConverter.h:67