00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MS_SPECTRAL_LIB_ENTRY
00020 #define MS_SPECTRAL_LIB_ENTRY
00021
00022
00023
00024
00025 #include <map>
00026 #include <string>
00027
00028
00029 namespace matrix_science {
00030
00037
00038
00067 class MS_MASCOTRESFILE_API ms_spectral_lib_entry : public ms_errors
00068 {
00069 public:
00071
00076 enum WHAT_TO_ANNOTATE {
00077 ANNOTATE_NONE,
00078 ANNOTATE_REPLACE_ALL,
00079 ANNOTATE_REPLACE_QUESTION_MARKS,
00080 ANNOTATE_REPLACE_IF_ALL_EMPTY
00081 };
00082
00084 ms_spectral_lib_entry();
00085
00087 ms_spectral_lib_entry(const ms_spectral_lib_entry & src);
00088
00090 ms_spectral_lib_entry(const std::string & entry, const std::string & fileName, const ms_spectral_lib::FILE_FORMAT format);
00091
00093 ms_spectral_lib_entry(const std::vector<std::string> & entry, const std::string & fileName, const ms_spectral_lib::FILE_FORMAT format);
00094
00096 virtual ~ms_spectral_lib_entry();
00097
00099 void copyFrom(const ms_spectral_lib_entry* right);
00100
00101 #ifndef SWIG
00102
00103 ms_spectral_lib_entry& operator=(const ms_spectral_lib_entry& right);
00104 #endif
00105
00107 const std::string get() const;
00108
00110 std::string getLine(const char * key) const;
00111
00113 std::string getName() const;
00114
00116 double getPrecursorMZ() const;
00117
00119 int getCharge() const;
00120
00122 std::string getSequence() const;
00123
00125 std::string getComment() const;
00126
00128 std::string getCommentField(const char * fieldName) const;
00129
00131 int getMods(std::vector<std::string> & names,
00132 std::vector<int> & positions) const;
00133
00135 int getMods(std::vector<std::string> & names,
00136 std::vector<int> & positions,
00137 bool & anyModfileStyleName,
00138 std::string & modsWithoutSpecificities) const;
00139
00141 int getNumPeaks() const;
00142
00144 double getMW() const;
00145
00147 std::vector<std::string> getPeakList(bool convertToNISTformat = false) const;
00148
00150 matrix_science::ms_spectral_lib_peak_list getPeakListObject() const;
00151
00153 std::string getPeakListChecksum() const;
00154
00156 std::string getFileName() const;
00157
00159 bool annotatePeaks(const WHAT_TO_ANNOTATE whatToAnnotate, const double fragmentToleranceValue, const std::string fragmentToleranceUnit, const ms_umod_configfile * unimod = 0);
00160
00162 void clearAnnotation();
00163
00164 private:
00165 bool parseLines(const std::vector<std::string> & lines);
00166 bool parseMSPLines(const std::vector<std::string> & lines, ms_spectral_lib::FILE_FORMAT format);
00167 bool parseXHunterLines(const std::vector<std::string> & lines);
00168
00169 typedef std::map<std::string, std::string> values_t;
00170 values_t values_;
00171 std::vector<std::string> originalLines_;
00172 ms_spectral_lib_peak_list peakList_;
00173 ms_spectral_lib::FILE_FORMAT format_;
00174 std::string fileName_;
00175 };
00176
00178 }
00179
00180 #endif // MS_SPECTRAL_LIB_ENTRY
00181
00182