nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
665 stars 169 forks source link

How can I get the content of my sample file through NGL? #794

Closed J-DuYa closed 3 years ago

J-DuYa commented 4 years ago

How can I get the content of my sample file through NGL

fredludlow commented 4 years ago

The original file isn't saved anywhere. You can make a fetch /ajax request from your own code (which will, in practice, be fast as it hits the browser cache unless you do something to prevent that).

You can also do the fetch in your code and pass the file data in to ngl as a Blob (there's an example of this here https://github.com/nglviewer/ngl/blob/e8713514cfa7100a8313b3ff34a3c94b4125ced4/examples/parallel.html)

J-DuYa commented 4 years ago

If I modify the molecular structure in the interface, can I get the modified file information

J-DuYa commented 4 years ago

https://www.rcsb.org/3d-view/6V94?preset=ligandInteraction&sele=GNP

Is this page's download an internal method of NGL?

fredludlow commented 4 years ago

That link takes me to a molstar view? Are you actually modifying the structure? If so, you can download it as a PDB file. new NGL.PdbWriter(structure).getString().

J-DuYa commented 4 years ago

That link takes me to a molstar view? Are you actually modifying the structure? If so, you can download it as a PDB file. new NGL.PdbWriter(structure).getString().

This function can be downloaded, but it is not the same as what I expected. I will take a look at it then, thanks.

J-DuYa commented 4 years ago

Then I can take the liberty to ask, can I get the file information after the change (delete operation) on the page? If there is no similar method, what is the reason?

fredludlow commented 4 years ago

Sorry, I think we're talking at cross purposes a bit :)

NGL doesn't currently have any way to: 1) Edit molecules in a general way and save the results

2) You load 3 molecules, setup representations, then remove a molecule and other representations and want to save a "view" (the current state of the stage).