Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MDAnalysis.Universe as the frame parameter #395

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

GardevoirX
Copy link

Closes #358

This PR allows passing a Universe object to the frame parameter of chemiscope.show. It can be checked by running

import chemiscope
import MDAnalysis as mda

u = mda.Universe("./python/examples/data/trajectory.xyz")
chemiscope.show(frames=u, mode="structure")

As mda is usually used in analyzing biosystem-related trajectories, I also tried it on a pdb file containing two peptides, but I found the current representation schemes cannot display the protein well (see below), maybe we can later consider supporting the ribbon diagram representation?
image

@Luthaf
Copy link
Contributor

Luthaf commented Nov 18, 2024

Thanks a lot, this is very nice!

From the screenshot, it looks like the structure is using the wrong unit. Chemiscope/3Dmol.js assumes Angstroms, but I think MDA is using nm. I think there should be at least some automatically guessed bonds in this structure.

As a related point, does MDA add back the implicit H atoms that are often missing in bioinformatics file formats?

maybe we can later consider supporting the ribbon diagram representation?

This is #127, PR welcome! The biggest issue there will be that we will need to add another field to chemiscope's JSON containing information about alpha carbons / some level of pre-computed secondary structure information.

python/chemiscope/structures/__init__.py Outdated Show resolved Hide resolved
python/chemiscope/jupyter.py Outdated Show resolved Hide resolved
python/chemiscope/structures/_mda.py Outdated Show resolved Hide resolved
python/chemiscope/structures/_stk.py Outdated Show resolved Hide resolved
@GardevoirX
Copy link
Author

GardevoirX commented Nov 18, 2024

From the screenshot, it looks like the structure is using the wrong unit. Chemiscope/3Dmol.js assumes Angstroms, but I think MDA is using nm. I think there should be at least some automatically guessed bonds in this structure.

In this screenshot, I turned off the bond display, otherwise it would be totally a mess 👇 But I agree that there might be a unit issue. I will look at it later.
image

As a related point, does MDA add back the implicit H atoms that are often missing in bioinformatics file formats?

No, it doesn't.

@GardevoirX
Copy link
Author

Regarding the unit issue, I think mda read the coordinate in the structure file as-is. The real difference comes from the units that are used by different formats (like Å for xyz and nm for pdb, generally speaking). And it might be hard to tell which unit is being using from chemiscope side.

@Luthaf
Copy link
Contributor

Luthaf commented Nov 21, 2024

https://userguide.mdanalysis.org/stable/units.html Looks like everything should be in A. I'm not sure what's happening in the initial screenshot though. Which file did you use for it?

@GardevoirX
Copy link
Author

Ahh yes, thanks! I used this file. And in the initial screenshot, I toggled off the bond. Perhaps you can take the latter one for your reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing an MDAnalysis AtomGroup as frames paramater
2 participants