BioInt
1.02.00
BioInt: An integrative biological object-oriented application framework and interpreter
|
00001 /**************************************************************************** 00002 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00003 The BioBhasha : The Biologist's Programming Language 00004 Version 1.0 (19th December 2001) 00005 Prasad, B.V.L.S. 00006 Contact: burrashiva@yahoo.com 00007 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00008 *****************************************************************************/ 00009 #ifndef BIOATOM_H 00010 #define BIOATOM_H 00011 00012 #include <fstream> 00013 #include <string> 00014 #include <cmath> 00015 #include <vector> 00016 #include "BioUtilities.h" 00017 #include "BioHelperClass.h" 00018 #include "BioPoint.h" 00019 00020 using namespace std; 00021 00022 /***************************************************************************** 00023 * 00024 * COMMENTARY on Each Class/Concept: Hows and Whys: 00025 * 00026 * BioAtom: 00027 * A qualified Point is an Atom. 00028 * At Atom "Is-A" Point, even though At Atom "Has-A" Point can 00029 * also be considered. A Point when is qualified with an AtomName, 00030 * AtomNumber, Occupancy and Bfactor(Atomic Displacement Parameter) 00031 * it gets transformed into an Atom. Using this philosophy, 00032 * the BioAtom inherits from BioPoint. BioPoint is NOT composed into 00033 * BioAtom. 00034 *****************************************************************************/ 00035 00036 class BioAtom : public BioPoint 00037 { 00038 string at_Name; 00039 long at_Number; 00040 float oc_,bf_; 00041 string at_Record_; // This field has been created to facilitate the 00042 //the user to change the RECORD according to his/ 00043 //her wish. At times even the Atom is water coordinates, 00044 //the RECORD should be ATOM. Some Programs identify 00045 //only ATOM RECORD not HETATM RECORD. For Example, 00046 //ALIGN(Cohen), to align water coordinates also, the 00047 //RECORD should be ATOM.This has either "ATOM " or 00048 //"HETATM". By default it is "ATOM ". This is the 00049 //reason why it is put at the last argument which 00050 //can defaulted. 00051 friend bool operator >(const BioAtom& , const BioAtom&); 00052 friend bool operator <(const BioAtom& , const BioAtom&); 00053 friend bool operator ==(const BioAtom& , const BioAtom&); 00054 00055 public: 00056 // Default Constructor... 00057 BioAtom(); 00058 /* The following constructor expects a file name which has ATOM/HETATM RECORD. 00059 * When this constructor is used, it takes only first/one line of ATOM/HETATM RECORD, 00060 * because BioAtom should hold information of only one atom coordinates. 00061 * This constructor may not be of much use. 00062 * *******************************************************************************/ 00063 BioAtom(const string& ); 00064 BioAtom(const BioAtom&); 00065 BioAtom& operator=(const BioAtom& ); 00066 /* 00067 * This Constructor is specially useful, when one wants to transform the information 00068 * of BioPoint to BioAtom. Hence it expects the user to give AtomName, AtomNumber , 00069 * Occupancy, Bfactor. But the Occupancy and Bfactor are defaulted to 1.0 and 15.0. 00070 * ********************************************************************************/ 00071 00072 BioAtom(const unsigned long atnum_, const string atname_, const BioPoint& , 00073 const float oc1=1.0 , const float bf1=15.0, 00074 const string atrec = "ATOM "); 00075 /* 00076 * This constructor is useful for filling the BioAtom from a file which follows 00077 * PDB format 2.2v, strictly. This is the constructor which is used very extensively 00078 * to write the PDB File Parser and Abstracting the Atom, Residue and Chain Information. 00079 * ********************************************************************************/ 00080 BioAtom(const unsigned long atnumber,const string atname, 00081 const float x1, const float y1, const float z1, 00082 const float oc=1.0,const float bf=15.0, 00083 const string atrec = "ATOM "); 00084 // Setting Options of all the information required for an Atom to become qualified. 00085 // Unless necessary, these options need not be used as they directly change the 00086 // state of the Object. so, one should exercise these options with CARE!!! 00087 00088 void setAtomName(string ) ; 00089 void setAtomNumber( unsigned long ) ; 00090 void setBfactor(float ) ; 00091 void setOccupancy(float ) ; 00092 00093 void setAtom(const unsigned long atnumber,const string atname, 00094 const float x1, const float y1, const float z1, 00095 const float oc=1.0,const float bf=15.0, 00096 const string atrec = "ATOM "); 00097 00098 // These options are for accessing the information, these have been very extensively 00099 // used for conditional and logical expressions and testing. 00100 string getAtomName() const ; 00101 00102 unsigned long getAtomNumber() const ; 00103 00104 float getBfactor() const ; 00105 00106 float getOccupancy() const ; 00107 00108 string getAtomRecord () const; 00109 00110 // This Method gives the user to output the information of Atom in PDB format. 00111 // By default it prints on the console. One can divert it to output stream i.e 00112 // to any other device like another file..etc.. 00113 // An Atom doesnot have any information about Residue Number, ResidueName, Chain, 00114 // so PDB format would be expected to have blanks at those respective places, 00115 // which would not be read by many softwares if the Residue information is not 00116 // given. To avoid such troubles, the user is given option of giving the ChainId, 00117 // ResidueNumber, Residue Name as Arguments. The Atom will be displayed in PDB format 00118 // with ResidueName ....etc...as specified in the argument. Providing this option 00119 // is very advantages. This will become obvious when BioResidue is discussed. 00120 00121 void showAtom( ostream& = cout,string="AAA" ,int = 0, char='A'); 00122 friend ostream& operator<<(ostream& os, const BioAtom& ip); 00123 00124 // Inherit the Comments from BioPoint. :-) :-). 00125 // This is created for User's Convinience.They might feel comfortable with a 00126 // Qualified Point(BioAtom) than a Point (BioPoint). 00127 BioAtom getRotatedAtom(const float **a_ ); 00128 BioAtom getRotatedAtom(const float a_, const char axis_); 00129 BioAtom getTranslatedAtom(const float *a_); 00130 BioAtom getRotoTranslatedAtom(const float **a_,const float *b_ ); 00131 BioAtom getRotoTranslatedAtom(const float a_ ,const char axis_ , 00132 const float *b_ ); 00133 00134 }; 00135 00136 00137 float BioDistance( const BioAtom& , const BioAtom& ); 00138 float BioAngle( const BioAtom& , const BioAtom& , const BioAtom&); 00139 float BioTorsion( const BioAtom&, const BioAtom& , const BioAtom& , 00140 const BioAtom& ); 00141 00142 vector <float> BioDirectionCosines( const BioAtom& , const BioAtom& ); 00143 vector <float> BioVectorCrossProduct( const BioAtom&, const BioAtom& , const BioAtom&); 00144 vector <float> BioVectorCrossProduct( const BioAtom&, const BioAtom& ); 00145 00146 BioAtom BioDifferenceVector(const BioAtom& , const BioAtom& ); 00147 float BioDotProduct(const BioAtom& , const BioAtom&); 00148 float BioDotMagnitude(const BioAtom& , const BioAtom&); 00149 BioAtom BioNormalize(const BioAtom& ); 00150 BioMatrix helix(BioAtom c1, BioAtom c2, BioAtom c3, BioAtom c4); 00151 void helixAxisDirectionCosines(BioAtom c1, BioAtom c2, BioAtom c3, BioAtom c4, 00152 float& l, float& m , float& n); 00153 #endif