MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / writeMsFile_

Method writeMsFile_

src/openms/source/ANALYSIS/ID/SiriusMSConverter.cpp:96–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94 }
95
96 void SiriusMSFile::writeMsFile_(ofstream& os,
97 const MSExperiment& spectra,
98 const std::vector<size_t>& ms2_spectra_index,
99 const SiriusMSFile::AccessionInfo& ainfo,
100 const StringList& adducts,
101 const std::vector<String>& v_description,
102 const std::vector<String>& v_sumformula,
103 const std::vector<pair<double,double>>& f_isotopes,
104 int& feature_charge,
105 uint64_t& feature_id,
106 const double& feature_rt,
107 const double& feature_mz,
108 bool& writecompound,
109 const bool& no_masstrace_info_isotope_pattern,
110 const int& isotope_pattern_iterations,
111 int& count_skipped_spectra,
112 int& count_assume_mono,
113 int& count_no_ms1,
114 std::vector<SiriusMSFile::CompoundInfo>& v_cmpinfo)
115 {
116 // if multiple identifications present for one MS1 and MS2 use all of them and
117 // let SIRIUS sort it out using fragment annotation
118 for (unsigned int k = 0; k != v_description.size(); ++k)
119 {
120 if (v_description.size() > 1) { writecompound = true; } // write the same "entry" for each possible hit (different: description, adduct, sumformula)
121 SiriusMSFile::CompoundInfo cmpinfo;
122
123 for (const size_t& ind : ms2_spectra_index)
124 {
125 // construct compound info structure
126 const MSSpectrum& current_ms2 = spectra[ind];
127 const double& current_rt = current_ms2.getRT();
128
129 const String& native_id = current_ms2.getNativeID();
130 const int& scan_number = SpectrumLookup::extractScanNumber(native_id, ainfo.native_id_accession);
131
132 const std::vector<Precursor> &precursor = current_ms2.getPrecursors();
133
134 // get m/z and intensity of precursor
135 if (precursor.empty())
136 {
137 throw Exception::MissingInformation(__FILE__,
138 __LINE__,
139 OPENMS_PRETTY_FUNCTION,
140 "Precursor for MS/MS spectrum was not found.");
141 }
142
143 IonSource::Polarity p = current_ms2.getInstrumentSettings().getPolarity(); //charge
144
145 // there should be only one precursor and MS2 should contain peaks to be considered
146 if (precursor.size() == 1 && !current_ms2.empty())
147 {
148
149 // read precursor charge
150 int precursor_charge = precursor[0].getCharge();
151
152 // sirius supports only single charged ions (+1; -1)
153 // if charge = 0, it will be changed to +1; -1 depending on Polarity

Callers

nothing calls this directly

Calls 15

concatenateFunction · 0.85
getNativeIDMethod · 0.80
getPrecursorsMethod · 0.80
getActivationEnergyMethod · 0.80
getPrecursorSpectrumMethod · 0.80
getMSLevelMethod · 0.80
emplace_backMethod · 0.80
StringClass · 0.50
sizeMethod · 0.45
getRTMethod · 0.45
emptyMethod · 0.45
getPolarityMethod · 0.45

Tested by

no test coverage detected