/usr/include/openbabel-2.0/openbabel/chains.h is in libopenbabel-dev 2.3.2+dfsg-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | /**********************************************************************
chains.h - Parse for macromolecule chains and residues
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison
Some portions Copyright (C) 2008 by Tim Vandermeersch
This file is part of the Open Babel project.
For more information, see <http://openbabel.org/>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
#ifndef OB_CHAINS_H
#define OB_CHAINS_H
#define MaxMonoAtom 20
#define MaxMonoBond 20
#include <openbabel/babelconfig.h>
#include <vector>
namespace OpenBabel
{
class OBAtom;
class OBMol;
//! Structure template for atomic patterns in residues for OBChainsParser
// implementation in chains.cpp
struct Template;
typedef struct Template Template;
/** @class OBChainsParser chains.h <openbabel/chains.h>
@brief Perceives peptide or nucleotide chains and residues in an OBMol
Perceive peptide or nucleotide chains and residues from atom connectivity.
Based on original RasMol code by Roger Sayle and modified by Joe Corkery.
For more on Roger's original talk, see:
http://www.daylight.com/meetings/mug96/sayle/sayle.html
*/
class OBAPI OBChainsParser
{
public:
OBChainsParser(void);
~OBChainsParser(void);
/**
* Perceive macromolecular (peptide and nucleotide) residues and chains
* @param mol The molecule to parse and update
* @param nukeSingleResidue If only one residue is found, clear information
* default = false -- single residue files should still be recognized.
*/
bool PerceiveChains(OBMol &mol, bool nukeSingleResidue = false);
private: // internal methods
//! @name Step 1: Determine hetero atoms
//@{
/**
* Determine HETATOM records for all atoms with a heavy valance of 0.
* This includes HOH, Cl, Fe, ...
*
* Sets resids[i] & hetflags[i] for these atoms.
* @todo add ions (Cl, Fe, ...)
*/
bool DetermineHetAtoms(OBMol &);
//@}
//! @name Step 2: Determine connected chains
//@{
/**
* Determine connected chains (e.g., subunits). Chains will be labeled A, B, C, ...
* Ligands also get assigned a chain label. The chain for ligands will later be
* replaced by ' '. The residue numbers will also be updated in this process to
* make sure all ligands, HOH, ions, etc. have a unique residue number in the ' '
* chain.
*
* Sets chains[i] for all atoms. (through RecurseChain())
*/
bool DetermineConnectedChains(OBMol &);
/**
* Perform the actual work for DetermineConnectedChains(). Set chains[i]
* to @p c for all atoms of the recursed chain.
* @param mol The molecule.
* @param i Index for the current atom. (RecurseChain() will be called for all neighbours)
* @param c The chain which we are recusring. ('A' + count)
* @return The number of heavy atoms in the recursed chain.
*/
unsigned int RecurseChain(OBMol &mol, unsigned int i, int c);
//@}
//! @name Step 3: Determine peptide backbone
//@{
/**
* Walk a peptide "backbone" atom sequence, from one residue to the next. This
* function will look for N-CA-C-O sequences and mark these atoms.
*
* Sets bitmaks[i] for these atoms. (through ConstrainBackbone())
* Sets resnos[i] for these atoms. (through TracePeptideChain())
*/
bool DeterminePeptideBackbone(OBMol &);
/**
* First the bitmasks[i] will be OR-ed with Template::flag for all atoms based on
* on Template::element and Template::count.
*
* Next, the bitmasks[i] are iteratively resolved by matching the
* constraints in OpenBabel::Peptide or OpenBabel::Nucleotide.
* @param mol The molecule.
* @param templ OpenBabel::Peptide or OpenBabel::Nucleotide
* @param tmax Number of entries in @p templ
*/
void ConstrainBackbone(OBMol &mol, Template *templ, int tmax);
/**
* @return True if the bitmasks[i] for @p atom matches @p mask.
*/
bool MatchConstraint(OBAtom *atom, int mask);
/**
* @return True if atom @p na and @p nb match the Template::n1 and
* Template::n2.
*/
bool Match2Constraints(Template *templ, OBAtom *na, OBAtom *nb);
/**
* @return True if atom @p na, @p nb and @p nc match the Template::n1,
* Template::n2 and Template::n3.
*/
bool Match3Constraints(Template *templ, OBAtom *na, OBAtom *nb, OBAtom *nc);
/**
* @return True if atom @p na, @p nb, @p nc and @p nd match the Template::n1,
* Template::n2, Template::n3 and Template::n4.
*/
bool Match4Constraints(Template *templ, OBAtom *na, OBAtom *nb, OBAtom *nc, OBAtom *nd);
/**
* Now we have the constrained bitmaks[i], trace N-CA-C-O-... and set
* resnos[i] and atomids[i] for each N-CA-C-O sequence.
*
* Also adds BF_DOUBLE to flags[b] for< each carbonyl bond in N-CA-C=O.
* @param mol The molecule.
* @param i Index for the current atom. (TracePeptideChain() will be called for all neighbours)
* @param r The residue number which we are tracing.
*/
void TracePeptideChain(OBMol &mol, unsigned int i, int r);
//@}
//! @name Step 4: Determine peptide side chains
//@{
/**
* Look for atoms with atomids[i] CA and identify their side chain.
*
* Sets resnos[i] and resids[i] for all identified residues (including the N-CA-C-O).
* (through IdentifyResidue() and AssignResidue())
*/
bool DeterminePeptideSidechains(OBMol &);
/**
* Identify a residue based on the @p tree ByteCode.
*
* Sets resnos[i] for all sidechain atoms to the residue number of
* the seed CA/C1 atom.
* @param tree Bytecode for the residues. (OBChainsParser::PDecisionTree or OBChainsParser::NDecisionTree)
* @param mol The molecule.
* @param seed Atom index for the CA (peptides) or C1 (nucleotides) atom.
* @param resno The residue number for this residue.
* @return The resids[i] for the identified residue.
*/
int IdentifyResidue(void *tree, OBMol &mol, unsigned int seed, int resno); // ByteCode *
/**
* Set resids[i] for all atoms where resids[i] = @p r and chains[i] = @p c.
* @param mol The molecule.
* @param r The residue number.
* @param c The chain number.
* @param i The residue id (resids[i] returned by IdentifyResidue())
*/
void AssignResidue(OBMol &mol, int r, int c, int i);
//@}
//! @name Step 5: Assign hydrogens
//@{
/**
* Assign the resids[i], resnos[i], ... for all hydrogens based on the
* atom they are bound to.
*/
bool DetermineHydrogens(OBMol &);
//@}
//! @name Step 6: Set the residue information
//@{
/**
* Convert the private data vectors to OBResidue objects and add them to @p mol.
* @param mol The molecule to parse and update
* @param nukeSingleResidue If only one residue is found, clear information
* default = false -- single residue files should still be recognized.
*/
void SetResidueInformation(OBMol &, bool nukeSingleResidue);
//@}
//! @name Nucleic acids (analog to peptides)
//@{
/**
* Walk a nucleic "backbone" atom sequence, from one residue to the next. This
* function will look for ribose-5-P sequences and mark these atoms.
*
* Sets bitmaks[i] for these atoms. (through ConstrainBackbone())
* Sets resnos[i] for these atoms. (through TraceNucleicChain())
*/
bool DetermineNucleicBackbone(OBMol &);
/**
* Now we have the constrained bitmaks[i], trace nucleic backbone and set
* resnos[i] and atomids[i] for each ribose-5-P sequence.
* @param mol The molecule.
* @param i Index for the current atom. (TraceNucleicChain() will be called for all neighbours)
* @param r The residue number which we are tracing.
*/
void TraceNucleicChain(OBMol &, unsigned int i, int r);
/**
* Look for atoms with atomids[i] C1 and identify their side chain.
*
* Sets resnos[i] and resids[i] for all identified residues.
* (through IdentifyResidue() and AssignResidue())
*/
bool DetermineNucleicSidechains(OBMol &);
//@}
/**
* Set up the chain perception to operate on the supplied molecule
* by resizing and initializing the private data vectors.
*/
void SetupMol(OBMol &);
/**
* Delete all residues in @p mol
*/
void ClearResidueInformation(OBMol &mol);
/**
* Clear all private data vectors
*/
void CleanupMol();
/**
* Construct and add ByteCode to the @p tree for a single residue.
* @param tree Bytecode for the residues. (OBChainsParser::PDecisionTree or OBChainsParser::NDecisionTree)
* @param resid The residue id.
* @param smiles The pseudo-smiles string (from OpenBabel::AminoAcids or OpenBabel::Nucleotides)
*/
void DefineMonomer(void **tree, int resid, const char *smiles); // ByteCode **
/**
* @param ptr Element id (from OpenBabel::ChainsAtomName)
* @return The element number.
*/
int IdentifyElement(char *ptr);
/**
* Parse a pseudo smiles from OpenBabel::AminoAcids or OpenBabel::Nucleotides.
* @param smiles The pseudo-smiles string.
* @param prev The previous position (used for recursing, use -1 to start).
*/
const char *ParseSmiles(const char *smiles, int prev);
/**
* Debugging function.
*/
void DumpState();
void *PDecisionTree; //!< ByteCode decision tree for peptides
void *NDecisionTree; //!< ByteCode decision tree for nucleotides
int ResMonoAtom[MaxMonoAtom];
int ResMonoBond[MaxMonoBond];
std::vector<unsigned short> bitmasks;
std::vector<bool> visits; //!< mark visits to prevent looping
std::vector<unsigned char> resids;
std::vector<unsigned char> flags;
std::vector<bool> hetflags;
std::vector<int> atomids;
std::vector<short> resnos;
std::vector<short> sernos; //!< array of residue serial numbers
std::vector<char> hcounts;
std::vector<char> chains;
};
}
#endif // OB_CHAINS_H
//! \file chains.h
//! \brief Parse for macromolecule chains and residues.
|