The Macromolecular Structure Classes


The Macromolecular Structure Classes are:


Click here to see Macromolecular Structure Class documentation


Class IntrAtom

class IntrAtom {
  
  friend class IntrPdbFile;
  friend class IntrSubEntity;
  friend class IntrCAAResidue;
  friend class AtomIter;

 protected:
  IntrAtom();
 IntrAtom(const IntrAtom &atom,
       double i11 =1, double i12 =0, double i13 =0,
       double i21 =0, double i22 =1, double i23 =0,
       double i31 =0, double i32 =0, double i33 =1,
       double d1 =0, double d2 =0, double d3 =0);

  ATom * _alt;            // Pointer to the first alternative atom.

  // *************************************************************************
  // Alternative atoms were implemented as a list of atoms directed 
  // by the alt_p.
  // *************************************************************************

    ATom * _next;           // Pointer to the next atom.
    ATom * _previous;       // Pointer to the previous atom.
  SubEntity * _subEntity;    // Pointer to the Residue that contains the atom. 
  int _numOfNonDummyAtomRemainInAltList;

  // *********************************************************************
  // num_alt_position indicates the number of alternative atoms remain on the 
  // alternative atom list (including the current atom).  For example, if an
  // atom has three aternative position, the following method
  //
  //      for (ATom * atom=this, atom, atom=alt_p) cout << atom->d_alt <<", ";
  // 
  // will have output as:  3, 2, 1, 
  // *********************************************************************

  char _altLoc;          // Alternative location identifier
  double _xPos;
  double _yPos;
  double _zPos;
  double _occ;
  double _temper;
  
  int _id;               // need to be moved to protected section.
  int _queryMark;         // Query feature.
  char _name[5];

 public:

  // ********************************************************************
  // Following methods are used to retrieve corresponding data of the ith 
  // atom, where i is equal to 0 by default. Which indecates the current atom. 
  // ********************************************************************

  ~IntrAtom();
  double X(int) const;
  double X() const {return _xPos;}
  double Y(int) const;
  double Y() const {return _yPos;}
  double Z(int) const;
  double Z() const {return _zPos;}
  double Temperature(int) const;
  double Temperature() const {return _temper;}
  double Occupancy(int) const;
  double Occupancy() const {return _occ;}

  const SubEntity* MySubEntity() const { return _subEntity;}
  void AssignSubEntity(SubEntity& s){_subEntity=&s;}
  const Entity* MyEntity () const;
  const LinkListElement * MySubStrucList() const;  
  const Compound* MyCompound() const;
  void AddAltAtom(ATom*); // Put atom into alternative atom list.
  char AltLocation(int) const;
  char AltLocation() const {return _altLoc;}
  int IsMissingAtom() const {return (_id==ILEGAL_NUMBER);}

  // *****************************************************************
  // is_missing_atom is a method to identify whether an atom was missing 
  // from the PDB file. The internal data of a missing atom are undefined. 
  // *****************************************************************

  int NumOfNonDummyAtom() const {return _numOfNonDummyAtomRemainInAltList;}
  ATom *AltAtom() const {return _alt;} 
  ATom *Next() const {return _next;}
  ATom *Previous() const {return _previous;}
  ATom *NthAltAtom(int =0) const; // Return the ith alternative atom.
  LinkListElement *BoundAtoms() const;



  // ******************************************************************
  //  bound_atoms() Returns a list of atoms that are bound and later in 
  //  the sequence assumed in the "Connect" file to the target atom.
  //  The object returned by the bound_atoms() need to be deleted by
  //  the user explicitly to prevent memory leak.
  //
  //  example of usage:
  // 
  //  cout<<"Atoms that are connected to Atom "<< atom->_name
  //    <<" "<< atom->d_no<< endl;
  //  for (LListOfAtom *temp, *a_list=atom->bound_atoms();
  //       a_list;
  //       temp=a_list, a_list=a_list->next_ListOfAtom(), delete temp)
  //    cout<< a_list->_atom_p->_name<<" "<< a_list->_atom_p->d_no<< endl;
  //
  // ******************************************************************


