icn3d 3.28.8 → 3.28.10

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
@@ -4161,6 +4161,17 @@ class UtilsCls {
4161
4161
 
4162
4162
  return this.getStructures(atoms);
4163
4163
  }
4164
+
4165
+ getDateDigitStr() { this.icn3dui;
4166
+ let date = new Date();
4167
+ let monthStr =(date.getMonth() + 1).toString();
4168
+ if(date.getMonth() + 1 < 10) monthStr = '0' + monthStr;
4169
+
4170
+ let dateStr = date.getDate().toString();
4171
+ if(date.getDate() < 10) dateStr = '0' + dateStr;
4172
+
4173
+ return date.getFullYear().toString() + monthStr + dateStr;
4174
+ }
4164
4175
  }
4165
4176
 
4166
4177
  /**
@@ -7273,24 +7284,24 @@ class ClickMenu {
7273
7284
  thisClass.setLogCmd('setoption phisurface nothing', true);
7274
7285
  });
7275
7286
 
7276
- me.myEventCls.onIds("#" + me.pre + "applymap2fofc", "click", function(e) { let ic = me.icn3d;
7287
+ me.myEventCls.onIds("#" + me.pre + "applymap2fofc", "click", async function(e) { let ic = me.icn3d;
7277
7288
  e.preventDefault();
7278
7289
 
7279
7290
  //if(!me.cfg.notebook) dialog.dialog( "close" );
7280
7291
  let sigma2fofc = parseFloat($("#" + me.pre + "sigma2fofc" ).val());
7281
7292
  let type = '2fofc';
7282
- ic.dsn6ParserCls.dsn6Parser(ic.inputid, type, sigma2fofc);
7293
+ await ic.dsn6ParserCls.dsn6Parser(ic.inputid, type, sigma2fofc);
7283
7294
  //ic.setOptionCls.setOption('map', '2fofc');
7284
7295
  thisClass.setLogCmd('set map 2fofc sigma ' + sigma2fofc, true);
7285
7296
  });
7286
7297
 
7287
- me.myEventCls.onIds("#" + me.pre + "applymapfofc", "click", function(e) { let ic = me.icn3d;
7298
+ me.myEventCls.onIds("#" + me.pre + "applymapfofc", "click", async function(e) { let ic = me.icn3d;
7288
7299
  e.preventDefault();
7289
7300
 
7290
7301
  //if(!me.cfg.notebook) dialog.dialog( "close" );
7291
7302
  let sigmafofc = parseFloat($("#" + me.pre + "sigmafofc" ).val());
7292
7303
  let type = 'fofc';
7293
- ic.dsn6ParserCls.dsn6Parser(ic.inputid, type, sigmafofc);
7304
+ await ic.dsn6ParserCls.dsn6Parser(ic.inputid, type, sigmafofc);
7294
7305
  //ic.setOptionCls.setOption('map', 'fofc');
7295
7306
  thisClass.setLogCmd('set map fofc sigma ' + sigmafofc, true);
7296
7307
  });
@@ -7315,7 +7326,7 @@ class ClickMenu {
7315
7326
  thisClass.setLogCmd('setoption emmap nothing', true);
7316
7327
  });
7317
7328
 
7318
- me.myEventCls.onIds("#" + me.pre + "applyemmap", "click", function(e) { let ic = me.icn3d;
7329
+ me.myEventCls.onIds("#" + me.pre + "applyemmap", "click", async function(e) { let ic = me.icn3d;
7319
7330
  e.preventDefault();
7320
7331
 
7321
7332
  //if(!me.cfg.notebook) dialog.dialog( "close" );
@@ -7323,7 +7334,7 @@ class ClickMenu {
7323
7334
  let type = 'em';
7324
7335
  //ic.emd = 'emd-3906';
7325
7336
 
7326
- ic.densityCifParserCls.densityCifParser(ic.inputid, type, empercentage, ic.emd);
7337
+ await ic.densityCifParserCls.densityCifParser(ic.inputid, type, empercentage, ic.emd);
7327
7338
  thisClass.setLogCmd('set emmap percentage ' + empercentage, true);
7328
7339
  });
7329
7340
 
@@ -7371,6 +7382,18 @@ class ClickMenu {
7371
7382
  // }
7372
7383
  });
7373
7384
 
7385
+ me.myEventCls.onIds("#" + me.pre + "mn6_igrefTpl", "click", async function(e) { me.icn3d; //e.preventDefault();
7386
+ me.htmlCls.dialogCls.openDlg('dl_igrefTpl', 'Choose an Ig template');
7387
+ });
7388
+
7389
+ me.myEventCls.onIds("#" + me.pre + "mn6_igrefTpl_apply", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
7390
+ if(!me.cfg.notebook) dialog.dialog( "close" );
7391
+
7392
+ let template = $("#" + me.pre + "igrefTpl").val();
7393
+ thisClass.setLogCmd('ig template ' + template, true);
7394
+ await ic.refnumCls.showIgRefNum(template);
7395
+ });
7396
+
7374
7397
  me.myEventCls.onIds("#" + me.pre + "mn6_igrefNo", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
7375
7398
  thisClass.setLogCmd('ig refnum off', true);
7376
7399
  await ic.refnumCls.hideIgRefNum();
@@ -8624,14 +8647,14 @@ class SetMenu {
8624
8647
  }
8625
8648
 
8626
8649
  //!!!
8627
- /*
8650
+ /*
8628
8651
  html += this.getMenuText('m1_exportrefnum', 'Reference Numbers', undefined, undefined, 2);
8629
8652
  html += "<ul>";
8630
8653
  html += this.getLink('mn1_exportIgstrand', 'Ig Strand', undefined, 3);
8631
8654
  html += this.getLink('mn1_exportKabat', 'Kabat', undefined, 3);
8632
8655
  html += this.getLink('mn1_exportImgt', 'IMGT', undefined, 3);
8633
8656
  html += "</ul>";
8634
- */
8657
+ */
8635
8658
 
8636
8659
  html += "<li><br/></li>";
8637
8660
 
