00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_NMR_READ_STAR_H
00008 #define BALL_NMR_READ_STAR_H
00009
00010 #ifndef BALL_FORMAT_LineBasedFile_H
00011 # include<BALL/FORMAT/lineBasedFile.h>
00012 #endif
00013
00014 #include <vector>
00015
00016 namespace BALL
00017 {
00023
00029 struct BALL_EXPORT NMRAtomData
00030 {
00031 NMRAtomData() ;
00032
00033 Position atom_ID;
00034 Position residue_seq_code;
00035 String residue_label;
00036 String atom_name;
00037 char atom_type;
00038 float shift_value;
00039 float error_value;
00040 Position ambiguity_code;
00041 };
00042
00048 struct BALL_EXPORT SampleCondition
00049 {
00050 SampleCondition() ;
00051
00052 String name;
00053 float temperature;
00054 float pH;
00055 float pressure;
00056 };
00057
00063 struct BALL_EXPORT ShiftReferenceElement
00064 {
00065 ShiftReferenceElement() ;
00066
00067 String mol_common_name;
00068 char atom_type;
00069 Position isotope_number;
00070 String atom_group;
00071 String shift_units;
00072 float shift_value;
00073 char reference_method;
00074 char reference_type;
00075 float indirect_shift_ratio;
00076 };
00077
00083 struct BALL_EXPORT ShiftReferenceSet
00084 {
00085 ShiftReferenceSet() ;
00086 String name;
00087 std::vector<ShiftReferenceElement> elements;
00088 };
00089
00090 struct BALL_EXPORT NMRAtomDataSet
00091 {
00092 NMRAtomDataSet() ;
00093
00094 String name;
00095 std::vector<NMRAtomData> atom_data;
00096 SampleCondition condition;
00097 ShiftReferenceSet reference;
00098 };
00099
00100 std::ostream& operator << (std::ostream& s, const NMRAtomData& ad) ;
00101 std::ostream& operator << (std::ostream& s, const SampleCondition& sc) ;
00102 std::ostream& operator << (std::ostream& s, const ShiftReferenceElement& sre) ;
00103 std::ostream& operator << (std::ostream& s, const ShiftReferenceSet& sr) ;
00104 std::ostream& operator << (std::ostream& s, const NMRAtomDataSet& set) ;
00105
00107
00116 class BALL_EXPORT NMRStarFile
00117 : public LineBasedFile
00118 {
00119 public:
00120
00121 BALL_CREATE(NMRStarFile)
00122
00123
00126
00129 NMRStarFile()
00130 ;
00131
00137 NMRStarFile(const NMRStarFile& f)
00138 throw(Exception::FileNotFound);
00139
00143 NMRStarFile(const String& file_name)
00144 throw(Exception::FileNotFound, Exception::ParseError);
00145
00149 const NMRStarFile& operator = (const NMRStarFile& f)
00150 ;
00151
00152 ~NMRStarFile()
00153 ;
00154
00157 void clear()
00158 ;
00159
00161
00162
00166
00169 Size getNumberOfAtoms()
00170 const ;
00171
00174 const std::vector<NMRAtomDataSet>& getData()
00175 const ;
00176
00178
00181
00185 bool operator == (const NMRStarFile& f) ;
00186
00190 bool operator != (const NMRStarFile& f) ;
00191
00193
00196
00197 enum ReferenceMethod
00198 {
00199 INTERNAL_REFERENCE,
00200 EXTERNAL_REFERENCE,
00201 UNKNOWN_REFERENCE,
00202 UNSET_REFERENCE
00203 };
00204
00205 enum ReferenceType
00206 {
00207 DIRECT_TYPE,
00208 INDIRECT_TYPE,
00209 UNKNOWN_TYPE,
00210 UNSET_TYPE
00211 };
00212
00214
00215 private:
00216
00217
00218
00219
00220
00222 NMRAtomData processShiftLine_()
00223 throw(Exception::ParseError);
00224
00226 void readEntryInformation_()
00227 throw(Exception::ParseError, Exception::InvalidFormat);
00228
00230 void readMolSystem_()
00231 ;
00232
00234 void readSampleConditions_()
00235 ;
00236
00238 void readShiftReferences_()
00239 ;
00240
00242 void readShifts_()
00243 throw (Exception::ParseError);
00244
00246 static void initializeReferenceOptions_()
00247 ;
00248
00249
00250
00251
00252
00253
00255 Size number_of_shifts_;
00256
00258 std::vector<NMRAtomDataSet> atom_data_sets_;
00259
00261 std::vector<SampleCondition> sample_conditions_;
00262
00264 std::vector<ShiftReferenceSet> shift_references_;
00265
00267 String system_name_;
00268
00270 static std::vector<String> reference_options_;
00271
00273 enum ShiftReferenceTypes_
00274 {
00275 MOL_COMMON_NAME,
00276 ATOM_TYPE,
00277 ISOTOPE_NUMBER,
00278 ATOM_GROUP,
00279 SHIFT_UNITS,
00280 SHIFT_VALUE,
00281 REFERENCE_METHOD,
00282 REFERENCE_TYPE,
00283 INDIRECT_SHIFT_RATIO
00284 };
00285
00286
00287
00288 };
00289
00291 }
00292
00293 #endif // BALL_NMR_READ_STAR_H