  int MyID() const {return _id;}
  int MyQueryMark() const {return _queryMark;}
  void SetQueryMark(int qm) {_queryMark = qm;}
  char * MyName() const {return (char *) _name;}
  void AssignID(const int i){_id=i;}
  void AssignName(char * name){strcpy(_name, name);}
  void AssignNext(ATom * t){_next=t;}
  void AssignPrevious(ATom * t){_previous=t;}
};


Class IntrSubEntity

class IntrSubEntity : public UniversalBase {
friend class IntrPdbFile;
friend class IntrCompound;
friend class IntrSStrucSE;
friend class IntrEntity;
friend class IntrSubEntity;
friend class IntrAtom;

public:

#if NEED_OBJECTSTORE
  os_backptr _bkptr;
  void MakeLinks();
  void BreakLinks();
#endif
  
protected:
  
  IntrSubEntity();
  IntrSubEntity(char*);  
  IntrSubEntity(const SubEntity&, 
		const Matrix*, 
		const Vector*);
  virtual ~IntrSubEntity();
  ATom *_atom;            // Pointer to the first atom.
  ATom *_atomToPreSE, * _atomToNextSE; 

// Derived Features
  int _nContactsInEntity;
  int _nContactsInCompound;
  SubentityContact * _contactsInEntity;
  SubentityContact * _contactsInCompound;
  int _exposureInGXG;
  int _exposureInEntity;
  int _exposureInCompound;


  
  // *******************************************************************
  // atom_to_previous = atom that connected to the previous subentity.
  // atom_to_next = atom that connected to the next subentity.
  // *******************************************************************
  
  Entity *_entity;        // Entity that contain the subentity.

  LinkListElement * _subStrucList;
  SubEntity *_next;       // Pointer to the next subentity.
  SubEntity *_previous;   // Pointer to the previous subentity.
  SubEntityConnectivity *_connectivity;
  
  // *********************************************************************
  // SubEntityConnectivity object stores the general information such as
  // formula, connectivity and name of member atoms of the current subentity 
  // type (not a class in term of C++ implementation).
  // **********************************************************************
  
  ATom * NthAtom(int);   // Return th ith atom according to the sequence
                          // assumed in the SubEntityConnectitivity object.
  ATom * LastAtom();     // similar to nth_atom().
  int LastAtomNum();     // The PDB file ATOM serial number of the last 
                          // atom.
  const BoundAtom * AtomsBoundTo(const ATom*) const;
  
  // **********************************************************************
  // Return a set of numbers that indicate the relative atoms that are 
  // connected to the target atom.  For more information please reference
  // to i_connectivity.h.
  // **********************************************************************

  int AssignConnectivity();
  SubEntityConnectivity * FindAltConnectivity(char* atom_name) const ;

  // **********************************************************************
  // Find the first alterative connectivite that contains the atom_name
  // **********************************************************************

  SubEntity * InsertSubEntityAfter(SubEntity* new_subentity);

  // **********************************************************************
  // Insert the new_subentity between the current subentity and the next 
  // subentity.
  // **********************************************************************

  void BuildAtoms();

  // **********************************************************************
  // Create all atoms of the current subentity according to the 
  // SubEntityConnectivity object.
  // **********************************************************************

  void AddTermOx();    // Add terminal oxygen.
  void AssignNext(SubEntity * subentity){_next=subentity;}
  void AssignPrevious(SubEntity * subentity){_previous=subentity;}
  void AddAtom(ATom &atom);  
  void AssignAllConnectivity();
  void AssignAtomsToPreNext();
  void BuildAltConnectivity(char * atom_name);
  
  int _queryMark;         // Query feature.
  int _seqNum;           // Residue sequence number.
  char _insertCode[2];
  char _name[4];         // i.e. ALA, GLY ....

