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.js CHANGED
@@ -78278,6 +78278,8 @@ class CurveStripArrow {
78278
78278
  let scale = 1.8; // scale of the arrow width
78279
78279
  delta = delta * scale * (ic.axisDIV - cnt) / ic.axisDIV;
78280
78280
 
78281
+ if(!pntsCA[i] || !prevCOArray[i]) continue;
78282
+
78281
78283
  let v = new Vector3$1(pntsCA[i].x + prevCOArray[i].x * delta,
78282
78284
  pntsCA[i].y + prevCOArray[i].y * delta,
78283
78285
  pntsCA[i].z + prevCOArray[i].z * delta);
@@ -78299,7 +78301,7 @@ class CurveStripArrow {
78299
78301
  pntsCA[lastCAIndex].z + prevCOArray[lastCAIndex].z * delta);
78300
78302
 
78301
78303
  pnts[index].push(v);
78302
- colorsTmp.push(colors[i]);
78304
+ colorsTmp.push(colors[lastCAIndex]);
78303
78305
  if(index === 0) posIndex.push(positions[lastCAIndex]);
78304
78306
  }
78305
78307
 
@@ -79932,13 +79934,13 @@ class Tube {
79932
79934
  let maxDist2 = 3.0; // avoid tube between the residues in 3 residue helix
79933
79935
 
79934
79936
  let pnts_colors_radii = [];
79935
- let firstAtom, firstPos, prevAtom, prevPos;
79937
+ let firstAtom, firstPos, atom, prevAtom, prevPos;
79936
79938
  let half = Math.floor(ic.axisDIV / 2) - 1;
79937
79939
 
79938
79940
  for (let i = 0, il = atoms.length; i < il; ++i) {
79939
79941
  let pos = (tubePosArray) ? tubePosArray[i] : undefined;
79940
79942
 
79941
- let atom = atoms[i];
79943
+ atom = atoms[i];
79942
79944
  if ((atom.name === atomName) && !atom.het) {
79943
79945
  if(index == 0) {
79944
79946
  firstAtom = atom;
@@ -79965,7 +79967,61 @@ class Tube {
79965
79967
 
79966
79968
  pnts_colors_radii.push(result);
79967
79969
  }
79968
- else {
79970
+ else {
79971
+ /*
79972
+ if(!isNaN(firstAtom.resi) && !isNaN(prevAtom.resi)) {
79973
+ let prevoneResid = firstAtom.structure + '_' + firstAtom.chain + '_' + (parseInt(firstAtom.resi) - 1).toString();
79974
+ let prevoneCoord = ic.firstAtomObjCls.getAtomCoordFromResi(prevoneResid, atomName);
79975
+ prevone = (prevoneCoord !== undefined) ? [prevoneCoord] : [];
79976
+
79977
+ let nextoneResid = prevAtom.structure + '_' + prevAtom.chain + '_' + (parseInt(prevAtom.resi) + 1).toString();
79978
+ let nexttwoResid = prevAtom.structure + '_' + prevAtom.chain + '_' + (parseInt(prevAtom.resi) + 2).toString();
79979
+ let nextthreeResid = prevAtom.structure + '_' + prevAtom.chain + '_' + (parseInt(prevAtom.resi) + 3).toString();
79980
+
79981
+ if(ic.residues.hasOwnProperty(nextoneResid)) {
79982
+ let nextAtom = ic.firstAtomObjCls.getAtomFromResi(nextoneResid, atomName);
79983
+ if(nextAtom !== undefined && nextAtom.ssbegin) { // include the residue
79984
+ nextoneResid = prevAtom.structure + '_' + prevAtom.chain + '_' + (parseInt(prevAtom.resi) + 2).toString();
79985
+ nexttwoResid = prevAtom.structure + '_' + prevAtom.chain + '_' + (parseInt(prevAtom.resi) + 3).toString();
79986
+
79987
+ pnts.push(nextAtom.coord);
79988
+ if(bCustom) {
79989
+ radii.push(this.getCustomtubesize(nextoneResid));
79990
+ }
79991
+ else {
79992
+ radii.push(this.getRadius(radius, nextAtom));
79993
+ }
79994
+ colors.push(nextAtom.color);
79995
+ }
79996
+ }
79997
+
79998
+ // add one more residue if only one residue is available and it's not part of helix/sheet
79999
+ if(pnts.length == 1 && ic.residues.hasOwnProperty(nextoneResid) && atom.ss == 'coil') {
80000
+ let nextAtom = ic.firstAtomObjCls.getAtomFromResi(nextoneResid, atomName);
80001
+
80002
+ if(nextAtom) {
80003
+ pnts.push(nextAtom.coord);
80004
+ colors.push(nextAtom.color);
80005
+
80006
+ let radiusFinal = this.getRadius(radius, atom);
80007
+ radii.push(radiusFinal);
80008
+
80009
+ nextoneResid = nexttwoResid;
80010
+ nexttwoResid = nextthreeResid;
80011
+ }
80012
+ }
80013
+
80014
+ let nextoneCoord = ic.firstAtomObjCls.getAtomCoordFromResi(nextoneResid, atomName);
80015
+ if(nextoneCoord !== undefined) {
80016
+ nexttwo.push(nextoneCoord);
80017
+ }
80018
+
80019
+ let nexttwoCoord = ic.firstAtomObjCls.getAtomCoordFromResi(nexttwoResid, atomName);
80020
+ if(nexttwoCoord !== undefined) {
80021
+ nexttwo.push(nexttwoCoord);
80022
+ }
80023
+ }
80024
+ */
79969
80025
  pnts_colors_radii.push({'pnts':pnts, 'colors':colors, 'radii':radii});
79970
80026
  }
79971
80027
  }
@@ -79989,6 +80045,24 @@ class Tube {
79989
80045
  }
79990
80046
  }
79991
80047
  else { // b factor, etc
80048
+ /*
80049
+ if(pnts.length == 0 && !isNaN(atom.resi)) {
80050
+ let prevoneResid = atom.structure + '_' + atom.chain + '_' + (parseInt(atom.resi) - 1).toString();
80051
+ if(ic.residues.hasOwnProperty(prevoneResid)) {
80052
+ prevAtom = ic.firstAtomObjCls.getAtomFromResi(prevoneResid, atomName);
80053
+ if(prevAtom !== undefined && prevAtom.ssend) { // include the residue
80054
+ pnts.push(prevAtom.coord);
80055
+ if(bCustom) {
80056
+ radii.push(this.getCustomtubesize(prevoneResid));
80057
+ }
80058
+ else {
80059
+ radii.push(this.getRadius(radius, prevAtom));
80060
+ }
80061
+ colors.push(prevAtom.color);
80062
+ }
80063
+ }
80064
+ }
80065
+ */
79992
80066
  pnts.push(atom.coord);
79993
80067
 
79994
80068
  let radiusFinal;
@@ -80037,6 +80111,47 @@ class Tube {
80037
80111
  }
80038
80112
  }
80039
80113
  else {
80114
+ /*
80115
+ prevone = [];
80116
+ if(firstAtom !== undefined && !isNaN(firstAtom.resi)) {
80117
+ let prevoneResid = firstAtom.structure + '_' + firstAtom.chain + '_' + (parseInt(firstAtom.resi) - 1).toString();
80118
+ let prevoneCoord = ic.firstAtomObjCls.getAtomCoordFromResi(prevoneResid, atomName);
80119
+ prevone = (prevoneCoord !== undefined) ? [prevoneCoord] : [];
80120
+ }
80121
+
80122
+ nexttwo = [];
80123
+ if(atom !== undefined && !isNaN(atom.resi)) {
80124
+ let nextoneResid = atom.structure + '_' + atom.chain + '_' + (parseInt(atom.resi) + 1).toString();
80125
+ let nexttwoResid = atom.structure + '_' + atom.chain + '_' + (parseInt(atom.resi) + 2).toString();
80126
+ let nextthreeResid = atom.structure + '_' + atom.chain + '_' + (parseInt(atom.resi) + 3).toString();
80127
+
80128
+ // add one more residue if only one residue is available
80129
+ if(pnts.length == 1 && ic.residues.hasOwnProperty(nextoneResid)) {
80130
+ let nextAtom = ic.firstAtomObjCls.getAtomFromResi(nextoneResid, atomName);
80131
+
80132
+ if(nextAtom) {
80133
+ pnts.push(nextAtom.coord);
80134
+ colors.push(nextAtom.color);
80135
+
80136
+ let radiusFinal = this.getRadius(radius, atom);
80137
+ radii.push(radiusFinal);
80138
+
80139
+ nextoneResid = nexttwoResid;
80140
+ nexttwoResid = nextthreeResid;
80141
+ }
80142
+ }
80143
+
80144
+ let nextoneCoord = ic.firstAtomObjCls.getAtomCoordFromResi(nextoneResid, atomName);
80145
+ if(nextoneCoord !== undefined) {
80146
+ nexttwo.push(nextoneCoord);
80147
+ }
80148
+
80149
+ let nexttwoCoord = ic.firstAtomObjCls.getAtomCoordFromResi(nexttwoResid, atomName);
80150
+ if(nexttwoCoord !== undefined) {
80151
+ nexttwo.push(nexttwoCoord);
80152
+ }
80153
+ }
80154
+ */
80040
80155
  pnts_colors_radii.push({'pnts':pnts, 'colors':colors, 'radii':radii});
80041
80156
  }
80042
80157
  }
@@ -80046,7 +80161,12 @@ class Tube {
80046
80161
  let colors = pnts_colors_radii[i].colors;
80047
80162
  let radii = pnts_colors_radii[i].radii;
80048
80163
 
80049
- this.createTubeSub(pnts, colors, radii, bHighlight, bNonCoil);
80164
+ if(tubePosArray) {
80165
+ this.createTubeSub(pnts, colors, radii, bHighlight, bNonCoil);
80166
+ }
80167
+ else {
80168
+ this.createTubeSub(pnts, colors, radii, bHighlight, bNonCoil, true);
80169
+ }
80050
80170
  }
80051
80171
 
80052
80172
  pnts_colors_radii = [];
@@ -80105,7 +80225,7 @@ class Tube {
80105
80225
  };
80106
80226
 
80107
80227
  // modified from iview (http://istar.cse.cuhk.edu.hk/iview/)
80108
- createTubeSub(_pnts, colors, radii, bHighlight, bNonCoil) { let ic = this.icn3d, me = ic.icn3dui;
80228
+ createTubeSub(_pnts, colors, radii, bHighlight, bNonCoil, bSubdivide) { let ic = this.icn3d, me = ic.icn3dui;
80109
80229
  if(me.bNode) return;
80110
80230
 
80111
80231
  if (_pnts.length < 2) return;
@@ -80118,8 +80238,8 @@ class Tube {
80118
80238
  let offset = 0, offset2 = 0, offset3 = 0;
80119
80239
 
80120
80240
  let pnts;
80121
- /*
80122
- if(!bSubdivided) {
80241
+
80242
+ if(bSubdivide) {
80123
80243
  let pnts_clrs = me.subdivideCls.subdivide(_pnts, colors, axisDiv);
80124
80244
 
80125
80245
  pnts = pnts_clrs[0];
@@ -80128,8 +80248,6 @@ class Tube {
80128
80248
  else {
80129
80249
  pnts = _pnts;
80130
80250
  }
80131
- */
80132
- pnts = _pnts;
80133
80251
 
80134
80252
  let constRadiius;
80135
80253
  // a threshold to stop drawing the tube if it's less than this ratio of radius
@@ -80612,7 +80730,10 @@ class Strand {
80612
80730
 
80613
80731
  bSheetSegment = prevCoorO ? (ss === 'sheet') : (atom.ss === 'sheet');
80614
80732
  bHelixSegment = prevCoorO ? (ss === 'helix') : (atom.ss === 'helix');
80615
- this.createStrand_base(posArray, pntsAllSub, pntsCAAllSub, prevCOArrayAllSub, colorsAllSub, positionsSub, missingResArray, fill, bHighlight, bRibbon, num, bSheetSegment, bHelixSegment, bFullAtom, thickness);
80733
+ // skip the 2-residue joint between two adjacent SS (sheet end -> helix begin)
80734
+ if(!(ssend && atom.ssbegin)) {
80735
+ this.createStrand_base(posArray, pntsAllSub, pntsCAAllSub, prevCOArrayAllSub, colorsAllSub, positionsSub, missingResArray, fill, bHighlight, bRibbon, num, bSheetSegment, bHelixSegment, bFullAtom, thickness);
80736
+ }
80616
80737
  posArray = [];
80617
80738
  missingResArray = [];
80618
80739
  } // end if (atom.ssbegin || atom.ssend)