Matrix Science header

ms_spectral_lib_entry.hpp

00001 /*
00002 ##############################################################################
00003 # File: ms_spectral_lib_entry.hpp                                            #
00004 # Mascot Parser toolkit                                                      #
00005 # Encapsulates a single entry from a spectral library file                   #
00006 #                                                                            #
00007 ##############################################################################
00008 # COPYRIGHT NOTICE                                                           #
00009 # Copyright 2015 Matrix Science Limited  All Rights Reserved.                #
00010 #                                                                            #
00011 ##############################################################################
00012 #    $Source: parser/inc/ms_spectral_lib_entry.hpp $
00013 #    $Author: francoisr@matrixscience.com $ 
00014 #      $Date: 2021-05-27 10:03:04 +0100 $ 
00015 #  $Revision: a47aab4c911db687b9c37e6e2e3e9b23174da535 | MSPARSER_REL_2_8_1-0-gea32989045 $
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_SPECTRAL_LIB_ENTRY
00020 #define MS_SPECTRAL_LIB_ENTRY
00021 
00022 
00023 // Includes from the standard template library
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     }; // class ms_spectral_lib_entry
00176  // end of tools_group
00178 } // namespace matrix_science
00179 
00180 #endif // MS_SPECTRAL_LIB_ENTRY
00181 
00182 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:30