nglviewer / ngl Goto Github PK
View Code? Open in Web Editor NEWWebGL protein viewer
Home Page: http://nglviewer.org/ngl/
License: MIT License
WebGL protein viewer
Home Page: http://nglviewer.org/ngl/
License: MIT License
I am trying to use ngl to create a visualization for a webserver. Is there a way to color by b-factor and set the color spectrum. For example, everything below a b-factor below 0.2 is blue, .2 to .8 is green, and .8 to 1 is red?
Thanks!
For instance in PDB 4jjk, for ligand molecule FOL. If I use selection string: :A and polymer
, the FOL molecule is included in the selection, when it shouldn't because it is not part of the protein chain.
The current methods for building geometric primitives (buffer.js) do not appear to be designed for use by end users. Adding some documentation would be a great first step, as the arguments are often hard to guess and there are many similarly-named functions (e.g. should I use a SphereBuffer, a SphereGeometryBuffer, or the nefarious SphereImposterBuffer?). It would also be nice to have some higher-level structures, such as a method for arrows.
Hello. I got color changing to work. I am now dealing with performance issues. There are a lot of things I can do on my end to improve performance of my webapp. However, I need some insight into the NGL.ColorMakerRegistry.addSelectionScheme( selection_scheme ) function.
I have noticed this function is O(N^2), where N is the number of selections in selection_scheme. I'm not sure why this is the case, but it may have something to do with the way jQuery works. For example, if N =130, NGL takes 968ms, but at N=2492, it takes 22571ms. My highest theoretical N so far is around 7000, although I may never see that in practice. That would take around 90,000ms to run. That's quite a bit too much for an interactive application.
Can you think of a better faster way to do this? Would combining selections be faster? For example, which is faster?
red, 10-50
red, 70-80
OR
red, 10-50 or 70-80
I know with Jmol and PyMOL, if I tried to put too many ORs together, it would crash. Please advise,
Thank you
Chad
interesting post processing passes include
The picking code is sufficient but some representations/helpers are needed to display the measurements.
Just like vmd.
In python we can use scipy (same as mdtraj) for traj smoothing. Not sure about what u want for js side.
Setting the near clipping plane does not effect line-based representations (e.g. line, trace, ...). This is due to missing shader support for custom clipping planes in the line shader.
I am myself using VMD for visualization and there are few things I want to customize in in ngl
ngl
allows user to config (right now I need to change js file)currently ngl uses right mouse button for translating molecule. But using ring finger to push seems requiring more press. What's about adding shorcut key T (same as VMD) to switch to translate mode to be used with index finger? add adding 'R' to go back to Rotation mode.
PS: since I am using VMD and find it very convenient, I will suggest some nice features (I think).
aka PRD
The atom line parsing can be done inside the NGL.CubeParser
class and similar to the NGL.GroParser._parse
. The atom elements need to be assigned from the number code in the atom lines. To complete the structure, post-processing as in NGL.StructureParser
is required.
Further, the NGL.Stage.loadFile
method needs to be adapted to create two components for the Cube file, a SurfaceComponent
and additionally a StructureComponent
.
See http://www.ks.uiuc.edu/Training/Tutorials/namd/namd-tutorial-unix-html/node23.html for a format description.
Only atom and bond sections.
There is an example file ala.psf in the repository.
I'm not sure the best way to unload a file. I only need one mmCIF file loaded at a time, at least in the near future. What code do I run as soon as I know I'm going to need a different file?
Also, when I accidentally loaded a second structure, WebGL crashed. I'm not sure if that is a bug or not. It may just be that my computer ran out of memory when trying to do that. I may experiment with loading multiple large structures another time and test the limits.
It is often useful to superimpose structures based on a single chain or selection. The most natural (for me) way to do this in NGL would be to filter two structures to the desired selections, superimpose them, and then remove the filters to show the unaligned portions as well. However, the superposition gets updated automatically after changing the filter. Should this behavior be changed to only update the superposition after manually selecting the Superpose option, or is there another way to superimpose based on a selection?
Hello. I have found at least one spot where the documentation is wrong. I'm looking at this page, http://arose.github.io/ngl/doc/#API_reference/Object/ColorMakerRegistry
You have the following example,
// color residues 1 to 100 in red, 101-200 in blue and the remaining in white
var mySelectionScheme = NGL.ColorMakerRegistry.addSelectionScheme( [
[ "red": "1-100" ],
[ "blue": "101-200" ],
[ "white": "*" ]
] );
// apply colorscheme to an existing representation
repr.setParameters( { color: mySelectionScheme } );
In order to make this work, I had to change the : to , and change color to colorScheme, like this.
// color residues 1 to 100 in red, 101-200 in blue and the remaining in white
var mySelectionScheme = NGL.ColorMakerRegistry.addSelectionScheme( [
[ "red", "1-100" ],
[ "blue", "101-200" ],
[ "white", "*" ]
] );
// apply colorscheme to an existing representation
repr.setParameters( { colorScheme: mySelectionScheme } )
What did you intend?
Chad
This includes storing the information (list of chains) and allow using it for selections.
Especially for surface calculation. Important when visualizing calculation done with different/custom atom radii, e.g. from APBS.
The insertion code is currently not parsed.
See http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM
Adding support has consequences when comparing atoms for identity where at least one has an insertion code set.
dxbin is the binary variant of the dx format used by apbs
Currently downloads are triggered by NGL.download( data, filename )
.
See also: https://github.com/eligrey/FileSaver.js/
I have a Chromebook with both a touch screen and a touchpad. I can zoom using my touchpad but not using multi-touch on the touch screen.
This is my wish list but might be very low priority.
Supposed I have a molecule and load to ngl. I do not have artistic eye but wanting to have nice rendering. I just want to have an option, such as 'I am lucky' to have ngl to o make best guess to make nice representation for me. (So I can make good figure for publication)
...
This includes (1) parsing the data from the files and (2) providing a mechanism to select parts of the structure based on it.
http://www.wwpdb.org/documentation/file-format-content/format33/sect2.html
http://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v40.dic/Categories/entity.html
Generally this kind of annotation should make it more easy for a user to select certain parts in big molecules/assemblies like the ribosome.
Hello, great project. I have an issue though.
In mmCIF format, you are using label_asym_id for the chain names. On it's own, that seems reasonable. However, the PDB and PyMOL, and maybe others use auth_asym_id for the chain names. Do you think NGL should use auth_asym_id as well in the interest of compatibility? You know a lot more about your program and these file formats than I do. I'm sure you will come up with a reasonable solution.
Please check this
import pytraj as pt
import nglview as nv
traj = pt.load('f2.pdb')
view = nv.show_pytraj(traj)
view.representations = []
view.add_representation('licorice')
view
file: https://github.com/hainm/amber_things/blob/master/things/nucleic/f2.pdb
(modified nucleotides: AF2, GF2).
Does ngl has function to guess bond? if not, does it have option to add bond_indices (pytraj has bond info).
Good for demos would be an auto-rotate option that just continuously rotates model until mouse takes over.
Currently the transformation matrices for a specific biological assembly must all be applied to the same set of chains. However in PDB entries like 4OPJ two different matrices need to be applied to two different sets of chains to create a biological assembly.
Before I start with this I will implement the use of bitsets to represent atom selections which will allow easier and more efficient combination of selections.
Hi
Does ngl support zoom?
atomPair
parameterto bring it in par with all the other parsers
This can be done by processing the file lines as chunks with NGL.processArray
as in NGL.GroParser._parse
.
for image exports with scaling > 1 the resulting figure is wrongly composed (e.g. like a puzzle)
currently it always triggers a download
Parsing is one of the slowest steps of this program. I use very big macromolecules, and the parsing makes my program appear unresponsive. I'd like to minimize that.
How do I put up some status messages on the screen?
Is it reasonably possible to cache parsed structures? In MATLAB, I save and load in .mat format instead of reading in the pdb every time. Could we do that here in JSON format or something? Although it would have to be gzipped too to minimize transfer time between the server and client.
I could help code this with some direction, I don't know the inner workings of this program yet.
Thanks.
Since the normal builds contain all assets there is no need to do async initialization. This is only needed for development mode where a number of assets loaded async. Basically get rid of the callback in NGL.init( callback )
. Maybe get rid of the whole function for builds.
As a representation that can be added to a structure component.
option to change the camera type (and can be changed in notebook)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.