Example #1
0
float ProteinEntropy::check_residue(Residue * residue, vector<Atom*> ligand_atoms)
{
  vector<Atom*> res_atoms = residue->getAtoms();

  Distances dist;
  dist.calculate(res_atoms,ligand_atoms,true);
  vector<vector<float> >  dists = dist.getResult();
  
   //is any ligand atom closer than threshold to any residue atom?
  bool close = false;
  for(unsigned int r=0; r<res_atoms.size(); r++)
    if (res_atoms[r]->element != "H") // disregard hydrogen
      if (find(backbone_atoms.begin(), backbone_atoms.end(), res_atoms[r]->name ) == backbone_atoms.end()) //disregard back bone atoms
	for(unsigned int l=0; l<ligand_atoms.size(); l++)
	  if(dists[r][l] < threshold)
	    close = true;
  
  //what is the entropy loss of this residue?
  float res = 0;
  if(close)
    {  
      if(method == "count")
	res = 1;
      else if(method == "abagyan")
	res = abagyan[residue->residueType];
      else
	{
	  res = 1;
	  printf("Warning: Invalid method '%s' in Protein Entropy\n",method.c_str());
	}
    }  

  return res;
}