Esempio n. 1
0
Residue ResidueSubstitutionTable::replaceResidue(Residue &_res) {
    // If this residue isn't in our list of residues to be replaced,
    // just return it!
    if( !isResidueInSubstitutionTable(_res) )
        return _res;

    // Clone the current residue, and find the replacement info.
    Residue newRes;
    ReplacementInfo ri = find( _res.getResidueName() )->second;
    string newName = ri.first;
    AtomHash ah = ri.second;

    // Loop over all of the atoms in the residue.
    for(int i=0; i < _res.size(); ++i ){
        Atom &currAtom = _res.getAtom(i);
        string currAtomName = currAtom.getName();
        // If the current atom is in the list of atoms we should keep,
        // add it.
        if( ah.find(currAtomName) != ah.end() )
            newRes.addAtom( currAtom );
    }

    // Set the new name of the residue.
    newRes.setResidueNumber( _res.getResidueNumber() );
    newRes.setResidueIcode( _res.getResidueIcode() );
    newRes.setChainId( _res.getChainId() );
    newRes.setResidueName( newName );

    return newRes;
}
Esempio n. 2
0
AtomPointerVector PDBTopology::getBackboneAtoms(Residue &_res){

    AtomPointerVector results;
    map<string,bool>::iterator it;
    for (it = backboneAtoms.begin();it != backboneAtoms.end();it++){
            if (it->second && _res.atomExists(it->first)){
	         results.push_back(&_res.getAtom(it->first));
	    } else {
	         if (it->second){
		     MSLOUT.stream() << " getBackboneAtoms(Residue) , residue "<<_res.toString()<<" does not have backbone atom '"<<it->second<<"'"<<endl;
	         }
	    }
    }

    return results;
}