00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MS_MODFILE_HPP
00020 #define MS_MODFILE_HPP
00021
00022
00023 #include <string>
00024 #include <vector>
00025 #include <memory>
00026
00027 namespace msparser_internal {
00028 class ms_modification_impl;
00029 }
00030
00031 namespace matrix_science {
00032
00033 class ms_masses;
00034 class ms_umod_modification;
00035
00046 enum MOD_TYPES
00047 {
00048 MOD_TYPE_RESIDUE = 0,
00049 MOD_TYPE_N_TERM = 1,
00050 MOD_TYPE_C_TERM = 2,
00051 MOD_TYPE_N_PROTEIN = 3,
00052 MOD_TYPE_C_PROTEIN = 4,
00053 MOD_TYPE_N_TERM_RESIDUE = 5,
00054 MOD_TYPE_C_TERM_RESIDUE = 6,
00055 MOD_TYPE_N_PROTEIN_RESIDUE= 7,
00056 MOD_TYPE_C_PROTEIN_RESIDUE= 8,
00057 MOD_TYPE_______LAST = 9
00058 };
00059
00061
00064 enum MASS_TYPE
00065 {
00066 MASS_TYPE_MONO = 0x0000,
00067 MASS_TYPE_AVE = 0x0001
00068 };
00069
00071
00074 enum
00075 {
00076 MAX_VAR_MODS = 'W' -'A' + 10
00077 };
00078
00079 typedef std::vector<double> ms_vectorDouble;
00080 typedef std::vector< bool > ms_vectorBool;
00081
00083
00133 class MS_MASCOTRESFILE_API ms_modification: public ms_customproperty
00134 {
00135 friend class ms_modfile;
00136 friend class ms_modvector;
00137 public:
00138
00140 ms_modification(const ms_masses* massFile = NULL);
00141
00143 ms_modification(const ms_modification& src);
00144
00146 ~ms_modification();
00147
00149 void defaultValues();
00150
00152 void copyFrom(const ms_modification* src);
00153
00154 #ifndef SWIG
00155
00156 ms_modification& operator=(const ms_modification& right);
00157 #endif
00158
00159 bool getFromUnimod(const char* modName, const ms_umod_configfile *umod_file);
00160
00162 void setMassFile(const ms_masses* massFile);
00163
00165 const ms_masses* getMassFile() const;
00166
00168 void copyMassFile(const ms_masses* massFile);
00169
00171 std::string getTitle() const;
00172
00174 void setTitle(const char* value);
00175
00177 int getModificationType() const;
00178
00180 void setModificationType(const int type);
00181
00183 bool isHidden() const;
00184
00186 void setHidden(const bool value);
00187
00189 bool inShortList() const;
00190
00192 void setInShortList(const bool value);
00193
00195 bool inLongList() const;
00196
00198 void setInLongList(const bool value);
00199
00201 bool inErrorTolerant() const;
00202
00204 void setInErrorTolerant(const bool value);
00205
00207 bool isSubstitution() const;
00208
00210 double getDelta(const MASS_TYPE massType) const;
00211
00213 void setDelta(const double massMono, const double massAve);
00214
00216 ms_vectorDouble getNeutralLoss(const MASS_TYPE massType) const;
00217
00219 ms_vectorBool getNeutralLossRequired() const;
00220
00222
00223
00225 void setNeutralLoss(const ms_vectorDouble massMono, const ms_vectorDouble massAve, const ms_vectorBool required);
00226
00228 int getNumberOfModifiedResidues() const;
00229
00231 char getModifiedResidue(const int n) const;
00232
00234 bool isResidueModified(const char residue) const;
00235
00237 double getResidueMass(const MASS_TYPE massType, const char residue) const;
00238
00240 void clearModifiedResidues();
00241
00243 void appendModifiedResidue(const char residue, const double massMono, const double massAve);
00244
00246 double getNTerminusMass(const MASS_TYPE massType) const;
00247
00249 void setNTerminusMass(const double massMono, const double massAve);
00250
00252 double getCTerminusMass(const MASS_TYPE massType) const;
00253
00255 void setCTerminusMass(const double massMono, const double massAve);
00256
00258 int getNumberOfIgnoreMasses() const;
00259
00261 double getIgnoreMass(const MASS_TYPE massType, const int idx) const;
00262
00264 void clearIgnoreMasses();
00265
00267 void appendIgnoreMass(const double massMono, const double massAve);
00268
00270 ms_vectorDouble getReqPepNeutralLoss(const MASS_TYPE massType) const;
00271
00273 void setReqPepNeutralLoss(const ms_vectorDouble valuesMono, const ms_vectorDouble valuesAve);
00274
00276 ms_vectorDouble getPepNeutralLoss(const MASS_TYPE massType) const;
00277
00279 void setPepNeutralLoss(const ms_vectorDouble valuesMono, const ms_vectorDouble valuesAve);
00280
00282 bool isGeneratedMonoLinker() const;
00283
00285 bool isLoopLinker() const;
00286
00288 std::string getCode() const;
00289
00291 std::string getPairsWith() const;
00292
00294 std::string getMonoLinkTitle() const;
00295
00297 bool isCrossLinker() const;
00298
00300 void setIsCrossLinker(const bool value);
00301
00303 void setIsGeneratedMonoLinker(const bool value);
00304
00306 void setIsLoopLinker(const bool value);
00307
00309 int getPositionInUnimodAsNeutralLoss() const;
00310
00312 void setPositionInUnimodAsNeutralLoss(const int value);
00313
00315 void setCode(std::string code);
00316
00318 void setPairsWith(std::string pairsWith);
00319
00321 void setTitleSource(const char *unimodName, const char *specString);
00322
00323 #ifdef SUPPRESS_MS_CUSTOMPROPERTY_INHERITANCE
00324 #include "suppress_ms_customproperty.hpp"
00325 #endif
00326
00327 private:
00328 void setCustomProperty();
00329
00330 msparser_internal::ms_modification_impl * m_pImpl;
00331 };
00332
00334 class MS_MASCOTRESFILE_API ms_modvector
00335 {
00336 friend class ms_modfile;
00337 public:
00339 ms_modvector();
00340
00342 ms_modvector(const ms_modvector& src);
00343
00345 ms_modvector(const ms_umod_modification &src, const ms_umod_configfile &umod_file);
00346
00348 ~ms_modvector();
00349
00351 void copyFrom(const ms_modvector* right);
00352
00354 void copyFrom(const ms_umod_modification* right, const ms_umod_configfile *umod_file);
00355
00356 #ifndef SWIG
00357
00358 ms_modvector& operator=(const ms_modvector& right);
00359 #endif
00360
00362 int getNumberOfModifications() const;
00363
00365 void clearModifications();
00366
00368 void appendModification(const ms_modification* item);
00369
00371 void appendModifications(ms_modvector &right);
00372
00374 const ms_modification * getModificationByNumber(const int numMod) const;
00375
00377 const ms_modification * getModificationByName(const std::string &name) const;
00378
00379 private:
00380 typedef std::vector<ms_modification* > mod_vector;
00381
00382 mod_vector entries_;
00383 };
00384
00386
00402 class MS_MASCOTRESFILE_API ms_modfile: public ms_errors
00403 {
00404 public:
00406 ms_modfile();
00407
00409 ms_modfile(const ms_modfile& src);
00410
00411
00413 ms_modfile(const ms_umod_configfile& src,
00414 const unsigned int flags = ms_umod_configfile::MODFILE_FLAGS_ALL);
00415
00417 ms_modfile(const char* filename,
00418 const ms_masses* massFile,
00419 const bool fromSubstitutions = false,
00420 const ms_connection_settings * cs = 0);
00421
00423 ~ms_modfile();
00424
00426 void defaultValues();
00427
00429 void copyFrom(const ms_modfile* right);
00430
00432 void copyFrom(const ms_umod_configfile* right,
00433 const unsigned int flags = ms_umod_configfile::MODFILE_FLAGS_ALL);
00434
00435 #ifndef SWIG
00436
00437 ms_modfile& operator=(const ms_modfile& right);
00438 #endif
00439
00440 void setFileName(const char* name);
00441
00443 std::string getFileName() const;
00444
00446 void setConnectionSettings(const ms_connection_settings & cs);
00447
00449 ms_connection_settings getConnectionSettings() const;
00450
00452 void setMassFile(const ms_masses* massFile);
00453
00455 const ms_masses* getMassFile() const;
00456
00458 bool isFromSubstitutions() const;
00459
00461 void setFromSubstitutions(const bool value);
00462
00464 void read_file();
00465
00467 void save_file();
00468 #ifndef SWIG
00469
00470 void saveToString(std::string & modfileAsStr);
00471 #else // SWIG Multiple return values
00472 void saveToString(std::string & OUTPUT);
00473 #endif
00474
00475 void sortModifications();
00476
00478 int getNumberOfModifications() const;
00479
00481 void clearModifications();
00482
00484 void appendModification(const ms_modification* item);
00485
00487 const ms_modification * getModificationByNumber(const int numMod) const;
00488
00490 const ms_modification * getModificationByName(const char* nameMod) const;
00491
00493 bool updateModificationByNumber(const int num, const ms_modification mod);
00494
00496 bool updateModificationByName(const char* name, const ms_modification mod);
00497
00499 bool deleteModificationByNumber(const int num);
00500
00502 bool deleteModificationByName(const char* name);
00503
00504 private:
00505 void read_text();
00506 void save_text();
00507 void applyVisibility(const ms_session *session);
00508
00509 typedef std::vector<ms_modification* > entries_vector;
00510 entries_vector entries;
00511
00512 std::string filename_;
00513 #if !defined(_WIN32) && !defined(__INTEL_COMPILER)
00514 #pragma GCC diagnostic push
00515 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
00516 #endif
00517 std::auto_ptr<ms_masses> m_massFile;
00518 #if !defined(_WIN32) && !defined(__INTEL_COMPILER)
00519 #pragma GCC diagnostic pop
00520 #endif
00521 std::vector< std::string > comments_;
00522 bool bFromSubstitutions_;
00523 ms_connection_settings cs_;
00524
00525 };
00527 }
00528
00529 #endif // MS_MODFILE_HPP
00530
00531