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: /vol/cvsroot/parser/inc/ms_spectral_lib_entry.hpp,v $
00013 #    $Author: davidc $ 
00014 #      $Date: 2017/05/04 11:08:52 $ 
00015 #  $Revision: 1.9 $
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_SPECTRAL_LIB_ENTRY
00020 #define MS_SPECTRAL_LIB_ENTRY
00021 
00022 #ifdef _WIN32
00023 #pragma warning(disable:4251)   // Don't want all classes to be exported
00024 #pragma warning(disable:4786)   // Debug symbols too long
00025 #   ifndef _MATRIX_USE_STATIC_LIB
00026 #       ifdef MS_MASCOTRESFILE_EXPORTS
00027 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00028 #       else
00029 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00030 #       endif
00031 #   else
00032 #       define MS_MASCOTRESFILE_API
00033 #   endif
00034 #else
00035 #   define MS_MASCOTRESFILE_API
00036 #endif
00037 
00038 // Includes from the standard template library
00039 
00040 #include <map>
00041 #include <string>
00042 
00043 
00044 namespace matrix_science {
00045   
00052 
00053 
00082     class MS_MASCOTRESFILE_API ms_spectral_lib_entry : public ms_errors
00083     {
00084     public:
00086 
00091         enum WHAT_TO_ANNOTATE {
00092             ANNOTATE_NONE,                     
00093             ANNOTATE_REPLACE_ALL,              
00094             ANNOTATE_REPLACE_QUESTION_MARKS,   
00095             ANNOTATE_REPLACE_IF_ALL_EMPTY      
00096         };
00097 
00099         ms_spectral_lib_entry();
00100 
00102         ms_spectral_lib_entry(const ms_spectral_lib_entry & src);
00103 
00105         ms_spectral_lib_entry(const std::string & entry, const std::string & fileName, const ms_spectral_lib::FILE_FORMAT format);
00106 
00108         ms_spectral_lib_entry(const std::vector<std::string> & entry, const std::string & fileName, const ms_spectral_lib::FILE_FORMAT format);
00109 
00111         virtual ~ms_spectral_lib_entry();
00112 
00114         void copyFrom(const ms_spectral_lib_entry* right);
00115 
00116 #ifndef SWIG
00117 
00118         ms_spectral_lib_entry& operator=(const ms_spectral_lib_entry& right);
00119 #endif
00120 
00122         const std::string get() const;
00123 
00125         std::string getLine(const char * key) const;
00126 
00128         std::string getName() const;
00129 
00131         double getPrecursorMZ() const;
00132 
00134         int getCharge() const;
00135 
00137         std::string getSequence() const;
00138 
00140         std::string getComment() const;
00141 
00143          std::string getCommentField(const char * fieldName) const;
00144 
00146         int getMods(std::vector<std::string> & names, 
00147                     std::vector<int>         & positions) const;
00148 
00150         int getNumPeaks() const;
00151 
00153         double getMW() const;
00154 
00156         std::vector<std::string> getPeakList(bool convertToNISTformat = false) const;
00157 
00159         matrix_science::ms_spectral_lib_peak_list getPeakListObject() const;
00160 
00162         std::string getPeakListChecksum() const;
00163 
00165         std::string getFileName() const;
00166 
00168         bool annotatePeaks(const WHAT_TO_ANNOTATE whatToAnnotate, const double fragmentToleranceValue, const std::string fragmentToleranceUnit, const ms_umod_configfile * unimod = 0);
00169 
00171         void clearAnnotation();
00172 
00173     private:
00174         bool parseLines(const std::vector<std::string> & lines);
00175         bool parseMSPLines(const std::vector<std::string> & lines, ms_spectral_lib::FILE_FORMAT format);
00176         bool parseXHunterLines(const std::vector<std::string> & lines);
00177 
00178         typedef std::map<std::string, std::string> values_t;
00179         values_t values_;
00180         std::vector<std::string> originalLines_;
00181         ms_spectral_lib_peak_list peakList_;
00182         ms_spectral_lib::FILE_FORMAT format_;
00183         std::string fileName_;
00184     }; // class ms_spectral_lib_entry
00185  // end of tools_group
00187 } // namespace matrix_science
00188 
00189 #endif // MS_SPECTRAL_LIB_ENTRY
00190 
00191 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51