Molecule

Template defines a collection of Particles that make up a Molecule. Among others class hosts a PDB file readr and linear algebra operators.

[ GAMB | Source | Keywords | Summary | Ancestors | All Members | Descendants ]

Quick Index

AUTHORS
CHANGES LOG
GOALS
USAGE
EXAMPLE

Class Summary

class Molecule :
public vector< ParticleT>
{
public:
// Constructors
Molecule() ;
// Adding Particles.
template< class StreamT> int readPDBfile(StreamT& PDBstream, const PDB::Selector& selector ));
template< class StreamT> int readHetAtomsFromPDBfile(StreamT& PDBstream, const PDB::Selector& selector ));
int readAllPDBfile(const string& pdbFile, const PDB::Selector& selector ));
template< class StreamT> int readAllPDBfile(StreamT& PDBstream, const PDB::Selector& selector ));
class Selector ;
class ChainSelector ;
class WaterHydrogenUnSelector ;
class CaSelector ;
class BackboneSelector ;
int select (const Selector& selector);
int select (const Selector& selector, Molecule< ParticleT>& m) const;
void add(const ParticleT& p);
vector< Vector3> getDiameterTriple() const;
// Inspection.
Vector3 operator()(unsigned int particle) const;
Vector3 centroid() const;
// Operators.
void transform(const Matrix3& lt);
void translate(const Vector3& move);
void rigidTrans(const RigidTrans3& rt);
void concat(const Molecule& m);
Molecule splitOnIndex(const int i);
Molecule& operator+=(const Vector3& v);
Molecule& operator*=(const Matrix3& lt);
Molecule& operator*=(const RigidTrans3& rt);
Molecule& operator=(const Molecule& m);
template< class T> friend ostream& operator<< (ostream& s, const Molecule& m);
protected:
}; // Molecule

Back to the top of Molecule


AUTHORS

Meir Fuchs. (meirfux@math.tau.ac.il) and Zipi Fligelman (zipo@math.tau.ac.il)

Copyright: SAMBA group, Tel-Aviv Univ. Israel, 1997-9.

Back to the top of Molecule


CHANGES LOG

Back to the top of Molecule


GOALS

Serves as a container to a set of similarly typed class Particle descendants. The Molecule container hosts all methods of the STL vector container. It allows linear transfomrations to be applied to all Particles in the molecule. A PDB reader, enabling selected atoms to be read off a PDB format file is also supplied.

Back to the top of Molecule


USAGE

Construction is done using the default constructor. An empty Molecule object is returned.

The Molecule may be built using the add method or using any other method supplied by the STL vector. Alternatively Particles may be added from a PDB format file using the readPDBfile method. This method may recieve a function object which will determine which of the atoms are loaded into memory.

Matrices, rigid transformations, vector additions may be applied to all particles simultaneously. See the operators.

The following is an example of using a Molecule<Particle> object to read in all C-alpha atom from a PDB file and print their coordinates after a rigid-transformation is applied to all the particles.

  class CAlphaSelector : public PDB::Selector
  {  // This class defines a selector that will pick only C-alpha atoms.
  public:
  bool operator()(const char *PDBrec) const {
  const char *type = PDB::atomType(PDBrec);
  return (*(type+1) == 'C' && *(type+2) == 'A');
  }
  };

  main() {
  Molecule<Particle> M;
  ifstream pdb("pdb1tpo.ent");  
  M.readPDBfile(pdb, CAlphaSelector());
  pdb.close();
  RigidTrans3 rt(Whatever);
  M*= rt;
  for (Molecule<Particle>::iterator i= M.begin(); i != M.end(); i++)
  cout << *i << '\n';

  }
Note that Molecule has 2 base classes. The MolculeBase class is a virtual class that has a sole virtual method - the () operator. This class may be used to pass Molecule objects of unknown type T into functions that access Molecule vector positions only. This tool is used in the Match class.

Back to the top of Molecule


EXAMPLE

main() { Molecule<Atom> mol; Molecule<Atom> antibody;

ifstream pdb("complex.pdb"); mol.readPDBfile(pdb); pdb.close();

Molecule<Atom>::ChainSelector selectorAntibody("LH"); Molecule<Atom>::ChainSelector selectorAntigen("A");

mol.select(selectorAntibody,antibody); mol.select(selectorAntigen); } END

Note: If the complex contained chains L,H,A than after the first select mol contains L,H,A and antibody contains L,H after the second select mol contains A.

Back to the top of Molecule


Molecule() ;

Default constructor - empty molecule.

  Molecule() ;

Function is currently defined inline.


Back to the top of Molecule


template< class StreamT> int readPDBfile(StreamT& PDBstream, const PDB::Selector& selector ));

Reads all ATOM records from the given PDB file according to the given atom selector and returns the number of read atoms (a negative value is returned in case of an error).
The default atom selector is PDB::Selector that selects all records. To write a different selection function one has to define a descendant of PDB::Selector() and redefine the 'operator()(const char* PDBrec) const' function to operate as desired.

  template< class StreamT>
  int readPDBfile(StreamT& PDBstream, const PDB::Selector& selector = PDB::Selector());

Back to the top of Molecule


template< class StreamT> int readHetAtomsFromPDBfile(StreamT& PDBstream, const PDB::Selector& selector ));

readHetAtomsFromPDBfile accepts an input stream (file or cin) a PDB file format. Only HETATM records are read.

  template< class StreamT>
  int readHetAtomsFromPDBfile(StreamT& PDBstream, const PDB::Selector& selector = PDB::Selector());

Back to the top of Molecule


int readAllPDBfile(const string& pdbFile, const PDB::Selector& selector ));

Reads all ATOM and HETATM records from the given PDB file according to the given atom selector and returns the number of read atoms (a negative value is returned in case of an error).
The default atom selector is PDB::Selector that selects all records. To write a different selection function one has to define a descendant of PDB::Selector() and redefine the 'operator()(const char* PDBrec) const' function to operate as desired.
Note that to filter out hydrogen, water molecules or anything else, use the PDB::WaterHydrogenUnSelector

  int readAllPDBfile(const string& pdbFile, const PDB::Selector& selector = PDB::Selector());

Back to the top of Molecule


template< class StreamT> int readAllPDBfile(StreamT& PDBstream, const PDB::Selector& selector ));

Reads all ATOM and HETATM records from the given PDB file according to the given atom selector and returns the number of read atoms (a negative value is returned in case of an error).
The default atom selector is PDB::Selector that selects all records. To write a different selection function one has to define a descendant of PDB::Selector() and redefine the 'operator()(const char* PDBrec) const' function to operate as desired.
Note that to filter out hydrogen, water molecules or anything else, use the PDB::WaterHydrogenUnSelector

  template< class StreamT>
  int readAllPDBfile(StreamT& PDBstream, const PDB::Selector& selector = PDB::Selector());

Back to the top of Molecule


class Selector ;

Enables to create selectors that can operate on a Molecule after the Molecule object was created. For example a pdb file containing several chains can be read only once to create a Molecule. Each chain would be selected into a new Molecule object. The selector can be operated on a Molecule using the select function.

  class Selector {
  public:
    virtual bool operator()(const ParticleT*) const {  return true;}
    virtual ~Selector() {}
  };

Function is currently defined inline.


Back to the top of Molecule


class ChainSelector ;

Selects particles from a Molecule according to their chainId.

  class ChainSelector : public Selector {
  public:
    ChainSelector(const string& chainID): chains(chainID) {}
    bool operator()(const ParticleT* particle) const {
      for (int i=0; i< (int)chains.length(); i++)
	if (particle->chainId() == chains[i])
	  return true;
      return false;
    }
  private:
    string chains;
  };

Function is currently defined inline.


Back to the top of Molecule


class WaterHydrogenUnSelector ;

Selects particles from a Molecule, which are not water or hydrogens atoms.

  class WaterHydrogenUnSelector : public Selector {
  public:
    bool operator()(const ParticleT* particle) const {
      if (!(particle->isWater() || particle->isH()))
	return true;
      return false;
    }
  };

Function is currently defined inline.


Back to the top of Molecule


class CaSelector ;

Selects CA atoms Molecule

  class CaSelector : public Selector {
  public:
    bool operator()(const ParticleT* particle) const {
      if (particle->isCA())
	return true;
      return false;
    }
  };

Function is currently defined inline.


Back to the top of Molecule


class BackboneSelector ;

Selects backbone atoms Molecule

  class BackboneSelector : public Selector {
  public:
    bool operator()(const ParticleT* particle) const {
      if (particle->isBackbone())
	return true;
      return false;
    }
  };

Function is currently defined inline.


Back to the top of Molecule


int select (const Selector& selector);

Excludes particles that are not selected by the Selector. The operating Molecule object may be changed as a result of this function.

  int select (const Selector& selector);

Back to the top of Molecule