 public:
  char* MyName() const {return (char*)_name;}
  int MyQueryMark() const {return _queryMark;}
  void SetQueryMark(int qm) {_queryMark = qm;}
  char* MyInsertionCode() const {return (char*)_insertCode;}
  int MySequenceNumber() const {return _seqNum;}
  void AssignSubStruc(CompSubStruc*);
  ATom * AtomToPreviousSubEntity() const {return _atomToPreSE;}
  ATom * AtomToNextSubEntity() const {return _atomToNextSE;}
  ATom * FindAtom(char * atom_name) const;
  ATom * MyFirstAtom() const {return _atom;}
  const Entity* MyEntity() const{ return _entity;}
  const LinkListElement * MySubStrucList() const { 
    return _subStrucList;
  }
  const Compound* MyCompound() const;
  int IsMissingSubEntity() const {return(_seqNum==ILEGAL_NUMBER);}
  int NumOfAtoms() const;
  SubEntity * Next() const { return _next;}
  SubEntity * Previous() const {return _previous;};
  SubEntityType MyType() const;
  SubEntityConnectivity* MySubEntityProperty() const {return _connectivity;}

  // Derived Features
  double MyExposureInGXG() const { // Div by 1000 to get actual value 
		return (double) _exposureInGXG/1000.0; 
  }
  double MyExposureInEntity() const { // Div by 1000 to get actual value 
		return (double) _exposureInEntity/1000.0; 
  }
  double MyExposureInCompound() const { // Div by 1000 to get actual value 
		return (double) _exposureInCompound/1000.0; 
  }

  SubentityContact * MyContactsInEntity() const { return _contactsInEntity;}
  SubentityContact * MyContactsInCompound() const { return _contactsInCompound;}

  int NumOfEntityContacts() const { return  _nContactsInEntity; }
  int NumOfCompoundContacts() const { return _nContactsInCompound; }



  // ******************************************************************
  // The following virtual methods provide the polymophic behavior 
  // entries for all the drived concrete classes.
  // ******************************************************************

  virtual ATom * N_atom() const {return NULL;}
  virtual ATom * CA_atom() const {return NULL;}
  virtual ATom * C_atom() const {return NULL;}
  virtual ATom * O_atom() const {return NULL;}
  virtual ATom * CenterAtom() const {return NULL;}
  virtual ListMgr * MainChainAtoms() const {return NULL;}
  virtual double PhiAngle(int =0) const {return ILEGAL_NUMBER;}
  virtual double PsiAngle(int =0) const {return ILEGAL_NUMBER;}
  virtual double DeltaOmega(int =0) const {return ILEGAL_NUMBER;}
  virtual double OmegaAngle(int =0) const {return ILEGAL_NUMBER;}
  virtual SubEntity * MySymmetricUnit(const Matrix*, 
				     const Vector*){return 0;}



  // *******************************************************************
  // The object returned by the MainChain_atoms() need to be deleted by
  // the user explicitly to prevent memory leak.
  // 
  // Example of usage:
  // 
  // AtomList * a_list=subentity_p->MainChainAtoms();
  // cout<<"Subentity "<_name<<" has main chain atoms:"<< endl;
  // for (AtomIter ait(*a_list); ait; ++ait)
  //    cout<< ait()._name<< endl;
  // delete a_list;
  //
  // *******************************************************************

};


Class IntrCompound

class IntrCompound : public UniversalBase {
friend class IntrPdbFile;
  
protected:
  char _name[5]; 
  PDBInfo  *_PDBInfo;
  CovalBond *_covalBonds;
  HydroBond *_hydroBonds;
  SaltBridge *_saltBridges;
  SSBond *_ssBonds;
  ConnectivityMgr *_cMgr;
  Entity *_polymers;
  Entity *_nonPolymers;
  NonLinearSSList *_sStrucList;

  void BuildEntities(const IntrCompound &compound);
  void BuildBonds(const IntrCompound &compound);
  void BuildSheets(const IntrCompound &compound);
  void BuildSites(const IntrCompound &compound);
  void BuildPDBInfo(const IntrCompound &compound);
  SubEntity * FindNeighboringSubEntity(SubEntity*, char*);
  SubEntity * FindFirstSubEntity(char*, char*, int, int);

