00001
00002
00003
00004
00005
00006 #ifndef BALL_FORMAT_NMRSTARFILE_H
00007 #define BALL_FORMAT_NMRSTARFILE_H
00008
00009 #ifndef BALL_FORMAT_CIFFILE_H
00010 # include<BALL/FORMAT/CIFFile.h>
00011 #endif
00012
00013 #ifndef BALL_COMMON_LIMITS_H
00014 # include<BALL/COMMON/limits.h>
00015 #endif
00016
00017 #include <vector>
00018
00019 namespace BALL
00020 {
00021
00022 class BALL_EXPORT NMRStarFile
00023 : public CIFFile
00024 {
00025 public:
00026 BALL_CREATE(NMRStarFile)
00027
00028 static const float FLOAT_VALUE_NA;
00029 static const Position POSITION_VALUE_NA;
00030
00035
00041 class BALL_EXPORT NMRAtomData
00042 {
00043 public:
00044 NMRAtomData();
00045
00046 Position atom_ID;
00047 Position residue_seq_code;
00048 String residue_label;
00049 String atom_name;
00050 char atom_type;
00051 float shift_value;
00052 float error_value;
00053 Position ambiguity_code;
00054
00055 std::ostream& operator >> (std::ostream& s) throw();
00056 };
00057
00062 class BALL_EXPORT SampleCondition
00063 {
00064 public:
00065 SampleCondition();
00066
00067 String name;
00068 float temperature;
00069 float pH;
00070 float pressure;
00071
00072 std::ostream& operator >> (std::ostream& s) throw();
00073 };
00074
00079 class BALL_EXPORT ShiftReferenceElement
00080 {
00081 public:
00082 ShiftReferenceElement();
00083
00084 String mol_common_name;
00085 char atom_type;
00086 Position isotope_number;
00087 String atom_group;
00088 String shift_units;
00089 float shift_value;
00090 char reference_method;
00091 char reference_type;
00092 float indirect_shift_ratio;
00093
00094 std::ostream& operator >> (std::ostream& s) throw();
00095 };
00096
00101 class BALL_EXPORT ShiftReferenceSet
00102 {
00103 public:
00104 ShiftReferenceSet();
00105
00106 String name;
00107 std::vector<ShiftReferenceElement> elements;
00108
00109 std::ostream& operator >> (std::ostream& s);
00110 };
00111
00115 class BALL_EXPORT NMRAtomDataSet
00116 {
00117 public:
00118 NMRAtomDataSet();
00119
00120 String name;
00121 std::vector<NMRAtomData> atom_data;
00122 SampleCondition condition;
00123 ShiftReferenceSet reference;
00124
00125 std::ostream& operator >> (std::ostream& s);
00126 };
00127
00131 class BALL_EXPORT EntryInformation
00132 {
00133 public:
00134 EntryInformation();
00135 ~EntryInformation();
00136 std::ostream& operator >> (std::ostream& s);
00137
00138 String entry_type;
00139 String BMRB_accession_code;
00140 String NMR_STAR_version;
00141 String experimental_method;
00142 };
00143
00145
00149
00152 NMRStarFile();
00153
00159 NMRStarFile(const NMRStarFile& f)
00160 throw(Exception::FileNotFound);
00161
00165 NMRStarFile(const String& file_name, File::OpenMode open_mode = std::ios::in)
00166 throw(Exception::FileNotFound);
00167
00168 ~NMRStarFile();
00169
00173 const NMRStarFile& operator = (const NMRStarFile& f);
00174
00177 bool read()
00178 throw(Exception::ParseError);
00179
00182 void clear();
00183
00185
00186
00190
00193 Size getNumberOfAtoms()
00194 const ;
00195
00198 const std::vector<NMRAtomDataSet>& getData()
00199 const ;
00200
00201 const EntryInformation& getEntryInformation() const {return entry_information_;};
00202
00206
00207
00208
00211
00212
00213
00215
00218
00222 bool operator == (const NMRStarFile& f) ;
00223
00227 bool operator != (const NMRStarFile& f) ;
00228
00230
00233
00234 enum ReferenceMethod
00235 {
00236 INTERNAL_REFERENCE,
00237 EXTERNAL_REFERENCE,
00238 UNKNOWN_REFERENCE,
00239 UNSET_REFERENCE
00240 };
00241
00242 enum ReferenceType
00243 {
00244 DIRECT_TYPE,
00245 INDIRECT_TYPE,
00246 UNKNOWN_TYPE,
00247 UNSET_TYPE
00248 };
00249
00251
00252 private:
00253
00254
00255
00256
00257
00259
00260
00261
00263 void readEntryInformation_()
00264 throw(Exception::ParseError, Exception::InvalidFormat);
00265
00267 void readMolSystem_()
00268 ;
00269
00271 void readSampleConditions_()
00272 ;
00273
00275 void readShiftReferences_()
00276 ;
00277
00279 void readShifts_()
00280 throw (Exception::ParseError);
00281
00283 static void initializeReferenceOptions_()
00284 ;
00285
00286
00287
00288
00289
00290
00292 Size number_of_shifts_;
00293
00294
00295 EntryInformation entry_information_;
00296
00298 std::vector<NMRAtomDataSet> atom_data_sets_;
00299
00301 std::vector<SampleCondition> sample_conditions_;
00302
00304 std::vector<ShiftReferenceSet> shift_references_;
00305
00307 String system_name_;
00308
00310 static std::vector<String> reference_options_;
00311
00312
00313 SaveFrame dummy_saveframe_;
00314
00316 enum ShiftReferenceTypes_
00317 {
00318 MOL_COMMON_NAME,
00319 ATOM_TYPE,
00320 ISOTOPE_NUMBER,
00321 ATOM_GROUP,
00322 SHIFT_UNITS,
00323 SHIFT_VALUE,
00324 REFERENCE_METHOD,
00325 REFERENCE_TYPE,
00326 INDIRECT_SHIFT_RATIO
00327 };
00328
00329
00330 };
00331
00333 }
00334
00335 #endif // BALL_FORMAT_NMRSTARFILE_H