Loading...
Searching...
No Matches
standardPredicates.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: standardPredicates.h,v 1.52.16.2 2007/03/29 10:34:59 bertsch Exp $
//
#ifndef BALL_KERNEL_STANDARDPREDICATES_H
#define BALL_KERNEL_STANDARDPREDICATES_H
#ifndef BALL_DATATYPE_STRINGHASHMAP_H
# include <BALL/DATATYPE/stringHashMap.h>
#endif
#ifndef BALL_DATATYPE_HASHSET_H
# include <BALL/DATATYPE/hashSet.h>
#endif
#ifndef BALL_KERNEL_BOND_H
# include <BALL/KERNEL/bond.h>
#endif
#ifndef BALL_KERNEL_EXPRESSION_H
# include <BALL/KERNEL/expression.h>
#endif
#ifndef BALL_STRUCTURE_SMARTSMATCHER_H
# include <BALL/STRUCTURE/smartsMatcher.h>
#endif
#ifndef BALL_QSAR_AROMATICITYPROCESSOR_H
# include <BALL/QSAR/aromaticityProcessor.h>
#endif
#ifndef BALL_QSAR_RINGPERCEPTIONPROCESSOR_H
# include <BALL/QSAR/ringPerceptionProcessor.h>
#endif
namespace BALL
{
class Atom;
class BALL_EXPORT TruePredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(TruePredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT FalsePredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(FalsePredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT SelectedPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(SelectedPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT AtomNamePredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(AtomNamePredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT AtomTypePredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(AtomTypePredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT ElementPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(ElementPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT ResiduePredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(ResiduePredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT ResidueIDPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(ResidueIDPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT ProteinPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(ProteinPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT ChainPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(ChainPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT SecondaryStructurePredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(SecondaryStructurePredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT SolventPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(SolventPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT MoleculePredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(MoleculePredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT BackBonePredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(BackBonePredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT NucleicAcidPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(NucleicAcidPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT NucleotidePredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(NucleotidePredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT InRingPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(InRingPredicate)
InRingPredicate();
InRingPredicate(Size n);
~InRingPredicate();
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT NumberOfBondsPredicate
: public ExpressionPredicate
{
public:
NumberOfBondsPredicate();
BALL_CREATE(NumberOfBondsPredicate)
virtual bool operator () (const Atom& atom) const;
protected:
bool testPredicate_(const Atom& atom, Bond::Order order) const;
};
class BALL_EXPORT SingleBondsPredicate
: public NumberOfBondsPredicate
{
public:
BALL_CREATE(SingleBondsPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT DoubleBondsPredicate
: public NumberOfBondsPredicate
{
public:
BALL_CREATE(DoubleBondsPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT TripleBondsPredicate
: public DoubleBondsPredicate
{
public:
BALL_CREATE(TripleBondsPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT AromaticBondsPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(AromaticBondsPredicate)
virtual bool operator () (const Atom& atom) const;
protected:
bool testPredicate_(const Atom& atom) const;
};
class BALL_EXPORT ConnectedToPredicate
: public ExpressionPredicate
{
public:
class BALL_EXPORT CTPNode
{
public:
enum BondType
{
BONDTYPE__UNINITIALISED = 0,
BONDTYPE__ANY = 1,
BONDTYPE__SINGLE = 2,
BONDTYPE__DOUBLE = 3,
BONDTYPE__TRIPLE = 4,
BONDTYPE__QUADRUPLE = 5,
BONDTYPE__AROMATIC = 6
};
typedef std::list<CTPNode*>::iterator Iterator;
typedef std::list<CTPNode*>::const_iterator ConstIterator;
/*
*/
CTPNode();
/*
*/
CTPNode(const CTPNode& node);
/*
*/
virtual ~CTPNode();
/*
*/
virtual void destroy();
/*
*/
void setParent(CTPNode* parent);
/*
*/
CTPNode* getParent() const;
/*
*/
void addChild(CTPNode* child);
/*
*/
void removeChild(CTPNode* child);
/*
*/
::std::list<CTPNode*>& getChildren();
Iterator begin();
ConstIterator begin() const;
Iterator end();
ConstIterator end() const;
/*
*/
Size getNumberOfChildren() const;
/*
*/
void setBondType(Size type);
/*
*/
void setBondType(char type);
/*
*/
Size getBondType() const;
/*
*/
char getBondTypeChar() const;
/*
*/
String getSymbol() const;
/*
*/
void setSymbol(const String& symbol);
/*
*/
void setFinished();
/*
*/
void unsetFinished();
/*
*/
bool isFinished() const;
/*
*/
void setLinked();
/*
*/
void unsetLinked();
/*
*/
bool isLinked() const;
/*
*/
void linkWith(CTPNode* partner);
/*
*/
const HashSet<CTPNode*>& getLinkSet() const;
private:
/*
*/
String element_symbol_;
/* Bond type means the bond connecting *to* this node.
*/
Size bond_type_;
/*
*/
std::list<CTPNode*> children_;
/*
*/
CTPNode* parent_;
/*
*/
bool finished_;
/*
*/
bool linked_;
/*
*/
HashSet<CTPNode*> link_set_;
/*
*/
struct greater_
: public binary_function<const CTPNode*, const CTPNode*, bool>
{
bool operator () (const CTPNode* a, const CTPNode* b) const
{
if ((a != 0) && (b != 0))
{
if (a->getSymbol() == "*")
{
return true;
}
else
{
return false;
}
}
else
{
Log.error() << "greater_: got NULL pointers" << std::endl;
return false;
}
}
};
};
public:
BALL_CREATE(ConnectedToPredicate)
ConnectedToPredicate();
ConnectedToPredicate(const ConnectedToPredicate& predicate);
virtual ~ConnectedToPredicate();
virtual void clear();
virtual bool operator () (const Atom& atom) const;
void dump() const;
void dump(const CTPNode* current) const;
virtual void setArgument(const String& argument);
private:
/*_ The syntax tree
*/
CTPNode* tree_;
/*_ Needed for realising parsing of loops (or links).
*/
HashMap<char, std::pair<CTPNode*, CTPNode*> > link_map_;
/*_ Needed for realising parsing of loops (or links).
*/
char link_mark_;
/*_ Keep it consistent
*/
CTPNode* createNewNode_(CTPNode* node);
/*_
*/
CTPNode* parse_();
// Clean up nodes created if parse_ exits with a parse error.
void cleanUpNodes_(std::vector<CTPNode*>& all_nodes);
/*_
*/
CTPNode* parse_(const String& input);
bool bondOrderMatch_(const Bond& bond, const CTPNode& node) const;
bool find_(const Atom& atom, const CTPNode* current,
HashSet<const Bond*>& visited) const;
};
class BALL_EXPORT SpHybridizedPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(SpHybridizedPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT Sp2HybridizedPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(Sp2HybridizedPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT Sp3HybridizedPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(Sp3HybridizedPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT ChargePredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(ChargePredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT AxialPredicate
: public ExpressionPredicate
{
public:
BALL_CREATE(AxialPredicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT Conformation4C1Predicate
: public ExpressionPredicate
{
public:
BALL_CREATE(Conformation4C1Predicate)
virtual bool operator () (const Atom& atom) const;
};
class BALL_EXPORT RingFinder
{
public:
// BALL_CREATE(RingFinder)
RingFinder();
RingFinder(Size n);
virtual ~RingFinder();
bool operator () (const Atom& atom);
bool dfs(const Atom& atom, const Size limit);
void setRingSize(Size n);
const HashSet<const Bond*>& getVisitedBonds() const;
const std::vector<const Atom*>& getRingAtoms() const;
private:
const Atom* first_atom_;
Size n_;
bool exact_;
/*_
*/
HashSet<const Bond*> visited_bonds_;
/*_
*/
std::vector<const Atom*> ring_atoms_;
};
class BALL_EXPORT SMARTSPredicate
: public ExpressionPredicate
{
public:
SMARTSPredicate();
SMARTSPredicate(const SMARTSPredicate& pred);
virtual ~SMARTSPredicate();
BALL_CREATE(SMARTSPredicate)
virtual bool operator () (const Atom& atom) const;
mutable SmartsMatcher matcher_;
mutable Molecule* last_molecule_;
mutable AromaticityProcessor arom_proc_;
mutable RingPerceptionProcessor ring_proc_;
// when was the aromaticity lastly calculated for a given molecule:
static HashMap<Molecule*, TimeStamp> call_time_map_;
static Molecule dummy_molecule_;
mutable HashSet<Atom*> matches_;
};
} // namespace BALL
#endif // BALL_KERNEL_STANDARDPREDICATES_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
aromaticityProcessor.h
bond.h
BALL::AromaticBondsPredicate
Definition standardPredicates.h:441
BALL::AromaticBondsPredicate::testPredicate_
bool testPredicate_(const Atom &atom) const
BALL::AromaticityProcessor
This processor provides methods for detection and assignment of aromaticity.
Definition aromaticityProcessor.h:30
BALL::AtomNamePredicate
Definition standardPredicates.h:107
BALL::AtomTypePredicate
Definition standardPredicates.h:123
BALL::Atom
Definition atom.h:90
BALL::AxialPredicate
Definition standardPredicates.h:799
BALL::BackBonePredicate
Definition standardPredicates.h:278
BALL::Bond
Definition bond.h:57
BALL::ChainPredicate
Definition standardPredicates.h:207
BALL::ChargePredicate
Definition standardPredicates.h:777
BALL::Conformation4C1Predicate
Definition standardPredicates.h:820
BALL::ConnectedToPredicate::CTPNode
Definition standardPredicates.h:487
BALL::ConnectedToPredicate::CTPNode::getParent
CTPNode * getParent() const
BALL::ConnectedToPredicate::CTPNode::addChild
void addChild(CTPNode *child)
BALL::ConnectedToPredicate::CTPNode::getSymbol
String getSymbol() const
BALL::ConnectedToPredicate::CTPNode::removeChild
void removeChild(CTPNode *child)
BALL::ConnectedToPredicate::CTPNode::unsetFinished
void unsetFinished()
BALL::ConnectedToPredicate::CTPNode::end
ConstIterator end() const
BALL::ConnectedToPredicate::CTPNode::getChildren
::std::list< CTPNode * > & getChildren()
BALL::ConnectedToPredicate::CTPNode::unsetLinked
void unsetLinked()
BALL::ConnectedToPredicate::CTPNode::begin
ConstIterator begin() const
BALL::ConnectedToPredicate::CTPNode::isFinished
bool isFinished() const
BALL::ConnectedToPredicate::CTPNode::begin
Iterator begin()
BALL::ConnectedToPredicate::CTPNode::getBondType
Size getBondType() const
BALL::ConnectedToPredicate::CTPNode::linkWith
void linkWith(CTPNode *partner)
BALL::ConnectedToPredicate::CTPNode::destroy
virtual void destroy()
BALL::ConnectedToPredicate::CTPNode::end
Iterator end()
BALL::ConnectedToPredicate::CTPNode::getNumberOfChildren
Size getNumberOfChildren() const
BALL::ConnectedToPredicate::CTPNode::CTPNode
CTPNode(const CTPNode &node)
BALL::ConnectedToPredicate::CTPNode::ConstIterator
std::list< CTPNode * >::const_iterator ConstIterator
Definition standardPredicates.h:502
BALL::ConnectedToPredicate::CTPNode::setLinked
void setLinked()
BALL::ConnectedToPredicate::CTPNode::setBondType
void setBondType(char type)
BALL::ConnectedToPredicate::CTPNode::CTPNode
CTPNode()
BALL::ConnectedToPredicate::CTPNode::~CTPNode
virtual ~CTPNode()
BALL::ConnectedToPredicate::CTPNode::setParent
void setParent(CTPNode *parent)
BALL::ConnectedToPredicate::CTPNode::setBondType
void setBondType(Size type)
BALL::ConnectedToPredicate::CTPNode::isLinked
bool isLinked() const
BALL::ConnectedToPredicate::CTPNode::setSymbol
void setSymbol(const String &symbol)
BALL::ConnectedToPredicate::CTPNode::getBondTypeChar
char getBondTypeChar() const
BALL::ConnectedToPredicate::CTPNode::BondType
BondType
Definition standardPredicates.h:491
BALL::ConnectedToPredicate::CTPNode::BONDTYPE__ANY
@ BONDTYPE__ANY
Definition standardPredicates.h:493
BALL::ConnectedToPredicate::CTPNode::BONDTYPE__DOUBLE
@ BONDTYPE__DOUBLE
Definition standardPredicates.h:495
BALL::ConnectedToPredicate::CTPNode::BONDTYPE__UNINITIALISED
@ BONDTYPE__UNINITIALISED
Definition standardPredicates.h:492
BALL::ConnectedToPredicate::CTPNode::BONDTYPE__AROMATIC
@ BONDTYPE__AROMATIC
Definition standardPredicates.h:498
BALL::ConnectedToPredicate::CTPNode::BONDTYPE__TRIPLE
@ BONDTYPE__TRIPLE
Definition standardPredicates.h:496
BALL::ConnectedToPredicate::CTPNode::BONDTYPE__SINGLE
@ BONDTYPE__SINGLE
Definition standardPredicates.h:494
BALL::ConnectedToPredicate::CTPNode::BONDTYPE__QUADRUPLE
@ BONDTYPE__QUADRUPLE
Definition standardPredicates.h:497
BALL::ConnectedToPredicate::CTPNode::getLinkSet
const HashSet< CTPNode * > & getLinkSet() const
BALL::ConnectedToPredicate::CTPNode::setFinished
void setFinished()
BALL::ConnectedToPredicate::CTPNode::Iterator
std::list< CTPNode * >::iterator Iterator
Definition standardPredicates.h:501
BALL::ConnectedToPredicate::dump
void dump() const
BALL::ConnectedToPredicate::clear
virtual void clear()
BALL::ConnectedToPredicate::ConnectedToPredicate
ConnectedToPredicate()
BALL::ConnectedToPredicate::setArgument
virtual void setArgument(const String &argument)
BALL::DoubleBondsPredicate
Definition standardPredicates.h:398
BALL::ElementPredicate
Definition standardPredicates.h:139
BALL::ExpressionPredicate::ExpressionPredicate
ExpressionPredicate()
BALL::FalsePredicate
Definition standardPredicates.h:73
BALL::HashMap
HashMap class based on the STL map (containing serveral convenience functions).
Definition hashMap.h:74
BALL::HashSet
Definition hashSet.h:46
BALL::InRingPredicate::InRingPredicate
InRingPredicate()
Default constructor;.
BALL::LogStream::error
LogStream & error(int n=0)
BALL::MoleculePredicate
Definition standardPredicates.h:261
BALL::Molecule
Definition molecule.h:31
BALL::NucleicAcidPredicate
Definition standardPredicates.h:293
BALL::NucleotidePredicate
Definition standardPredicates.h:309
BALL::NumberOfBondsPredicate::testPredicate_
bool testPredicate_(const Atom &atom, Bond::Order order) const
BALL::NumberOfBondsPredicate::NumberOfBondsPredicate
NumberOfBondsPredicate()
Default constructor.
BALL::ProteinPredicate
Definition standardPredicates.h:190
BALL::ResidueIDPredicate
Definition standardPredicates.h:173
BALL::ResiduePredicate
Definition standardPredicates.h:156
BALL::RingFinder::setRingSize
void setRingSize(Size n)
BALL::RingFinder::dfs
bool dfs(const Atom &atom, const Size limit)
BALL::RingFinder::~RingFinder
virtual ~RingFinder()
Destructor.
BALL::RingFinder::RingFinder
RingFinder()
Default constructor.
BALL::RingFinder::getRingAtoms
const std::vector< const Atom * > & getRingAtoms() const
BALL::RingFinder::RingFinder
RingFinder(Size n)
BALL::RingFinder::getVisitedBonds
const HashSet< const Bond * > & getVisitedBonds() const
BALL::RingPerceptionProcessor
Definition ringPerceptionProcessor.h:38
BALL::SMARTSPredicate::matcher_
SmartsMatcher matcher_
Definition standardPredicates.h:921
BALL::SMARTSPredicate::dummy_molecule_
static Molecule dummy_molecule_
Definition standardPredicates.h:927
BALL::SMARTSPredicate::call_time_map_
static HashMap< Molecule *, TimeStamp > call_time_map_
Definition standardPredicates.h:926
BALL::SMARTSPredicate::arom_proc_
AromaticityProcessor arom_proc_
Definition standardPredicates.h:923
BALL::SMARTSPredicate::matches_
HashSet< Atom * > matches_
Definition standardPredicates.h:928
BALL::SMARTSPredicate::last_molecule_
Molecule * last_molecule_
Definition standardPredicates.h:922
BALL::SMARTSPredicate::ring_proc_
RingPerceptionProcessor ring_proc_
Definition standardPredicates.h:924
BALL::SMARTSPredicate::~SMARTSPredicate
virtual ~SMARTSPredicate()
BALL::SMARTSPredicate::SMARTSPredicate
SMARTSPredicate()
BALL::SMARTSPredicate::SMARTSPredicate
SMARTSPredicate(const SMARTSPredicate &pred)
BALL::SecondaryStructurePredicate
Definition standardPredicates.h:224
BALL::SelectedPredicate
Definition standardPredicates.h:90
BALL::SingleBondsPredicate
Definition standardPredicates.h:380
BALL::SmartsMatcher
Definition smartsMatcher.h:45
BALL::SolventPredicate
Definition standardPredicates.h:245
BALL::Sp2HybridizedPredicate
Definition standardPredicates.h:746
BALL::Sp3HybridizedPredicate
Definition standardPredicates.h:762
BALL::SpHybridizedPredicate
Definition standardPredicates.h:731
BALL::String
Definition string.h:57
BALL::TimeStamp
Definition timeStamp.h:172
BALL::TripleBondsPredicate
Definition standardPredicates.h:417
BALL::TruePredicate
Definition standardPredicates.h:56
BALL::binary_function
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
expression.h
hashSet.h
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
std
STL namespace.
ringPerceptionProcessor.h
smartsMatcher.h
stringHashMap.h