nglviewer / nglview

Jupyter widget to interactively view molecular structures and trajectories
http://nglviewer.org/nglview/latest/
Other
788 stars 132 forks source link

Support `inferBonds` parameter in PDB files #1092

Open Yoshanuikabundi opened 7 months ago

Yoshanuikabundi commented 7 months ago

Upstream NGL has recently added support for configuring which bonds are inferred from interatomic distances in PDB files: https://github.com/nglviewer/ngl/pull/977. This was released on Node in 2.2.0

At OpenFF, we'd love to be able to take advantage of this option in our visualization methods. Would you accept a PR to add this functionality?

I think it would involve:

Thanks!

hainm commented 7 months ago

Hi @Yoshanuikabundi

Would you accept a PR to add this functionality?

yeah, PRs are always very welcome

Updating the version of NGL used by NGLView to at least 2.2.0

Please continue my work here (the build passed on my macbook but failing. I guess I am using newer lab version (or so on) https://github.com/nglviewer/nglview/pull/1086

NGLView seems to be on "2.0.0-dev.39" - is there a reason we're on a pre-release from 3 years ago?

no, it is just I am too lazy to check and no one ever asked.

Ideally, adding a way to set PDB loader parameters from Structure subclasses

Agree.

it seems that the Structure.params attribute would be for this, but it doesn't seem to get used anywhere. Or am I missing something?

No you're not. I think we don't use it. But I am open for suggestion. I think the params will be passed in this _load_data function:

The API can be

nv.show_file('abc.pdb', infer_bonds=True)
hainm commented 7 months ago

But please use 2 PRs

thanks

hainm commented 5 months ago
  • Updating the version of NGL used by NGLView to at least 2.2.0

@Yoshanuikabundi updated in nglview 3.1.0

Yoshanuikabundi commented 5 months ago

Oh awesome, thanks @hainm! It's going to be a while before I can get to contributing to this - hopefully I'll be able to get to it in March.