perses: hybrid_{complex,solvent}.pdb written by FAH generation code is missing CONECT records for ligands B state

The current hybrid_{complex,solvent}.pdb written by the FAH generation code appears to be missing CONECT records for the ligand B state. It also incorrectly writes the MOL residue as ATOM instead of HETATM.

@dominicrufa : Any idea where I would fix this? It would seem to be an issue with the OpenMM topology we use for writing if we’re writing via OpenMM’s PDBFile.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (17 by maintainers)

Most upvoted comments

So, it took me a while to get things running but I finally made the changes (check PR #839 ). The visualization PDBs generated by the changes are as follow (green is new), for the solvent phase.

image

Whereas if you want to check the serialized atom mappings you would have to do something like

npzfile = np.load('/path/to/hybrid_atom_mappings.npz', allow_pickle=True)
npzfile.files
['hybrid_to_old_map', 'hybrid_to_new_map']
npzfile['hybrid_to_new_map'].flat[0]

Which I believe is not that friendly but just to stick to numpy object files. Maybe in the future we can think of better formats for serialization (JSON, HDF?).

@ijpulidos : Here are code snippets that will be useful for adding the features John described. You’ll probably want to insert some version of these code snippets near here

Note that these code snippets assume that we’ve instantiated a HybridTopologyFactory object (which i’ve called htf here), but given the way the fah_generator.py code (linked above) is set up, you can use replace htf here with htfs[phase]

  1. Write PDBs of the old/new topology and positions
    import mdtraj as md
    # 'pos' below is defined here: https://github.com/choderalab/perses/blob/master/perses/app/fah_generator.py#L412-L413
    traj = md.Trajectory(htf.old_positions(pos), md.Topology.from_openmm(htf._topology_proposal.old_topology))
    traj.save('blah.pdb')

Note: For saving the new PDB, replace htf.old_positions(pos) with htf.new_positions(pos) and htf._topology_proposal.old_topology with htf._topology_proposal.new_topology

  1. Save the mappings (not sure which format is best) for hybrid to old indices and hybrid to new indices. Here’s how to access the dictionaries:
htf._hybrid_to_old_map
htf._hybrid_to_new_map

Happy to review once you’ve incorporated these changes!

I let it run for an hour and 15 minutes, this was the last log message: 2021-05-26 12:04:32,259:(0.01s):root:Starting to equilibrate for 2000000.0 fs and I don’t see any pdb files:

Whoops! You’ll want to change the 05-prepare-single-transformation.py script to reduce the number of steps. From

options['num_equilibration_iterations'] = 2000 # 2 ns

to

options['num_equilibration_iterations'] = 1 # 1 ps

There is no 0.0.2.2 version for fragalysis-api on pypi or conda-forge https://pypi.org/project/fragalysis-api/#history There are no releases or tags on their github page so I’ll just install version 0.1.1 and hope for the best There is no pandda-gemmi package, there is a pandda-2 and gemmi package, I’ll install the newest version of pandda from source pip install --no-dependencies git+https://bitbucket.org/pandda/pandda.git and gemmi from pypi and see if that works.

These packages aren’t required by perses, but they are required for fah-xchem. For now, I’ve just been putting these pip+git entries into an environment.yml, but once things stabilize there, it might be useful for @dotsdl to help me work with the Fragalysis devs to get stable releases of these packages onto PyPI and conda-forge.

For now, this functionality is really an optional feature of fah-xchem for pushing structures to fragalysis, and should not be a significant concern right now for perses.

https://github.com/choderalab/fah-xchem seems to be needed,

My apologies for neglecting to mention how I initialized this environment! I had used this environment.yml from fah-xchem: https://github.com/choderalab/fah-xchem/blob/master/environment.yml