question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
ijpulidoscommented, Aug 7, 2021

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?).

1reaction
zhang-ivycommented, Aug 2, 2021

@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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found