icn3d 3.54.0 → 3.54.1

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
@@ -79179,6 +79179,8 @@ class CurveStripArrow {
79179
79179
  let scale = 1.8; // scale of the arrow width
79180
79180
  delta = delta * scale * (ic.axisDIV - cnt) / ic.axisDIV;
79181
79181
 
79182
+ if(!pntsCA[i] || !prevCOArray[i]) continue;
79183
+
79182
79184
  let v = new Vector3$1(pntsCA[i].x + prevCOArray[i].x * delta,
79183
79185
  pntsCA[i].y + prevCOArray[i].y * delta,
79184
79186
  pntsCA[i].z + prevCOArray[i].z * delta);
@@ -79200,7 +79202,7 @@ class CurveStripArrow {
79200
79202
  pntsCA[lastCAIndex].z + prevCOArray[lastCAIndex].z * delta);
79201
79203
 
79202
79204
  pnts[index].push(v);
79203
- colorsTmp.push(colors[i]);
79205
+ colorsTmp.push(colors[lastCAIndex]);
79204
79206
  if(index === 0) posIndex.push(positions[lastCAIndex]);
79205
79207
  }
79206
79208
 
@@ -80833,13 +80835,13 @@ class Tube {
80833
80835
  let maxDist2 = 3.0; // avoid tube between the residues in 3 residue helix
80834
80836
 
80835
80837
  let pnts_colors_radii = [];
80836
- let firstAtom, firstPos, prevAtom, prevPos;
80838
+ let firstAtom, firstPos, atom, prevAtom, prevPos;
80837
80839
  let half = Math.floor(ic.axisDIV / 2) - 1;
80838
80840
 
80839
80841
  for (let i = 0, il = atoms.length; i < il; ++i) {
80840
80842
  let pos = (tubePosArray) ? tubePosArray[i] : undefined;
80841
80843
 
80842
- let atom = atoms[i];
80844
+ atom = atoms[i];
80843
80845
  if ((atom.name === atomName) && !atom.het) {
80844
80846
  if(index == 0) {
80845
80847
  firstAtom = atom;
@@ -80866,7 +80868,61 @@ class Tube {
80866
80868
 
80867
80869
  pnts_colors_radii.push(result);
80868
80870
  }
80869
- else {
80871
+ else {
80872
+ /*
80873
+ if(!isNaN(firstAtom.resi) && !isNaN(prevAtom.resi)) {
80874
+ let prevoneResid = firstAtom.structure + '_' + firstAtom.chain + '_' + (parseInt(firstAtom.resi) - 1).toString();
80875
+ let prevoneCoord = ic.firstAtomObjCls.getAtomCoordFromResi(prevoneResid, atomName);
80876
+ prevone = (prevoneCoord !== undefined) ? [prevoneCoord] : [];
80877
+
80878
+ let nextoneResid = prevAtom.structure + '_' + prevAtom.chain + '_' + (parseInt(prevAtom.resi) + 1).toString();
80879
+ let nexttwoResid = prevAtom.structure + '_' + prevAtom.chain + '_' + (parseInt(prevAtom.resi) + 2).toString();
80880
+ let nextthreeResid = prevAtom.structure + '_' + prevAtom.chain + '_' + (parseInt(prevAtom.resi) + 3).toString();
80881
+
80882
+ if(ic.residues.hasOwnProperty(nextoneResid)) {
80883
+ let nextAtom = ic.firstAtomObjCls.getAtomFromResi(nextoneResid, atomName);
80884
+ if(nextAtom !== undefined && nextAtom.ssbegin) { // include the residue
80885
+ nextoneResid = prevAtom.structure + '_' + prevAtom.chain + '_' + (parseInt(prevAtom.resi) + 2).toString();
80886
+ nexttwoResid = prevAtom.structure + '_' + prevAtom.chain + '_' + (parseInt(prevAtom.resi) + 3).toString();
80887
+
80888
+ pnts.push(nextAtom.coord);
80889
+ if(bCustom) {
80890
+ radii.push(this.getCustomtubesize(nextoneResid));
80891
+ }
80892
+ else {
80893
+ radii.push(this.getRadius(radius, nextAtom));
80894
+ }
80895
+ colors.push(nextAtom.color);
80896
+ }
80897
+ }
80898
+
80899
+ // add one more residue if only one residue is available and it's not part of helix/sheet
80900
+ if(pnts.length == 1 && ic.residues.hasOwnProperty(nextoneResid) && atom.ss == 'coil') {
80901
+ let nextAtom = ic.firstAtomObjCls.getAtomFromResi(nextoneResid, atomName);
80902
+
80903
+ if(nextAtom) {
80904
+ pnts.push(nextAtom.coord);
80905
+ colors.push(nextAtom.color);
80906
+
80907
+ let radiusFinal = this.getRadius(radius, atom);
80908
+ radii.push(radiusFinal);
80909
+
80910
+ nextoneResid = nexttwoResid;
80911
+ nexttwoResid = nextthreeResid;
80912
+ }
80913
+ }
80914
+
80915
+ let nextoneCoord = ic.firstAtomObjCls.getAtomCoordFromResi(nextoneResid, atomName);
80916
+ if(nextoneCoord !== undefined) {
80917
+ nexttwo.push(nextoneCoord);
80918
+ }
80919
+
80920
+ let nexttwoCoord = ic.firstAtomObjCls.getAtomCoordFromResi(nexttwoResid, atomName);
80921
+ if(nexttwoCoord !== undefined) {
80922
+ nexttwo.push(nexttwoCoord);
80923
+ }
80924
+ }
80925
+ */
80870
80926
  pnts_colors_radii.push({'pnts':pnts, 'colors':colors, 'radii':radii});
80871
80927
  }
80872
80928
  }
@@ -80890,6 +80946,24 @@ class Tube {
80890
80946
  }
80891
80947
  }
80892
80948
  else { // b factor, etc
80949
+ /*
80950
+ if(pnts.length == 0 && !isNaN(atom.resi)) {
80951
+ let prevoneResid = atom.structure + '_' + atom.chain + '_' + (parseInt(atom.resi) - 1).toString();
80952
+ if(ic.residues.hasOwnProperty(prevoneResid)) {
80953
+ prevAtom = ic.firstAtomObjCls.getAtomFromResi(prevoneResid, atomName);
80954
+ if(prevAtom !== undefined && prevAtom.ssend) { // include the residue
80955
+ pnts.push(prevAtom.coord);
80956
+ if(bCustom) {
80957
+ radii.push(this.getCustomtubesize(prevoneResid));
80958
+ }
80959
+ else {
80960
+ radii.push(this.getRadius(radius, prevAtom));
80961
+ }
80962
+ colors.push(prevAtom.color);
80963
+ }
80964
+ }
80965
+ }
80966
+ */
80893
80967
  pnts.push(atom.coord);
80894
80968
 
80895
80969
  let radiusFinal;
@@ -80938,6 +81012,47 @@ class Tube {
80938
81012
  }
80939
81013
  }
80940
81014
  else {
81015
+ /*
81016
+ prevone = [];
81017
+ if(firstAtom !== undefined && !isNaN(firstAtom.resi)) {
81018
+ let prevoneResid = firstAtom.structure + '_' + firstAtom.chain + '_' + (parseInt(firstAtom.resi) - 1).toString();
81019
+ let prevoneCoord = ic.firstAtomObjCls.getAtomCoordFromResi(prevoneResid, atomName);
81020
+ prevone = (prevoneCoord !== undefined) ? [prevoneCoord] : [];
81021
+ }
81022
+
81023
+ nexttwo = [];
81024
+ if(atom !== undefined && !isNaN(atom.resi)) {
81025
+ let nextoneResid = atom.structure + '_' + atom.chain + '_' + (parseInt(atom.resi) + 1).toString();
81026
+ let nexttwoResid = atom.structure + '_' + atom.chain + '_' + (parseInt(atom.resi) + 2).toString();
81027
+ let nextthreeResid = atom.structure + '_' + atom.chain + '_' + (parseInt(atom.resi) + 3).toString();
81028
+
81029
+ // add one more residue if only one residue is available
81030
+ if(pnts.length == 1 && ic.residues.hasOwnProperty(nextoneResid)) {
81031
+ let nextAtom = ic.firstAtomObjCls.getAtomFromResi(nextoneResid, atomName);
81032
+
81033
+ if(nextAtom) {
81034
+ pnts.push(nextAtom.coord);
81035
+ colors.push(nextAtom.color);
81036
+
81037
+ let radiusFinal = this.getRadius(radius, atom);
81038
+ radii.push(radiusFinal);
81039
+
81040
+ nextoneResid = nexttwoResid;
81041
+ nexttwoResid = nextthreeResid;
81042
+ }
81043
+ }
81044
+
81045
+ let nextoneCoord = ic.firstAtomObjCls.getAtomCoordFromResi(nextoneResid, atomName);
81046
+ if(nextoneCoord !== undefined) {
81047
+ nexttwo.push(nextoneCoord);
81048
+ }
81049
+
81050
+ let nexttwoCoord = ic.firstAtomObjCls.getAtomCoordFromResi(nexttwoResid, atomName);
81051
+ if(nexttwoCoord !== undefined) {
81052
+ nexttwo.push(nexttwoCoord);
81053
+ }
81054
+ }
81055
+ */
80941
81056
  pnts_colors_radii.push({'pnts':pnts, 'colors':colors, 'radii':radii});
80942
81057
  }
80943
81058
  }
@@ -80947,7 +81062,12 @@ class Tube {
80947
81062
  let colors = pnts_colors_radii[i].colors;
80948
81063
  let radii = pnts_colors_radii[i].radii;
80949
81064
 
80950
- this.createTubeSub(pnts, colors, radii, bHighlight, bNonCoil);
81065
+ if(tubePosArray) {
81066
+ this.createTubeSub(pnts, colors, radii, bHighlight, bNonCoil);
81067
+ }
81068
+ else {
81069
+ this.createTubeSub(pnts, colors, radii, bHighlight, bNonCoil, true);
81070
+ }
80951
81071
  }
80952
81072
 
80953
81073
  pnts_colors_radii = [];
@@ -81006,7 +81126,7 @@ class Tube {
81006
81126
  };
81007
81127
 
81008
81128
  // modified from iview (http://istar.cse.cuhk.edu.hk/iview/)
81009
- createTubeSub(_pnts, colors, radii, bHighlight, bNonCoil) { let ic = this.icn3d, me = ic.icn3dui;
81129
+ createTubeSub(_pnts, colors, radii, bHighlight, bNonCoil, bSubdivide) { let ic = this.icn3d, me = ic.icn3dui;
81010
81130
  if(me.bNode) return;
81011
81131
 
81012
81132
  if (_pnts.length < 2) return;
@@ -81019,8 +81139,8 @@ class Tube {
81019
81139
  let offset = 0, offset2 = 0, offset3 = 0;
81020
81140
 
81021
81141
  let pnts;
81022
- /*
81023
- if(!bSubdivided) {
81142
+
81143
+ if(bSubdivide) {
81024
81144
  let pnts_clrs = me.subdivideCls.subdivide(_pnts, colors, axisDiv);
81025
81145
 
81026
81146
  pnts = pnts_clrs[0];
@@ -81029,8 +81149,6 @@ class Tube {
81029
81149
  else {
81030
81150
  pnts = _pnts;
81031
81151
  }
81032
- */
81033
- pnts = _pnts;
81034
81152
 
81035
81153
  let constRadiius;
81036
81154
  // a threshold to stop drawing the tube if it's less than this ratio of radius
@@ -81513,7 +81631,10 @@ class Strand {
81513
81631
 
81514
81632
  bSheetSegment = prevCoorO ? (ss === 'sheet') : (atom.ss === 'sheet');
81515
81633
  bHelixSegment = prevCoorO ? (ss === 'helix') : (atom.ss === 'helix');
81516
- this.createStrand_base(posArray, pntsAllSub, pntsCAAllSub, prevCOArrayAllSub, colorsAllSub, positionsSub, missingResArray, fill, bHighlight, bRibbon, num, bSheetSegment, bHelixSegment, bFullAtom, thickness);
81634
+ // skip the 2-residue joint between two adjacent SS (sheet end -> helix begin)
81635
+ if(!(ssend && atom.ssbegin)) {
81636
+ this.createStrand_base(posArray, pntsAllSub, pntsCAAllSub, prevCOArrayAllSub, colorsAllSub, positionsSub, missingResArray, fill, bHighlight, bRibbon, num, bSheetSegment, bHelixSegment, bFullAtom, thickness);
81637
+ }
81517
81638
  posArray = [];
81518
81639
  missingResArray = [];
81519
81640
  } // end if (atom.ssbegin || atom.ssend)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.54.0",
3
+ "version": "3.54.1",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {