FMolecule

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

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

Quick Index

AUTHORS
CHANGES LOG
GOALS
USAGE

Class Summary

class FMolecule :
public vector< ParticleT>

{
public:
// Constructors
FMolecule() ;
// Adding Particles.
int readPDBfile(istream& PDBstream, const PDB::Selector& selector ));
class Selector ;
class CaSelector ;
void add(const ParticleT& p);
int select (const Selector& selector);
// 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(FMolecule& m);
FMolecule splitOnIndex(const int i);
FMolecule& operator+=(const Vector3& v);
FMolecule& operator*=(const Matrix3& lt);
FMolecule& operator*=(const RigidTrans3& rt);
FMolecule& operator=(const FMolecule& m);
template<class ParticleTT> friend ostream& operator<<(ostream& s, const FMolecule<ParticleTT>& m);
protected:
}; // FMolecule

Back to the top of FMolecule


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 FMolecule


CHANGES LOG

Back to the top of FMolecule


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 FMolecule


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 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 FMolecule


FMolecule() ;

Default constructor - empty molecule.

  FMolecule() ;

Function is currently defined inline.


Back to the top of FMolecule


int readPDBfile(istream& PDBstream, const PDB::Selector& selector ));

readPDBfile accepts an input stream (file or cin) and an atom selector. The default atom selector defined under PDB - PDB::Selector selects all atoms by default. To write different selection functions one has to define descendants to PDB::Selector() and redefine the operato()(const char* PDBrec) const function to operate as desired.

    int readPDBfile(istream& PDBstream, 
		    const PDB::Selector& selector = PDB::Selector());

Back to the top of FMolecule


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 FMolecule


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 FMolecule


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 FMolecule


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 FMolecule


Vector3 operator()(unsigned int particle) const ;

The () operator returns a Particle's position according to index. The virtual operator() is declared in MoleculeBase a virtual class that serves as a base for Molecule. The operator() is used by functions recieving Molecule objects of unknown types. See for example Match.h.

    Vector3 operator()(unsigned int particle) const                              
;

Function is currently defined inline.


Back to the top of FMolecule


Vector3 centroid() const;

Returns centroid of all particle positions.

    Vector3 centroid() const;

Back to the top of FMolecule


void transform(const Matrix3& lt);

Transforms molecule using a linear transformation of type Matrix3.

    void transform(const Matrix3& lt);

Back to the top of FMolecule


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 FMolecule


void rigidTrans(const RigidTrans3& rt);

Applies a rigid transformation on all molecule's Particles.

    void rigidTrans(const RigidTrans3& rt);

Back to the top of FMolecule


void concat(FMolecule& m);

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

    void concat(FMolecule& m);

Back to the top of FMolecule


FMolecule 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

    FMolecule splitOnIndex(const int i);

Back to the top of FMolecule


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

Moves all atom coordinates by given vector3 move.

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

Back to the top of FMolecule


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

Applies a linear transformation on all protein coordinates.

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

Back to the top of FMolecule


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

Applies a rigid transformation on all atom coordinates.

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

Back to the top of FMolecule


FMolecule& operator=(const FMolecule& m);

Equality operator.

    FMolecule& operator=(const FMolecule& m);

Back to the top of FMolecule


template<class ParticleTT> friend ostream& operator<<(ostream& s, const FMolecule<ParticleTT>& m);

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

    template<class ParticleTT>
    friend ostream& operator<<(ostream& s, const FMolecule<ParticleTT>& m);

Back to the top of FMolecule


All Members

public:
// Adding Particles.
int readPDBfile(istream& PDBstream, const PDB::Selector& selector ));
class Selector ;
class CaSelector ;
void add(const ParticleT& p);
int select (const Selector& selector);
// 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(FMolecule& m);
FMolecule splitOnIndex(const int i);
FMolecule& operator+=(const Vector3& v);
FMolecule& operator*=(const Matrix3& lt);
FMolecule& operator*=(const RigidTrans3& rt);
FMolecule& operator=(const FMolecule& m);
template<class ParticleTT> friend ostream& operator<<(ostream& s, const FMolecule<ParticleTT>& m);
protected:

Back to the top of FMolecule


Ancestors

Inheritance chain for FMolecule:

Back to the top of FMolecule


Descendants

Back to the top of FMolecule


Generated from source by the Cocoon utilities on Tue Jan 5 18:47:30 2010 .

Report problems to jkotula@unimax.com