blues
blues copied to clipboard
Side chain bias - pull request
Description
Updates to the side chain move class that facilitate identification of dihedral atom indices (without manual entry) as well as target rotamer bins (based on an input rotpref.yaml file)
Status
- Needs review
@khburley Your PR looks good for the most part, except some of your tests are failing. The output makes it seem like the test fails because getRotBondAtoms()
can't find the rotpref.yml
file.
blues/moves.py:763: FileNotFoundError
_____________________ SideChainTester.test_sidechain_move ______________________
self = <blues.tests.test_sidechain.SideChainTester testMethod=test_sidechain_move>
def setUp(self):
# Obtain topologies/positions
prmtop = utils.get_data_filename('blues', 'tests/data/vacDivaline.prmtop')
inpcrd = utils.get_data_filename('blues', 'tests/data/vacDivaline.inpcrd')
self.struct = parmed.load_file(prmtop, xyz=inpcrd)
> self.sidechain = SideChainMove(self.struct, [1])
blues/tests/test_sidechain.py:38:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
blues/moves.py:482: in __init__
self.rot_atoms, self.rot_bonds, self.qry_atoms = self.getRotBondAtoms()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <blues.moves.SideChainMove object at 0x7f6f4da537f0>
def getRotBondAtoms(self):
"""This function is called on class initialization.
Takes in a PDB filename (as a string) and list of residue numbers. Returns
a nested dictionary of rotatable bonds (containing only heavy atoms), that are keyed by residue number,
then keyed by bond pointer, containing values of atom indicies [axis1, axis2, atoms to be rotated]
Note: The atom indicies start at 0, and are offset by -1 from the PDB file indicies
Returns
-------
rot_atoms : dict
Dictionary of residues, bonds and atoms to be rotated
rot_bonds : dict of oechem.OEBondBase
Dictionary containing the bond pointers of the rotatable bonds.
qry_atoms : dict of oechem.OEAtomBase
Dictionary containing all the atom pointers (as OpenEye objects) that
make up the given residues.
"""
backbone_atoms = self.getBackboneAtoms(self.molecule)
# Generate dictionary containing locations and indicies of heavy residue atoms
#print('Dictionary of all query atoms generated from residue list\n')
qry_atoms, backbone_atoms = self.getTargetAtoms(self.molecule, backbone_atoms, self.residue_list)
# Identify bonds containing query atoms and return dictionary of indicies
rot_bonds = self.findHeavyRotBonds(self.molecule, qry_atoms)
# Generate dictionary of residues, bonds and atoms to be rotated
rot_atoms = self.getRotAtoms(rot_bonds, self.molecule, backbone_atoms)
# Read in yaml file
> rotfile = open('rotpref.yml',"r")
E FileNotFoundError: [Errno 2] No such file or directory: 'rotpref.yml'
Maybe you can use the blues.utils.get_data_filename()
function to get the path to the rotpref.yml
file in the package to get around that.