residueChecker.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: residueChecker.h,v 1.22.20.1 2007/05/25 09:36:27 oliver Exp $
00005 //
00006 // Author:
00007 //   Oliver Kohlbacher
00008 //
00009 
00010 #ifndef BALL_STRUCTURE_RESIDUECHECKER_H
00011 #define BALL_STRUCTURE_RESIDUECHECKER_H
00012 
00013 #ifndef BALL_MATHS_COMMON_H
00014 # include <BALL/MATHS/common.h>
00015 #endif
00016 
00017 #ifndef BALL_COMMON_H
00018 # include <BALL/common.h>
00019 #endif
00020 
00021 #ifndef BALL_CONCEPT_PROCESSOR_H
00022 # include <BALL/CONCEPT/processor.h>
00023 #endif
00024 
00025 #ifndef BALL_DATATYPE_BITVECTOR_H
00026 # include <BALL/DATATYPE/bitVector.h>
00027 #endif
00028 
00029 namespace BALL
00030 {
00031   class FragmentDB;
00032   class Residue;
00033 
00131   class BALL_EXPORT ResidueChecker
00132     : public UnaryProcessor<Residue>
00133   {
00134     public:
00135 
00136     BALL_CREATE(ResidueChecker)
00137 
00138     
00141       
00142     
00146     enum TestType
00147     {
00149       MISSING_ATOMS = 0,
00151       EXTRA_ATOMS,
00153       ELEMENTS, 
00155       SUSPECT_BOND_LENGTHS,
00157       NON_INTEGRAL_NET_CHARGE,
00159       LARGE_CHARGES,
00161       LARGE_NET_CHARGE,
00163       NAN_POSITIONS,
00165       OVERLAPPING_ATOMS,
00167       STRONGLY_OVERLAPPING_ATOMS,
00169       DUPLICATE_ATOM_NAMES,
00171       UNKNOWN_RESIDUES,
00172 
00173       NUMBER_OF_TESTS
00174     };
00176 
00180 
00183     ResidueChecker();
00184 
00187     ResidueChecker(FragmentDB& fragment_db);
00188 
00191     ResidueChecker(const ResidueChecker& residue_checker);
00192 
00195     virtual ~ResidueChecker();
00197 
00201 
00204     void enable(TestType t) ;
00205 
00208     void disable(TestType t) ;
00209 
00212     void enableSelection()  { selection_ = true; }
00213 
00216     void disableSelection()  { selection_ = false; }
00217 
00220     bool isSelectionEnabled()  { return selection_; }
00221 
00227     bool getStatus() const;
00228 
00229 
00230 
00233     bool isEnabled(TestType t) const ;
00235 
00239 
00242     Processor::Result operator () (Residue& residue);
00243 
00246     bool start();
00247 
00250     bool finish();
00251 
00253 
00259     bool checkAtomPositions(const Residue& res, const String& res_name)
00260       ;
00261 
00264     bool checkCharge(const Residue& res, const String& res_name)
00265       ;
00266 
00269     bool checkCompleteness(const Residue& res, const Residue& reference, const String& res_name)
00270       ;
00271 
00274     bool checkTemplate(const Residue& res, const Residue& reference, const String& res_name)
00275       ;
00276       
00278       
00279     protected:
00280     
00281     // The fragment database
00282     FragmentDB* fragment_db_;
00283 
00284     // Bool flag indicating whether any of the tests failed
00285     bool        status_;
00286 
00287     // A bitvector containing the flags for the tests
00288     BitVector   tests_;
00289 
00290     // If this flag is set, all atoms/residues having problems will be selected
00291     bool        selection_;
00292   }; 
00293             
00294 } // namespace BALL
00295 
00296 #endif // BALL_STRUCTURE_RESIDUE_CHECKER