  Sheet *_sheets;              // Pointer to the first sheet.
  Site *_sites;                // Pointer to the first site.

// Derived Features

double _maxDistance;
int _exposureAssignment;
ListMgr *_subEntColl;


public:
  IntrCompound();
   IntrCompound(const IntrCompound &c);
  ~IntrCompound();

// Create Derived Features
  void AssignContacts(double);
  void AssignExposure();
  int  MyExposureFlag() const {return _exposureAssignment; }
  double MyMaxDistance() const { return _maxDistance; }
  void BuildSubEntColl();
  ListMgr * MySubEntColl() { return _subEntColl; }
#if NEED_OBJECTSTORE
  char * BuildSequenceQuery(char **seq, int num);
  CollectionListMgr * SequenceQuery(char **seq, int num);
  CollectionListMgr * SequenceQuery(char *query_str);
#endif

  void AddEntity(Entity&);      // Add polymer entity.
  void AddPolyEntity(Entity&); // Add poly ent, but make sure it is in _poly
  void AddSStrucSE(SStrucSE&); 
  void AddBond(CovalBond*);
  void AddBond(HydroBond*);
  void AddBond(SaltBridge*);
  void AddBond(SSBond*);
  void AddHetSubEntity(SubEntity&); // add nonpolyentity entity.
  
  // ********************************************************************
  // add_het_subentity add a non-polymer entity to the compound structure,
  // and attach the subentity to the non-polymer entity.
  // ********************************************************************
  
  void AddSheet(Sheet*);
  void AddSite(Site*);
  
  void AddOrigx(int i, double d1, double d2, double d3, double d4){
    _PDBInfo->AddOrigx(i, d1, d2, d3, d4);
  }
  void AddScale(int i, double d1, double d2, double d3, double d4){
    _PDBInfo->AddScale(i, d1, d2, d3, d4);
  }
  void AddCrystalLengthVector(Vector& vector){
    _PDBInfo->AddCrystalLengthVector(vector);
  }
  void AddCrystalAngleVector(Vector& vector){
    _PDBInfo->AddCrystalAngleVector(vector);
  }

  void Assign1stSheet(Sheet * sp){_sheets=sp;}

  void Assign1stSite(Site * sp){_sites=sp;}



  // *******************************************************************
  // Following methods are used to convert PDB file into proper OOP
  // representation when missing information occurs. Normally, they are 
  // not needed by library users. However, if you are interested in these 
  // methods, please feel free to contact the author.
  // *******************************************************************
  
  
  void AssignConnectivityMgr(ConnectivityMgr *mp){_cMgr=mp;}
  SubEntity * FindEmptySubEntity(SubEntity*, char*, char*, int, int);
  SubEntity * InsertSubEntityAfter(SubEntity*, SubEntity*, char*, int);
  SubEntity * FindPreNonExcSubEntity(SubEntity*);
  void ReOrganizeSheets();
  SubEntity * NewSubEntity(char* name) const;
  char * MyName() const {return (char *) _name;}

  // *******************************************************************
  // new_subentity create a subentity object according to the first
  // SubEntityConnectivity object that match the parameter "name" in the 
  // ConnectivityMgr.
  // *******************************************************************
  
  // ********************************************************************
  // In following methods, O11 is represented as ORIGX_O(1,1) T1 is 
  // represented as ORIGX_T(1).  
  // ********************************************************************
  
  double Origx_O(int i, int j) const {return _PDBInfo->ORIGX_O(i, j);}
  double Origx_T(int i) const {return _PDBInfo->ORIGX_T(i);}
  double Scale_S(int i, int j) const {return _PDBInfo->SCALE_S(i, j);}
  double Scale_U(int i) const {return _PDBInfo->SCALE_U(i);}
  PDBInfo * MyPDBInfo() const {return _PDBInfo;}
  SpaceGroup * MySpaceGroup() const {return _PDBInfo->MySpaceGroup();}
  
  double RamachandranQuality() const; 
  
  // *******************************************************************
  // Returns the percentage of amino acid residues who's phi/psi 
  // combination falls in the allowable regions.
  // *******************************************************************
  
  HistogramValues * OmegaAngles() const;
  
  // ***********************************************************************
  // Returns a sorted list of omega angles and their associated subentities.
  // Refernece to the definition of HistogramValues for detail information.
  //
  // Example of usage:
  //
  //  HistogramValues *temp, *head=compound->omega_angles();
  //
  //  while (head) {
  //    cout<value<<" for subentity "<<
  //              (head->subentity_p)->_name<< endl;
  //    temp=head;
  //    head=head->next_p;
  //    delete head;       
  //  };
  //
  // ***********************************************************************
  