int select (const Selector& selector, Molecule< ParticleT>& m) const;

Adds particles that are selected by the Selector to the input Molecule. The operating Molecule object is NOT changed as a result of this function.

  int select (const Selector& selector, Molecule< ParticleT>& m) const;

Back to the top of Molecule


void add(const ParticleT& p);

Shorthand for vector push_back. Adds a new Particle at the end of the Particle array.

  void add(const ParticleT& p);

Back to the top of Molecule


vector< Vector3> getDiameterTriple() const;

Return a triple of the positions of the most distant atoms

  vector< Vector3> getDiameterTriple() const;

Back to the top of Molecule


Vector3 operator()(unsigned int particle) const;

The () operator returns a Particle's position according to index.

  Vector3 operator()(unsigned int particle) const;

Back to the top of Molecule


Vector3 centroid() const;

Returns centroid of all particle positions.

  Vector3 centroid() const;

Back to the top of Molecule


void transform(const Matrix3& lt);

Transforms molecule using a linear transformation of type Matrix3.

  void transform(const Matrix3& lt);

Back to the top of Molecule


void translate(const Vector3& move);

Moves all atom coordinates by given vector3 move.

  inline void translate(const Vector3& move);

Function is currently defined inline.


Back to the top of Molecule


void rigidTrans(const RigidTrans3& rt);

Applies a rigid transformation on all molecule's Particles.

  void rigidTrans(const RigidTrans3& rt);

Back to the top of Molecule


void concat(const Molecule& m);

Concating two molecules together molecule m is added at the end of *this molecule

  void concat(const Molecule& m);

Back to the top of Molecule


Molecule splitOnIndex(const int i);

Splitting a molecule on index i all the particles from 0-i (included) will stay in this molecule the other particles : i+1-end-of-molecule are returned as a different molecule

  Molecule splitOnIndex(const int i);

Back to the top of Molecule


Molecule& operator+=(const Vector3& v);

Moves all atom coordinates by given vector3 move.

  Molecule& operator+=(const Vector3& v);

Back to the top of Molecule


Molecule& operator*=(const Matrix3& lt);

Applies a linear transformation on all protein coordinates.

  Molecule& operator*=(const Matrix3& lt);

Back to the top of Molecule


Molecule& operator*=(const RigidTrans3& rt);

Applies a rigid transformation on all atom coordinates.

  Molecule& operator*=(const RigidTrans3& rt);

Back to the top of Molecule


Molecule& operator=(const Molecule& m);

Equality operator.

  Molecule& operator=(const Molecule& m);

Back to the top of Molecule


template< class T> friend ostream& operator<< (ostream& s, const Molecule& m);

Output operator assuming the ParticleT class has its own overload of the output operator.

  template< class T>
  friend ostream& operator<< (ostream& s, const Molecule& m);

Back to the top of Molecule


All Members

public:
// Adding Particles.
template< class StreamT> int readPDBfile(StreamT& PDBstream, const PDB::Selector& selector ));
template< class StreamT> int readHetAtomsFromPDBfile(StreamT& PDBstream, const PDB::Selector& selector ));
int readAllPDBfile(const string& pdbFile, const PDB::Selector& selector ));
template< class StreamT> int readAllPDBfile(StreamT& PDBstream, const PDB::Selector& selector ));
class Selector ;
class ChainSelector ;
class WaterHydrogenUnSelector ;
class CaSelector ;
class BackboneSelector ;
int select (const Selector& selector);
int select (const Selector& selector, Molecule< ParticleT>& m) const;
void add(const ParticleT& p);
vector< Vector3> getDiameterTriple() const;
// Inspection.
Vector3 operator()(unsigned int particle) const;
Vector3 centroid() const;
// Operators.
void transform(const Matrix3& lt);
void translate(const Vector3& move);
void rigidTrans(const RigidTrans3& rt);
void concat(const Molecule& m);
Molecule splitOnIndex(const int i);
Molecule& operator+=(const Vector3& v);
Molecule& operator*=(const Matrix3& lt);
Molecule& operator*=(const RigidTrans3& rt);
Molecule& operator=(const Molecule& m);
template< class T> friend ostream& operator<< (ostream& s, const Molecule& m);
protected:

Back to the top of Molecule


Ancestors

Inheritance chain for Molecule:

Back to the top of Molecule


Descendants

Back to the top of Molecule


Generated from source by the Cocoon utilities on Sun Nov 15 13:35:25 2009 .

Report problems to jkotula@unimax.com