icn3d 3.40.4 → 3.40.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.module.js CHANGED
@@ -11723,12 +11723,17 @@ class ClickMenu {
11723
11723
  // alert("The url is more than 4000 characters and may not work.");
11724
11724
  //}
11725
11725
  //else {
11726
- url = url.replace("icn3d/full.html?", "icn3d/full2.html?");
11726
+ // url = url.replace("icn3d/full.html?", "icn3d/full2.html?");
11727
+
11728
+ url = url.replace(/icn3d\/full[_\d\.]*\.html\?/, "icn3d/full2.html?");
11729
+
11727
11730
  url = url.replace("icn3d/?", "icn3d/full2.html?");
11731
+
11728
11732
  url += '&closepopup=1';
11729
11733
  let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
11730
11734
  window.open(url, urlTarget);
11731
- thisClass.setLogCmd('side by side | ' + url, true);
11735
+ // thisClass.setLogCmd('side by side | ' + url, true);
11736
+ thisClass.setLogCmd('side by side | ' + url, false);
11732
11737
  //}
11733
11738
  });
11734
11739
 
@@ -34150,7 +34155,6 @@ ElectronMap.prototype.fillvoxels = function(atoms, atomlist) { //(int seqinit,in
34150
34155
  //this.vpAtomID[index] =(this.dataArray[index] >= 0) ? 1 : 0; // determine whether it's positive
34151
34156
  }
34152
34157
  }
34153
-
34154
34158
  }
34155
34159
  }
34156
34160
 
