Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_spectral_lib_entry.hpp
1/*
2##############################################################################
3# File: ms_spectral_lib_entry.hpp #
4# Mascot Parser toolkit #
5# Encapsulates a single entry from a spectral library file #
6# #
7##############################################################################
8# COPYRIGHT NOTICE #
9# Copyright 2015 Matrix Science Limited All Rights Reserved. #
10# #
11##############################################################################
12# $Source: parser/inc/ms_spectral_lib_entry.hpp $
13# $Author: francoisr@matrixscience.com $
14# $Date: 2021-05-27 10:03:04 +0100 $
15# $Revision: a47aab4c911db687b9c37e6e2e3e9b23174da535 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $
16##############################################################################
17*/
18
19#ifndef MS_SPECTRAL_LIB_ENTRY
20#define MS_SPECTRAL_LIB_ENTRY
21
22
23// Includes from the standard template library
24
25#include <map>
26#include <string>
27
28
29namespace matrix_science {
30
38
67 class MS_MASCOTRESFILE_API ms_spectral_lib_entry : public ms_errors
68 {
69 public:
71
80 ANNOTATE_REPLACE_IF_ALL_EMPTY
81 };
82
85
88
90 ms_spectral_lib_entry(const std::string & entry, const std::string & fileName, const ms_spectral_lib::FILE_FORMAT format);
91
93 ms_spectral_lib_entry(const std::vector<std::string> & entry, const std::string & fileName, const ms_spectral_lib::FILE_FORMAT format);
94
96 virtual ~ms_spectral_lib_entry();
97
99 void copyFrom(const ms_spectral_lib_entry* right);
100
101#ifndef SWIG
103 ms_spectral_lib_entry& operator=(const ms_spectral_lib_entry& right);
104#endif
105
107 const std::string get() const;
108
110 std::string getLine(const char * key) const;
111
113 std::string getName() const;
114
116 double getPrecursorMZ() const;
117
119 int getCharge() const;
120
122 std::string getSequence() const;
123
125 std::string getComment() const;
126
128 std::string getCommentField(const char * fieldName) const;
129
131 int getMods(std::vector<std::string> & names,
132 std::vector<int> & positions) const;
133
135 int getMods(std::vector<std::string> & names,
136 std::vector<int> & positions,
137 bool & anyModfileStyleName,
138 std::string & modsWithoutSpecificities) const;
139
141 int getNumPeaks() const;
142
144 double getMW() const;
145
147 std::vector<std::string> getPeakList(bool convertToNISTformat = false) const;
148
150 matrix_science::ms_spectral_lib_peak_list getPeakListObject() const;
151
153 std::string getPeakListChecksum() const;
154
156 std::string getFileName() const;
157
159 bool annotatePeaks(const WHAT_TO_ANNOTATE whatToAnnotate, const double fragmentToleranceValue, const std::string fragmentToleranceUnit, const ms_umod_configfile * unimod = 0);
160
162 void clearAnnotation();
163
164 private:
165 bool parseLines(const std::vector<std::string> & lines);
166 bool parseMSPLines(const std::vector<std::string> & lines, ms_spectral_lib::FILE_FORMAT format);
167 bool parseXHunterLines(const std::vector<std::string> & lines);
168
169 typedef std::map<std::string, std::string> values_t;
170 values_t values_;
171 std::vector<std::string> originalLines_;
174 std::string fileName_;
175 }; // class ms_spectral_lib_entry
176 // end of tools_group
178} // namespace matrix_science
179
180#endif // MS_SPECTRAL_LIB_ENTRY
181
182/*------------------------------- End of File -------------------------------*/
This class is used as a base class for several Mascot Parser classes.
Definition: ms_errors.hpp:696
This class is used to encapsulate a single entry, i.e. single spectrum from a NIST ....
Definition: ms_spectral_lib_entry.hpp:68
WHAT_TO_ANNOTATE
Used by annotatePeaks to specify if existing annotation should be overwritten.
Definition: ms_spectral_lib_entry.hpp:76
@ ANNOTATE_NONE
Don't perform any annotation.
Definition: ms_spectral_lib_entry.hpp:77
@ ANNOTATE_REPLACE_QUESTION_MARKS
Only annotate if ms_spectral_lib_peak_list::getPeakAnnotationLevel returns ms_spectral_lib_peak_list:...
Definition: ms_spectral_lib_entry.hpp:79
@ ANNOTATE_REPLACE_ALL
Replace all existing annotation.
Definition: ms_spectral_lib_entry.hpp:78
This class is used to encapsulate a peak list from a single spectrum in a NIST .msp or a SpectraST ....
Definition: ms_spectral_lib_peak_list.hpp:39
This class represents the file unimod.xml.
Definition: ms_umod_configfile.hpp:54
FILE_FORMAT
Definition: ms_spectral_lib_peak.hpp:48