@@ -22,38 +22,42 @@ document.onkeypress = function(e) { default_keypress(stage,e); };
2222
2323document .addEventListener ( " DOMContentLoaded" , function () {
2424 $ .get (" {{tsvUrl}}" , function (tsv ) {
25- stage = new NGL.Stage ( " viewport" );
26- stage .setParameters ({ backgroundColor: " white" } );
27-
2825 // Parse TSV file
2926 // Each line should contain ResNum/Chain/AminoAcid triplets
3027 // Lines end with tabs, so each line should have 3n+1 columns for n repeats.
3128 var lines = tsv .split (" \n " )
3229 .filter ((x ) => ! x .startsWith (" #" ) && x .length > 0 )
3330 .map ((x ) => x .split (" \t " ));
3431
35- // Get number of structures from first line
36- var n_strucs = (lines[0 ].length - 1 ) / 3 ;
37-
38- // Generate color palette
39- var colors = palette (' cb-Dark2' , n_strucs);
40-
41- // Create selection for each repeat
32+ // Check for significant alignment
4233 var colorSele = [];
43- for (j = 0 ; j < n_strucs; j++ ) {
44- var seleStr = [];
45- for (i = 0 ; i < lines .length ; i++ ) {
46- if (lines[i][3 * j] != " -" ) {
47- seleStr .push (" ( " + lines[i][3 * j] + " and :" + lines[i][3 * j+ 1 ] + " )" );
34+
35+ if ( lines .length > 0 ) {
36+ // Get number of structures from first line
37+ var n_strucs = (lines[0 ].length - 1 ) / 3 ;
38+
39+ // Generate color palette
40+ var colors = palette (' cb-Dark2' , n_strucs);
41+
42+ // Create selection for each repeat
43+ for (j = 0 ; j < n_strucs; j++ ) {
44+ var seleStr = [];
45+ for (i = 0 ; i < lines .length ; i++ ) {
46+ if (lines[i][3 * j] != " -" ) {
47+ seleStr .push (" ( " + lines[i][3 * j] + " and :" + lines[i][3 * j+ 1 ] + " )" );
48+ }
4849 }
50+ colorSele .push ( [" #" + colors[j], seleStr .join (" or " )]);
4951 }
50- colorSele .push ( [" #" + colors[j], seleStr .join (" or " )]);
52+ } else {
53+ $ (' #messages' ).html (" <p>No significant alignment found.</p>" );
5154 }
5255 colorSele .push ([" lightgrey" ," *" ]);
53- console .log (colorSele);
54-
56+
5557 var schemeId = NGL .ColorMakerRegistry .addSelectionScheme ( colorSele, " CE-Symm {{structureId}}" );
5658
59+ stage = new NGL.Stage ( " viewport" );
60+ stage .setParameters ({ backgroundColor: " white" } );
5761
5862 stage .loadFile ( " /pdb/{{structureId}}" , { defaultRepresentation: false , ext: " pdb" } ).then ( function ( o ){
5963 o .addRepresentation ( " cartoon" , { color: schemeId } );
@@ -62,25 +66,15 @@ document.addEventListener( "DOMContentLoaded", function() {
6266 });
6367 o .centerView ();
6468 } );
65-
66- /* var schemeId = NGL.ColorMakerRegistry.addSelectionScheme( [
67- [ "red", "64-74 or 134-154 or 222-254 or 310-310 or 322-326" ],
68- [ "green", "311-322" ],
69- [ "yellow", "40-63 or 75-95 or 112-133 or 155-173 or 202-221 or 255-277 or 289-309" ],
70- [ "blue", "1-39 or 96-112 or 174-201 or 278-288" ],
71- [ "white", "*" ]
72- ], "Transmembrane 3dqb" );
7369
74- stage.loadFile( "rcsb://3dqb.pdb" ).then( function( o ){
75- o.addRepresentation( "cartoon", { color: schemeId } ); // pass schemeId here
76- o.centerView();
77- } );
78- */ });
70+ });
7971} );
8072
8173</script >
8274
8375<div id =" viewport" style =" width: 100vw; height: 100vh; display:block;" ></div >
84-
76+ <div id =" messages" ></div >
77+ <p ><a href =" /cesymm/{{ structureId }} /multi" >Multiple Superposition</a >
78+ </p >
8579</body >
8680</html >
0 commit comments