@@ -60542,12 +60546,15 @@ class DensityCifParser {
60542
60546
  let thisClass = this;
60543
60547
 
60544
60548
  let url;
60545
- let detail = (me.utilsCls.isMobile() || me.cfg.notebook) ? 0 : 4; //4;
60549
+ let detail = (me.utilsCls.isMobile() || me.cfg.notebook) ? 2 : 4; //0 : 4;
60546
60550
 
60547
60551
  //https://www.ebi.ac.uk/pdbe/densities/doc.html
60548
60552
  if(type == '2fofc' || type == 'fofc') {
60549
- detail = 0;
60550
- url = "https://www.ebi.ac.uk/pdbe/densities/x-ray/" + pdbid.toLowerCase() + "/cell?detail=" + detail;
60553
+ //detail = 0;
60554
+
60555
+ // url = "https://www.ebi.ac.uk/pdbe/densities/x-ray/" + pdbid.toLowerCase() + "/cell?detail=" + detail;
60556
+ let min_max = ic.contactCls.getExtent(ic.atoms);
60557
+ url = "https://www.ebi.ac.uk/pdbe/volume-server/x-ray/" + pdbid.toLowerCase() + "/box/" + min_max[0][0] + "," + min_max[0][1] + "," + min_max[0][2] + "/" + min_max[1][0] + "," + min_max[1][1] + "," + min_max[1][2] + "?detail=" + detail;
60551
60558
  }
60552
60559
  else if(type == 'em') {
60553
60560
  url = "https://www.ebi.ac.uk/pdbe/densities/emd/" + emd.toLowerCase() + "/cell?detail=" + detail;
@@ -60620,6 +60627,33 @@ class DensityCifParser {
60620
60627
  // return sigma;
60621
60628
  }
60622
60629
 
60630
+ setMatrix(density) { let ic = this.icn3d; ic.icn3dui;
60631
+ let sampleCount = density.box.sampleCount;
60632
+ let header = {xExtent: sampleCount[0], yExtent: sampleCount[1], zExtent: sampleCount[2], mean: density.valuesInfo.mean, sigma: density.valuesInfo.sigma, max: density.valuesInfo.max, min: density.valuesInfo.min};
60633
+ for(let i = 0; i < density.data.length; ++i) {
60634
+ density.data[i];
60635
+ }
60636
+
60637
+ let origin = density.box.origin;
60638
+ let dimensions = density.box.dimensions;
60639
+ let basis = density.spacegroup.basis;
60640
+ let scale = new THREE.Matrix4().makeScale(
60641
+ dimensions[0] / (sampleCount[0] ),
60642
+ dimensions[1] / (sampleCount[1] ),
60643
+ dimensions[2] / (sampleCount[2] ));
60644
+ let translate = new THREE.Matrix4().makeTranslation(origin[0], origin[1], origin[2]);
60645
+ let fromFrac = new THREE.Matrix4().set(
60646
+ basis.x[0], basis.y[0], basis.z[0], 0.0,
60647
+ 0.0, basis.y[1], basis.z[1], 0.0,
60648
+ 0.0, 0.0, basis.z[2], 0.0,
60649
+ 0.0, 0.0, 0.0, 1.0);
60650
+
60651
+ //var toFrac = new LiteMol.Visualization.THREE.Matrix4().getInverse(fromFrac);
60652
+ let matrix = fromFrac.multiply(translate).multiply(scale);
60653
+
60654
+ return {matrix: matrix, header: header};
60655
+ }
60656
+
60623
60657
  parseChannels(densitydata, type, sigma) { let ic = this.icn3d; ic.icn3dui;
60624
60658
  let cif = this.BinaryParse(densitydata);
60625
60659
 
@@ -60629,92 +60663,35 @@ class DensityCifParser {
60629
60663
 
60630
60664
  // '2fofc'
60631
60665
  let density = twoDensity;
60632
- let sampleCount = density.box.sampleCount;
60633
- let header = {xExtent: sampleCount[0], yExtent: sampleCount[1], zExtent: sampleCount[2], mean: density.valuesInfo.mean, sigma: density.valuesInfo.sigma};
60634
- ic.mapData.header2 = header;
60635
-
60636
- ic.mapData.data2 = density.data;
60637
- for(let i = 0; i < density.data.length; ++i) {
60638
- density.data[i];
60639
- }
60640
-
60641
- let origin = density.box.origin;
60642
- let dimensions = density.box.dimensions;
60643
- let basis = density.spacegroup.basis;
60644
- let scale = new THREE.Matrix4().makeScale(
60645
- dimensions[0] / (sampleCount[0] ),
60646
- dimensions[1] / (sampleCount[1] ),
60647
- dimensions[2] / (sampleCount[2] ));
60648
- let translate = new THREE.Matrix4().makeTranslation(origin[0], origin[1], origin[2]);
60649
- let fromFrac = new THREE.Matrix4().set(
60650
- basis.x[0], basis.y[0], basis.z[0], 0.0,
60651
- 0.0, basis.y[1], basis.z[1], 0.0,
60652
- 0.0, 0.0, basis.z[2], 0.0,
60653
- 0.0, 0.0, 0.0, 1.0);
60654
-
60655
- //var toFrac = new LiteMol.Visualization.THREE.Matrix4().getInverse(fromFrac);
60656
- let matrix = fromFrac.multiply(translate).multiply(scale);
60666
+ let result = this.setMatrix(density);
60657
60667
 
60658
- ic.mapData.matrix2 = matrix;
60668
+ ic.mapData.matrix2 = result.matrix;
60669
+ ic.mapData.header2 = result.header;
60659
60670
 
60671
+ ic.mapData.data2 = density.data;
60660
60672
  ic.mapData.type2 = type;
60661
60673
  ic.mapData.sigma2 = sigma;
60662
60674
 
60663
60675
  // 'fofc'
60664
60676
  density = oneDensity;
60665
- sampleCount = density.box.sampleCount;
60666
- header = {xExtent: sampleCount[0], yExtent: sampleCount[1], zExtent: sampleCount[2], mean: density.valuesInfo.mean, sigma: density.valuesInfo.sigma};
60667
- ic.mapData.header = header;
60677
+ result = this.setMatrix(density);
60668
60678
 
60669
- ic.mapData.data = density.data;
60670
-
60671
- origin = density.box.origin;
60672
- dimensions = density.box.dimensions;
60673
- basis = density.spacegroup.basis;
60674
-
60675
- scale = new THREE.Matrix4().makeScale(
60676
- dimensions[0] / (sampleCount[0] ),
60677
- dimensions[1] / (sampleCount[1] ),
60678
- dimensions[2] / (sampleCount[2] ));
60679
- translate = new THREE.Matrix4().makeTranslation(origin[0], origin[1], origin[2]);
60680
- fromFrac = new THREE.Matrix4().set(
60681
- basis.x[0], basis.y[0], basis.z[0], 0.0,
60682
- 0.0, basis.y[1], basis.z[1], 0.0,
60683
- 0.0, 0.0, basis.z[2], 0.0,
60684
- 0.0, 0.0, 0.0, 1.0);
60685
- //var toFrac = new LiteMol.Visualization.THREE.Matrix4().getInverse(fromFrac);
60686
- matrix = fromFrac.multiply(translate).multiply(scale);
60687
- ic.mapData.matrix = matrix;
60679
+ ic.mapData.matrix = result.matrix;
60680
+ ic.mapData.header = result.header;
60688
60681
 
60682
+ ic.mapData.data = density.data;
60689
60683
  ic.mapData.type = type;
60690
60684
  ic.mapData.sigma = sigma;
60691
60685
  }
60692
60686
  else if(type == 'em') {
60693
60687
  let density = this.getChannel(cif, 'EM');
60694
60688
 
60695
- let sampleCount = density.box.sampleCount;
60696
- let header = {xExtent: sampleCount[0], yExtent: sampleCount[1], zExtent: sampleCount[2], max: density.valuesInfo.max, min: density.valuesInfo.min};
60697
- ic.mapData.headerEm = header;
60698
-
60699
- ic.mapData.dataEm = density.data;
60689
+ let result = this.setMatrix(density);
60700
60690
 
60701
- let origin = density.box.origin;
60702
- let dimensions = density.box.dimensions;
60703
- let basis = density.spacegroup.basis;
60704
- let scale = new THREE.Matrix4().makeScale(
60705
- dimensions[0] / (sampleCount[0] ),
60706
- dimensions[1] / (sampleCount[1] ),
60707
- dimensions[2] / (sampleCount[2] ));
60708
- let translate = new THREE.Matrix4().makeTranslation(origin[0], origin[1], origin[2]);
60709
- let fromFrac = new THREE.Matrix4().set(
60710
- basis.x[0], basis.y[0], basis.z[0], 0.0,
60711
- 0.0, basis.y[1], basis.z[1], 0.0,
60712
- 0.0, 0.0, basis.z[2], 0.0,
60713
- 0.0, 0.0, 0.0, 1.0);
60714
- //var toFrac = new LiteMol.Visualization.THREE.Matrix4().getInverse(fromFrac);
60715
- let matrix = fromFrac.multiply(translate).multiply(scale);
60716
- ic.mapData.matrixEm = matrix;
60691
+ ic.mapData.matrixEm = result.matrix;
60692
+ ic.mapData.headerEm = result.header;
60717
60693
 
60694
+ ic.mapData.dataEm = density.data;
60718
60695
  ic.mapData.typeEm = type;
60719
60696
  ic.mapData.sigmaEm = sigma;
60720
60697
  }
@@ -79907,6 +79884,8 @@ class SaveFile {
79907
79884
  for(let i = 0, il = residueArray.length; i < il; ++i) {
79908
79885
  let resid = residueArray[i];
79909
79886
  let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
79887
+ if(!atom) continue;
79888
+
79910
79889
  let chainid = atom.structure + '_' + atom.chain;
79911
79890
  let resnAbbr = me.utilsCls.residueName2Abbr(atom.resn);
79912
79891
  let resName = resnAbbr + atom.resi;
@@ -83887,7 +83866,7 @@ class iCn3DUI {
83887
83866
  //even when multiple iCn3D viewers are shown together.
83888
83867
  this.pre = this.cfg.divid + "_";
83889
83868
 
83890
- this.REVISION = '3.40.3';
83869
+ this.REVISION = '3.40.5';
83891
83870
 
83892
83871
  // In nodejs, iCn3D defines "window = {navigator: {}}"
83893
83872
  this.bNode = (Object.keys(window).length < 2) ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.40.4",
3
+ "version": "3.40.5",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {