Skip to content

Commit

Permalink
Pull request #536: Merged Jack Lin's branch with the following new fe…
Browse files Browse the repository at this point in the history
…atures: show some basic color legends when coloring a structure; add local Smith-Waterman alignment when aligning two sequences; add a preference in the menu 'Style > Preferences' to enlarge the cmd window

Merge in STRUC/icn3d from release3180 to master

* commit 'b0162fe9811688512c3d1c3817bffafaf9e1e896':
  Merged Jack Lin's branch with the following new features: show some basic color legends when coloring a structure; add local Smith-Waterman alignment when aligning two sequences; add a preference in the menu 'Style > Preferences' to enlarge the cmd window.
  • Loading branch information
jiywang3 committed Nov 4, 2022
2 parents abdb76a + b0162fe commit f792456
Show file tree
Hide file tree
Showing 17 changed files with 124 additions and 109 deletions.
39 changes: 21 additions & 18 deletions build/icn3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -19087,7 +19087,7 @@ var icn3d = (function (exports) {
case 'confidence':
for (let i in atoms) {
let atom = ic.atoms[i];
if(atom.b === undefined || parseInt(atom.b * 1000) == 0) { // invalid b-factor
if(atom.b === undefined || isNaN(atom.b) || parseInt(atom.b * 1000) == 0) { // invalid b-factor
atom.color = me.parasCls.thr().setRGB(0, 1, 0);
}
else {
Expand Down Expand Up @@ -19121,7 +19121,7 @@ var icn3d = (function (exports) {

for (let i in atoms) {
let atom = ic.atoms[i];
if(atom.b === undefined || parseInt(atom.b * 1000) == 0) { // invalid b-factor
if(atom.b === undefined || isNaN(atom.b) || parseInt(atom.b * 1000) == 0) { // invalid b-factor
atom.color = me.parasCls.thr().setRGB(0, 1, 0);
}
else {
Expand Down Expand Up @@ -19162,7 +19162,7 @@ var icn3d = (function (exports) {
let totalCnt = ic.bfactorArray.length;
for (let i in atoms) {
let atom = ic.atoms[i];
if(atom.b === undefined || parseInt(atom.b * 1000) == 0 || ic.bfactorArray.length == 0) { // invalid b-factor
if(atom.b === undefined || isNaN(atom.b) || parseInt(atom.b * 1000) == 0 || ic.bfactorArray.length == 0) { // invalid b-factor
atom.color = me.parasCls.thr().setRGB(0, 1, 0);
}
else {
Expand Down Expand Up @@ -23638,9 +23638,11 @@ var icn3d = (function (exports) {
$.when.apply(undefined, ajaxArray).then(function() {
let dataArray =(struArray.length == 1) ? [arguments] : Array.from(arguments);
thisClass.parseDsspData(dataArray, struArray, bAppend);

if(!ic.bCheckMemProtein) {
ic.ParserUtilsCls.checkMemProtein(me.cfg.afid);
let afid = (me.cfg.afid) ? me.cfg.afid : me.cfg.mmdbafid;

ic.ParserUtilsCls.checkMemProtein(afid);
ic.bCheckMemProtein = true;
}
})
Expand Down Expand Up @@ -23972,7 +23974,9 @@ var icn3d = (function (exports) {
}
else {
this.loadPdbDataRender(bAppend);
ic.ParserUtilsCls.checkMemProtein(me.cfg.afid);
let afid = (me.cfg.afid) ? me.cfg.afid : me.cfg.mmdbafid;

ic.ParserUtilsCls.checkMemProtein(afid);

if(ic.deferredOpm !== undefined) ic.deferredOpm.resolve();
}
Expand Down Expand Up @@ -25763,7 +25767,7 @@ var icn3d = (function (exports) {
ic.selectionCls.selectAll_base();

ic.opts['chemicals'] = 'stick';
ic.opts['color'] = 'structure';
ic.opts['color'] = 'confidence'; //'structure';

ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
}
Expand All @@ -25787,6 +25791,7 @@ var icn3d = (function (exports) {
ic.transformCls.setRotation(axis, angle);
}

if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
if(ic.deferredRealign !== undefined) ic.deferredRealign.resolve();
}
else {
Expand Down Expand Up @@ -27180,7 +27185,6 @@ var icn3d = (function (exports) {
hAtoms = me.hashUtilsCls.unionHash(hAtoms, hAtomsTmp);
}

// calculate secondary structures with applyCommandDssp
if(bQuery && me.cfg.matchedchains) {
// $.when(ic.pdbParserCls.applyCommandDssp(true)).then(function() {
let bRealign = true, bPredefined = true;
Expand All @@ -27198,17 +27202,14 @@ var icn3d = (function (exports) {
// VAST+ on the fly
let structArray = Object.keys(ic.structures);
ic.vastplusCls.vastplusAlign(structArray, vastplusAtype);

//ic.pdbParserCls.loadPdbDataRender(true);
}
else ;

if(Object.keys(ic.structures).length == 1 && me.cfg.mmdbafid.length > 5) {
ic.ParserUtilsCls.checkMemProtein(me.cfg.mmdbafid);
}
else {
if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
}
// if(Object.keys(ic.structures).length == 1 && me.cfg.mmdbafid.length > 5) {
// ic.ParserUtilsCls.checkMemProtein(me.cfg.mmdbafid);
// }
// else {
// if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
// }
}
}

Expand Down Expand Up @@ -28424,6 +28425,8 @@ var icn3d = (function (exports) {

//Run commands one after another. The commands can be semicolon ';' or new line '\n' separated.
loadScript(dataStr, bStatefile, bStrict) { let ic = this.icn3d; ic.icn3dui;
if(!dataStr) return;

// allow the "loading structure..." message to be shown while loading script
ic.bCommandLoad = true;

Expand Down Expand Up @@ -38438,7 +38441,7 @@ var icn3d = (function (exports) {
// do nothing
if(ic.deferredOpm !== undefined) ic.deferredOpm.resolve();
}
else if (me.cfg.afmem == 'on' || confirm(question)) {
else if (me.cfg.afmem == 'on' || confirm(question)) {
let url2 = "https://storage.googleapis.com/membranome-assets/pdb_files/proteins/" + data.pdbid + ".pdb";
$.ajax({
url: url2,
Expand Down
2 changes: 1 addition & 1 deletion build/icn3d.min.js

Large diffs are not rendered by default.

39 changes: 21 additions & 18 deletions build/icn3d.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -19084,7 +19084,7 @@ class SetColor {
case 'confidence':
for (let i in atoms) {
let atom = ic.atoms[i];
if(atom.b === undefined || parseInt(atom.b * 1000) == 0) { // invalid b-factor
if(atom.b === undefined || isNaN(atom.b) || parseInt(atom.b * 1000) == 0) { // invalid b-factor
atom.color = me.parasCls.thr().setRGB(0, 1, 0);
}
else {
Expand Down Expand Up @@ -19118,7 +19118,7 @@ class SetColor {

for (let i in atoms) {
let atom = ic.atoms[i];
if(atom.b === undefined || parseInt(atom.b * 1000) == 0) { // invalid b-factor
if(atom.b === undefined || isNaN(atom.b) || parseInt(atom.b * 1000) == 0) { // invalid b-factor
atom.color = me.parasCls.thr().setRGB(0, 1, 0);
}
else {
Expand Down Expand Up @@ -19159,7 +19159,7 @@ class SetColor {
let totalCnt = ic.bfactorArray.length;
for (let i in atoms) {
let atom = ic.atoms[i];
if(atom.b === undefined || parseInt(atom.b * 1000) == 0 || ic.bfactorArray.length == 0) { // invalid b-factor
if(atom.b === undefined || isNaN(atom.b) || parseInt(atom.b * 1000) == 0 || ic.bfactorArray.length == 0) { // invalid b-factor
atom.color = me.parasCls.thr().setRGB(0, 1, 0);
}
else {
Expand Down Expand Up @@ -23635,9 +23635,11 @@ class Dssp {
$.when.apply(undefined, ajaxArray).then(function() {
let dataArray =(struArray.length == 1) ? [arguments] : Array.from(arguments);
thisClass.parseDsspData(dataArray, struArray, bAppend);

if(!ic.bCheckMemProtein) {
ic.ParserUtilsCls.checkMemProtein(me.cfg.afid);
let afid = (me.cfg.afid) ? me.cfg.afid : me.cfg.mmdbafid;

ic.ParserUtilsCls.checkMemProtein(afid);
ic.bCheckMemProtein = true;
}
})
Expand Down Expand Up @@ -23969,7 +23971,9 @@ class PdbParser {
}
else {
this.loadPdbDataRender(bAppend);
ic.ParserUtilsCls.checkMemProtein(me.cfg.afid);
let afid = (me.cfg.afid) ? me.cfg.afid : me.cfg.mmdbafid;

ic.ParserUtilsCls.checkMemProtein(afid);

if(ic.deferredOpm !== undefined) ic.deferredOpm.resolve();
}
Expand Down Expand Up @@ -25760,7 +25764,7 @@ class RealignParser {
ic.selectionCls.selectAll_base();

ic.opts['chemicals'] = 'stick';
ic.opts['color'] = 'structure';
ic.opts['color'] = 'confidence'; //'structure';

ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
}
Expand All @@ -25784,6 +25788,7 @@ class RealignParser {
ic.transformCls.setRotation(axis, angle);
}

if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
if(ic.deferredRealign !== undefined) ic.deferredRealign.resolve();
}
else {
Expand Down Expand Up @@ -27177,7 +27182,6 @@ class ChainalignParser {
hAtoms = me.hashUtilsCls.unionHash(hAtoms, hAtomsTmp);
}

// calculate secondary structures with applyCommandDssp
if(bQuery && me.cfg.matchedchains) {
// $.when(ic.pdbParserCls.applyCommandDssp(true)).then(function() {
let bRealign = true, bPredefined = true;
Expand All @@ -27195,17 +27199,14 @@ class ChainalignParser {
// VAST+ on the fly
let structArray = Object.keys(ic.structures);
ic.vastplusCls.vastplusAlign(structArray, vastplusAtype);

//ic.pdbParserCls.loadPdbDataRender(true);
}
else ;

if(Object.keys(ic.structures).length == 1 && me.cfg.mmdbafid.length > 5) {
ic.ParserUtilsCls.checkMemProtein(me.cfg.mmdbafid);
}
else {
if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
}
// if(Object.keys(ic.structures).length == 1 && me.cfg.mmdbafid.length > 5) {
// ic.ParserUtilsCls.checkMemProtein(me.cfg.mmdbafid);
// }
// else {
// if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
// }
}
}

Expand Down Expand Up @@ -28421,6 +28422,8 @@ class LoadScript {

//Run commands one after another. The commands can be semicolon ';' or new line '\n' separated.
loadScript(dataStr, bStatefile, bStrict) { let ic = this.icn3d; ic.icn3dui;
if(!dataStr) return;

// allow the "loading structure..." message to be shown while loading script
ic.bCommandLoad = true;

Expand Down Expand Up @@ -38435,7 +38438,7 @@ class ParserUtils {
// do nothing
if(ic.deferredOpm !== undefined) ic.deferredOpm.resolve();
}
else if (me.cfg.afmem == 'on' || confirm(question)) {
else if (me.cfg.afmem == 'on' || confirm(question)) {
let url2 = "https://storage.googleapis.com/membranome-assets/pdb_files/proteins/" + data.pdbid + ".pdb";
$.ajax({
url: url2,
Expand Down
Binary file modified dist/icn3d-3.18.0.zip
Binary file not shown.
15 changes: 8 additions & 7 deletions dist/icn3d.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<link rel="stylesheet" href="icn3d.css">
<script src="lib/jquery-3.5.0.min.js"></script>
<script src="lib/jquery-ui-1.13.2.min.js"></script>
<script src="lib/three_0.137.0.min.js"></script>
<script src="icn3d.min.js"></script>
<!---script src="lib/three_0.137.0.min.js"></script>
<script--- src="icn3d.min.js"></script--->

<style type="text/css">
/* header */
Expand Down Expand Up @@ -71,9 +71,10 @@
</style>

<script type="text/javascript">

$( document ).ready(function() {
$("accordion").show();

/*
var cfg = {
divid: 'icn3dwrap',
width: 400,
Expand All @@ -89,7 +90,7 @@
var icn3dui = new icn3d.iCn3DUI(cfg);
icn3dui.show3DStructure();
}); // document ready
*/

// mn display
$("accordion").accordion({ collapsible: true, active: false, heightStyle: "content"});
Expand All @@ -101,7 +102,7 @@
$("#icn3d-accordion1").hover( function(){ $("#icn3d-accordion1 div").css("display", "block"); }, function(){ $("#icn3d-accordion1 div").css("display", "none"); } );
$("#icn3d-accordion2").hover( function(){ $("#icn3d-accordion2 div").css("display", "block"); }, function(){ $("#icn3d-accordion2 div").css("display", "none"); } );
$("#icn3d-accordion3").hover( function(){ $("#icn3d-accordion3 div").css("display", "block"); }, function(){ $("#icn3d-accordion3 div").css("display", "none"); } );

}); // document ready
</script>

</head>
Expand Down Expand Up @@ -202,10 +203,10 @@ <h3>Menu</h3>

<h3>What is iCn3D Structure Viewer?</h3>
"I see in 3D" (iCn3D) Structure Viewer is not only a web-based 3D viewer, but also a structure analysis tool interactively or in the batch mode using NodeJS scripts based on the npm package icn3d. iCn3D synchronizes the display of 3D structure, 2D interaction, and 1D sequences and annotations. Users' custom display can be saved in a short URL or a PNG image. Some features are listed below.<br/>
<br/>
<!---br/>
<br/>
<div id="icn3dwrap" style="font-size: 0.8em; width:420px"></div>
<br/>
<br/--->

<ol>
<li><b>View a 3D structure in iCn3D</b><br/>
Expand Down
Loading

0 comments on commit f792456

Please sign in to comment.