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
00101
00110 class BALL_EXPORT NMRStarFile
00111 : public LineBasedFile
00112 {
00113 public:
00114
00115 BALL_CREATE(NMRStarFile)
00116
00117
00120
00123 NMRStarFile()
00124 ;
00125
00131 NMRStarFile(const NMRStarFile& f)
00132 throw(Exception::FileNotFound);
00133
00137 NMRStarFile(const String& file_name)
00138 throw(Exception::FileNotFound, Exception::ParseError);
00139
00143 const NMRStarFile& operator = (const NMRStarFile& f)
00144 ;
00145
00146 ~NMRStarFile()
00147 ;
00148
00151 void clear()
00152 ;
00153
00155
00156
00160
00163 Size getNumberOfAtoms()
00164 const ;
00165
00168 const std::vector<NMRAtomDataSet>& getData()
00169 const ;
00170
00172
00175
00179 bool operator == (const NMRStarFile& f) ;
00180
00184 bool operator != (const NMRStarFile& f) ;
00185
00187
00190
00191 enum ReferenceMethod
00192 {
00193 INTERNAL_REFERENCE,
00194 EXTERNAL_REFERENCE,
00195 UNKNOWN_REFERENCE,
00196 UNSET_REFERENCE
00197 };
00198
00199 enum ReferenceType
00200 {
00201 DIRECT_TYPE,
00202 INDIRECT_TYPE,
00203 UNKNOWN_TYPE,
00204 UNSET_TYPE
00205 };
00206
00208
00209 private:
00210
00211
00212
00213
00214
00216 NMRAtomData processShiftLine_()
00217 throw(Exception::ParseError);
00218
00220 void readEntryInformation_()
00221 throw(Exception::ParseError, Exception::InvalidFormat);
00222
00224 void readMolSystem_()
00225 ;
00226
00228 void readSampleConditions_()
00229 ;
00230
00232 void readShiftReferences_()
00233 ;
00234
00236 void readShifts_()
00237 throw (Exception::ParseError);
00238
00240 static void initializeReferenceOptions_()
00241 ;
00242
00243
00244
00245
00246
00247
00249 Size number_of_shifts_;
00250
00252 std::vector<NMRAtomDataSet> atom_data_sets_;
00253
00255 std::vector<SampleCondition> sample_conditions_;
00256
00258 std::vector<ShiftReferenceSet> shift_references_;
00259
00261 String system_name_;
00262
00264 static std::vector<String> reference_options_;
00265
00267 enum ShiftReferenceTypes_
00268 {
00269 MOL_COMMON_NAME,
00270 ATOM_TYPE,
00271 ISOTOPE_NUMBER,
00272 ATOM_GROUP,
00273 SHIFT_UNITS,
00274 SHIFT_VALUE,
00275 REFERENCE_METHOD,
00276 REFERENCE_TYPE,
00277 INDIRECT_SHIFT_RATIO
00278 };
00279
00280
00281
00282 };
00283
00285 }
00286
00287 #endif // BALL_NMR_READ_STAR_H