  HistogramValues * DeltaOmegas() const;
  
  // ***********************************************************************
  // Similar to the previous method except that the values are the angle of 
  // deviation from 180 degree.
  //
  // ***********************************************************************
  
  ConnectivityMgr *MyConnectivityMgr() const {return _cMgr;}
  Sheet *FindSheet(char* id);  // id = sheet identifier in PDB file.
  Site *FindSite(char* id);    // id = site identifier in PDB file.
  Bond *FindBond(Bond * bonds, ATom * a, ATom * b);
  Bond *FindBond(Bond * bonds, Bond * target);
  HydroBond *FindHydroBond(ATom *donor, ATom *acceptor){
    return (HydroBond*)FindBond(_hydroBonds, donor, acceptor);
  } 
  HydroBond *FindHydroBond(HydroBond *hb){
    return (HydroBond*)FindBond(_hydroBonds, hb);
  }
  int NumCrystalSymmetricUnits();
  Entity * MyPolymers() const {return _polymers;}
  Entity * MyNonPolymers() const {return _nonPolymers;}
  Entity * MyPolymersSymmetricUnit(Matrix*, Vector*) const;
  Entity * MyNonPolymersSymmetricUnit(Matrix*, Vector*) const;
  Entity * MySymmetricUnit(Matrix*, Vector*) const;
  Entity * MyCrystalPolymersSymmetricUnit(int) const;
  Entity * MyCrystalNonPolymersSymmetricUnit(int) const;
  Entity * MyCrystalSymmetricUnit(int) const;
  Sheet * MySheets() const {return _sheets;}
  Site * MySites() const {return _sites;}
  CovalBond * MyCovalBonds() const {return _covalBonds;}
  HydroBond * MyHydroBonds() const {return _hydroBonds;}
  SaltBridge * MySaltBridges() const {return _saltBridges;}
  SSBond * MySSBonds() const {return _ssBonds;}

};


Class IntrBond

class IntrBond :public UniversalBase {
 protected:
  IntrBond();
  IntrBond(const IntrBond&);
  IntrBond(ATom*, ATom*);

  ATom *_beginAtom;
  ATom *_endAtom;
  Bond *_next;
 public:
  ATom *BeginAtom(){return _beginAtom;}
  ATom *EndAtom(){return _endAtom;}
  Bond *NextBond(){return _next;}
  Bond **NextBondAddress(){return &_next;}
  virtual int operator==(IntrBond&);

};


Class IntrCovalBond

class IntrCovalBond : public Bond {
 protected:
  IntrCovalBond(){}
  IntrCovalBond(ATom *b, ATom *e) :Bond(b, e) {}
 public:
  int operator==(IntrBond&);
  CovalBond *NextCovalBond(){return (CovalBond*)NextBond();}

};


Class IntrSSBond

class IntrSSBond : public Bond {
 protected:
  IntrSSBond(){}
  IntrSSBond(ATom *b, ATom *e) :Bond(b, e) {}

 public:
  SSBond *NextSSBond(){return (SSBond*)NextBond();}

};


Class IntrHydroBond

class IntrHydroBond : public Bond {
 protected:
  IntrHydroBond(){}
  IntrHydroBond(ATom *d, ATom *a) : Bond(d, a) {}

 public:
  ATom *DonorAtom(){return _beginAtom;}
  ATom *AcceptorAtom() {return _endAtom;}
  HydroBond *NextHydroBond(){return (HydroBond*)NextBond();}

};


Class IntrSaltBridge

class IntrSaltBridge : public Bond {
 protected:
  IntrSaltBridge(){}
  IntrSaltBridge(ATom *n, ATom *p) : Bond(n, p) {};

 public:
  ATom *NegativeAtom(){return _beginAtom;}
  ATom *PositiveAtom(){return _endAtom;}
  SaltBridge *NextSaltBridge(){return (SaltBridge*)NextBond();}

};

Back to The PDBLib


Currently under Heavy Construction, please excuse the mess


jcooper@cuhhca.hhmi.columbia.edu