nglviewer / ngl

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

CAlphaOnly not working when loading pdb from rcsb #623

Open martingraham opened 5 years ago

martingraham commented 5 years ago

This might be me not understanding what's possible, but using this adjusted codepen of Alex's, I've loaded the same protein 3 times, showing from left to right: 1. from a data:// source (in red), 2. from a data:// source with cAlphaOnly:true (in yellow), and 3. from a rcsb:// source with cAlphaOnly:true (in cyan)

https://codepen.io/anon/pen/WPqgpv

I expected the last two to be the same, but loading with rcsb:// seems to ignore the cAlphaOnly setting. Have I just got something in the wrong place, is it a bug or is it something that's not doable?

arose commented 5 years ago

looks like a bug, a workaround is the following

stage.loadFile( "rcsb://1crn.bb.mmtf", {cAlphaOnly:true}).then( function( o ){
    var p = new NGL.Vector3( -50, 0, 0 );
    o.setPosition( p );
    o.addRepresentation( "backbone", {color: "cyan"});
    stage.autoView();
} );