@@ -9698,10 +9721,11 @@ class SetMenu {
9698
9721
  //!!!
9699
9722
  /*
9700
9723
  html += this.getLink('mn6_igrefYes', 'Show Ig Ref. Number', undefined, 2);
9724
+ html += this.getLink('mn6_igrefTpl', 'Ig w/ Specified Template', undefined, 2);
9701
9725
  html += this.getLink('mn6_igrefNo', 'Hide Ig Ref. Number', undefined, 2);
9702
-
9703
- html += this.getMenuSep();
9704
9726
  */
9727
+ html += this.getMenuSep();
9728
+
9705
9729
  html += this.getLink('mn6_customref', 'Custom Ref. Number', undefined, 2);
9706
9730
  html += "</ul>";
9707
9731
  html += "</li>";
@@ -11803,6 +11827,31 @@ class SetDialog {
11803
11827
  html += this.addNotebookTitle('dl_disttable', 'Distance Table', true);
11804
11828
  html += "</div>";
11805
11829
 
11830
+ html += me.htmlCls.divStr + "dl_igrefTpl' class='" + dialogClass + "'>";
11831
+ html += this.addNotebookTitle('dl_igrefTpl', 'Choose an Ig template');
11832
+ html += "<span style='white-space:nowrap;font-weight:bold;'>Choose an Ig template for selected residues:</span> <br><br><select id='" + me.pre + "igrefTpl'>";
11833
+
11834
+ //html += me.htmlCls.setHtmlCls.getOptionHtml(['0', '10', '20', '30', '40', '50', '60', '70', '80', '90', '100'], 3);
11835
+ let group2tpl = {};
11836
+ group2tpl['V'] = ['FAB-HEAVY_5esv_V-n1', 'FAB-LIGHT_5esv_V-n1', 'VNAR_1t6vN_shark_V', 'TCRa_6jxrm_human_V-n1', 'VISTA_6oilA_human_V', 'CD8a_1cd8A_human_V', 'PD1_4zqkB_human_V', 'ICOS_6x4gA_human_V', 'CD28_1yjdC_human_V', 'PDL1_4z18B_human_V-n1', 'CD2_1hnfA_human_V-n1', 'LAG3_7tzgD_human_V-n1'];
11837
+ group2tpl['C1'] = ['FAB-LIGHT_5esv_C1-n2', 'GHR_1axiB_human_FN3-n1', 'VTCN1_Q7Z7D3_human_V-n2', 'B2Microglobulin_7phrL_human_C1', 'FAB-HEAVY_5esv_C1-n2', 'MHCIa_7phrH_human_C1', 'TCRa_6jxrm_human_C1-n2'];
11838
+ group2tpl['C2'] = ['CD2_1hnfA_human_C2-n2', 'Siglec3_5j0bB_human_C2-n2', 'LAG3_7tzgD_human_C2-n2', 'Contactin1_3s97C_human_C2-n2'];
11839
+ group2tpl['Iset'] = ['BTLA_2aw2A_human_Iset', 'Palladin_2dm3A_human_Iset-n1', 'Titin_4uowM_human_Unk-n152', 'JAM1_1nbqA_human_VorIset-n2', 'CD19_6al5A_human_C2orV-n1'];
11840
+ group2tpl['FN3'] = ['InsulinR_8guyE_human_FN3-n1', 'IL6Rb_1bquB_human_FN3-n3', 'Sidekick2_1wf5A_human_FN3-n7', 'InsulinR_8guyE_human_FN3-n2', 'Contactin1_2ee2A_human_FN3-n9', 'IL6Rb_1bquB_human_FN3-n2'];
11841
+ group2tpl['Other'] = ['Endo-1,4-BetaXylanase10A_1i8aA_bacteria_n4', 'CoAtomerGamma1_1r4xA_human', 'TP34_2o6cA_bacteria', 'RBPJ_6py8C_human_Unk-n2', 'TP47_1o75A_bacteria', 'C3_2qkiD_human_n1', 'BArrestin1_4jqiA_rat_n1', 'RBPJ_6py8C_human_Unk-n1', 'CuZnSuperoxideDismutase_1hl5C_human', 'TEAD1_3kysC_human', 'ASF1A_2iijA_human', 'MPT63_1lmiA_bacteria', 'NaCaExchanger_2fwuA_dog_n2', 'ORF7a_1xakA_virus', 'ECadherin_4zt1A_human_n2', 'NaKATPaseTransporterBeta_2zxeB_spurdogshark', 'LaminAC_1ifrA_human', 'IsdA_2iteA_bacteria'];
11842
+
11843
+ for(let group in group2tpl) {
11844
+ html += "<optgroup label='" + group + "'>";
11845
+ for(let i = 0, il = group2tpl[group].length; i < il; ++i) {
11846
+ let template = group2tpl[group][i];
11847
+ html += me.htmlCls.optionStr + "'" + template + "'>" + template + "</option>";
11848
+ }
11849
+ html += "</optgroup>";
11850
+ }
11851
+
11852
+ html += "</select><br><br><span style='white-space:nowrap;'>" + me.htmlCls.buttonStr + "mn6_igrefTpl_apply'>Show Ig Ref. Number</button></span>";
11853
+ html += "</div>";
11854
+
11806
11855
  html += "</div>";
11807
11856
  html += "<!--/form-->";
11808
11857
 
@@ -15622,7 +15671,7 @@ class SetHtml {
15622
15671
  if(postfix == 'style') {
15623
15672
  if(bReset) {
15624
15673
  $("#" + me.pre + "shininess").val('40');
15625
- $("#" + me.pre + "light1").val('0.6');
15674
+ $("#" + me.pre + "light1").val('0.8');
15626
15675
  $("#" + me.pre + "light2").val('0.4');
15627
15676
  $("#" + me.pre + "light3").val('0.2');
15628
15677
  $("#" + me.pre + "glycan").val('0');
@@ -17849,7 +17898,8 @@ function createDefaultMaterial( cache ) {
17849
17898
  roughness: 1,
17850
17899
  transparent: false,
17851
17900
  depthTest: true,
17852
- side: FrontSide
17901
+ side: FrontSide,
17902
+ //needsUpdate: true
17853
17903
  } );
17854
17904
 
17855
17905
  }
@@ -20776,7 +20826,7 @@ function findNodes( motionController, scene ) {
20776
20826
 
20777
20827
  // Attach a touch dot to the touchpad.
20778
20828
  const sphereGeometry = new SphereGeometry( 0.001 );
20779
- const material = new MeshBasicMaterial( { color: 0x0000FF } );
20829
+ const material = new MeshBasicMaterial( {color: 0x0000FF } );
20780
20830
  const sphere = new Mesh( sphereGeometry, material );
20781
20831
  component.touchPointNode.add( sphere );
20782
20832
 
@@ -21398,7 +21448,7 @@ class CanvasUI{
21398
21448
  if ( this.scene ){
21399
21449
  const radius = 0.015;
21400
21450
  const geometry = new THREE.IcosahedronBufferGeometry( radius );
21401
- const material = new THREE.MeshBasicMaterial( { color: 0x0000aa } );
21451
+ const material = new THREE.MeshBasicMaterial( {color: 0x0000aa } );
21402
21452
 
21403
21453
  const mesh1 = new THREE.Mesh( geometry, material );
21404
21454
  mesh1.visible = false;
@@ -23205,7 +23255,7 @@ class Box {
23205
23255
  specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, color: color }));
23206
23256
  // }
23207
23257
  // else {
23208
- // mesh = new THREE.Mesh(ic.boxGeometry, new THREE.MeshPhongMaterial({
23258
+ // mesh = new THREE.Mesh(ic.boxGeometry, new THREE.MeshPhongMaterial({needsUpdate: true,
23209
23259
  // specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, color: color }));
23210
23260
  // }
23211
23261
 
@@ -23666,18 +23716,18 @@ class Cylinder {
23666
23716
  else {
23667
23717
  if(bHighlight === 2) {
23668
23718
  mesh = new THREE.Mesh(ic.cylinderGeometry, new THREE.MeshPhongMaterial(
23669
- { transparent: true, opacity: opacity, specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, color: color }));
23719
+ {transparent: true, opacity: opacity, specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, color: color }));
23670
23720
 
23671
23721
  radius *= 1.5;
23672
23722
  }
23673
23723
  //else if(bGlycan) {
23674
23724
  else {
23675
23725
  mesh = new THREE.Mesh(ic.cylinderGeometry, new THREE.MeshPhongMaterial(
23676
- { transparent: true, opacity: opacity, specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, color: color }));
23726
+ {transparent: true, opacity: opacity, specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, color: color }));
23677
23727
  }
23678
23728
  // else {
23679
23729
  // mesh = new THREE.Mesh(ic.cylinderGeometry, new THREE.MeshPhongMaterial(
23680
- // { specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, color: color }));
23730
+ // {specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, color: color }));
23681
23731
  // }
23682
23732
 
23683
23733
  mesh.position.copy(p0).add(p1).multiplyScalar(0.5);
@@ -23744,7 +23794,7 @@ class Cylinder {
23744
23794
  if(me.bNode) return;
23745
23795
 
23746
23796
  let mesh = new THREE.Mesh(ic.cylinderGeometry, new THREE.MeshPhongMaterial(
23747
- { specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, color: color }));
23797
+ {specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, color: color }));
23748
23798
 
23749
23799
  mesh.position.copy(p0).add(p1).multiplyScalar(0.5);
23750
23800
  mesh.matrixAutoUpdate = false;
@@ -23975,7 +24025,7 @@ class Line$1 {
23975
24025
  if(bHighlight === 1) ;
23976
24026
  else {
23977
24027
  line = new THREE.LineSegments(geo, new THREE.LineBasicMaterial(
23978
- { linewidth: ic.linewidth, vertexColors: true }));
24028
+ {linewidth: ic.linewidth, vertexColors: true }));
23979
24029
  ic.mdl.add(line);
23980
24030
  }
23981
24031
 
@@ -24108,7 +24158,7 @@ class Line$1 {
24108
24158
  let p2 = line.position2;
24109
24159
 
24110
24160
  let dashed = (line.dashed) ? line.dashed : false;
24111
- let dashSize = 0.3;
24161
+ let dashSize = (name == 'missingres') ? 0.8 : 0.3;
24112
24162
 
24113
24163
  let radius = (line.radius) ? line.radius : ic.lineRadius;
24114
24164
  let opacity = (line.opacity) ? line.opacity : 1.0;
@@ -26179,7 +26229,8 @@ class TextSprite {
26179
26229
  map: texture,
26180
26230
  //useScreenCoordinates: false,
26181
26231
  depthTest: !frontOfTarget,
26182
- depthWrite: !frontOfTarget
26232
+ depthWrite: !frontOfTarget,
26233
+ //needsUpdate: true
26183
26234
  } );
