Пример #1
0
 def test_raises_invalid_protein_assertion(self):
     prot = _load_test_protein(
         'alphafold/relax/testdata/multiple_disulfides_target.pdb')
     prot.atom_mask[4, :] = 0
     with self.assertRaisesRegex(
             ValueError,
             'Amber minimization can only be performed on proteins with well-defined'
             ' residues. This protein contains at least one residue with no atoms.'
     ):
         amber_minimize.run_pipeline(prot,
                                     max_iterations=10,
                                     stiffness=1.,
                                     max_attempts=1)
Пример #2
0
 def process(
         self, *,
         prot: protein.Protein) -> Tuple[str, Dict[str, Any], np.ndarray]:
     """Runs Amber relax on a prediction, adds hydrogens, returns PDB string."""
     out = amber_minimize.run_pipeline(
         prot=prot,
         max_iterations=self._max_iterations,
         tolerance=self._tolerance,
         stiffness=self._stiffness,
         exclude_residues=self._exclude_residues,
         max_outer_iterations=self._max_outer_iterations)
     min_pos = out['pos']
     start_pos = out['posinit']
     rmsd = np.sqrt(np.sum((start_pos - min_pos)**2) / start_pos.shape[0])
     debug_data = {
         'initial_energy': out['einit'],
         'final_energy': out['efinal'],
         'attempts': out['min_attempts'],
         'rmsd': rmsd
     }
     pdb_str = amber_minimize.clean_protein(prot)
     min_pdb = utils.overwrite_pdb_coordinates(pdb_str, min_pos)
     min_pdb = utils.overwrite_b_factors(min_pdb, prot.b_factors)
     utils.assert_equal_nonterminal_atom_types(
         protein.from_pdb_string(min_pdb).atom_mask, prot.atom_mask)
     violations = out['structural_violations'][
         'total_per_residue_violations_mask']
     return min_pdb, debug_data, violations
Пример #3
0
 def test_multiple_disulfides_target(self):
     prot = _load_test_protein(
         'alphafold/relax/testdata/multiple_disulfides_target.pdb')
     ret = amber_minimize.run_pipeline(prot,
                                       max_iterations=10,
                                       max_attempts=1,
                                       stiffness=10.)
     self.assertIn('opt_time', ret)
     self.assertIn('min_attempts', ret)
Пример #4
0
 def test_iterative_relax(self):
     prot = _load_test_protein(
         'alphafold/relax/testdata/with_violations.pdb')
     violations = amber_minimize.get_violation_metrics(prot)
     self.assertGreater(violations['num_residue_violations'], 0)
     out = amber_minimize.run_pipeline(prot=prot,
                                       max_outer_iterations=10,
                                       stiffness=10.)
     self.assertLess(out['efinal'], out['einit'])
     self.assertEqual(0, out['num_residue_violations'])