00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MS_FRAGMENTATIONRULES_HPP
00020 #define MS_FRAGMENTATIONRULES_HPP
00021
00022
00023
00024 #include <vector>
00025 #include <string>
00026
00027
00028 namespace matrix_science {
00034 class ms_filesource;
00035
00037
00055 class MS_MASCOTRESFILE_API ms_fragmentationrules : public ms_customproperty
00056 {
00057 friend class ms_fragrulesfile;
00058 public:
00059
00061
00067 enum FRAG_SERIES_TYPE
00068 {
00069 FRAG_IMMONIUM = 4,
00070 FRAG_A_SERIES = 5,
00071 FRAG_A_MINUS_NH3 = 6,
00072 FRAG_A_MINUS_H2O = 7,
00073 FRAG_B_SERIES = 8,
00074 FRAG_B_MINUS_NH3 = 9,
00075 FRAG_B_MINUS_H2O = 10,
00076 FRAG_C_SERIES = 11,
00077 FRAG_X_SERIES = 12,
00078 FRAG_Y_SERIES = 13,
00079 FRAG_Y_MINUS_NH3 = 14,
00080 FRAG_Y_MINUS_H2O = 15,
00081 FRAG_Z_SERIES = 16,
00082 FRAG_INTERNAL_YB = 17,
00083 FRAG_INTERNAL_YA = 18,
00084 FRAG_Z_PLUS_1 = 21,
00085 FRAG_D_SERIES = 22,
00086 FRAG_V_SERIES = 23,
00087 FRAG_W_SERIES = 24,
00088 FRAG_Z_PLUS_2 = 25
00089 };
00090
00092 ms_fragmentationrules();
00093
00095 ms_fragmentationrules(const ms_fragmentationrules& src);
00096
00098 ~ms_fragmentationrules();
00099
00101 void defaultValues();
00102
00104 void copyFrom(const ms_fragmentationrules* right);
00105
00106 #ifndef SWIG
00107
00108 ms_fragmentationrules& operator=(const ms_fragmentationrules& right);
00109 #endif
00110
00111 std::string getTitle() const;
00112
00114 void setTitle(const char * title);
00115
00117 static int getFirstSeries();
00118
00120 static int getFirstSerie();
00121
00123 static int getLastSeries();
00124
00126 static int getLastSerie();
00127
00129 bool isSinglyCharged() const;
00130
00132 void setSinglyCharged(const bool value);
00133
00135 bool isCharged2Plus() const;
00136
00138 void setCharged2Plus(const bool value);
00139
00141 bool isCharged3Plus() const;
00142
00144 void setCharged3Plus(const bool value);
00145
00147 bool isSeriesUsed(const int series) const;
00148
00150 void clearSeries();
00151
00153 void setSeriesUsed(const int series, const bool val);
00154
00156 bool isValid() const;
00157
00159 bool verifyRule(ms_errs* err_, const bool tryToFix);
00160
00162 static std::string getSeriesDescription(const int series);
00163
00165 double getMinInternalMass() const;
00166
00168 void setMinInternalMass(const double mass);
00169
00171 double getMaxInternalMass() const;
00172
00174 void setMaxInternalMass(const double mass);
00175
00177 static std::string getSeriesName(const int series);
00178
00180 static bool isBackboneSeries(const int series);
00181
00183 static bool isNeutralLossSeries(const int series);
00184
00186 bool anyNLseriesUsed(const int series) const;
00187
00189 static int getTotalSeriesOutput();
00190
00191 #ifdef SUPPRESS_MS_CUSTOMPROPERTY_INHERITANCE
00192 #include "suppress_ms_customproperty.hpp"
00193 #endif
00194
00195 private:
00196 std::string title_;
00197 bool* which_series_;
00198 double minInternalMass_;
00199 double maxInternalMass_;
00200 };
00201
00203
00208 class MS_MASCOTRESFILE_API ms_fragrulesfile: public ms_errors
00209 {
00210 public:
00212 ms_fragrulesfile();
00213
00215 ms_fragrulesfile(const char* filename, const matrix_science::ms_connection_settings * cs = 0);
00216
00218 ms_fragrulesfile(const ms_fragrulesfile& src);
00219
00221 ~ms_fragrulesfile();
00222
00224 void defaultValues();
00225
00227 void copyFrom(const ms_fragrulesfile* right);
00228
00229 #ifndef SWIG
00230
00231 ms_fragrulesfile& operator=(const ms_fragrulesfile& right);
00232 #endif
00233
00234 void setFileName(const char* filename);
00235
00237 std::string getFileName() const;
00238
00240 void setConnectionSettings(const matrix_science::ms_connection_settings & cs);
00241
00243 matrix_science::ms_connection_settings getConnectionSettings() const;
00244
00246 void read_file();
00247
00249 void read_buffer(const char * buffer);
00250
00252 void save_file();
00253
00255 int getNumberOfInstruments() const;
00256
00258 void clearInstruments();
00259
00261 void appendInstrument(const ms_fragmentationrules* item);
00262
00264 std::string getInstrumentName(const int instrumentNum) const;
00265
00267 const ms_fragmentationrules* getInstrumentByName(const char * name) const;
00268
00270 const ms_fragmentationrules* getInstrumentByNumber(const int instrumentNum) const;
00271
00273 bool updateInstrumentByNumber(const int num, const ms_fragmentationrules item);
00274
00276 bool updateInstrumentByName(const char* name, const ms_fragmentationrules item);
00277
00279 bool deleteInstrumentByNumber(const int num);
00280
00282 bool deleteInstrumentByName(const char* name);
00283
00284 private:
00285 void read_filesource(ms_filesource & fsource);
00286
00287 std::string filename_;
00288 std::vector< ms_fragmentationrules* > rules_;
00289 std::vector< std::string > comments_;
00290 ms_connection_settings cs_;
00291 };
00293 }
00294
00295 #endif // MS_FRAGMENTATIONRULES_HPP
00296
00297
00298