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

No bond representation for large molecules? Possible improvement: Ribbon for proteins #126

Closed
KasperBuskPedersen opened this issue Apr 15, 2021 · 6 comments

Comments

@KasperBuskPedersen
Copy link

KasperBuskPedersen commented Apr 15, 2021

Hi

I am trying to visualize a trajectory of a medium sized peptide (alpha-synuclein, PDB: 2kkw) along with two structural properties, however i cannot get the bond representation setting to work (see attached .png). The bond slider does not change anything in the right representation.

billede

I suspect that either the structure is too large or there is a problem with my ASE trajectory. The trajectory is generated with GROMACS in .xtc format and converted to Amber NetCDF .nc with MDTraj to be compatible with ASE, like this:

`
traj = mdtraj.load('protein.xtc', top='protein.pdb')
traj.save_netcdf('protein.nc')
t_s1_rep_01_ase = ase.io.read('protein.nc',':')

properties = {
"Norm": {
"target": "structure",
"values": norm_helix_vector_s1_rep_01,
"units": "nm",
},
"Theta": {
"target": "structure",
"values": theta_helix_vector_s1_rep_01,
"units": "deg",
},
"RSS": {
"target": "structure",
"values": sfg_rss_s1_rep_01 ,
},
}

write_input("chemiscope_t_s1_rep_01.json.gz", frames=t_s1_rep_01_ase, properties=properties)
`
Suggestion: I see most examples are of small molecules, however chemiscope is equally relevant for molecular dynamics simulations of proteins. It would be wonderful (and powerful) with protein representations like ribbon structures (like the VMD STRIDE secondary structure) or alternatively, if it should be web-based, the NGLviewer widget.

Though for now a working bond representation would be sufficient. How to resolve this?

Thank you in advance

Best regards
Kasper Busk Pedersen
Ph.d. student

@Luthaf
Copy link
Contributor

Luthaf commented Apr 15, 2021

Hello Kasper, and thanks for opening this issue!

I agree that having a ribbon representation for bio-molecules would be really nice to have, but this would be a longer term project for us!

Regarding the missing bonds in your example, could you maybe share your chemiscope input file, either in github or privately to me by email? Alternatively, could you share the first few frames of the XTC trajectory? I suspect the issue is that the topology is missing, so JSmol (that we are using to render the molecules) can not guess bonds in the system.

@KasperBuskPedersen
Copy link
Author

Dear Luthaf

Thank you for looking at it.
I created a json.gz with only the first 5 frames, together with corresponding .xtc (containing 5 frams), .nc and a .pdb (first frame)
Please see the attached .zip

Is there a general workflow i can follow starting from Gromacs .xtc files to avoid an Amber intermediate? ASE takes in .gro files i see, but it is not the most efficient storage format for trajectories. A wrapper compatible with mdtraj or MDanalysis would be awesome :)

Excited about a possible ribbon in the future

Thanks,
Kasper

chemiscope_test.zip

billede

@Luthaf
Copy link
Contributor

Luthaf commented Apr 15, 2021

So the issue is that all atoms are identified as Hydrogen atoms, since information about topology is missing in both the NC and XTC files.

I worked around the issue by using chemfiles (another project of mine) to read the data, and then converting to ASE with:

from chemfiles import Trajectory
import ase

# Step 1, read all the data in memory, using atom names from the topology
with Trajectory("test.xtc") as trajectory:
    trajectory.set_topology("test.pdb")
    frames = [f for f in trajectory]

# Step 2, convert from ASE to chemfiles data structures
def chemfiles_to_ase(frame):
    symbols = [a.type for a in frame.atoms]
    return ase.Atoms(
        symbols=symbols,
        positions=frame.positions,
        cell=frame.cell.matrix,
    )

frames = [chemfiles_to_ase(f) for f in frames]

# use chemiscope.write_input as before

I plan to add direct support for chemfiles soon, in the mean time you can use the above code as a workaround!

A wrapper compatible with mdtraj or MDanalysis would be awesome :)

If there is a specific format you would like supported that is not in either ASE or chemfiles, we can work together to make this happen 😃


I'll open a separate issue for the ribbon support

@Luthaf
Copy link
Contributor

Luthaf commented May 12, 2021

@KasperBuskPedersen did you manage to import your structure in chemiscope?

@KasperBuskPedersen
Copy link
Author

@Luthaf Yes indeed, your workaround worked like a charm, thank you! I will definitely have chemiscope in the back of my head next time i do CV exploration on a small molecule. Right now i am working on small peptides so the atom visualization is a bit crowded, but hopefully there is a ribbon option sometime in the future :)

@Luthaf
Copy link
Contributor

Luthaf commented May 12, 2021

Ok, nice to know! I'll close this issue, and track ribbon visualization in #127

@Luthaf Luthaf closed this as completed May 12, 2021
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

2 participants