nglviewer / ngl

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

Load only one biological unit #78

Closed BernierCR closed 8 years ago

BernierCR commented 8 years ago

Is it possible to load only one biological unit? For crystallized ribosomes, there are two ribosome assemblies in the asymmetric unit. For example, 4V9D has this data near the end of the mmcif file. I only need assembly_id=1, which would be the chains listed in asym_id_list.

loop_ _pdbx_struct_assembly_gen.assembly_id _pdbx_struct_assembly_gen.oper_expression _pdbx_struct_assembly_gen.asym_id_list 1 1 ;A,B,C,.... 2 1 ;Y,Z,AA,... ;

arose commented 8 years ago

You can't only load specific assemblies, but you set a default assembly and override it for each representation.

stage.loadFile( "rcsb://4V9D.cif", {
    assembly: "BU1"  // set default assembly
} ).then( function( comp ){
    comp.addRepresentation( "cartoon" );
    comp.addRepresentation( "backbone", {
        assembly: "AU"  // override default assembly
    } );
    stage.centerView();
} );

The available parameters are described here: http://arose.github.io/ngl/doc/index.html#User_manual/Usage/Molecular_representations

BernierCR commented 8 years ago

Hmm. I had tested filtering by BU1 in the selection, which does not work. Doing as you said helps me somewhat. At least now I don't have to worry about accidentally showing extra pieces. However, the initial parsing time is still a bit too long. How is the work on the binary format going?

Also, stage.centerView();still centers around the entire structure. How can I center around just the BU1?

Thanks,

arose commented 8 years ago

How is the work on the binary format going?

Good. Write me an email if you want to know more.

Also, stage.centerView();still centers around the entire structure. How can I center around just the BU1?

stage.centerView() centers around all representations created, visible or not. Earlier this day I created a related issue (#82) to help exclude non-visible representations.

There is also comp.centerView( zoom, sele ) where zoom is a boolean and sele a selection string.