mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #3601 from bgruening/ngl_viewer
NGL Viewer for molecule representation
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
define( [], function() { return {nvd3_bar:require( "visualizations/nvd3/bar/config" ), nvd3_bar_horizontal:require( "visualizations/nvd3/bar_horizontal/config" ), nvd3_bar_horizontal_stacked:require( "visualizations/nvd3/bar_horizontal_stacked/config" ), nvd3_bar_stacked:require( "visualizations/nvd3/bar_stacked/config" ), nvd3_line:require( "visualizations/nvd3/line/config" ), nvd3_line_focus:require( "visualizations/nvd3/line_focus/config" ), nvd3_scatter:require( "visualizations/nvd3/scatter/config" ), nvd3_stackedarea:require( "visualizations/nvd3/stackedarea/config" ), nvd3_stackedarea_full:require( "visualizations/nvd3/stackedarea_full/config" ), nvd3_stackedarea_stream:require( "visualizations/nvd3/stackedarea_stream/config" ), nvd3_pie:require( "visualizations/nvd3/pie/config" ), nvd3_histogram:require( "visualizations/nvd3/histogram/config" ), nvd3_histogram_discrete:require( "visualizations/nvd3/histogram_discrete/config" ), jqplot_bar:require( "visualizations/jqplot/bar/config" ), jqplot_boxplot:require( "visualizations/jqplot/boxplot/config" ), jqplot_histogram_discrete:require( "visualizations/jqplot/histogram_discrete/config" ), jqplot_line:require( "visualizations/jqplot/line/config" ), jqplot_scatter:require( "visualizations/jqplot/scatter/config" ), biojs_msa:require( "visualizations/biojs/msa/config" ), biojs_drawrnajs:require( "visualizations/biojs/drawrnajs/config" ), others_example:require( "visualizations/others/example/config" ), others_heatmap:require( "visualizations/others/heatmap/config" ), others_heatmap_cluster:require( "visualizations/others/heatmap_cluster/config" ), cytoscape_basic:require( "visualizations/cytoscape/basic/config" ), pv_viewer:require( "visualizations/pv/viewer/config" ), benfred_venn:require( "visualizations/benfred/venn/config" ),} } );
|
||||
define( [], function() { return {nvd3_bar:require( "visualizations/nvd3/bar/config" ), nvd3_bar_horizontal:require( "visualizations/nvd3/bar_horizontal/config" ), nvd3_bar_horizontal_stacked:require( "visualizations/nvd3/bar_horizontal_stacked/config" ), nvd3_bar_stacked:require( "visualizations/nvd3/bar_stacked/config" ), nvd3_line:require( "visualizations/nvd3/line/config" ), nvd3_line_focus:require( "visualizations/nvd3/line_focus/config" ), nvd3_scatter:require( "visualizations/nvd3/scatter/config" ), nvd3_stackedarea:require( "visualizations/nvd3/stackedarea/config" ), nvd3_stackedarea_full:require( "visualizations/nvd3/stackedarea_full/config" ), nvd3_stackedarea_stream:require( "visualizations/nvd3/stackedarea_stream/config" ), nvd3_pie:require( "visualizations/nvd3/pie/config" ), nvd3_histogram:require( "visualizations/nvd3/histogram/config" ), nvd3_histogram_discrete:require( "visualizations/nvd3/histogram_discrete/config" ), jqplot_bar:require( "visualizations/jqplot/bar/config" ), jqplot_boxplot:require( "visualizations/jqplot/boxplot/config" ), jqplot_histogram_discrete:require( "visualizations/jqplot/histogram_discrete/config" ), jqplot_line:require( "visualizations/jqplot/line/config" ), jqplot_scatter:require( "visualizations/jqplot/scatter/config" ), biojs_msa:require( "visualizations/biojs/msa/config" ), biojs_drawrnajs:require( "visualizations/biojs/drawrnajs/config" ), others_example:require( "visualizations/others/example/config" ), others_heatmap:require( "visualizations/others/heatmap/config" ), others_heatmap_cluster:require( "visualizations/others/heatmap_cluster/config" ), cytoscape_basic:require( "visualizations/cytoscape/basic/config" ), pv_viewer:require( "visualizations/pv/viewer/config" ), benfred_venn:require( "visualizations/benfred/venn/config" ), ngl_viewer:require( "visualizations/ngl/viewer/config" ),} } );
|
||||
File diff suppressed because one or more lines are too long
@@ -5,5 +5,6 @@
|
||||
"others" : [ "example", "heatmap", "heatmap_cluster" ],
|
||||
"cytoscape" : [ "basic" ],
|
||||
"pv" : [ "viewer" ],
|
||||
"benfred" : [ "venn" ]
|
||||
"benfred" : [ "venn" ],
|
||||
"ngl" : [ "viewer" ]
|
||||
}
|
||||
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
define( [], function() {
|
||||
return {
|
||||
title : 'NGL Viewer',
|
||||
library : 'NGL',
|
||||
datatypes : [ 'pdb' ],
|
||||
keywords : 'NGL protein viewer pdb',
|
||||
description : 'NGL Viewer is a WebGL based molecular visualization hosted at http://arose.github.io/ngl/.',
|
||||
settings : {
|
||||
quality : {
|
||||
label : 'Quality',
|
||||
help : 'Select the rendering quality.',
|
||||
type : 'select',
|
||||
display : 'radio',
|
||||
value : 'medium',
|
||||
data : [ { label : 'High', value : 'high' }, { label : 'Medium', value : 'medium' }, { label : 'Low', value : 'low' } ]
|
||||
},
|
||||
viewer : {
|
||||
type : 'conditional',
|
||||
test_param : {
|
||||
name : 'mode',
|
||||
label : 'Display mode',
|
||||
type : 'select',
|
||||
display : 'radio',
|
||||
value : 'cartoon',
|
||||
help : '',
|
||||
data : [ { label : 'Axes', value : 'axes' },
|
||||
{ label : 'Base', value : 'base' },
|
||||
{ label : 'Backbone', value : 'backbone' },
|
||||
{ label : 'Ball+Stick', value : 'ball+stick' },
|
||||
{ label : 'Cartoon', value : 'cartoon' },
|
||||
{ label : 'Contact', value : 'contact' },
|
||||
{ label : 'Helixorient', value : 'helixorient' },
|
||||
{ label : 'Hyperball', value : 'hyperball' },
|
||||
{ label : 'Label', value : 'label' },
|
||||
{ label : 'Licorice', value : 'licorice' },
|
||||
{ label : 'Line', value : 'line' },
|
||||
{ label : 'Point', value : 'point' },
|
||||
{ label : 'Ribbon', value : 'ribbon' },
|
||||
{ label : 'Rocket', value : 'rocket' },
|
||||
{ label : 'Rope', value : 'rope' },
|
||||
{ label : 'Spacefill', value : 'spacefill' },
|
||||
{ label : 'Surface', value : 'surface' },
|
||||
{ label : 'Trace', value : 'trace' },
|
||||
{ label : 'Tube', value : 'tube' },
|
||||
{ label : 'Unitcell', value : 'unitcell' } ]
|
||||
}
|
||||
},
|
||||
radius: {
|
||||
name : 'radius',
|
||||
label : 'Radius',
|
||||
help : 'Select a number providing a fixed radius used for rendering the representation.',
|
||||
type : 'float',
|
||||
min : 0.001,
|
||||
max : 10.0,
|
||||
value : 0.05
|
||||
},
|
||||
scale: {
|
||||
name : 'scale',
|
||||
label : 'Scale',
|
||||
help : 'Select a number that scales the value defined by the *radius* parameter.',
|
||||
type : 'float',
|
||||
min : 0.001,
|
||||
max : 10.0,
|
||||
value : 0.7
|
||||
},
|
||||
colorscheme : {
|
||||
label : 'Color Scheme',
|
||||
help : 'Select color scheme of the molecule scene.',
|
||||
type : 'select',
|
||||
display : 'radio',
|
||||
value : 'atomindex',
|
||||
data : [ { label : 'Element', value : 'element' },
|
||||
{ label : 'Picking', value : 'picking' },
|
||||
{ label : 'Random', value : 'random' },
|
||||
{ label : 'Uniform', value : 'uniform' },
|
||||
{ label : 'Atomindex', value : 'atomindex' },
|
||||
{ label : 'Residue Index', value : 'residueindex' },
|
||||
{ label : 'Chain Index', value : 'chainindex' },
|
||||
{ label : 'Chain Name', value : 'chainname' },
|
||||
{ label : 'Chain Id', value : 'chainid' },
|
||||
{ label : 'Polymer', value : 'polymer' },
|
||||
{ label : 'Model Index', value : 'modelindex' },
|
||||
{ label : 'Entity Type', value : 'entitytype' },
|
||||
{ label : 'Molecule Type', value : 'moleculetype' },
|
||||
{ label : 'Secondary Structure', value : 'sstruc' },
|
||||
{ label : 'Bfactor', value : 'bfactor' },
|
||||
{ label : 'Resname', value : 'resname' },
|
||||
{ label : 'Hydrophobicity', value : 'hydrophobicity' },
|
||||
{ label : 'Value', value : 'value' },
|
||||
{ label : 'Volume', value : 'volume' },
|
||||
{ label : 'Occupancy', value : 'occupancy' } ]
|
||||
},
|
||||
backcolor : {
|
||||
label : 'Background Color',
|
||||
help : 'Select background color of the viewer.',
|
||||
type : 'select',
|
||||
display : 'radio',
|
||||
value : 'white',
|
||||
data : [ { label : 'Light', value : 'white' }, { label : 'Dark', value : 'black' } ]
|
||||
},
|
||||
spin : {
|
||||
label : 'Spin',
|
||||
help : 'Spin the molecule view.',
|
||||
type : 'select',
|
||||
display : 'radio',
|
||||
value : false,
|
||||
data : [ { label : 'On', value : true }, { label : 'Off', value : false } ]
|
||||
},
|
||||
assembly : {
|
||||
label : 'Assembly',
|
||||
help : 'Select a name of an assembly object.',
|
||||
type : 'select',
|
||||
display : 'radio',
|
||||
value : 'default',
|
||||
data : [ { label : 'Default', value : 'default' }, { label : 'AU', value : '' },
|
||||
{ label : 'BU1', value : 'BU1' }, { label : 'UNITCELL', value : 'UNITCELL' },
|
||||
{ label : 'SUPERCELL', value: 'SUPERCELL' } ]
|
||||
},
|
||||
opacity : {
|
||||
name : 'opacity',
|
||||
label : 'Opacity',
|
||||
help : 'Select opacity for the molecule scene.',
|
||||
type : 'float',
|
||||
min : 0.0,
|
||||
max : 1.0,
|
||||
value : 1.0
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 158 KiB |
+42
@@ -0,0 +1,42 @@
|
||||
define( [ 'utilities/utils', "plugins/ngl/viewer" ], function( Utils, ngl ) {
|
||||
return Backbone.Model.extend({
|
||||
initialize: function( options ) {
|
||||
var dataset = options.dataset,
|
||||
settings = options.chart.settings,
|
||||
stage = new ngl.Stage( options.targets[ 0 ], { backgroundColor: settings.get( 'backcolor' ) } ),
|
||||
viewer_options = {},
|
||||
representation_parameters = {},
|
||||
stage_parameters = {};
|
||||
|
||||
_.each( settings.attributes, function( value, key ) {
|
||||
if ( key.startsWith( 'viewer|' ) ) {
|
||||
viewer_options[ key.replace( 'viewer|', '' ) ] = value;
|
||||
}
|
||||
} );
|
||||
representation_parameters = {
|
||||
radius: settings.get( 'radius' ),
|
||||
scale: settings.get( 'scale' ),
|
||||
assembly: settings.get( 'assembly' ),
|
||||
color: settings.get( 'colorscheme' ),
|
||||
opacity: settings.get( 'opacity' )
|
||||
};
|
||||
stage_parameters = { ext: dataset.extension, defaultRepresentation: true };
|
||||
try {
|
||||
stage.loadFile( dataset.download_url, stage_parameters ).then( function( component ) {
|
||||
component.addRepresentation( viewer_options.mode, representation_parameters );
|
||||
options.chart.state( 'ok', 'Chart drawn.' );
|
||||
options.process.resolve();
|
||||
} );
|
||||
} catch( e ) {
|
||||
options.chart.state( 'failed', 'Could not load PDB file.' );
|
||||
options.process.resolve();
|
||||
}
|
||||
stage.setQuality( settings.get( 'quality' ) );
|
||||
if( settings.get( 'spin' ) === true || settings.get( 'spin' ) === 'true' ) {
|
||||
stage.setSpin( [ 0, 1, 0 ], 0.01 );
|
||||
}
|
||||
// Re-renders the molecule view when window is resized
|
||||
$( window ).resize( function() { stage.viewer.handleResize() } );
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user