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 for topology and trajectory #21

Open
papillot opened this issue Apr 22, 2024 · 6 comments
Open

Support for topology and trajectory #21

papillot opened this issue Apr 22, 2024 · 6 comments

Comments

@papillot
Copy link

I would like to know it the specification allows to export a scene that contains topology and trajectory from two different resources?

@sbittrich
Copy link
Member

Not sure I understand. Data from multiple sources is supported by invoking the .download() method multiple times. See e.g. the 4th example on this page: https://molstar.org/mol-view-spec/. You can combine data from different resources by pointing to their respective URLs.

@papillot
Copy link
Author

Thanks for the explanation. I think that what I was referring to is a different scenario.
For example in a Molecular Dynamics simulation, one structure is defined by its topology (let's say it's downloaded as a PDB file) but the coordinates of this structure change through time, which is described in a distinct trajectory file (for example in netCDF format). The representations and colorings remain the same though and in that sense are associated with the topology entity.

It's true that each frame could be extracted to its own distinct PDB file, each having a complete specification for its rendering, but this would be very inefficient (i.e. parsing + memory + representations) especially for long trajectories.

@sbittrich
Copy link
Member

I see. I'm not familiar with netCDF but this seems comparable to NMR trajectories.

Right now, it would be possible to download some NMR structure and select different frames/models before creating representations. These would appear as separate/duplicate items in the MolViewSpec JSON representation but Mol* will cache e.g. the download of resources to avoid downloading the same content multiple times. It seems more elegant to trust the viewer with optimizing (potentially in some viewer-specific fashion) than moving this responsibility to the MolViewSpec specification itself. But we are open to revisit if performance becomes an issue.

@Glucksistemi
Copy link

Glucksistemi commented Jun 7, 2024

@papillot,
As I found, Mol* supports multi-model PDB file as an option of trajectory showcase. It becomes heavy (got 58mb .pdb from <2MB .gro+.xtc) but it works.

For me easiest way to combine such file was using PyMol with something like this:

load topology.gro
load_traj trajectory.xtc
save md_output.pdb, state=0

What I haven't found was option to autoplay trajectory right from load, but I think it's not absolutely necessary and can be done with custom Mol* installation

@papillot
Copy link
Author

papillot commented Jun 7, 2024

Thanks @Glucksistemi for sharing!
The multiple model PDB file approach leads to information duplication as all the columns for the atom names, chains, residues, etc remain the same across the Models, while the only columns that change between models are the coordinates. But it is amenable to gz compression (although not up to the 30x ratio you have measured).
For my purposes, I will try to leverage Mol* sessions directly instead of mol-view-specs as I initially thought I could.

@Glucksistemi
Copy link

For my purposes, I will try to leverage Mol* sessions directly instead of mol-view-specs as I initially thought I could.

@papillot yes, I considered this approach earlier. If you need to build scenes manually, it should work fine. My problem is that I need to prepare MD results showcase automatically and session file is harder to prepare without handiwork in Mol* itself

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

No branches or pull requests

3 participants