26184
26235
 
26185
26236
  //https://stackoverflow.com/questions/29421702/threejs-texture
@@ -27478,19 +27529,25 @@ ProteinSurface.prototype.initparm = function(extent, btype, in_bCalcArea, atomli
27478
27529
 
27479
27530
  // 2. If size > 90, change scale
27480
27531
  //var threshbox = 180; // maximum possible boxsize
27481
- if(this.bCalcArea || this.defaultScaleFactor * maxLen > this.threshbox) {
27532
+ //if(this.bCalcArea || this.defaultScaleFactor * maxLen > this.threshbox) {
27533
+ if(this.defaultScaleFactor * maxLen > this.threshbox) {
27482
27534
  boxLength = Math.floor(this.threshbox);
27483
27535
  this.scaleFactor =(this.threshbox - 1.0) / maxLen;
27484
27536
  }
27537
+
27538
+ // 3. use a fixed scaleFactor for surface area calculation
27539
+ if(this.bCalcArea) {
27540
+ this.scaleFactor = this.defaultScaleFactor;
27541
+ }
27485
27542
  // end of surface.js part
27486
27543
 
27487
27544
  this.pLength = Math.ceil(this.scaleFactor *(this.pmaxx - this.pminx)) + 1;
27488
27545
  this.pWidth = Math.ceil(this.scaleFactor *(this.pmaxy - this.pminy)) + 1;
27489
27546
  this.pHeight = Math.ceil(this.scaleFactor *(this.pmaxz - this.pminz)) + 1;
27490
27547
 
27491
- this.finalScaleFactor.x =(this.pLength - 1.0) /(this.pmaxx - this.pminx);
27492
- this.finalScaleFactor.y =(this.pWidth - 1.0) /(this.pmaxy - this.pminy);
27493
- this.finalScaleFactor.z =(this.pHeight - 1.0) /(this.pmaxz - this.pminz);
27548
+ // this.finalScaleFactor.x =(this.pLength - 1.0) /(this.pmaxx - this.pminx);
27549
+ // this.finalScaleFactor.y =(this.pWidth - 1.0) /(this.pmaxy - this.pminy);
27550
+ // this.finalScaleFactor.z =(this.pHeight - 1.0) /(this.pmaxz - this.pminz);
27494
27551
 
27495
27552
  this.boundingatom(btype);
27496
27553
  this.cutRadius = this.probeRadius * this.scaleFactor;
@@ -27604,9 +27661,13 @@ ProteinSurface.prototype.fillvoxels = function(atoms, atomlist) { //(int seqinit
27604
27661
  for(i = 0; i < this.pLength; ++i) {
27605
27662
  for(j = 0; j < this.pWidth; ++j) {
27606
27663
  for(k = 0; k < this.pHeight; ++k) {
27607
- let x = i / this.finalScaleFactor.x - this.ptranx;
27608
- let y = j / this.finalScaleFactor.y - this.ptrany;
27609
- let z = k / this.finalScaleFactor.z - this.ptranz;
27664
+ // let x = i / this.finalScaleFactor.x - this.ptranx;
27665
+ // let y = j / this.finalScaleFactor.y - this.ptrany;
27666
+ // let z = k / this.finalScaleFactor.z - this.ptranz;
27667
+
27668
+ let x = i / this.scaleFactor - this.ptranx;
27669
+ let y = j / this.scaleFactor - this.ptrany;
27670
+ let z = k / this.scaleFactor - this.ptranz;
27610
27671
 
27611
27672
  let r = new THREE.Vector3(x, y, z);
27612
27673
 
@@ -28236,7 +28297,7 @@ ProteinSurface.prototype.marchingcube = function(stype) {
28236
28297
  }
28237
28298
 
28238
28299
  // calculate surface area
28239
- let serial2area, maxScaleFactor, area = 0;
28300
+ let serial2area, area = 0;
28240
28301
  if(this.bCalcArea) {
28241
28302
  let faceHash = {};
28242
28303
  serial2area = {};
@@ -28306,14 +28367,15 @@ ProteinSurface.prototype.marchingcube = function(stype) {
28306
28367
  //}
28307
28368
  } // for loop
28308
28369
 
28309
- maxScaleFactor = Math.max(this.finalScaleFactor.x, this.finalScaleFactor.y, this.finalScaleFactor.z);
28310
- area = area / maxScaleFactor / maxScaleFactor;
28311
- //area = area / this.scaleFactor / this.scaleFactor;
28370
+ //maxScaleFactor = Math.max(this.finalScaleFactor.x, this.finalScaleFactor.y, this.finalScaleFactor.z);
28371
+ //area = area / maxScaleFactor / maxScaleFactor;
28372
+ area = area / this.scaleFactor / this.scaleFactor;
28312
28373
  }
28313
28374
 
28314
28375
  if(!this.bCalcArea) this.marchingCube.laplacianSmooth(1, this.verts, this.faces);
28315
28376
 
28316
- return {"area": area, "serial2area": serial2area, "scaleFactor": maxScaleFactor};
28377
+ //return {"area": area, "serial2area": serial2area, "scaleFactor": maxScaleFactor};
28378
+ return {"area": area, "serial2area": serial2area, "scaleFactor": this.scaleFactor};
28317
28379
  };
28318
28380
 
28319
28381
  /* ProteinSurface4.js
@@ -29293,7 +29355,8 @@ class Surface {
29293
29355
  wireframe: wireframe,
29294
29356
  opacity: opacity,
29295
29357
  transparent: true,
29296
- side: THREE.DoubleSide
29358
+ side: THREE.DoubleSide,
29359
+ //needsUpdate: true
29297
29360
  }));
29298
29361
 
29299
29362
  //http://www.html5gamedevs.com/topic/7288-threejs-transparency-bug-or-limitation-or-what/
@@ -29362,7 +29425,8 @@ class Surface {
29362
29425
  opacity: opacity,
29363
29426
  transparent: true,
29364
29427
  depthWrite: (parseInt(10*opacity) != 10) ? false : true, // important to make the transparency work
29365
- side: THREE.DoubleSide
29428
+ side: THREE.DoubleSide,
29429
+ //needsUpdate: true
29366
29430
  //depthTest: (ic.ic.transparentRenderOrder) ? false : true
29367
29431
  }));
29368
29432
 
@@ -31546,7 +31610,7 @@ class Impostor {
31546
31610
  fragmentShader: this.getShader(shaderName + ".frag"),
31547
31611
  depthTest: true,
31548
31612
  depthWrite: true,
31549
- //needsUpdate: true,
31613
+ //needsUpdate: true,
31550
31614
  lights: true
31551
31615
  });
31552
31616
 
@@ -32313,7 +32377,7 @@ class Instancing {
32313
32377
  fragmentShader: ic.impostorCls.getShader(name + ".frag"),
32314
32378
  depthTest: true,
32315
32379
  depthWrite: true,
32316
- //needsUpdate: true,
32380
+ //needsUpdate: true,
32317
32381
  lights: true
32318
32382
  });
32319
32383
 
@@ -32819,6 +32883,7 @@ class Alternate {
32819
32883
  if(ic.scene) {
32820
32884
  // https://github.com/gkjohnson/three-gpu-pathtracer/blob/main/example/basic.js
32821
32885
  ic.renderer.outputEncoding = THREE.sRGBEncoding;
32886
+ //ic.renderer.outputEncoding = THREE.LinearEncoding
32822
32887
 
32823
32888
  ic.renderer.render(ic.scene, cam);
32824
32889
  }
@@ -35956,9 +36021,9 @@ class SetOption {
35956
36021
 
35957
36022
  const name2color = {
35958
36023
  //"A- Strand": "FF00FF",
35959
- "A Strand": "663399",
35960
- //"A+ Strand": "663399", //"FFC0CB",
35961
- "A' Strand": "663399", //"9370db",
36024
+ "A Strand": "9400D3", //"663399",
36025
+ //"A+ Strand": "9400D3", //"663399",
36026
+ "A' Strand": "9400D3", //"663399",
35962
36027
  "B Strand": "ba55d3",
35963
36028
  "C Strand": "0000FF",
35964
36029
  "C' Strand": "6495ED",
@@ -43103,12 +43168,14 @@ class ShowSeq {
43103
43168
  html += '</div>';
43104
43169
  html3 += '</div></div>';
43105
43170
  }
43106
- else if(ic.bShowRefnum && ic.chainid2refpdbname.hasOwnProperty(chnid) && ic.chainid2refpdbname[chnid].length > 0) {
43171
+
43172
+ if(ic.bShowRefnum && ic.chainid2refpdbname.hasOwnProperty(chnid) && ic.chainid2refpdbname[chnid].length > 0) {
43107
43173
  let result = this.showAllRefNum(giSeq, chnid);
43108
43174
  html += result.html;
43109
43175
  html3 += result.html3;
43110
43176
  }
43111
- else if(ic.bShowCustomRefnum && ic.chainsMapping.hasOwnProperty(chnid)) {
43177
+
43178
+ if(ic.bShowCustomRefnum && ic.chainsMapping.hasOwnProperty(chnid)) {
43112
43179
  let bCustom = true;
43113
43180
  let result = this.showRefNum(giSeq, chnid, undefined, bCustom);
43114
43181
  html += result.html;
@@ -43118,7 +43185,8 @@ class ShowSeq {
43118
43185
 
43119
43186
  // highlight reference numbers
43120
43187
  if(ic.bShowRefnum) {
43121
- ic.hAtoms = ic.hAtomsRefnum;
43188
+ // comment out so that this process didn't change the selection
43189
+ //ic.hAtoms = ic.hAtomsRefnum;
43122
43190
 
43123
43191
  // commented out because it produced too many commands
43124
43192
  // let name = 'refnum_anchors';
@@ -43157,6 +43225,7 @@ class ShowSeq {
43157
43225
  ic.selectionCls.selectAll_base();
43158
43226
  ic.hlUpdateCls.updateHlAll();
43159
43227
  //ic.drawCls.draw();
43228
+ ic.drawCls.draw();
43160
43229
  }
43161
43230
 
43162
43231
  return {'html': html, 'html3': html3};
@@ -43232,7 +43301,10 @@ class ShowSeq {
43232
43301
 
43233
43302
  if(!bCustom && !kabat_or_imgt && !me.bNode) { // do not overwrite loops in node
43234
43303
  // reset ic.residIgLoop for the current selection, which could be the second round of ref num assignment
43235
- let residHash = ic.firstAtomObjCls.getResiduesFromAtoms(ic.hAtoms);
43304
+ // just current chain
43305
+ let atomHash = me.hashUtilsCls.intHash(ic.chains[chnid], ic.hAtoms);
43306
+ let residHash = ic.firstAtomObjCls.getResiduesFromAtoms(atomHash);
43307
+
43236
43308
  for(let resid in residHash) {
43237
43309
  // not in loop any more if you assign ref numbers multiple times
43238
43310
  delete ic.residIgLoop[resid];
@@ -43674,17 +43746,17 @@ class ShowSeq {
43674
43746
 
43675
43747
  getRefnumColor(currStrand, bText) { let ic = this.icn3d, me = ic.icn3dui;
43676
43748
  if(currStrand == "A-") {
43677
- return '#663399';
43749
+ return '#9400D3'; //'#663399';
43678
43750
  }
43679
43751
  else if(currStrand == "A") {
43680
- return '#663399';
43752
+ return '#9400D3'; //'#663399';
43681
43753
  }
43682
43754
  //else if(currStrand == "A*") {
43683
43755
  else if(currStrand == "A+") {
43684
- return '#663399'; //'#FFC0CB';
43756
+ return '#9400D3'; //'#663399';
43685
43757
  }
43686
43758
  else if(currStrand == "A'") {
43687
- return '#663399';
43759
+ return '#9400D3'; //'#663399';
43688
43760
  }
43689
43761
  else if(currStrand == "B") {
43690
43762
  return '#ba55d3';
@@ -45425,7 +45497,7 @@ class LineGraph {
45425
45497
  ic.hlUpdateCls.updateHlAll();
45426
45498
  }
45427
45499
 
45428
- async showIgRefNum() { let ic = this.icn3d, me = ic.icn3dui;
45500
+ async showIgRefNum(template) { let ic = this.icn3d, me = ic.icn3dui;
45429
45501
  let thisClass = this;
45430
45502
 
45431
45503
  // round 1, 16 templates
@@ -45509,9 +45581,14 @@ class LineGraph {
45509
45581
  }
45510
45582
 
45511
45583
  // try {
45512
- let allPromise = Promise.allSettled(pdbAjaxArray);
45513
- ic.pdbDataArray = await allPromise;
45514
- await thisClass.parseRefPdbData(ic.pdbDataArray);
45584
+ if(!template) {
45585
+ let allPromise = Promise.allSettled(pdbAjaxArray);
45586
+ ic.pdbDataArray = await allPromise;
45587
+ await thisClass.parseRefPdbData(ic.pdbDataArray, template);
45588
+ }
45589
+ else {
45590
+ await thisClass.parseRefPdbData(undefined, template);
45591
+ }
45515
45592
  // }
45516
45593
  // catch(err) {
45517
45594
  // if(!me.bNode) var aaa = 1; //alert("Error in retrieveing reference PDB data...");
@@ -45519,7 +45596,7 @@ class LineGraph {
45519
45596
  // }
45520
45597
  }
45521
45598
 
45522
- async parseRefPdbData(dataArray) { let ic = this.icn3d, me = ic.icn3dui;
45599
+ async parseRefPdbData(dataArray, template) { let ic = this.icn3d, me = ic.icn3dui;
45523
45600
  let thisClass = this;
45524
45601
 
45525
45602
  let struArray = Object.keys(ic.structures);
@@ -45571,6 +45648,11 @@ class LineGraph {
45571
45648
  for(let n = 0, nl = residueArray.length; n < nl; ++n) {
45572
45649
  let resid = residueArray[n];
45573
45650
  ic.resid2domainid[resid] = chainid + '-0' + '_' + resiSum;
45651
+
45652
+ // clear previous refnum assignment if any
45653
+ if(ic.resid2refnum && ic.resid2refnum[resid]) {
45654
+ delete ic.resid2refnum[resid];
45655
+ }
45574
45656
  }
45575
45657
  }
45576
45658
  else {
@@ -45585,6 +45667,11 @@ class LineGraph {
45585
45667
  let resid = chainid + '_' + pos2resi[n];
45586
45668
  domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
45587
45669
  //ic.resid2domainid[resid] = chainid + '-' + k;
45670
+
45671
+ // clear previous refnum assignment if any
45672
+ if(ic.resid2refnum && ic.resid2refnum[resid]) {
45673
+ delete ic.resid2refnum[resid];
45674
+ }
45588
45675
  }
45589
45676
  }
45590
45677
 
@@ -45606,6 +45693,8 @@ class LineGraph {
45606
45693
  }
45607
45694
  }
45608
45695
 
45696
+ if(!ic.domainid2refpdbname) ic.domainid2refpdbname = {};
45697
+
45609
45698
  for(let k = 0, kl = domainAtomsArray.length; k < kl; ++k) {
45610
45699
  let pdb_target = ic.saveFileCls.getAtomPDB(domainAtomsArray[k], undefined, undefined, undefined, undefined, struct);
45611
45700
  let bForceOneDomain = true;
@@ -45619,56 +45708,107 @@ class LineGraph {
45619
45708
  let domainid = chainid + '-' + k + '_' + resiSum;
45620
45709
  ic.domainid2pdb[domainid] = pdb_target;
45621
45710
 
45622
- for(let index = 0, indexl = dataArray.length; index < indexl; ++index) {
45623
- // let struct2 = ic.defaultPdbId + index;
45624
- // let pdb_query = dataArray[index].value; //[0];
45625
- // let header = 'HEADER ' + struct2 + '\n';
45626
- // pdb_query = header + pdb_query;
45627
- let jsonStr_q = dataArray[index].value; //[0];
45711
+ if(!template) {
45712
+ for(let index = 0, indexl = dataArray.length; index < indexl; ++index) {
45713
+ // let struct2 = ic.defaultPdbId + index;
45714
+ // let pdb_query = dataArray[index].value; //[0];
45715
+ // let header = 'HEADER ' + struct2 + '\n';
45716
+ // pdb_query = header + pdb_query;
45717
+ let jsonStr_q = dataArray[index].value; //[0];
45628
45718
 
45629
- // TM-align is not good when you align a full structure with the strand-only structure. VAST is better in this case.
45630
- // let dataObj = {'pdb_query': pdb_query, 'pdb_target': pdb_target, "queryid": ic.refpdbArray[index]};
45631
- // let alignAjax = me.getAjaxPostPromise(urltmalign, dataObj);
45719
+ // TM-align is not good when you align a full structure with the strand-only structure. VAST is better in this case.
45720
+ // let dataObj = {'pdb_query': pdb_query, 'pdb_target': pdb_target, "queryid": ic.refpdbArray[index]};
45721
+ // let alignAjax = me.getAjaxPostPromise(urltmalign, dataObj);
45632
45722
 
45633
- let dataObj = {'domains1': jsonStr_q, 'domains2': jsonStr_t};
45634
- let alignAjax = me.getAjaxPostPromise(urlalign, dataObj);
45723
+ let dataObj = {'domains1': jsonStr_q, 'domains2': jsonStr_t};
45724
+ let alignAjax = me.getAjaxPostPromise(urlalign, dataObj);
45635
45725
 
45636
- ajaxArray.push(alignAjax);
45637
-
45638
- domainidpairArray.push(domainid + "|" + ic.refpdbArray[index]);
45726
+ ajaxArray.push(alignAjax);
45727
+
45728
+ domainidpairArray.push(domainid + "|" + ic.refpdbArray[index]);
45729
+ }
45730
+ }
45731
+ else {
45732
+ ic.domainid2refpdbname[domainid] = template;
45733
+ domainidpairArray.push(domainid + "|1" + template); // "1" was added for the first round strand-only template
45639
45734
  }
45640
45735
  }
45641
45736
  }
45642
45737
  }
45643
45738
 
45644
45739
  try {
45645
- let dataArray2 = [];
45740
+ if(!template) {
45741
+ let dataArray2 = [];
45646
45742
 
45647
- // let allPromise = Promise.allSettled(ajaxArray);
45648
- // dataArray2 = await allPromise;
45743
+ // let allPromise = Promise.allSettled(ajaxArray);
45744
+ // dataArray2 = await allPromise;
45649
45745
 
45650
- //split arrays into chunks of 96 jobs or me.cfg.maxajax jobs
45651
- let n = (me.cfg.maxajax) ? me.cfg.maxajax : 96;
45746
+ //split arrays into chunks of 96 jobs or me.cfg.maxajax jobs
45747
+ let n = (me.cfg.maxajax) ? me.cfg.maxajax : 96;
45652
45748
 
45653
- for(let i = 0, il = parseInt((ajaxArray.length - 1) / n + 1); i < il; ++i) {
45654
- let currAjaxArray = [];
45655
- if(i == il - 1) { // last one
45656
- currAjaxArray = ajaxArray.slice(i * n, ajaxArray.length);
45657
- }
45658
- else {
45659
- currAjaxArray = ajaxArray.slice(i * n, (i + 1) * n);
45660
- }
45749
+ for(let i = 0, il = parseInt((ajaxArray.length - 1) / n + 1); i < il; ++i) {
45750
+ let currAjaxArray = [];
45751
+ if(i == il - 1) { // last one
45752
+ currAjaxArray = ajaxArray.slice(i * n, ajaxArray.length);
45753
+ }
45754
+ else {
45755
+ currAjaxArray = ajaxArray.slice(i * n, (i + 1) * n);
45756
+ }
45661
45757
 
45662
- let currPromise = Promise.allSettled(currAjaxArray);
45663
- let currDataArray = await currPromise;
45758
+ let currPromise = Promise.allSettled(currAjaxArray);
45759
+ let currDataArray = await currPromise;
45664
45760
 
45665
- dataArray2 = dataArray2.concat(currDataArray);
45761
+ dataArray2 = dataArray2.concat(currDataArray);
45762
+ }
45763
+
45764
+ let bRound1 = true;
45765
+ await thisClass.parseAlignData(dataArray2, domainidpairArray, bRound1);
45766
+
45767
+ /// if(ic.deferredRefnum !== undefined) ic.deferredRefnum.resolve();
45666
45768
  }
45667
-
45668
- let bRound1 = true;
45669
- await thisClass.parseAlignData(dataArray2, domainidpairArray, bRound1);
45769
+ else {
45770
+ if(!me.bNode) console.log("Start alignment with the reference culsters " + JSON.stringify(ic.domainid2refpdbname));
45771
+
45772
+ // start round2
45773
+ let ajaxArray = [];
45774
+ let domainidpairArray3 = [];
45775
+ let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
45776
+
45777
+ let urlpdb = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi?refpdbid=" + template;
45778
+ let pdbAjax = me.getAjaxPromise(urlpdb, 'text');
45779
+ let pdbAjaxArray = [];
45780
+ pdbAjaxArray.push(pdbAjax);
45670
45781
 
45671
- /// if(ic.deferredRefnum !== undefined) ic.deferredRefnum.resolve();
45782
+ let allPromise2 = Promise.allSettled(pdbAjaxArray);
45783
+ ic.pdbDataArray = await allPromise2;
45784
+
45785
+ for(let domainid in ic.domainid2refpdbname) {
45786
+ let refpdbname = ic.domainid2refpdbname[domainid];
45787
+ let chainid = domainid.substr(0, domainid.indexOf('-'));
45788
+
45789
+ let pdb_target = ic.domainid2pdb[domainid];
45790
+ for(let index = 0, indexl = ic.pdbDataArray.length; index < indexl; ++index) {
45791
+ let struct2 = ic.defaultPdbId + index;
45792
+ let pdb_query = ic.pdbDataArray[index].value; //[0];
45793
+
45794
+ let header = 'HEADER ' + struct2 + '\n';
45795
+ pdb_query = header + pdb_query;
45796
+
45797
+ let dataObj = {'pdb_query': pdb_query, 'pdb_target': pdb_target, "queryid": template};
45798
+ let alignAjax = me.getAjaxPostPromise(urltmalign, dataObj);
45799
+ ajaxArray.push(alignAjax);
45800
+
45801
+ //domainidpairArray3.push(domainid + "," + refpdbname);
45802
+ domainidpairArray3.push(domainid + "|" + template);
45803
+ }
45804
+ }
45805
+
45806
+ let dataArray3 = [];
45807
+ let allPromise = Promise.allSettled(ajaxArray);
45808
+ dataArray3 = await allPromise;
45809
+
45810
+ await thisClass.parseAlignData(dataArray3, domainidpairArray3);
45811
+ }
45672
45812
  }
45673
45813
  catch(err) {
45674
45814
  let mess = "Some of " + ajaxArray.length + " TM-align alignments failed. Please select a chain or a subset to assing reference numbers to avoid overloading the server...";
@@ -45680,7 +45820,7 @@ class LineGraph {
45680
45820
  }
45681
45821
  //console.log("Error in aligning with TM-align...");
45682
45822
  return;
45683
- }
45823
+ }
45684
45824
  }
45685
45825
 
45686
45826
  getTemplateList(chainid) { let ic = this.icn3d; ic.icn3dui;
@@ -45790,7 +45930,7 @@ class LineGraph {
45790
45930
  //if(!(bBstrand && bCstrand && bEstrand && bFstrand && bGstrand)) continue;
45791
45931
  if(!(bBstrand && bCstrand && bEstrand && bFstrand)) {
45792
45932
  if(!me.bNode) console.log("Some of the Ig strands B, C, E, F are missing in the domain " + domainid + "...");
45793
- if(ic.domainid2refpdbname[domainid]) delete ic.domainid2refpdbname[domainid];
45933
+ if(ic.domainid2refpdbname[domainid] == refpdbname) delete ic.domainid2refpdbname[domainid];
45794
45934
  continue;
45795
45935
  }
45796
45936
  }
@@ -45876,10 +46016,28 @@ class LineGraph {
45876
46016
  }
45877
46017
 
45878
46018
  let dataArray3 = [];
45879
- let allPromise = Promise.allSettled(ajaxArray);
45880
- dataArray3 = await allPromise;
46019
+ //let allPromise = Promise.allSettled(ajaxArray);
46020
+ //dataArray3 = await allPromise;
46021
+
46022
+ //split arrays into chunks of 96 jobs or me.cfg.maxajax jobs
46023
+ let n = (me.cfg.maxajax) ? me.cfg.maxajax : 96;
46024
+
46025
+ for(let i = 0, il = parseInt((ajaxArray.length - 1) / n + 1); i < il; ++i) {
46026
+ let currAjaxArray = [];
46027
+ if(i == il - 1) { // last one
46028
+ currAjaxArray = ajaxArray.slice(i * n, ajaxArray.length);
46029
+ }
46030
+ else {
46031
+ currAjaxArray = ajaxArray.slice(i * n, (i + 1) * n);
46032
+ }
46033
+
46034
+ let currPromise = Promise.allSettled(currAjaxArray);
46035
+ let currDataArray = await currPromise;
46036
+
46037
+ dataArray3 = dataArray3.concat(currDataArray);
46038
+ }
45881
46039
 
45882
- await thisClass.parseAlignData(dataArray3, domainidpairArray3);
46040
+ await thisClass.parseAlignData(dataArray3, domainidpairArray3, false);
45883
46041
 
45884
46042
  // end of round 2
45885
46043
  return;
@@ -45910,6 +46068,7 @@ class LineGraph {
45910
46068
  if(!ic.chainsMapping) ic.chainsMapping = {};
45911
46069
 
45912
46070
  if(!ic.refPdbList) ic.refPdbList = [];
46071
+
45913
46072
  for(let chainid in chainid2segs) {
45914
46073
  let segArray = chainid2segs[chainid];
45915
46074
 
@@ -50076,15 +50235,15 @@ class Dsn6Parser {
50076
50235
  this.icn3d = icn3d;
50077
50236
  }
50078
50237
 
50079
- dsn6Parser(pdbid, type, sigma) { let ic = this.icn3d; ic.icn3dui;
50238
+ async dsn6Parser(pdbid, type, sigma) { let ic = this.icn3d; ic.icn3dui;
50080
50239
  // https://edmaps.rcsb.org/maps/1kq2_2fofc.dsn6
50081
50240
  // https://edmaps.rcsb.org/maps/1kq2_fofc.dsn6
50082
50241
 
50083
50242
  let url = "https://edmaps.rcsb.org/maps/" + pdbid.toLowerCase() + "_" + type + ".dsn6";
50084
- this.dsn6ParserBase(url, type, sigma);
50243
+ await this.dsn6ParserBase(url, type, sigma);
50085
50244
  }
50086
50245
 
50087
- dsn6ParserBase(url, type, sigma) { let ic = this.icn3d; ic.icn3dui;
50246
+ async dsn6ParserBase(url, type, sigma) { let ic = this.icn3d, me = ic.icn3dui;
50088
50247
  let thisClass = this;
50089
50248
 
50090
50249
  //https://stackoverflow.com/questions/33902299/using-jquery-ajax-to-download-a-binary-file
@@ -50097,37 +50256,17 @@ class Dsn6Parser {
50097
50256
  ic.setOptionCls.setOption('map', type);
50098
50257
  }
50099
50258
  else {
50100
- let oReq = new XMLHttpRequest();
50101
- oReq.open("GET", url, true);
50102
- oReq.responseType = "arraybuffer";
50103
-
50104
- oReq.onreadystatechange = function() {
50105
- if(this.readyState == 4) {
50106
- if(this.status == 200) {
50107
- let arrayBuffer = oReq.response;
50108
- thisClass.loadDsn6Data(arrayBuffer, type, sigma);
50109
-
50110
- if(type == '2fofc') {
50111
- ic.bAjax2fofc = true;
50112
- }
50113
- else if(type == 'fofc') {
50114
- ic.bAjaxfofc = true;
50115
- }
50116
-
50117
- ic.setOptionCls.setOption('map', type);
50118
- }
50119
- else {
50120
- var aaa = 1; //alert("RCSB server has no corresponding eletron density map for this structure.");
50121
- }
50259
+ let arrayBuffer = await me.getXMLHttpRqstPromise(url, 'GET', 'arraybuffer', 'rcsbEdmaps');
50260
+ thisClass.loadDsn6Data(arrayBuffer, type, sigma);
50122
50261
 
50123
- /// if(ic.deferredMap !== undefined) ic.deferredMap.resolve();
50124
- }
50125
- else {
50126
- ic.ParserUtilsCls.showLoading();
50127
- }
50128
- };
50262
+ if(type == '2fofc') {
50263
+ ic.bAjax2fofc = true;
50264
+ }
50265
+ else if(type == 'fofc') {
50266
+ ic.bAjaxfofc = true;
50267
+ }
50129
50268
 
50130
- oReq.send();
50269
+ ic.setOptionCls.setOption('map', type);
50131
50270
  }
50132
50271
  }
50133
50272
 
@@ -50865,6 +51004,11 @@ class MmdbParser {
50865
51004
 
50866
51005
  let color =(molid2rescount[i].color === undefined) ? '#CCCCCC' : '#' +( '000000' + molid2rescount[i].color.toString( 16 ) ).slice( - 6 );
50867
51006
  let chainName =(molid2rescount[i].chain === undefined) ? '' : molid2rescount[i].chain.trim();
51007
+ // remove "_" in chain name
51008
+ if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
51009
+ chainName = chainName.replace(/_/g, '');
51010
+ }
51011
+
50868
51012
  if(chainNameHash[chainName] === undefined) {
50869
51013
  chainNameHash[chainName] = 1;
50870
51014
  }
@@ -53121,7 +53265,7 @@ class DensityCifParser {
53121
53265
  this.icn3d = icn3d;
53122
53266
  }
53123
53267
 
53124
- densityCifParser(pdbid, type, sigma, emd) { let ic = this.icn3d, me = ic.icn3dui;
53268
+ async densityCifParser(pdbid, type, sigma, emd) { let ic = this.icn3d, me = ic.icn3dui;
53125
53269
  let thisClass = this;
53126
53270
 
53127
53271
  let url;
@@ -53151,46 +53295,21 @@ class DensityCifParser {
53151
53295
  ic.setOptionCls.setOption('emmap', type);
53152
53296
  }
53153
53297
  else {
53154
- let oReq = new XMLHttpRequest();
53155
- oReq.open("GET", url, true);
53156
- oReq.responseType = "arraybuffer";
53157
-
53158
- oReq.onreadystatechange = function() {
53159
- if (this.readyState == 4) {
53160
- if(this.status == 200) {
53161
- let arrayBuffer = oReq.response;
53298
+ let arrayBuffer = await me.getXMLHttpRqstPromise(url, 'GET', 'arraybuffer', type);
53162
53299
 
53163
- thisClass.parseChannels(arrayBuffer, type, sigma);
53164
-
53165
- if(type == '2fofc' || type == 'fofc') {
53166
- ic.bAjax2fofc = true;
53167
- ic.bAjaxfofc = true;
53168
-
53169
- ic.setOptionCls.setOption('map', type);
53170
- }
53171
- else if(type == 'em') {
53172
- ic.bAjaxEm = true;
53300
+ thisClass.parseChannels(arrayBuffer, type, sigma);
53173
53301
 
53174
- ic.setOptionCls.setOption('emmap', type);
53175
- }
53176
- }
53177
- else {
53178
- if(type == '2fofc' || type == 'fofc') {
53179
- var aaa = 1; //alert("Density server at EBI has no corresponding electron density map for this structure.");
53180
- }
53181
- else if(type == 'em') {
53182
- var aaa = 1; //alert("Density server at EBI has no corresponding EM density map for this structure.");
53183
- }
53184
- }
53302
+ if(type == '2fofc' || type == 'fofc') {
53303
+ ic.bAjax2fofc = true;
53304
+ ic.bAjaxfofc = true;
53185
53305
 
53186
- /// if(ic.deferredEmmap !== undefined) ic.deferredEmmap.resolve();
53187
- }
53188
- else {
53189
- ic.ParserUtilsCls.showLoading();
53190
- }
53191
- };
53306
+ ic.setOptionCls.setOption('map', type);
53307
+ }
53308
+ else if(type == 'em') {
53309
+ ic.bAjaxEm = true;
53192
53310
 
53193
- oReq.send();
53311
+ ic.setOptionCls.setOption('emmap', type);
53312
+ }
53194
53313
  }
53195
53314
  }
53196
53315
 
@@ -54242,13 +54361,10 @@ class ParserUtils {
54242
54361
 
54243
54362
  getMissingResidues(seqArray, type, chainid) { let ic = this.icn3d, me = ic.icn3dui;
54244
54363
  ic.chainsSeq[chainid] = [];
54245
-
54246
- // find the offset of MMDB sequence
54247
- let offset = 0;
54248
54364
  if(type === 'mmdbid' || type === 'align') {
54249
54365
  for(let i = 0, il = seqArray.length; i < il; ++i) {
54250
54366
  if(seqArray[i][0] != 0) {
54251
- offset = seqArray[i][0] - (i + 1);
54367
+ seqArray[i][0] - (i + 1);
54252
54368
  break;
54253
54369
  }
54254
54370
  }
@@ -54283,14 +54399,12 @@ class ParserUtils {
54283
54399
  resObject.resi = i + 1;
54284
54400
  }
54285
54401
  else {
54286
- //let offset =(ic.chainid2offset[chainid]) ? ic.chainid2offset[chainid] : 0;
54287
-
54288
- if(type === 'mmdbid' || type === 'align') {
54289
- resObject.resi =(seqArray[i][resiPos] == '0') ? i + 1 + offset : seqArray[i][resiPos];
54290
- }
54291
- else {
54402
+ //if(type === 'mmdbid' || type === 'align') {
54403
+ // resObject.resi =(seqArray[i][resiPos] == '0') ? i + 1 + offset : seqArray[i][resiPos];
54404
+ //}
54405
+ //else {
54292
54406
  resObject.resi =(seqArray[i][resiPos] == '0') ? parseInt(prevResi) + 1 : seqArray[i][resiPos];
54293
- }
54407
+ //}
54294
54408
  }
54295
54409
 
54296
54410
  //resObject.resi =(seqArray[i][resiPos] == '0') ? i + 1 + offset : seqArray[i][resiPos];
@@ -55075,6 +55189,12 @@ class LoadAtomData {
55075
55189
  if(Object.keys(data.moleculeInfor[molid]).length === 0) continue;
55076
55190
 
55077
55191
  let chain = data.moleculeInfor[molid].chain.trim();
55192
+
55193
+ // remove "_" in chain name
55194
+ if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
55195
+ chain = chain.replace(/_/g, '');
55196
+ }
55197
+
55078
55198
  let chainid = pdbidTmp + '_' + chain;
55079
55199
 
55080
55200
  if(chainHash.hasOwnProperty(chain)) {
@@ -55220,6 +55340,11 @@ class LoadAtomData {
55220
55340
 
55221
55341
  atm.chain = atm.chain.trim(); //.replace(/_/g, '');
55222
55342
 
55343
+ // remove "_" in chain name
55344
+ if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
55345
+ atm.chain = atm.chain.replace(/_/g, '');
55346
+ }
55347
+
55223
55348
  // mmcif has pre-assigned structure in mmcifparser.cgi output
55224
55349
  if(type === 'mmdbid' || type === 'align') {
55225
55350
  atm.structure = mmdbId;
@@ -61348,10 +61473,14 @@ class LoadScript {
61348
61473
  let bFinalStep =(i === steps - 1) ? true : false;
61349
61474
 
61350
61475
  if(!ic.commands[i].trim()) continue;
61351
- if(!ic.atoms && ic.commands[i].indexOf('load') == -1) continue;
61476
+ let nAtoms = Object.keys(ic.atoms).length;
61477
+
61478
+ if(nAtoms == 0 && ic.commands[i].indexOf('load') == -1) continue;
61352
61479
 
61353
61480
  let strArray = ic.commands[i].split("|||");
61354
61481
  let command = strArray[0].trim();
61482
+
61483
+ if(ic.inputid) ic.bNotLoadStructure = true;
61355
61484
 
61356
61485
  if(command.indexOf('load') !== -1) {
61357
61486
  if(end === 0 && start === end) {
@@ -61440,6 +61569,10 @@ class LoadScript {
61440
61569
  else if(command.indexOf('ig refnum on') == 0 ) {
61441
61570
  await ic.refnumCls.showIgRefNum();
61442
61571
  }
61572
+ else if(command.indexOf('ig template') == 0 ) {
61573
+ let template = command.substr(command.lastIndexOf(' ') + 1);
61574
+ await ic.refnumCls.showIgRefNum(template);
61575
+ }
61443
61576
  else if(command.indexOf('set annotation 3ddomain') == 0) { // the command may have "|||{"factor"...
61444
61577
  if(Object.keys(ic.proteins).length > 0) {
61445
61578
  thisClass.applyCommand3ddomain(strArray[0].trim());
@@ -61613,10 +61746,10 @@ class LoadScript {
61613
61746
  await thisClass.applyCommandLoad(lastCommand);
61614
61747
  }
61615
61748
  else if(lastCommand.indexOf('set map') !== -1 && lastCommand.indexOf('set map wireframe') === -1) {
61616
- thisClass.applyCommandMap(lastCommand);
61749
+ await thisClass.applyCommandMap(lastCommand);
61617
61750
  }
61618
61751
  else if(lastCommand.indexOf('set emmap') !== -1 && lastCommand.indexOf('set emmap wireframe') === -1) {
61619
- thisClass.applyCommandEmmap(lastCommand);
61752
+ await thisClass.applyCommandEmmap(lastCommand);
61620
61753
  }
61621
61754
  else if(lastCommand.indexOf('set phi') !== -1) {
61622
61755
  await ic.delphiCls.applyCommandPhi(lastCommand);
@@ -61886,7 +62019,7 @@ class LoadScript {
61886
62019
  }
61887
62020
 
61888
62021
  //Apply the command to show electron density map.
61889
- applyCommandMap(command) { let ic = this.icn3d; ic.icn3dui;
62022
+ async applyCommandMap(command) { let ic = this.icn3d; ic.icn3dui;
61890
62023
 
61891
62024
  // chain functions together
61892
62025
  // ic.deferredMap = $.Deferred(function() { let ic = thisClass.icn3d;
@@ -61902,10 +62035,10 @@ class LoadScript {
61902
62035
  let type = paraArray[0];
61903
62036
 
61904
62037
  if(urlArray.length == 2) {
61905
- ic.dsn6ParserCls.dsn6ParserBase(urlArray[1], type, sigma);
62038
+ await ic.dsn6ParserCls.dsn6ParserBase(urlArray[1], type, sigma);
61906
62039
  }
61907
62040
  else {
61908
- ic.dsn6ParserCls.dsn6Parser(ic.inputid, type, sigma);
62041
+ await ic.dsn6ParserCls.dsn6Parser(ic.inputid, type, sigma);
61909
62042
  }
61910
62043
  }
61911
62044
  // }); // end of me.deferred = $.Deferred(function() {
@@ -61914,7 +62047,7 @@ class LoadScript {
61914
62047
  }
61915
62048
 
61916
62049
  //Apply the command to show EM density map.
61917
- applyCommandEmmap(command) { let ic = this.icn3d; ic.icn3dui;
62050
+ async applyCommandEmmap(command) { let ic = this.icn3d; ic.icn3dui;
61918
62051
 
61919
62052
  // chain functions together
61920
62053
  // ic.deferredEmmap = $.Deferred(function() { let ic = thisClass.icn3d;
@@ -61925,7 +62058,7 @@ class LoadScript {
61925
62058
  let percentage = paraArray[1];
61926
62059
  let type = 'em';
61927
62060
 
61928
- ic.densityCifParserCls.densityCifParser(ic.inputid, type, percentage, ic.emd);
62061
+ await ic.densityCifParserCls.densityCifParser(ic.inputid, type, percentage, ic.emd);
61929
62062
  }
61930
62063
  // }); // end of me.deferred = $.Deferred(function() {
61931
62064
 
@@ -62257,7 +62390,7 @@ class SelectByCommand {
62257
62390
  // $1,2,3: Structure
62258
62391
  // .A,B,C: chain
62259
62392
  // :5-10,K,chemicals: residues, could be 'proteins', 'nucleotides', 'chemicals', 'ions', and 'water'
62260
- // :ref_1250,anchors,strands,loops: reference numbers 1250, anchor residues (e.g., 2250), residues in strands, residues in loops
62393
+ // :ref_1250,ref_anchors,ref_strands,ref_loops: reference numbers 1250, anchor residues (e.g., 2250), residues in strands, residues in loops
62261
62394
  // @CA,C,C*: atoms
62262
62395
  // wild card * can be used to select all
62263
62396
  //var currHighlightAtoms = {}
@@ -63862,31 +63995,12 @@ class Delphi {
63862
63995
  this.icn3d = icn3d;
63863
63996
  }
63864
63997
 
63865
- CalcPhiUrl(gsize, salt, contour, bSurface, url) { let ic = this.icn3d; ic.icn3dui;
63998
+ async CalcPhiUrl(gsize, salt, contour, bSurface, url) { let ic = this.icn3d, me = ic.icn3dui;
63866
63999
  let thisClass = this;
63867
64000
 
63868
- let oReq = new XMLHttpRequest();
63869
- oReq.open("GET", url, true);
63870
-
63871
- oReq.responseType = "text";
63872
-
63873
- oReq.onreadystatechange = async function() {
63874
- if(this.readyState == 4) {
63875
- if(this.status == 200) {
63876
- let data = oReq.response;
64001
+ let data = await me.getXMLHttpRqstPromise(url, 'GET', 'text', 'PQR');
63877
64002
 
63878
- await thisClass.CalcPhi(gsize, salt, contour, bSurface, data);
63879
- }
63880
- else {
63881
- var aaa = 1; //alert("The PQR file is unavailable...");
63882
- }
63883
- }
63884
- else {
63885
- ic.ParserUtilsCls.showLoading();
63886
- }
63887
- };
63888
-
63889
- oReq.send();
64003
+ await thisClass.CalcPhi(gsize, salt, contour, bSurface, data);
63890
64004
  }
63891
64005
 
63892
64006
  getPdbStr(bNode) { let ic = this.icn3d, me = ic.icn3dui;
@@ -63973,7 +64087,7 @@ class Delphi {
63973
64087
  }
63974
64088
 
63975
64089
  return new Promise(function(resolve, reject) {
63976
- // see full_ui.js for ajaxTransport
64090
+ // see icn3dui.js for ajaxTransport
63977
64091
  $.ajax({
63978
64092
  url: url,
63979
64093
  type: 'POST',
@@ -63997,7 +64111,7 @@ class Delphi {
63997
64111
  });
63998
64112
  }
63999
64113
 
64000
- PhiParser(url, type, contour, bSurface) { let ic = this.icn3d; ic.icn3dui;
64114
+ async PhiParser(url, type, contour, bSurface) { let ic = this.icn3d, me = ic.icn3dui;
64001
64115
  let thisClass = this;
64002
64116
  //var dataType;
64003
64117
 
@@ -64015,49 +64129,32 @@ class Delphi {
64015
64129
  }
64016
64130
  else {
64017
64131
  */
64018
- let oReq = new XMLHttpRequest();
64019
- oReq.open("GET", url, true);
64020
64132
 
64133
+ let responseType;
64021
64134
  if(type == 'phiurl' || type == 'phiurl2') {
64022
- oReq.responseType = "arraybuffer";
64135
+ responseType = "arraybuffer";
64023
64136
  }
64024
64137
  else {
64025
- oReq.responseType = "text";
64138
+ responseType = "text";
64026
64139
  }
64027
64140
 
64028
- oReq.onreadystatechange = function() {
64029
- if(this.readyState == 4) {
64030
- if(this.status == 200) {
64031
- let data = oReq.response;
64141
+ let data = await me.getXMLHttpRqstPromise(url, 'GET', responseType, 'potential');
64032
64142
 
64033
- if(type == 'phiurl' || type == 'phiurl2') {
64034
- thisClass.loadPhiData(data, contour, bSurface);
64035
- }
64036
- else {
64037
- thisClass.loadCubeData(data, contour, bSurface);
64038
- }
64039
-
64040
- ic.bAjaxPhi = true;
64041
-
64042
- if(bSurface) {
64043
- ic.setOptionCls.setOption('phisurface', 'phi');
64044
- }
64045
- else {
64046
- ic.setOptionCls.setOption('phimap', 'phi');
64047
- }
64048
- }
64049
- else {
64050
- var aaa = 1; //alert("The potential file is unavailable...");
64051
- }
64143
+ if(type == 'phiurl' || type == 'phiurl2') {
64144
+ thisClass.loadPhiData(data, contour, bSurface);
64145
+ }
64146
+ else {
64147
+ thisClass.loadCubeData(data, contour, bSurface);
64148
+ }
64052
64149
 
64053
- /// if(ic.deferredPhi !== undefined) ic.deferredPhi.resolve();
64054
- }
64055
- else {
64056
- ic.ParserUtilsCls.showLoading();
64057
- }
64058
- };
64150
+ ic.bAjaxPhi = true;
64059
64151
 
64060
- oReq.send();
64152
+ if(bSurface) {
64153
+ ic.setOptionCls.setOption('phisurface', 'phi');
64154
+ }
64155
+ else {
64156
+ ic.setOptionCls.setOption('phimap', 'phi');
64157
+ }
64061
64158
  // }
64062
64159
  }
64063
64160
 
@@ -64235,7 +64332,7 @@ class Delphi {
64235
64332
  await thisClass.CalcPhiUrl(gsize, salt, contour, bSurface, url);
64236
64333
  }
64237
64334
  else {
64238
- thisClass.PhiParser(url, type, contour, bSurface);
64335
+ await thisClass.PhiParser(url, type, contour, bSurface);
64239
64336
  }
64240
64337
  // }); // end of me.deferred = $.Deferred(function() {
64241
64338
 
@@ -64414,7 +64511,7 @@ class Delphi {
64414
64511
  await this.CalcPhiUrl(gsize, salt, contour, bSurface, url);
64415
64512
  }
64416
64513
  else {
64417
- this.PhiParser(url, type, contour, bSurface);
64514
+ await this.PhiParser(url, type, contour, bSurface);
64418
64515
  }
64419
64516
 
64420
64517
  if(bSurface) {
@@ -69728,14 +69825,7 @@ class ShareLink {
69728
69825
  }
69729
69826
 
69730
69827
  // add time stamp
69731
- let date = new Date();
69732
- let monthStr =(date.getMonth() + 1).toString();
69733
- if(date.getMonth() + 1 < 10) monthStr = '0' + monthStr;
69734
-
69735
- let dateStr = date.getDate().toString();
69736
- if(date.getDate() < 10) dateStr = '0' + dateStr;
69737
-
69738
- let dateAllStr = date.getFullYear().toString() + monthStr + dateStr;
69828
+ let dateAllStr = me.utilsCls.getDateDigitStr();
69739
69829
  if(!bPrevDate) url += 'date=' + dateAllStr + '&';
69740
69830
  url += 'v=' + me.REVISION + '&';
69741
69831
 
@@ -72700,7 +72790,7 @@ class iCn3DUI {
72700
72790
  //even when multiple iCn3D viewers are shown together.
72701
72791
  this.pre = this.cfg.divid + "_";
72702
72792
 
72703
- this.REVISION = '3.28.2';
72793
+ this.REVISION = '3.28.3';
72704
72794
 
72705
72795
  // In nodejs, iCn3D defines "window = {navigator: {}}"
72706
72796
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -73221,6 +73311,44 @@ iCn3DUI.prototype.getMmtfReducedPromise = function(mmtfid) { return new Promi
73221
73311
  });
73222
73312
  };
73223
73313
 
73314
+ iCn3DUI.prototype.getXMLHttpRqstPromise = function(url, dataType, responseType, mapType) { let me = this;
73315
+ return new Promise(function(resolve, reject) {
73316
+ let oReq = new XMLHttpRequest();
73317
+ oReq.open(dataType, url, true);
73318
+ oReq.responseType = responseType;
73319
+
73320
+ oReq.onreadystatechange = function() {
73321
+ if (this.readyState == 4) {
73322
+ if(this.status == 200) {
73323
+ let arrayBuffer = oReq.response;
73324
+ resolve(arrayBuffer);
73325
+ }
73326
+ else {
73327
+ if(mapType == '2fofc' || mapType == 'fofc') {
73328
+ var aaa = 1; //alert("Density server at EBI has no corresponding electron density map for this structure.");
73329
+ }
73330
+ else if(mapType == 'em') {
73331
+ var aaa = 1; //alert("Density server at EBI has no corresponding EM density map for this structure.");
73332
+ }
73333
+ else if(mapType == 'rcsbEdmaps') {
73334
+ var aaa = 1; //alert("RCSB server has no corresponding eletron density map for this structure.");
73335
+ }
73336
+ else {
73337
+ var aaa = 1; //alert("The " + mapType + " file is unavailable...");
73338
+ }
73339
+
73340
+ reject('error');
73341
+ }
73342
+ }
73343
+ else {
73344
+ me.icn3d.ParserUtilsCls.showLoading();
73345
+ }
73346
+ };
73347
+
73348
+ oReq.send();
73349
+ });
73350
+ };
73351
+
73224
73352
  iCn3DUI.prototype.getAjaxPromise = function(url, dataType, beforeSend, alertMess, logMess, complete, bNode) { let me = this;
73225
73353
  // if(!bNode || dataType != 'json') {
73226
73354
  return new Promise(function(resolve, reject) {