def buildProtein(sequence, outdir, start_idx=1): from htmd.builder.preparation import proteinPrepare from htmd.ui import Molecule, amber import sys sys.path.append( "/home/pablo/PyRosetta4.Release.python36.linux.release-197") import pyrosetta pyrosetta.init() pose = pyrosetta.pose_from_sequence(sequence, 'fa_standard') pose.dump_pdb('/tmp/test.pdb') mol = Molecule('/tmp/test.pdb') mol = proteinPrepare(mol) mol.resid = mol.resid + start_idx mol.set('segid', 'P1') mol.filter('backbone') _ = amber.build(mol, outdir=outdir, ionize=False # , caps=None ) return outdir + '/structure.prmtop'
def testWithProteinPrepare(self): from htmd.builder.preparation import proteinPrepare from htmd.builder.solvate import solvate # Test with proteinPrepare pdbids = ['3PTB'] # pdbids = ['3PTB', '1A25', '1GZM'] # '1U5U' out because it has AR0 (no parameters) for pid in pdbids: np.random.seed(1) mol = Molecule(pid) mol.filter('protein') mol = proteinPrepare(mol) mol.filter('protein') # Fix for bad proteinPrepare hydrogen placing smol = solvate(mol) ffs = defaultFf() tmpdir = os.path.join(self.testDir, 'withProtPrep', pid) _ = build(smol, ff=ffs, outdir=tmpdir) refdir = home(dataDir=join('test-amber-build', 'pp', pid)) TestAmberBuild._compareResultFolders(refdir, tmpdir, pid)
newResData.data['protonation'] = copy_of_protonation newResData.data['default_protonation'] = copy_of_default_protonation newResData.data.loc[list_of_forced_protonations, 'protonation'] = \ d.loc[list_of_forced_protonations, 'forced_protonation'] for cn in keep_pka_columns: newResData.data[cn] = d[cn] newResData.pdb2pqr_routines = routines newResData.pdb2pqr_protein = routines.protein newResData.missedLigands = self.missedLigands return newMol, newResData if __name__ == "__main__": from htmd.builder.preparation import proteinPrepare import sys import doctest doctest.testmod() if len(sys.argv) > 1 and sys.argv[1] == 'long-test': print('LONG TEST') m = Molecule("3ptb") mp, dp = proteinPrepare(m, returnDetails=True) hb = dp.findHbonds() d = dp.data d.loc[d.resid == 40, 'forced_protonation'] = 'HIP' mp2, dp2 = dp.reprepare() hb2 = dp2.findHbonds()
'Different results produced by amber.build for test {} between {} and {} in files {}.' .format(pid, compare, tmpdir, mismatch)) for f in deletefiles: os.remove(f) # Test with proteinPrepare pdbids = ['3PTB'] # pdbids = ['3PTB', '1A25', '1GZM'] # '1U5U' out because it has AR0 (no parameters) for pid in pdbids: np.random.seed(1) mol = Molecule(pid) mol.filter('protein') if mol._checkInsertions(): mol.renumberResidues() mol = proteinPrepare(mol) mol.filter('protein') # Fix for bad proteinPrepare hydrogen placing smol = solvate(mol) ffs = defaultFf() tmpdir = tempname() bmol = build(smol, ff=ffs, outdir=tmpdir) refdir = home(dataDir=os.path.join('test-amber-build', pid)) _compareResultFolders(refdir, tmpdir, pid) shutil.rmtree(tmpdir) # Test without proteinPrepare pdbids = ['3PTB'] # pdbids = ['3PTB', '1A25', '1GZM', '1U5U'] for pid in pdbids: np.random.seed(1)
match, mismatch, error = filecmp.cmpfiles(tmpdir, compare, files, shallow=False) if len(mismatch) != 0 or len(error) != 0 or len(match) != len(files): raise RuntimeError( 'Different results produced by amber.build for test {} between {} and {} in files {}.'.format(pid, compare, tmpdir, mismatch)) for f in deletefiles: os.remove(f) # Test with proteinPrepare pdbids = ['3PTB', '1A25', '1GZM'] # '1U5U' out because it has AR0 (no parameters) for pid in pdbids: np.random.seed(1) mol = Molecule(pid) mol.filter('protein') mol = proteinPrepare(mol) mol.filter('protein') # Fix for bad proteinPrepare hydrogen placing smol = solvate(mol) ffs = ['leaprc.lipid14', 'leaprc.ff14SB', 'leaprc.gaff'] tmpdir = tempname() bmol = build(smol, ff=ffs, outdir=tmpdir) refdir = home(dataDir=os.path.join('test-amber-build', pid)) _compareResultFolders(refdir, tmpdir, pid) shutil.rmtree(tmpdir) # Test without proteinPrepare pdbids = ['3PTB', '1A25', '1GZM', '1U5U'] for pid in pdbids: np.random.seed(1) mol = Molecule(pid)
newResData.data['resname'] = copy_of_resname newResData.data['protonation'] = copy_of_protonation newResData.data['default_protonation'] = copy_of_default_protonation newResData.data.loc[list_of_forced_protonations, 'protonation'] = \ d.loc[list_of_forced_protonations, 'forced_protonation'] for cn in keep_pka_columns: newResData.data[cn] = d[cn] newResData.pdb2pqr_routines = routines newResData.pdb2pqr_protein = routines.protein newResData.missedLigands = self.missedLigands return newMol, newResData if __name__ == "__main__": from htmd.builder.preparation import proteinPrepare import sys import doctest doctest.testmod() if len(sys.argv) > 1 and sys.argv[0] == 'long-test': m = Molecule("3ptb") mp, dp = proteinPrepare(m, returnDetails=True) hb = dp.findHbonds() d = dp.data d.loc[d.resid == 40, 'forced_protonation'] = 'HIP' mp2, dp2 = dp.reprepare() hb2 = dp2.findHbonds()