ReliaSolve / Molprobity2

0 stars 0 forks source link

Implement Reduce2 #162

Closed russell-taylor closed 1 year ago

russell-taylor commented 2 years ago

Make this a Program Template program that is driven by Phil parameters. Match the Probe2 probe Phil parameters when they apply to both.

russell-taylor commented 2 years ago

(done) Leave the metalic atoms jumpered out in Reduce when computing the Probe score.

It may be that metallics are not jumpered out, just short-circuited for Histidine ahead of the Mover placement; check this.

Metals are added to an excluded points list in manageMetals(); the list is used to invalidate nearby atoms that overlap the metals during findCliques(). This looks like it probably avoids adding locked-down Movers to cliques, or at least locked-down atoms that touch metals.

Yeah, it looks like that is what "jumpered out" means, so we're already doing this with our special checks for flips.

We're not yet excluding them in the checks for clique overlaps (invalidating potential bumpers that come into contact with +ions), but this appears to only be used to cull clique memberships. Leaving them in may cause additional Movers to be added to cliques, so we may need to fix this if our performance is too slow.

russell-taylor commented 2 years ago

The best score for each flipper when it was in the non preferred state is also recorded. Page 1746: can be run adding to put each flip in the non chosen state but everything else optimized to enable comparisons. It uses the header information from its previous output to determine which state to use.

russell-taylor commented 2 years ago

(done) His61 in 1XSO has two metals so no hydrogen added. Good test case.

More test cases from Jane:

Two of the cases were already in the early H-bond addition tests:

(other cases)

Modified amino acids are presumably taken care of in their descriptions, but two to check are:

Interactions of protein with ions:

russell-taylor commented 2 years ago

Page 1743 describes flagging ambiguous cases in the output.

russell-taylor commented 2 years ago

(done) Pull out the Probe parameters and their parsing into Helper functions that are used by both the Probe2 and Reduce2 programs. Make it report a subset of the Phil parameters that gets included by each and that get parsed by wrapper Python constructors.

(done) Replace the PHIL-based parameters in the helper functions with a phil structure.

russell-taylor commented 2 years ago

(done) Find out which command-line arguments MolProbity uses.

russell-taylor commented 2 years ago

(done) From molprobity/doc/dev_notes/reduce_in_Molprobity.txt:

From code inspection:

russell-taylor commented 2 years ago

(done) Changing the preference magnitude from 1.0 to 9999.0 on 1xs0 produces the same results in either case.

The reported final states are different for some Movers, so it is not clear why the output models are the same... except that the output files have no hydrogens on them! We were writing the original model, not the modified model, to disk. Fixed.

russell-taylor commented 2 years ago

(done) Run on all alternate conformations, finishing with the first conformation so non-alternate ones will end up matching alternate A. Looks like this happens already in the singleton optimizer so may happen in all, remove comment from main code if that is the case and add the equivalent of -onlya in, letting them select an alternate.

We get a crash in the second ("A) alternate of 1xs0 when we try to run on both. Fixed this by re-initializing the atom cache for each alternate in the FastOptimizer.

russell-taylor commented 2 years ago

(done) There is consideration of metals during placement that modifies biases for radius checks and other things.

russell-taylor commented 2 years ago

(done) Add ASX and GLX to the ASN and GLN residues that have HS2 flips. Make sure that the flip code works in both cases (atom names and bonding) and then check for all four cases rather than just two in Optimizers.py in all places that we check.

The Mover code won't currently be able to handle atom type X when it is looking for neighbors and bonds. 1KP0 is an example structure with an ASX and GLX.

Just report when they are found but do not attempt to operate on them.

Note that CCTBX throws a "Sorry" when it encounters an atom of type X, so we won't need to deal with this in any case.

russell-taylor commented 2 years ago

(done) Running mmtbx.reduce2 F:\data\Richardsons\1xso.cif output.description_file_name=deleteme.txt add_flip_movers=True now causes a crash when trying to write the model as an mmcif (though it can write the file as a PDB):

Traceback (most recent call last):
  File "C:\tmp\cctbx-probe\build\..\modules\cctbx_project\mmtbx\command_line\reduce2.py", line 6, in <module>
    run_program(reduce2.Program)
  File "C:\tmp\cctbx-probe\modules\cctbx_project\iotbx\cli_parser.py", line 70, in run_program
    task.run()
  File "C:\tmp\cctbx-probe\modules\cctbx_project\mmtbx\programs\reduce2.py", line 200, in run
    txt = model.model_as_mmcif()
  File "C:\tmp\cctbx-probe\modules\cctbx_project\mmtbx\model\model.py", line 1550, in model_as_mmcif
    grm_geometry.pair_proxies(sites_cart)
  File "C:\tmp\cctbx-probe\modules\cctbx_project\cctbx\geometry_restraints\manager.py", line 1317, in pair_proxies
    sites_cart) > self.effective_nonbonded_buffer)):
RuntimeError: scitbx Internal Error: C:\tmp\cctbx-probe\modules\cctbx_project\scitbx\array_family\boost_python\flex_vec3_double.cpp(516): SCITBX_ASSERT(lhs.size() == rhs.size()) failure.

Re-processing the model without making restraints before making it into CIF seems to solve the problem.

russell-taylor commented 2 years ago

(done) Do not remove the Hydrogen in the NH2 case when there is a nearby ion. Instead, lock down the orientation (which is what the original code does).

If the NH2 has the Nitrogen pointing at an +ion, Jane expects it to flip rather than removing the Hydrogen.

russell-taylor commented 2 years ago

(done) Reduce marks some (but not all) Water Oxygens as radius 0, no donor, no acceptor and marks others radius 1.40 with acceptor (but no donor?). This differs from how Probe marks them, which is all acceptor+donor with radius 1.4. We'll accept CCTBX's judgement on this.

russell-taylor commented 2 years ago

(moved) As of 12/21/2021, we are getting a lot of messages to the console of the form:

pdbres="NCO B 109 "
  Cannot extract axes_and_atoms_to_rotate:
    n_branches <= 2, n_branches: 4

These happen when running mmtbx.reduce2 output.description_file_name=4fen_new.txt F:\data\Richardsons\4fen.pdb

We're getting corresponding notifications in the Reduce2 output: "Could not add MoverNH3Rotator to chain B NCO 109: MoverNH3Rotator(): Partner does not have three bonded friends"

Created issue https://github.com/ReliaSolve/cctbx_project/issues/244 to deal with this.