icn3d 3.25.2 → 3.25.4

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
@@ -15291,7 +15291,7 @@ class SetHtml {
15291
15291
  let matchedStrState = "Start of state file======\n";
15292
15292
  let posState = imageStr.indexOf(matchedStrState);
15293
15293
  if(pos == -1 && posState == -1) {
15294
- var aaa = 1; //alert('Please load a PNG image saved by clicking "Save Datas > PNG Image" in the Data menu...');
15294
+ var aaa = 1; //alert('Please load a PNG image saved by clicking the menu "File > Save File > iCn3D PNG Image"...');
15295
15295
  }
15296
15296
  else if(pos != -1) {
15297
15297
  let url = imageStr.substr(pos + matchedStr.length);
@@ -41922,10 +41922,10 @@ class ShowSeq {
41922
41922
  // sometimes one chain may have several Ig domains,set an index for each IgDomain
41923
41923
  let index = 1, bStart = false;
41924
41924
 
41925
- // get the range of each strand excluding loops
41926
- let strandArray = [], strandHash = {}, strandCnt = 0, resCnt = 0;
41925
+ // 1. get the range of each strand excluding loops
41926
+ let strandArray = [], strandHash = {}, strandCnt = 0, resCnt = 0, resCntBfAnchor = 0;
41927
41927
  if(!bCustom && !kabat_or_imgt) {
41928
- for(let i = 0, il = giSeq.length; i < il; ++i, ++resCnt) {
41928
+ for(let i = 0, il = giSeq.length; i < il; ++i, ++resCnt, ++resCntBfAnchor) {
41929
41929
  let currResi = ic.ParserUtilsCls.getResi(chnid, i);
41930
41930
  let residueid = chnid + '_' + currResi;
41931
41931
  refnumLabel = ic.resid2refnum[residueid];
@@ -41954,6 +41954,8 @@ class ShowSeq {
41954
41954
 
41955
41955
  if(currStrand && currStrand != ' ') {
41956
41956
  if(refnum3c.substr(0,1) != '9') {
41957
+ let lastTwo = parseInt(refnum.toString().substr(refnum.toString().length - 2, 2));
41958
+
41957
41959
  if(currStrand != prevStrand) { // reset currCnt
41958
41960
  if(strandHash[currStrand + postfix]) {
41959
41961
  ++index;
@@ -41965,10 +41967,17 @@ class ShowSeq {
41965
41967
  strandArray[strandCnt] = {};
41966
41968
  strandArray[strandCnt].startResi = currResi;
41967
41969
  strandArray[strandCnt].startRefnum = refnum; // 1250 in A1250a
41970
+
41971
+ resCntBfAnchor = 0;
41968
41972
 
41969
41973
  strandArray[strandCnt].endResi = currResi;
41970
41974
  strandArray[strandCnt].endRefnum = refnum; // 1250a
41971
41975
 
41976
+ if(lastTwo == 50) {
41977
+ strandArray[strandCnt].anchorRefnum = refnum;
41978
+ strandArray[strandCnt].resCntBfAnchor = resCntBfAnchor;
41979
+ }
41980
+
41972
41981
  strandArray[strandCnt].strandPostfix = strandPostfix; // a in A1250a
41973
41982
  strandArray[strandCnt].strand = currStrand; // A in A1250a
41974
41983
 
@@ -41984,6 +41993,11 @@ class ShowSeq {
41984
41993
  strandArray[strandCnt - 1].endResi = currResi;
41985
41994
  strandArray[strandCnt - 1].endRefnum = refnum; // 1250a
41986
41995
 
41996
+ if(lastTwo == 50) {
41997
+ strandArray[strandCnt - 1].anchorRefnum = refnum;
41998
+ strandArray[strandCnt - 1].resCntBfAnchor = resCntBfAnchor;
41999
+ }
42000
+
41987
42001
  resCnt = 0;
41988
42002
  }
41989
42003
  }
@@ -41994,13 +42008,22 @@ class ShowSeq {
41994
42008
  prevStrand = currStrand;
41995
42009
  }
41996
42010
 
42011
+ // 2. remove strands with less than 3 residues
42012
+ for(let il = strandArray.length, i = il - 1; i >= 0; --i) {
42013
+ if(strandArray[i].endRefnum - strandArray[i].startRefnum < 3 - 1) { // remove the strand
42014
+ strandArray.splice(i, 1);
42015
+ }
42016
+ }
42017
+
42018
+ // 3. assign refnumLabel for each resid
41997
42019
  strandCnt = 0;
41998
42020
  let loopCnt = 0;
41999
42021
 
42000
42022
  let bNterminal = true, refnumLabelNoPostfix, prevStrandCnt = 0, currRefnum;
42001
42023
  bStart = false;
42024
+ let refnumInStrand = 0;
42002
42025
  if(strandArray.length > 0) {
42003
- for(let i = 0, il = giSeq.length; i < il; ++i, ++loopCnt) {
42026
+ for(let i = 0, il = giSeq.length; i < il; ++i, ++loopCnt, ++refnumInStrand) {
42004
42027
  let currResi = ic.ParserUtilsCls.getResi(chnid, i);
42005
42028
  let residueid = chnid + '_' + currResi;
42006
42029
  refnumLabel = ic.resid2refnum[residueid];
@@ -42072,6 +42095,15 @@ class ShowSeq {
42072
42095
  else if(parseInt(currResi) >= parseInt(strandArray[strandCnt].startResi) && parseInt(currResi) <= parseInt(strandArray[strandCnt].endResi)) {
42073
42096
  bNterminal = false;
42074
42097
 
42098
+ if(strandArray[strandCnt].anchorRefnum) { // use anchor to name refnum
42099
+ if(currResi == strandArray[strandCnt].startResi) {
42100
+ refnumInStrand = strandArray[strandCnt].anchorRefnum - strandArray[strandCnt].resCntBfAnchor;
42101
+ }
42102
+
42103
+ refnumLabelNoPostfix = strandArray[strandCnt].strand + refnumInStrand;
42104
+ refnumLabel = refnumLabelNoPostfix + strandArray[strandCnt].strandPostfix;
42105
+ }
42106
+
42075
42107
  if(currResi == strandArray[strandCnt].endResi) {
42076
42108
  ++strandCnt; // next strand
42077
42109
  loopCnt = 0;
@@ -44096,7 +44128,11 @@ class GetGraph {
44096
44128
  let fontsize = '6px'; // '6';
44097
44129
  //let html = (bAfMap) ? "<g>" : "<g class='icn3d-node' resid='" + resid + "' >";
44098
44130
  let html = "<g class='icn3d-node' resid='" + resid + "' >";
44099
- html += "<title>" + node.id + "</title>";
44131
+ let title = node.id;
44132
+ if(ic.resid2refnum[resid]) {
44133
+ title += '=>' + ic.resid2refnum[resid];
44134
+ }
44135
+ html += "<title>" + title + "</title>";
44100
44136
  if(bVertical) {
44101
44137
  html += "<circle cx='" + y + "' cy='" + x + "' r='" + r + "' fill='" + color + "' stroke-width='" + strokewidth + "' stroke='" + strokecolor + "' resid='" + resid + "' />";
44102
44138
  html += "<text x='" +(y - 20).toString() + "' y='" +(x + 2).toString() + "' fill='" + textcolor + "' stroke='none' style='font-size:" + fontsize + "; text-anchor:middle' >" + nodeName + "</text>";
@@ -50276,7 +50312,7 @@ class RealignParser {
50276
50312
 
50277
50313
  async realignOnStructAlign() { let ic = this.icn3d, me = ic.icn3dui;
50278
50314
  // each 3D domain should have at least 3 secondary structures
50279
- let minSseCnt = 3;
50315
+ let minSseCnt = (me.cfg.aligntool != 'tmalign') ? 3 : 0;
50280
50316
  let struct2domain = {};
50281
50317
  for(let struct in ic.structures) {
50282
50318
  struct2domain[struct] = {};
@@ -66315,7 +66351,7 @@ class SaveFile {
66315
66351
  if(me.utilsCls.isIE()) {
66316
66352
  blob = ic.renderer.domElement.msToBlob();
66317
66353
 
66318
- if(bAddURL && typeof(blob) == 'Blob') {
66354
+ if(bAddURL) {
66319
66355
  let reader = new FileReader();
66320
66356
  reader.onload = function(e) {
66321
66357
  let arrayBuffer = e.target.result; // or = reader.result;
@@ -66341,7 +66377,7 @@ class SaveFile {
66341
66377
  }
66342
66378
  else {
66343
66379
  ic.renderer.domElement.toBlob(function(data) {
66344
- if(bAddURL && typeof(blob) == 'data') {
66380
+ if(bAddURL) {
66345
66381
  let reader = new FileReader();
66346
66382
  reader.onload = function(e) {
66347
66383
  let arrayBuffer = e.target.result; // or = reader.result;