icn3d 3.23.3 → 3.23.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/icn3d.js CHANGED
@@ -7039,6 +7039,12 @@ class ClickMenu {
7039
7039
  thisClass.setLogCmd('color confidence', true);
7040
7040
  });
7041
7041
 
7042
+ me.myEventCls.onIds("#" + me.pre + "mn4_clrIgstrand", "click", function(e) { let ic = me.icn3d; //e.preventDefault();
7043
+ //ic.legendClick = 6;
7044
+ ic.setOptionCls.setOption('color', 'ig strand');
7045
+ thisClass.setLogCmd('color ig strand', true);
7046
+ });
7047
+
7042
7048
 
7043
7049
  me.myEventCls.onIds("#" + me.pre + "mn4_clrArea", "click", function(e) { me.icn3d; //e.preventDefault();
7044
7050
  me.htmlCls.dialogCls.openDlg('dl_colorbyarea', "Color based on residue's solvent accessibility");
@@ -9354,6 +9360,8 @@ class SetMenu {
9354
9360
  //if(!me.cfg.mmtfid && !me.cfg.pdbid && !me.cfg.opmid && !me.cfg.mmdbid && !me.cfg.gi && !me.cfg.uniprotid && !me.cfg.blast_rep_id && !me.cfg.cid && !me.cfg.mmcifid && !me.cfg.align && !me.cfg.chainalign) {
9355
9361
  html += this.getRadio('mn4_clr', 'mn4_clrConfidence', 'AlphaFold<br><span style="padding-left:1.5em;">Confidence</span>', undefined, 1, 1);
9356
9362
  //}
9363
+
9364
+ html += this.getRadio('mn4_clr', 'mn4_clrIgstrand', 'Ig Strand', undefined, undefined, 2);
9357
9365
  }
9358
9366
  else {
9359
9367
  //if(!me.cfg.hidelicense) html += this.getRadio('mn4_clr', 'mn1_delphi2', 'DelPhi<br><span style="padding-left:1.5em;">Potential ' + me.htmlCls.licenseStr + '</span>');
@@ -9572,12 +9580,12 @@ class SetMenu {
9572
9580
  html += this.getMenuText('mn6_igrefwrap', 'Ref. Number', undefined, undefined, 1);
9573
9581
 
9574
9582
  html += "<ul>";
9575
- /*
9583
+
9576
9584
  html += this.getLink('mn6_igrefYes', 'Show Ig Ref. Number', undefined, 2);
9577
9585
  html += this.getLink('mn6_igrefNo', 'Hide Ig Ref. Number', undefined, 2);
9578
9586
 
9579
9587
  html += this.getMenuSep();
9580
- */
9588
+
9581
9589
  html += this.getLink('mn6_customref', 'Custom Ref. Number', undefined, 2);
9582
9590
  html += "</ul>";
9583
9591
  html += "</li>";
@@ -10677,7 +10685,7 @@ class SetDialog {
10677
10685
  html += me.htmlCls.divStr + "dl_mmdbafid' class='" + dialogClass + "' style='max-width:600px'>";
10678
10686
  html += "List of PDB, MMDB, or AlphaFold UniProt structures: " + me.htmlCls.inputTextStr + "id='" + me.pre + "mmdbafid' placeholder='e.g., 1HHO,4N7N,P69905,P01942' size=30> <br><br>";
10679
10687
  html += "<div style='display:inline-block; width:20px'></div>" + me.htmlCls.buttonStr + "reload_mmdbaf' style='width:150px'>Load Biological Unit</button>" + me.htmlCls.buttonStr + "reload_mmdbaf_asym' style='margin-left:30px; width:250px'>Load Asymmetric Unit (All Chains)</button>" + "<br/><br/>";
10680
- html += "<div style='display:inline-block; width:20px'>or</div>" + me.htmlCls.buttonStr + "reload_mmdbaf_append' style='width:150px'>Append Biological Unit</button>" + me.htmlCls.buttonStr + "reload_mmdbaf_asym_append' style='margin-left:30px; width:250px'>Append Asymmetric ; Unit (All Chains)</button>" + "<br/><br/>";
10688
+ html += "<div style='display:inline-block; width:20px'>or</div>" + me.htmlCls.buttonStr + "reload_mmdbaf_append' style='width:150px'>Append Biological Unit</button>" + me.htmlCls.buttonStr + "reload_mmdbaf_asym_append' style='margin-left:30px; width:250px'>Append Asymmetric Unit (All Chains)</button>" + "<br/><br/>";
10681
10689
 
10682
10690
  html += '<b>Note</b>: The "<b>biological unit</b>" is the <b>biochemically active form of a biomolecule</b>, <div style="width:20px; margin:6px 0 0 20px; display:inline-block;"><span id="'
10683
10691
  + me.pre + 'asu_bu2_expand" class="ui-icon ui-icon-plus icn3d-expand icn3d-link" style="width:15px;" title="Expand"></span><span id="'
@@ -11811,9 +11819,16 @@ class Events {
11811
11819
  else {
11812
11820
  ic.loadCmd = 'load mmdbaf0 ' + me.cfg.mmdbafid;
11813
11821
  }
11814
- me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
11822
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
11823
+
11824
+ let bStructures = (ic.structures && Object.keys(ic.structures).length > 0) ? true : false;
11815
11825
 
11816
11826
  await ic.chainalignParserCls.downloadMmdbAf(me.cfg.mmdbafid);
11827
+
11828
+ if(bStructures) {
11829
+ if(ic.bSetChainsAdvancedMenu) ic.definedSetsCls.showSets();
11830
+ if(ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
11831
+ }
11817
11832
  }
11818
11833
  }
11819
11834
  }
@@ -34366,6 +34381,35 @@ class SetColor {
34366
34381
 
34367
34382
  break;
34368
34383
 
34384
+ case 'ig strand':
34385
+ if(ic.bShowRefnum) {
34386
+ for(let resid in ic.resid2refnum) {
34387
+ let refnumLabel = ic.resid2refnum[resid];
34388
+ let color;
34389
+ if(!refnumLabel) {
34390
+ color = me.parasCls.thr(me.htmlCls.GREYB);
34391
+ }
34392
+ else {
34393
+ let refnumStr = refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').substr(1); // C', C''
34394
+ let currStrand = refnumLabel.replace(new RegExp(refnumStr,'g'), '');
34395
+ color = ic.showSeqCls.getRefnumColor(currStrand);
34396
+
34397
+ if(ic.residIgLoop.hasOwnProperty(resid)) {
34398
+ color = me.parasCls.thr(me.htmlCls.GREYB);
34399
+ }
34400
+ }
34401
+
34402
+ for (let i in ic.residues[resid]) {
34403
+ let atom = ic.atoms[i];
34404
+ atom.color = me.parasCls.thr(color);
34405
+
34406
+ ic.atomPrevColors[i] = atom.color;
34407
+ }
34408
+ }
34409
+ }
34410
+
34411
+ break;
34412
+
34369
34413
  case 'residue custom':
34370
34414
  for (let i in atoms) {
34371
34415
  let atom = ic.atoms[i];
@@ -35027,6 +35071,9 @@ class SetOption {
35027
35071
  else if(colorType == 'hydrophobic') {
35028
35072
  colorLabel = 'Hydrophobicity';
35029
35073
  }
35074
+ else if(colorType == 'ig strand') {
35075
+ colorLabel = 'Ig Strand';
35076
+ }
35030
35077
 
35031
35078
  let html = "Color by <b>" + colorLabel + "</b><br><br>";
35032
35079
 
@@ -35047,6 +35094,9 @@ class SetOption {
35047
35094
  else if (colorType == 'charge'){
35048
35095
  html += this.getColorLegendForCharge(ic.hAtoms);
35049
35096
  }
35097
+ else if (colorType == 'ig strand'){
35098
+ html += this.getColorLegendForIgstrand(ic.hAtoms);
35099
+ }
35050
35100
  //else if (ic.legendClick == 4){
35051
35101
  else if (colorType == 'normalized hydrophobic' || colorType == 'hydrophobic') {
35052
35102
  let bOriResn = true;
@@ -35270,6 +35320,40 @@ class SetOption {
35270
35320
 
35271
35321
  return html;
35272
35322
  }
35323
+
35324
+ getColorLegendForIgstrand(atomHash) { let ic = this.icn3d; ic.icn3dui;
35325
+ let html = '';
35326
+
35327
+ const name2color = {
35328
+ "A^ Strand": "FF00FF",
35329
+ "A Strand": "663399",
35330
+ "A* Strand": "FFC0CB",
35331
+ "A Strand": "9370db",
35332
+ "B Strand": "ba55d3",
35333
+ "C Strand": "0000FF",
35334
+ "C' Strand": "6495ED",
35335
+ "C'' Strand": "006400",
35336
+ "D Strand": "00FF00",
35337
+ "E Strand": "FFFF00",
35338
+ "F Strand": "FFA500",
35339
+ "G Strand": "FF0000",
35340
+ "G* Strand": "8B0000",
35341
+ "Loop": "CCCCCC"
35342
+ };
35343
+
35344
+ html += "<div>";
35345
+ for (let name in name2color) {
35346
+ let color = name2color[name];
35347
+ html += "<span>";
35348
+ html += "<div style='width: 10px; height: 10px; background-color:#" + color + "; border: 0px;display:inline-block;' ></div> ";
35349
+ html += name;
35350
+ html += "</span><br>";
35351
+ }
35352
+
35353
+ html += "</div>";
35354
+
35355
+ return html;
35356
+ }
35273
35357
  }
35274
35358
 
35275
35359
  /**
@@ -40388,6 +40472,14 @@ class ShowAnno {
40388
40472
  } // align seq to structure
40389
40473
  }
40390
40474
  ic.bAnnoShown = true;
40475
+
40476
+ if(ic.bShowRefnum) {
40477
+ ic.opts.color = 'ig strand';
40478
+ ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
40479
+
40480
+ ic.selectionCls.selectAll_base();
40481
+ ic.hlUpdateCls.updateHlAll();
40482
+ }
40391
40483
  }
40392
40484
 
40393
40485
  async showAnnoSeqData(nucleotide_chainid, chemical_chainid, chemical_set) { let ic = this.icn3d, me = ic.icn3dui;
@@ -41678,6 +41770,7 @@ class ShowSeq {
41678
41770
  else {
41679
41771
  if(bShowRefnum && currStrand != ' ') {
41680
41772
  html += this.getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bHidelabel);
41773
+ if(bLoop) ic.residIgLoop[residueid] = 1;
41681
41774
  }
41682
41775
  else {
41683
41776
  html += '<span></span>';
@@ -41690,7 +41783,7 @@ class ShowSeq {
41690
41783
  // skip non-protein residues
41691
41784
  // after G strand and before A strand, just use the mapped reference number
41692
41785
  if((!atom || ic.proteins.hasOwnProperty(atom.serial)) && prevStrand && !bCustom && !kabat_or_imgt
41693
- && currStrand_ori.substr(0,1) != 'G') {
41786
+ && (!currStrand_ori || currStrand_ori.substr(0,1) != 'G')) {
41694
41787
  // no ref num
41695
41788
  bLoop = true;
41696
41789
 
@@ -41725,6 +41818,7 @@ class ShowSeq {
41725
41818
 
41726
41819
  if(bShowRefnum && currStrand != ' ') {
41727
41820
  html += this.getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bHidelabel);
41821
+ if(bLoop) ic.residIgLoop[residueid] = 1;
41728
41822
  }
41729
41823
  else {
41730
41824
  html += '<span></span>';
@@ -41798,7 +41892,10 @@ class ShowSeq {
41798
41892
  refnumLabelNoPostfix = currStrand + refnum;
41799
41893
 
41800
41894
  //if(currCnt == 0 || currCnt == halfLen || currCnt == halfLen + 1 || currCnt == end - 1) {
41801
- if(currCnt == 1 || currCnt == halfLen || currCnt == halfLen + 1 || currCnt == end - 1) {
41895
+ // if(currCnt == 1 || currCnt == halfLen || currCnt == halfLen + 1 || currCnt == end - 1) {
41896
+ // bHidelabel = true;
41897
+ // }
41898
+ if(currCnt == 1 || currCnt == end - 1) {
41802
41899
  bHidelabel = true;
41803
41900
  }
41804
41901
 
@@ -41829,7 +41926,7 @@ class ShowSeq {
41829
41926
  getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bHidelabel) { let ic = this.icn3d, me = ic.icn3dui;
41830
41927
  let refnum = parseInt(refnumStr).toString();
41831
41928
  let color = this.getRefnumColor(currStrand);
41832
- let colorStr = 'style="color:' + color + '"';
41929
+ let colorStr = (!bLoop) ? 'style="color:' + color + '; text-decoration: underline overline;"' : 'style="color:' + color + '"';
41833
41930
 
41834
41931
  let lastTwo = parseInt(refnum.substr(refnum.length - 2, 2));
41835
41932
  parseInt(refnum.substr(refnum.length - 3, 3));
@@ -41854,48 +41951,48 @@ class ShowSeq {
41854
41951
  return html;
41855
41952
  }
41856
41953
 
41857
- getRefnumColor(currStrand) { let ic = this.icn3d; ic.icn3dui;
41858
- if(currStrand == "A^") { // deep sky blue
41859
- return '#00BFFF';
41954
+ getRefnumColor(currStrand) { let ic = this.icn3d, me = ic.icn3dui;
41955
+ if(currStrand == "A^") { //magenta // deep sky blue
41956
+ return '#FF00FF'; //'#9900ff'; //'#00BFFF';
41860
41957
  }
41861
- else if(currStrand == "A") { // blue
41862
- return '#0000FF';
41958
+ else if(currStrand == "A") { //rebecca purple // blue
41959
+ return '#663399'; //'#9900ff'; //'#0000FF';
41863
41960
  }
41864
- else if(currStrand == "A*") { // sky blue
41865
- return '#87CEEB';
41961
+ else if(currStrand == "A*") { //pink // sky blue
41962
+ return '#FFC0CB'; //'#9900ff'; //'#87CEEB';
41866
41963
  }
41867
- else if(currStrand == "A'") { // steel blue
41868
- return '#4682B4';
41964
+ else if(currStrand == "A'") { //medium purple // steel blue
41965
+ return '#9370db'; //'#9900ff'; //'#4682B4';
41869
41966
  }
41870
- else if(currStrand == "B") { // cyan
41871
- return '#00FFFF';
41967
+ else if(currStrand == "B") { //medium orchid // cyan
41968
+ return '#ba55d3'; //'#0000FF'; //'#4a86e8'; //'#00FFFF';
41872
41969
  }
41873
- else if(currStrand == "C") { // green
41874
- return '#00FF00';
41970
+ else if(currStrand == "C") { //blue // green
41971
+ return '#0000FF'; //'#76d6ff'; //'#00FF00';
41875
41972
  }
41876
- else if(currStrand == "C'") { // yellow
41877
- return '#FFFF00';
41973
+ else if(currStrand == "C'") { //corn blue // yellow
41974
+ return '#6495ED'; //'#006400'; //'#00b050'; //'#FFFF00';
41878
41975
  }
41879
- else if(currStrand == "C''") { // orange
41880
- return '#FFA500';
41976
+ else if(currStrand == "C''") { //dark green // orange
41977
+ return '#006400'; //'#00ff00'; //'#FFA500';
41881
41978
  }
41882
- else if(currStrand == "D") { // brown
41883
- return '#A52A2A';
41979
+ else if(currStrand == "D") { //green // brown
41980
+ return '#00FF00'; //'#fffb00'; //'#A52A2A';
41884
41981
  }
41885
- else if(currStrand == "E") { // pink
41886
- return '#FFC0CB';
41982
+ else if(currStrand == "E") { //yellow // pink
41983
+ return '#F0E68C'; //'#ff9900'; //'#ffd966'; //'#FFC0CB';
41887
41984
  }
41888
- else if(currStrand == "F") { // magenta
41889
- return '#FF00FF';
41985
+ else if(currStrand == "F") { //orange // magenta
41986
+ return '#FFA500'; //'#FF00FF'; //'#ff9900'; //'#FF00FF';
41890
41987
  }
41891
- else if(currStrand == "G") { // red
41892
- return '#FF0000';
41988
+ else if(currStrand == "G") { //red // red
41989
+ return '#FF0000'; //'#ff2600'; //'#FF0000';
41893
41990
  }
41894
- else if(currStrand == "G*") { // salmon
41895
- return '#FA8072';
41991
+ else if(currStrand == "G*") { //dark red // salmon
41992
+ return '#8B0000'; //'#ff2600'; //'#FA8072';
41896
41993
  }
41897
41994
  else {
41898
- return '#000';
41995
+ return me.htmlCls.GREYB;
41899
41996
  }
41900
41997
  }
41901
41998
 
@@ -47137,7 +47234,18 @@ class ChainalignParser {
47137
47234
  }
47138
47235
 
47139
47236
  // ic.deferredMmdbaf = $.Deferred(function() {
47140
- let structArray = idlist.split(',');
47237
+ let structArrayTmp = idlist.split(',');
47238
+
47239
+ let structArray = [];
47240
+ // remove redundant structures
47241
+ for(let i = 0, il = structArrayTmp.length; i < il; ++i) {
47242
+ if(!ic.structures.hasOwnProperty(structArrayTmp[i].toUpperCase())) {
47243
+ structArray.push(structArrayTmp[i]);
47244
+ }
47245
+ }
47246
+
47247
+ if(structArray.length == 0) return;
47248
+
47141
47249
  ic.structArray = ic.structArray.concat(structArray);
47142
47250
 
47143
47251
  let ajaxArray = [];
@@ -58624,6 +58732,10 @@ class LoadScript {
58624
58732
 
58625
58733
  // load pdb, mmcif, mmdb, cid
58626
58734
  let id = loadStr.substr(loadStr.lastIndexOf(' ') + 1);
58735
+
58736
+ // skip loading the structure if it was loaded before
58737
+ if(ic.structures.hasOwnProperty(id)) return;
58738
+
58627
58739
  ic.inputid = id;
58628
58740
  if(command.indexOf('load mmtf') !== -1) {
58629
58741
  me.cfg.mmtfid = id;
@@ -58698,7 +58810,7 @@ class LoadScript {
58698
58810
  else if(command.indexOf('load alignment') !== -1) {
58699
58811
  me.cfg.align = id;
58700
58812
 
58701
- if(me.cfg.inpara.indexOf('atype=2') == -1) {
58813
+ if(me.cfg.inpara || me.cfg.inpara.indexOf('atype=2') == -1) {
58702
58814
  await ic.alignParserCls.downloadAlignment(me.cfg.align);
58703
58815
  }
58704
58816
  else {
@@ -69254,7 +69366,7 @@ class iCn3D {
69254
69366
  this.optsOri = {};
69255
69367
  this.optsOri['camera'] = 'perspective'; //perspective, orthographic
69256
69368
  this.optsOri['background'] = 'black'; //transparent, black, grey, white
69257
- this.optsOri['color'] = 'chain'; //spectrum, secondary structure, charge, hydrophobic, conserved, chain, residue, atom, b factor, red, green, blue, magenta, yellow, cyan, white, grey, custom
69369
+ this.optsOri['color'] = 'chain'; //spectrum, secondary structure, charge, hydrophobic, conserved, chain, residue, atom, b factor, red, green, blue, magenta, yellow, cyan, white, grey, custom, ig strand
69258
69370
  this.optsOri['proteins'] = 'ribbon'; //ribbon, strand, cylinder and plate, schematic, c alpha trace, backbone, b factor tube, lines, stick, ball and stick, sphere, nothing
69259
69371
  this.optsOri['sidec'] = 'nothing'; //lines2, stick2, ball and stick2, sphere2, nothing
69260
69372
  this.optsOri['nucleotides'] = 'nucleotide cartoon'; //nucleotide cartoon, o3 trace, backbone, schematic, lines, stick,
@@ -69521,6 +69633,7 @@ iCn3D.prototype.init_base = function (bKeepCmd) {
69521
69633
 
69522
69634
  this.chainsMapping = {}; // structure_chain name -> residue id hash such as {'structure_chain_resi1': 'reference residue such as K10', ...}
69523
69635
  this.resid2refnum = {}; // residue id -> reference number, e.g., {'1WIO_A_16': '2150', ...}
69636
+ this.residIgLoop = {}; // residue ids in the loop regions of ig domain
69524
69637
  this.refnum2residArray = {}; // reference number -> array of residue id, e.g., {'2150': ['1WIO_A_16', ...], ...}
69525
69638
  this.bShowRefnum = false;
69526
69639
 
@@ -69693,7 +69806,7 @@ class iCn3DUI {
69693
69806
  //even when multiple iCn3D viewers are shown together.
69694
69807
  this.pre = this.cfg.divid + "_";
69695
69808
 
69696
- this.REVISION = '3.23.1';
69809
+ this.REVISION = '3.23.2';
69697
69810
 
69698
69811
  // In nodejs, iCn3D defines "window = {navigator: {}}"
69699
69812
  this.bNode = (Object.keys(window).length < 2) ? true : false;