icn3d 3.31.0 → 3.31.2

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
@@ -8933,7 +8933,7 @@ class ClickMenu {
8933
8933
  });
8934
8934
 
8935
8935
  me.myEventCls.onIds("#" + me.pre + "mn1_mmtfid", "click", function(e) { me.icn3d; //e.preventDefault();
8936
- me.htmlCls.dialogCls.openDlg('dl_mmtfid', 'Please input MMTF ID');
8936
+ me.htmlCls.dialogCls.openDlg('dl_mmtfid', 'Please input BCIF/MMTF ID');
8937
8937
  });
8938
8938
 
8939
8939
  // clkMn1_pdbid: function() {
@@ -11659,7 +11659,7 @@ class SetMenu {
11659
11659
 
11660
11660
  html += this.getLink('mn1_mmdbafid', 'PDB/MMDB/AlphaFold IDs' + me.htmlCls.wifiStr, 1, 2);
11661
11661
  html += this.getLink('mn1_mmdbid', 'NCBI MMDB ID (annotation) ' + me.htmlCls.wifiStr, undefined, 2);
11662
- html += this.getLink('mn1_mmtfid', 'RCSB MMTF ID (fast) ' + me.htmlCls.wifiStr, undefined, 2);
11662
+ html += this.getLink('mn1_mmtfid', 'RCSB BCIF/MMTF ID (fast) ' + me.htmlCls.wifiStr, undefined, 2);
11663
11663
  html += this.getLink('mn1_pdbid', 'RCSB PDB ID ' + me.htmlCls.wifiStr, undefined, 2);
11664
11664
 
11665
11665
  html += this.getMenuText('mn1_afwrap', 'AlphaFold Structures', undefined, undefined, 2);
@@ -13821,8 +13821,8 @@ class SetDialog {
13821
13821
  html += "</div>";
13822
13822
 
13823
13823
  html += me.htmlCls.divStr + "dl_mmtfid' class='" + dialogClass + "'>";
13824
- html += this.addNotebookTitle('dl_mmtfid', 'Please input an MMTF ID');
13825
- html += "MMTF ID: " + me.htmlCls.inputTextStr + "id='" + me.pre + "mmtfid' value='1TUP' size=8> ";
13824
+ html += this.addNotebookTitle('dl_mmtfid', 'Please input an BCIF/MMTF ID');
13825
+ html += "BCIF/MMTF ID: " + me.htmlCls.inputTextStr + "id='" + me.pre + "mmtfid' value='1TUP' size=8> ";
13826
13826
  html += me.htmlCls.buttonStr + "reload_mmtf'>Load</button>";
13827
13827
  html += "</div>";
13828
13828
 
@@ -15826,9 +15826,9 @@ class Events {
15826
15826
  me.myEventCls.onIds("#" + me.pre + "reload_mmtf", "click", function(e) { let ic = me.icn3d;
15827
15827
  e.preventDefault();
15828
15828
  if(!me.cfg.notebook) dialog.dialog( "close" );
15829
- thisClass.setLogCmd("load mmtf " + $("#" + me.pre + "mmtfid").val(), false);
15829
+ thisClass.setLogCmd("load bcif " + $("#" + me.pre + "mmtfid").val(), false);
15830
15830
  let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
15831
- window.open(hostUrl + '?mmtfid=' + $("#" + me.pre + "mmtfid").val(), urlTarget);
15831
+ window.open(hostUrl + '?bcifid=' + $("#" + me.pre + "mmtfid").val(), urlTarget);
15832
15832
  });
15833
15833
 
15834
15834
  me.myEventCls.onIds("#" + me.pre + "mmtfid", "keyup", function(e) { let ic = me.icn3d;
@@ -16925,6 +16925,7 @@ class Events {
16925
16925
  thisClass.setLogCmd('load mmcif file ' + $("#" + me.pre + "mmciffile").val(), false);
16926
16926
  ic.molTitle = "";
16927
16927
 
16928
+ /*
16928
16929
  // let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
16929
16930
  // //ic.bCid = undefined;
16930
16931
 
@@ -16942,6 +16943,19 @@ class Events {
16942
16943
  ic.InputfileType = 'mmcif';
16943
16944
  // await ic.mmcifParserCls.loadMmcifData(data);
16944
16945
  await ic.opmParserCls.loadOpmData(dataStr, undefined, undefined, 'mmcif', undefined, bText);
16946
+ */
16947
+
16948
+ let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
16949
+
16950
+ let dataObj = {'mmciffile': dataStr};
16951
+ let data = await me.getAjaxPostPromise(url, dataObj, true);
16952
+
16953
+ //ic.initUI();
16954
+ ic.init();
16955
+ ic.bInputfile = true;
16956
+ ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + data : data;
16957
+ ic.InputfileType = 'mmcif';
16958
+ await ic.mmcifParserCls.loadMmcifData(data);
16945
16959
  };
16946
16960
  reader.readAsText(file);
16947
16961
  }
@@ -40846,10 +40860,7 @@ class AnnoIg {
40846
40860
  html3 += result.html3;
40847
40861
 
40848
40862
  let kabat_or_imgt = 1;
40849
- if(!bKabatFound) {
40850
- return {html: html, html2: html2, html3: html3};
40851
- }
40852
- else {
40863
+ if(bKabatFound) {
40853
40864
  result = this.showRefNum(giSeq, chnid, kabat_or_imgt);
40854
40865
  html += result.html;
40855
40866
  html2 += result.html2;
@@ -40857,10 +40868,7 @@ class AnnoIg {
40857
40868
  }
40858
40869
 
40859
40870
  kabat_or_imgt = 2;
40860
- if(!bImgtFound) {
40861
- return {html: html, html2: html2, html3: html3};
40862
- }
40863
- else {
40871
+ if(bImgtFound) {
40864
40872
  result = this.showRefNum(giSeq, chnid, kabat_or_imgt);
40865
40873
  html += result.html;
40866
40874
  html2 += result.html2;
@@ -40874,13 +40882,57 @@ class AnnoIg {
40874
40882
  let bResult = ic.chainid2igtrack[chnid];
40875
40883
  if(!bResult) return {html: '', html2: '', html3: ''};
40876
40884
 
40885
+ let html = this.getIgAnnoHtml(chnid, giSeq, bCustom, kabat_or_imgt);
40886
+
40877
40887
  // add color to atoms
40878
40888
  if(ic.bShowRefnum) {
40879
40889
  ic.opts.color = 'ig strand';
40880
- ic.setColorCls.setColorByOptions(ic.opts, ic.dAtoms);
40890
+ // ic.setColorCls.setColorByOptions(ic.opts, ic.dAtoms);
40891
+ ic.setColorCls.setColorByOptions(ic.opts, ic.chains[chnid]);
40881
40892
  }
40882
40893
 
40883
- return this.getIgAnnoHtml(chnid, giSeq, bCustom, kabat_or_imgt);
40894
+ return html;
40895
+ }
40896
+
40897
+ setChain2igArray(chnid, giSeq, bCustom) { let ic = this.icn3d; ic.icn3dui;
40898
+ let refnumLabel;
40899
+
40900
+ let domainid2respos = {};
40901
+ for(let i = 0, il = giSeq.length; i < il; ++i) {
40902
+ let currResi = ic.ParserUtilsCls.getResi(chnid, i);
40903
+ let residueid = chnid + '_' + currResi;
40904
+ let domainid = (bCustom) ? 0 : ic.resid2domainid[residueid];
40905
+
40906
+ refnumLabel = ic.resid2refnum[residueid];
40907
+
40908
+ if(refnumLabel) {
40909
+ if(!domainid2respos[domainid]) domainid2respos[domainid] = [];
40910
+ domainid2respos[domainid].push(i);
40911
+ }
40912
+ }
40913
+
40914
+ for(let domainid in domainid2respos) {
40915
+ let posArray = domainid2respos[domainid];
40916
+ let pos, prevPos, startPosArray = [], endPosArray = [];
40917
+ for(let i = 0, il = posArray.length; i < il; ++i) {
40918
+ pos = posArray[i];
40919
+ if(i == 0) startPosArray.push(pos);
40920
+
40921
+ if(i > 0 && pos != prevPos + 1) { // a new range
40922
+ endPosArray.push(prevPos);
40923
+ startPosArray.push(pos);
40924
+ }
40925
+
40926
+ prevPos = pos;
40927
+ }
40928
+ endPosArray.push(pos);
40929
+
40930
+ let igElem = {};
40931
+ igElem.domainid = domainid;
40932
+ igElem.startPosArray = startPosArray;
40933
+ igElem.endPosArray = endPosArray;
40934
+ ic.chain2igArray[chnid].push(igElem);
40935
+ }
40884
40936
  }
40885
40937
 
40886
40938
  getIgAnnoHtml(chnid, giSeq, bCustom, kabat_or_imgt) { let ic = this.icn3d, me = ic.icn3dui;
@@ -40888,13 +40940,91 @@ class AnnoIg {
40888
40940
  let type = 'ig';
40889
40941
 
40890
40942
  if(!ic.chain2igArray) ic.chain2igArray = {};
40891
- ic.chain2igArray[chnid] = [];
40892
40943
 
40893
40944
  let bLoop = false, currStrand = '';
40894
40945
  let refnumLabel, refnumStr_ori, refnumStr;
40895
40946
 
40947
+ ic.chain2igArray[chnid] = [];
40948
+ this.setChain2igArray(chnid, giSeq, bCustom);
40949
+
40950
+ // remove Igs without BCEF strands one more time
40951
+ let igArray = ic.chain2igArray[chnid];
40952
+
40953
+ for(let i = 0, il = igArray.length; i < il; ++i) {
40954
+ let domainid = igArray[i].domainid;
40955
+ let info = ic.domainid2info[domainid];
40956
+ if(!info) continue;
40957
+
40958
+ let bBStrand = false, bCStrand = false, bEStrand = false, bFStrand = false;
40959
+
40960
+ let residHash = {};
40961
+ for(let j = 0, jl = igArray[i].startPosArray.length; j < jl; ++j) {
40962
+ let startPos = igArray[i].startPosArray[j];
40963
+ let endPos = igArray[i].endPosArray[j];
40964
+ for(let k = startPos; k <= endPos; ++k) {
40965
+ const resid = chnid + '_' + ic.chainsSeq[chnid][k].resi;
40966
+ residHash[resid] = 1;
40967
+ let refnum = ic.resid2refnum[resid];
40968
+
40969
+ if(refnum) {
40970
+ if(refnum.indexOf('B2550') != -1) bBStrand = true;
40971
+ if(refnum.indexOf('C3550') != -1) bCStrand = true;
40972
+ if(refnum.indexOf('E7550') != -1) bEStrand = true;
40973
+ if(refnum.indexOf('F8550') != -1) bFStrand = true;
40974
+ }
40975
+ }
40976
+ }
40977
+
40978
+ if(!(bBStrand && bCStrand && bEStrand && bFStrand)) {
40979
+ // reset for these residues
40980
+ for(let resid in residHash) {
40981
+ delete ic.resid2refnum[resid];
40982
+ delete ic.residIgLoop[resid];
40983
+ delete ic.resid2domainid[resid];
40984
+ }
40985
+
40986
+ let residArray = Object.keys(residHash);
40987
+
40988
+ // delete the following loops
40989
+ let lastPos = ic.setSeqAlignCls.getPosFromResi(chnid, residArray[residArray.length - 1].split('_')[2]);
40990
+
40991
+ for(let j = lastPos + 1, jl = ic.chainsSeq[chnid].length; j < jl; ++j) {
40992
+ let resi = ic.chainsSeq[chnid][j].resi;
40993
+ let resid = chnid + '_' + resi;
40994
+ if(ic.residIgLoop.hasOwnProperty(resid)) {
40995
+ delete ic.resid2refnum[resid];
40996
+ delete ic.residIgLoop[resid];
40997
+ delete ic.resid2domainid[resid];
40998
+ }
40999
+ else {
41000
+ break;
41001
+ }
41002
+ }
41003
+
41004
+ // delete the previous loops
41005
+ ic.setSeqAlignCls.getPosFromResi(chnid, residArray[0].split('_')[2]);
41006
+
41007
+ for(let j = lastPos - 1; j >= 0; --j) {
41008
+ let resi = ic.chainsSeq[chnid][j].resi;
41009
+ let resid = chnid + '_' + resi;
41010
+ if(ic.residIgLoop.hasOwnProperty(resid)) {
41011
+ delete ic.resid2refnum[resid];
41012
+ delete ic.residIgLoop[resid];
41013
+ delete ic.resid2domainid[resid];
41014
+ }
41015
+ else {
41016
+ break;
41017
+ }
41018
+ }
41019
+ }
41020
+ }
41021
+
41022
+ // reset ic.chain2igArray
41023
+ ic.chain2igArray[chnid] = [];
41024
+ this.setChain2igArray(chnid, giSeq, bCustom);
41025
+
40896
41026
  // show tracks
40897
- let domainid2respos = {};
41027
+ // let domainid2respos = {};
40898
41028
  let htmlIg = '';
40899
41029
  for(let i = 0, il = giSeq.length; i < il; ++i) {
40900
41030
  htmlIg += ic.showSeqCls.insertGap(chnid, i, '-');
@@ -40911,9 +41041,9 @@ class AnnoIg {
40911
41041
  let bHidelabel = false;
40912
41042
 
40913
41043
  if(refnumLabel) {
40914
- if(!domainid2respos[domainid]) domainid2respos[domainid] = [];
40915
- domainid2respos[domainid].push(i);
40916
-
41044
+ // if(!domainid2respos[domainid]) domainid2respos[domainid] = [];
41045
+ // domainid2respos[domainid].push(i);
41046
+
40917
41047
  refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
40918
41048
  currStrand = refnumLabel.replace(new RegExp(refnumStr_ori,'g'), '');
40919
41049
 
@@ -40983,32 +41113,6 @@ class AnnoIg {
40983
41113
  //}
40984
41114
  }
40985
41115
 
40986
- // igElem.endPos = prevPos;
40987
- // ic.chain2igArray[chnid].push(igElem);
40988
-
40989
- for(let domainid in domainid2respos) {
40990
- let posArray = domainid2respos[domainid];
40991
- let pos, prevPos, startPosArray = [], endPosArray = [];
40992
- for(let i = 0, il = posArray.length; i < il; ++i) {
40993
- pos = posArray[i];
40994
- if(i == 0) startPosArray.push(pos);
40995
-
40996
- if(i > 0 && pos != prevPos + 1) { // a new range
40997
- endPosArray.push(prevPos);
40998
- startPosArray.push(pos);
40999
- }
41000
-
41001
- prevPos = pos;
41002
- }
41003
- endPosArray.push(pos);
41004
-
41005
- let igElem = {};
41006
- igElem.domainid = domainid;
41007
- igElem.startPosArray = startPosArray;
41008
- igElem.endPosArray = endPosArray;
41009
- ic.chain2igArray[chnid].push(igElem);
41010
- }
41011
-
41012
41116
  if(me.bNode) return {html: html, html2: html2, html3: html3}
41013
41117
  let titleSpace = 120;
41014
41118
 
@@ -41066,7 +41170,8 @@ class AnnoIg {
41066
41170
  html += '</div>';
41067
41171
  html += '</div>';
41068
41172
 
41069
- let igArray = ic.chain2igArray[chnid];
41173
+ // use the updated ic.chain2igArray
41174
+ igArray = ic.chain2igArray[chnid];
41070
41175
 
41071
41176
  if(igArray.length == 0) return {html: html, html2: html2, html3: html3}
41072
41177
  let rangeArray = [], titleArray = [], fullTitleArray = [], domainArray = [];
@@ -41077,14 +41182,10 @@ class AnnoIg {
41077
41182
  if(!info) continue;
41078
41183
 
41079
41184
  let tmscore = info.score;
41080
- // let igType = ic.ref2igtype[info.refpdbname];
41081
- // let confidance = (parseFloat(tmscore) < 0.75 ) ? '?' : '';
41082
- // titleArray.push(igType + confidance + ' (TM:' + parseFloat(tmscore).toFixed(2) + ')');
41083
- // fullTitleArray.push(igType + confidance + ' (TM:' + parseFloat(tmscore).toFixed(2) + '), template: ' + info.refpdbname + ', Seq. identity: ' + parseFloat(info.seqid).toFixed(2) + ', aligned residues: ' + info.nresAlign);
41084
41185
 
41085
41186
  let igType = (parseFloat(tmscore) < ic.refnumCls.TMThreshold ) ? 'Ig' : ic.ref2igtype[info.refpdbname];
41086
41187
  titleArray.push(igType + ' (TM:' + parseFloat(tmscore).toFixed(2) + ')');
41087
- fullTitleArray.push(igType + ' (TM:' + parseFloat(tmscore).toFixed(2) + '), template: ' + info.refpdbname + ', Seq. identity: ' + parseFloat(info.seqid).toFixed(2) + ', aligned residues: ' + info.nresAlign);
41188
+ fullTitleArray.push(igType + ' (TM:' + parseFloat(tmscore).toFixed(2) + '), template: ' + info.refpdbname + ', type: ' + ic.ref2igtype[info.refpdbname] + ' Seq. identity: ' + parseFloat(info.seqid).toFixed(2) + ', aligned residues: ' + info.nresAlign);
41088
41189
 
41089
41190
  domainArray.push(igType);
41090
41191
 
@@ -41097,7 +41198,7 @@ class AnnoIg {
41097
41198
  rangeArray.push(range);
41098
41199
  }
41099
41200
 
41100
- if(titleArray.length == 0) return {html: html, html2: html2, html3: html3}
41201
+ if(rangeArray.length == 0) return {html: html, html2: html2, html3: html3}
41101
41202
 
41102
41203
  // add tracks for the summary view
41103
41204
  if(!kabat_or_imgt && !bCustom) {
@@ -46133,6 +46234,15 @@ class Annotation {
46133
46234
  }
46134
46235
 
46135
46236
  async updateIg(bSelection, template) { let ic = this.icn3d, me = ic.icn3dui;
46237
+ if(bSelection) { // clear previous refnum
46238
+ let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(ic.hAtoms);
46239
+ for(let resid in residueHash) {
46240
+ if(ic.resid2refnum) delete ic.resid2refnum[resid];
46241
+ if(ic.residIgLoop) delete ic.residIgLoop[resid];
46242
+ if(ic.resid2domainid) delete ic.resid2domainid[resid];
46243
+ }
46244
+ }
46245
+
46136
46246
  // if(!ic.bIgShown) {
46137
46247
  if(!bSelection && !template) {
46138
46248
  // select all protein chains
@@ -47457,13 +47567,6 @@ class ShowSeq {
47457
47567
  html += '</div>';
47458
47568
  html3 += '</div></div>';
47459
47569
  }
47460
-
47461
- // if(ic.bShowRefnum && ic.chainid2refpdbname.hasOwnProperty(chnid) && ic.chainid2refpdbname[chnid].length > 0) {
47462
- // let result = ic.annoIgCls.showAllRefNum(giSeq, chnid);
47463
-
47464
- // html += result.html;
47465
- // html3 += result.html3;
47466
- // }
47467
47570
 
47468
47571
  if(ic.bShowCustomRefnum && ic.chainsMapping.hasOwnProperty(chnid)) {
47469
47572
  let bCustom = true;
@@ -54379,6 +54482,7 @@ class MmcifParser {
54379
54482
  let url = "https://files.rcsb.org/download/" + mmcifid + ".cif";
54380
54483
  let data = await me.getAjaxPromise(url, 'text', true);
54381
54484
 
54485
+ /*
54382
54486
  // url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
54383
54487
  // let dataObj = {'mmciffile': data};
54384
54488
  // let data2 = await me.getAjaxPostPromise(url, dataObj, true);
@@ -54391,27 +54495,33 @@ class MmcifParser {
54391
54495
 
54392
54496
  // await this.loadMmcifData(bcifJson, mmcifid);
54393
54497
  await ic.opmParserCls.loadOpmData(data, mmcifid, undefined, 'mmcif', undefined, bText);
54498
+ */
54499
+
54500
+ url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
54501
+ let dataObj = {'mmciffile': data};
54502
+ let data2 = await me.getAjaxPostPromise(url, dataObj, true);
54503
+
54504
+ await this.loadMmcifData(data2, mmcifid);
54394
54505
  }
54395
54506
 
54396
54507
  async downloadMmcifSymmetry(mmcifid, type) { let ic = this.icn3d, me = ic.icn3dui;
54397
54508
  try {
54398
- // https://files.rcsb.org/header/ is not accessible in Node.js and Mac
54399
- // Some header files are in the wrong format. So we use the full mmCIF file
54400
- //let url = (me.bNode || me.utilsCls.isMac()) ? "https://files.rcsb.org/view/" + mmcifid + ".cif" : "https://files.rcsb.org/header/" + mmcifid + ".cif";
54401
- // let url = "https://files.rcsb.org/view/" + mmcifid + ".cif";
54402
- let url = "https://files.rcsb.org/download/" + mmcifid + ".cif";
54509
+ // let url = "https://files.rcsb.org/download/" + mmcifid + ".cif";
54510
+ // let data1 = await me.getAjaxPromise(url, 'text', false, "The structure " + mmcifid + " was not found...");
54511
+ // let bText = true;
54403
54512
 
54404
- //ic.bCid = undefined;
54405
- let data1 = await me.getAjaxPromise(url, 'text', false, "The structure " + mmcifid + " was not found...");
54513
+ let url = 'https://models.rcsb.org/' + mmcifid + '.bcif';
54514
+ let data1 = await me.getXMLHttpRqstPromise(url, 'GET', 'arraybuffer', 'bcif');
54515
+ let bText = false;
54406
54516
 
54407
54517
  // url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
54408
54518
  // let dataObj = {'mmcifheader': data1};
54409
54519
 
54410
54520
  // let data = await me.getAjaxPostPromise(url, dataObj, false, "The mmCIF data of " + mmcifid + " can not be parsed...");
54411
54521
 
54412
- let bText = true;
54413
54522
  let bNoCoord = true;
54414
54523
  let bcifData = ic.bcifParserCls.getBcifJson(data1, mmcifid, bText, bNoCoord);
54524
+
54415
54525
  let data = JSON.parse(bcifData);
54416
54526
 
54417
54527
  if(data.emd !== undefined) ic.emd = data.emd;
@@ -54905,7 +55015,8 @@ class MmdbParser {
54905
55015
  chain2molid[chain] = i;
54906
55016
  molid2chain[i] = chain;
54907
55017
 
54908
- ic.chainsColor[chain] = (type !== undefined && !me.cfg.mmdbafid) ? me.parasCls.thr(me.htmlCls.GREY8) : me.parasCls.thr(color);
55018
+ // ic.chainsColor[chain] = (type !== undefined && !me.cfg.mmdbafid) ? me.parasCls.thr(me.htmlCls.GREY8) : me.parasCls.thr(color);
55019
+ if(type === undefined || me.cfg.mmdbafid) ic.chainsColor[chain] = me.parasCls.thr(color);
54909
55020
 
54910
55021
  let geneId =(molid2rescount[i].geneId === undefined) ? '' : molid2rescount[i].geneId;
54911
55022
  let geneSymbol =(molid2rescount[i].geneSymbol === undefined) ? '' : molid2rescount[i].geneSymbol;
@@ -55082,9 +55193,11 @@ class BcifParser {
55082
55193
  // let bcifJson = JSON.parse(bcifData);
55083
55194
  // await ic.mmcifParserCls.loadMmcifData(bcifJson, bcifid);
55084
55195
 
55085
- await ic.opmParserCls.loadOpmData(bcifArrayBuffer, bcifid, undefined, 'mmcif', undefined, bText);
55196
+ await ic.opmParserCls.loadOpmData(bcifArrayBuffer, bcifid, undefined, 'bcif', undefined, bText);
55086
55197
  }
55087
55198
 
55199
+ // For text mmCIF file, CIFTools library does not support atom_site.getColumn("Cartn_x").data,
55200
+ // but just support atom_site.getColumn("Cartn_x").getFloat(i). So do not use "bText = true" for now.
55088
55201
  getBcifJson(bcifData, bcifid, bText, bNoCoord) { let ic = this.icn3d, me = ic.icn3dui;
55089
55202
  let text = "";
55090
55203
 
@@ -55724,46 +55837,32 @@ class BcifParser {
55724
55837
  // Retrieve the table corresponding to the struct_oper_list category, which delineates assembly
55725
55838
  let struct_oper_list = block.getCategory("_pdbx_struct_oper_list");
55726
55839
 
55727
- let struct_oper_idArray = struct_oper_list.getColumn("id").data;
55728
- let m11Array = struct_oper_list.getColumn("matrix[1][1]").data;
55729
- let m12Array = struct_oper_list.getColumn("matrix[1][2]").data;
55730
- let m13Array = struct_oper_list.getColumn("matrix[1][3]").data;
55731
- let m14Array = struct_oper_list.getColumn("vector[1]").data;
55732
-
55733
- let m21Array = struct_oper_list.getColumn("matrix[2][1]").data;
55734
- let m22Array = struct_oper_list.getColumn("matrix[2][2]").data;
55735
- let m23Array = struct_oper_list.getColumn("matrix[2][3]").data;
55736
- let m24Array = struct_oper_list.getColumn("vector[2]").data;
55737
-
55738
- let m31Array = struct_oper_list.getColumn("matrix[3][1]").data;
55739
- let m32Array = struct_oper_list.getColumn("matrix[3][2]").data;
55740
- let m33Array = struct_oper_list.getColumn("matrix[3][3]").data;
55741
- let m34Array = struct_oper_list.getColumn("vector[3]").data;
55742
-
55743
55840
  text += ", \"assembly\":[";
55744
55841
 
55745
55842
  let pmatrix = ", \"pmatrix\":";
55746
55843
  let bPmatrix = false;
55747
55844
 
55748
55845
  let assemblySize = struct_oper_list.rowCount;
55846
+
55847
+ // could be one or more rows, struct_oper_list.getColumn("id").data is unavailable if one row
55749
55848
  for (let i = 0; i < assemblySize; ++i) {
55750
- let struct_oper_id = struct_oper_idArray[i];
55849
+ let struct_oper_id = struct_oper_list.getColumn("id").getString(i);
55751
55850
  if(struct_oper_id == "X0") continue;
55752
55851
 
55753
- let m11 = m11Array[i];
55754
- let m12 = m12Array[i];
55755
- let m13 = m13Array[i];
55756
- let m14 = m14Array[i];
55757
-
55758
- let m21 = m21Array[i];
55759
- let m22 = m22Array[i];
55760
- let m23 = m23Array[i];
55761
- let m24 = m24Array[i];
55762
-
55763
- let m31 = m31Array[i];
55764
- let m32 = m32Array[i];
55765
- let m33 = m33Array[i];
55766
- let m34 = m34Array[i];
55852
+ let m11 = struct_oper_list.getColumn("matrix[1][1]").getFloat(i);
55853
+ let m12 = struct_oper_list.getColumn("matrix[1][2]").getFloat(i);
55854
+ let m13 = struct_oper_list.getColumn("matrix[1][3]").getFloat(i);
55855
+ let m14 = struct_oper_list.getColumn("vector[1]").getFloat(i);
55856
+
55857
+ let m21 = struct_oper_list.getColumn("matrix[2][1]").getFloat(i);
55858
+ let m22 = struct_oper_list.getColumn("matrix[2][2]").getFloat(i);
55859
+ let m23 = struct_oper_list.getColumn("matrix[2][3]").getFloat(i);
55860
+ let m24 = struct_oper_list.getColumn("vector[2]").getFloat(i);
55861
+
55862
+ let m31 = struct_oper_list.getColumn("matrix[3][1]").getFloat(i);
55863
+ let m32 = struct_oper_list.getColumn("matrix[3][2]").getFloat(i);
55864
+ let m33 = struct_oper_list.getColumn("matrix[3][3]").getFloat(i);
55865
+ let m34 = struct_oper_list.getColumn("vector[3]").getFloat(i);
55767
55866
 
55768
55867
  let matrix = "[" + m11 + "," + m21 + "," + m31 + ", 0, "
55769
55868
  + m12 + "," + m22 + "," + m32 + ", 0, "
@@ -55785,9 +55884,6 @@ class BcifParser {
55785
55884
  text += "]";
55786
55885
 
55787
55886
  if(bPmatrix) text += pmatrix;
55788
-
55789
- struct_oper_idArray = m11Array = m12Array = m13Array = m14Array = m21Array = m22Array = m23Array
55790
- = m24Array = m31Array = m32Array = m33Array = m34Array = [];
55791
55887
  }
55792
55888
 
55793
55889
  if(vDisulfides.length > 0) {
@@ -56072,10 +56168,11 @@ class OpmParser {
56072
56168
  try {
56073
56169
  if(!pdbid) pdbid = ic.defaultPdbId;
56074
56170
  let url = me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&opm&uid=" + pdbid.toLowerCase();
56075
-
56171
+
56076
56172
  let opmdata = await me.getAjaxPromise(url, 'jsonp', false);
56077
56173
 
56078
56174
  this.setOpmData(opmdata); // set ic.bOpm
56175
+
56079
56176
  await this.parseAtomData(data, pdbid, bFull, type, pdbid2, bText);
56080
56177
  }
56081
56178
  catch(err) {
@@ -56116,9 +56213,13 @@ class OpmParser {
56116
56213
  else
56117
56214
  */
56118
56215
 
56119
- if(type === 'mmcif') {
56120
- // ic.loadAtomDataCls.loadAtomDataIn(data, data.mmcif, 'mmcifid', undefined, undefined);
56121
- ic.loadCIFCls.loadCIF(data, pdbid, bText);
56216
+ if(type === 'mmcif' || type === 'bcif') {
56217
+ if(type === 'mmcif') {
56218
+ ic.loadAtomDataCls.loadAtomDataIn(data, data.mmcif, 'mmcifid', undefined, undefined);
56219
+ }
56220
+ else if(type === 'bcif') {
56221
+ ic.loadCIFCls.loadCIF(data, pdbid, bText);
56222
+ }
56122
56223
 
56123
56224
  if(ic.emd !== undefined) {
56124
56225
  $("#" + ic.pre + "mapWrapper1").hide();
@@ -56136,15 +56237,17 @@ class OpmParser {
56136
56237
  }
56137
56238
 
56138
56239
  // load assembly info
56139
- let assembly =(data.assembly !== undefined) ? data.assembly : [];
56140
- for(let i = 0, il = assembly.length; i < il; ++i) {
56141
- if(ic.biomtMatrices[i] == undefined) ic.biomtMatrices[i] = new THREE.Matrix4().identity();
56142
-
56143
- for(let j = 0, jl = assembly[i].length; j < jl; ++j) {
56144
- ic.biomtMatrices[i].elements[j] = assembly[i][j];
56240
+ if(type === 'mmcif') {
56241
+ let assembly =(data.assembly !== undefined) ? data.assembly : [];
56242
+ for(let i = 0, il = assembly.length; i < il; ++i) {
56243
+ if(ic.biomtMatrices[i] == undefined) ic.biomtMatrices[i] = new THREE.Matrix4().identity();
56244
+
56245
+ for(let j = 0, jl = assembly[i].length; j < jl; ++j) {
56246
+ ic.biomtMatrices[i].elements[j] = assembly[i][j];
56247
+ }
56145
56248
  }
56146
56249
  }
56147
-
56250
+
56148
56251
  if(ic.biomtMatrices !== undefined && ic.biomtMatrices.length > 1) {
56149
56252
  $("#" + ic.pre + "assemblyWrapper").show();
56150
56253
 
@@ -56153,7 +56256,7 @@ class OpmParser {
56153
56256
 
56154
56257
  ic.setStyleCls.setAtomStyleByOptions(ic.opts);
56155
56258
  ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
56156
-
56259
+
56157
56260
  await ic.ParserUtilsCls.renderStructure();
56158
56261
 
56159
56262
  if(me.cfg.rotate !== undefined) ic.resizeCanvasCls.rotStruc(me.cfg.rotate, true);
@@ -56266,6 +56369,7 @@ class PdbParser {
56266
56369
  await this.loadPdbData(data, id, undefined, bAppend);
56267
56370
  }
56268
56371
  else if(type === 'mmcif') {
56372
+ /*
56269
56373
  // let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
56270
56374
  // let dataObj = {'mmciffile': data};
56271
56375
  // let data2 = await me.getAjaxPostPromise(url, dataObj, true);
@@ -56277,6 +56381,12 @@ class PdbParser {
56277
56381
 
56278
56382
  // await ic.mmcifParserCls.loadMmcifData(bcifJson, undefined);
56279
56383
  await ic.opmParserCls.loadOpmData(data, undefined, undefined, 'mmcif', undefined, bText);
56384
+ */
56385
+
56386
+ let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
56387
+ let dataObj = {'mmciffile': data};
56388
+ let data2 = await me.getAjaxPostPromise(url, dataObj, true);
56389
+ await ic.mmcifParserCls.loadMmcifData(data2, undefined);
56280
56390
  }
56281
56391
  else if(type === 'mol2') {
56282
56392
  await ic.mol2ParserCls.loadMol2Data(data);
@@ -62623,7 +62733,8 @@ class LoadCIF {
62623
62733
  this.icn3d = icn3d;
62624
62734
  }
62625
62735
 
62626
- // loadCIF(src, bcifid, bOpm, bVector, bMutation, bAppend, type, bEsmfold, bText) { let ic = this.icn3d, me = ic.icn3dui;
62736
+ // For text mmCIF file, CIFTools library does not support atom_site.getColumn("Cartn_x").data,
62737
+ // but just support atom_site.getColumn("Cartn_x").getFloat(i). So do not use "bText = true" for now.
62627
62738
  loadCIF(bcifData, bcifid, bText, bAppend) { let ic = this.icn3d, me = ic.icn3dui;
62628
62739
  let hAtoms = {};
62629
62740
 
@@ -62638,7 +62749,6 @@ class LoadCIF {
62638
62749
 
62639
62750
  let block = parsed.result.dataBlocks[0];
62640
62751
 
62641
-
62642
62752
  let bNMR = false;
62643
62753
  // let lines = src.split('\n');
62644
62754
 
@@ -64703,6 +64813,7 @@ class ApplyCommand {
64703
64813
  }
64704
64814
  else if(command == 'defined sets') {
64705
64815
  ic.definedSetsCls.showSets();
64816
+ ic.bDefinedSets = true;
64706
64817
  }
64707
64818
  else if(command == 'delete selected sets') {
64708
64819
  ic.definedSetsCls.deleteSelectedSets();
@@ -64830,7 +64941,10 @@ class ApplyCommand {
64830
64941
  commandOri = commandOri.replace(/aligned_protein/g, 'protein_aligned');
64831
64942
 
64832
64943
  // define chains
64833
- ic.definedSetsCls.setChainsInMenu();
64944
+ if(!ic.bDefinedSets) {
64945
+ ic.definedSetsCls.setPredefinedInMenu();
64946
+ ic.bDefinedSets = true;
64947
+ }
64834
64948
 
64835
64949
  let paraArray = commandOri.split(' | '); // atom names might be case-sensitive
64836
64950
 
@@ -70639,25 +70753,6 @@ class Dssp {
70639
70753
  let result = ic.domain3dCls.c2b_NewSplitChain(currAtoms, undefined);
70640
70754
  let subdomains = result.subdomains;
70641
70755
  let pos2resi = result.pos2resi;
70642
- /*
70643
- if(subdomains.length <= 1) {
70644
- let residueArray = ic.resid2specCls.atoms2residues(Object.keys(currAtoms));
70645
- if(residueArray.length < minResidues) return domainAtomsArray;
70646
-
70647
- for(let n = 0, nl = residueArray.length; n < nl; ++n) {
70648
- let resid = residueArray[n];
70649
-
70650
- // clear previous refnum assignment if any
70651
- // if(bRerunDomain) {
70652
- delete ic.resid2refnum[resid];
70653
- delete ic.residIgLoop[resid];
70654
- // }
70655
- }
70656
-
70657
- domainAtomsArray.push(currAtoms);
70658
- }
70659
- else
70660
- */
70661
70756
 
70662
70757
  if(subdomains.length >= 1) {
70663
70758
  for(let k = 0, kl = subdomains.length; k < kl; ++k) {
@@ -70675,7 +70770,7 @@ class Dssp {
70675
70770
  domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
70676
70771
 
70677
70772
  // clear previous refnum assignment if any
70678
- delete ic.resid2refnum[resid];
70773
+ // delete ic.resid2refnum[resid];
70679
70774
  delete ic.residIgLoop[resid];
70680
70775
  }
70681
70776
  }
@@ -70722,12 +70817,11 @@ class Dssp {
70722
70817
 
70723
70818
  parseAlignData_part1(dataArray, domainidpairArray, bRound1) { let ic = this.icn3d, me = ic.icn3dui;
70724
70819
  // async parseAlignData(dataArray, domainidpairArray, bRound1) { let ic = this.icn3d, me = ic.icn3dui;
70725
- let tmscoreThreshold = 0.4; // 0.4; //0.5;
70820
+ let tmscoreThreshold = 0.45; // 0.4; //0.5;
70726
70821
  //let rmsdThreshold = 10;
70727
70822
 
70728
70823
  // find the best alignment for each chain
70729
70824
  let domainid2segs = {};
70730
- let domainid2strandcnt = {};
70731
70825
  let domainid2refpdbnamelist = {};
70732
70826
 
70733
70827
  if(!ic.chainid2refpdbname) ic.chainid2refpdbname = {};
@@ -70846,14 +70940,16 @@ class Dssp {
70846
70940
  }
70847
70941
 
70848
70942
  // count the number of matched strands
70849
- let strandHash = {};
70850
- for(let j = 0, jl = queryData[0].segs.length; j < jl; ++j) {
70851
- let seg = queryData[0].segs[j];
70852
- let q_start = parseInt(seg.q_start);
70943
+ // let strandHash = {};
70944
+ // for(let j = 0, jl = queryData[0].segs.length; j < jl; ++j) {
70945
+ // let seg = queryData[0].segs[j];
70946
+ // let q_start = parseInt(seg.q_start)
70853
70947
 
70854
- let strand = this.getStrandFromRefnum(q_start);
70855
- strandHash[strand] = 1;
70856
- }
70948
+ // let strand = this.getStrandFromRefnum(q_start);
70949
+ // strandHash[strand] = 1;
70950
+ // }
70951
+
70952
+ // let tmAdjust = 0.1;
70857
70953
  let score = parseFloat(queryData[0].score);
70858
70954
 
70859
70955
  // if the TM score difference is within 0.1 and more strands are found, use the template with more strands
@@ -70876,7 +70972,7 @@ class Dssp {
70876
70972
  }
70877
70973
 
70878
70974
  domainid2segs[domainid] = queryData[0].segs;
70879
- domainid2strandcnt[domainid] = Object.keys(strandHash).length;
70975
+ // domainid2strandcnt[domainid] = Object.keys(strandHash).length;
70880
70976
 
70881
70977
  ic.domainid2ig2kabat[domainid] = queryData[0].ig2kabat;
70882
70978
  ic.domainid2ig2imgt[domainid] = queryData[0].ig2imgt;
@@ -71207,20 +71303,6 @@ class Dssp {
71207
71303
  ic.resid2refnum_ori[resid] = refnumLabel;
71208
71304
  ic.resid2domainid[resid] = domainid;
71209
71305
  }
71210
-
71211
- // final reference numbers will be assign in ic.annoIgCls.showRefNum()
71212
-
71213
- // if(!ic.refnum2residArray.hasOwnProperty(refnum)) {
71214
- // ic.refnum2residArray[refnum] = [resid];
71215
- // }
71216
- // else {
71217
- // ic.refnum2residArray[refnum].push(resid);
71218
- // }
71219
-
71220
- // if(!ic.chainsMapping.hasOwnProperty(chainid)) {
71221
- // ic.chainsMapping[chainid] = {};
71222
- // }
71223
- // ic.chainsMapping[chainid][resid] = refnumLabel;
71224
71306
  //}
71225
71307
  }
71226
71308
  }
@@ -71245,34 +71327,6 @@ class Dssp {
71245
71327
  ic.chainid2igtrack[chainid] = this.ajdustRefnum(giSeq, chainid);
71246
71328
  }
71247
71329
  }
71248
-
71249
- /*
71250
- if(Object.keys(ic.resid2refnum).length > 0) {
71251
- ic.bShowRefnum = true;
71252
-
71253
- // open sequence view
71254
- ic.hAtomsRefnum = {};
71255
- //ic.bResetAnno = true;
71256
- if(ic.bAnnoShown) {
71257
- for(let chain in ic.protein_chainid) {
71258
- let chainidBase = ic.protein_chainid[chain];
71259
- ic.showSeqCls.showSeq(chain, chainidBase, 'protein');
71260
- }
71261
- }
71262
- else {
71263
- await ic.showAnnoCls.showAnnotations();
71264
- }
71265
-
71266
- ic.annotationCls.setAnnoViewAndDisplay('detailed view');
71267
- }
71268
- else if(!me.bNode) {
71269
- if(!ic.bNoIg) {
71270
- // var aaa = 1; //alert("No Ig reference numbers are assigned based on the reference structures in iCn3D...");
71271
- console.log("No Ig reference numbers are assigned based on the reference structures in iCn3D...");
71272
- ic.bNoIg = true;
71273
- }
71274
- }
71275
- */
71276
71330
  }
71277
71331
 
71278
71332
  getStrandFromRefnum(oriRefnum, prevStrand) { let ic = this.icn3d; ic.icn3dui;
@@ -71412,7 +71466,7 @@ class Dssp {
71412
71466
  return (!refnumLabel) ? refnumLabel : refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').replace(/\+/g, '').replace(/\-/g, '').substr(1); // C', C''
71413
71467
  }
71414
71468
 
71415
- exportRefnum(type, bCalcRef) { let ic = this.icn3d, me = ic.icn3dui;
71469
+ exportRefnum(type, bNoArraySymbol) { let ic = this.icn3d, me = ic.icn3dui;
71416
71470
  let refData = '';
71417
71471
 
71418
71472
  // 1. show IgStrand ref numbers
@@ -71459,91 +71513,101 @@ class Dssp {
71459
71513
 
71460
71514
  let bIgDomain = (ic.domainid2info && Object.keys(ic.domainid2info).length > 0) ? 1 : 0;
71461
71515
 
71462
- // refData += '{"Ig domain" : ' + bIgDomain + ', "ref PDB" : ' + JSON.stringify(ic.refPdbList) + ',\n';
71463
- refData += '{"Ig domain" : ' + bIgDomain + ',\n';
71516
+
71464
71517
 
71465
71518
  if(bIgDomain) {
71466
- refData += '"igs": [\n';
71467
- for(let chnid in ic.chains) {
71468
- let igArray = ic.chain2igArray[chnid];
71469
-
71470
- if(igArray && igArray.length > 0) {
71471
- refData += '{"' + chnid + '": {\n';
71472
-
71473
- for(let i = 0, il = igArray.length; i < il; ++i) {
71474
- let startPosArray = igArray[i].startPosArray;
71475
- let endPosArray = igArray[i].endPosArray;
71476
- let domainid = igArray[i].domainid;
71477
- let info = ic.domainid2info[domainid];
71478
- if(!info) continue;
71479
-
71480
- refData += '"' + domainid + '": {\n';
71481
-
71482
- refData += '"refpdbname":"' + info.refpdbname + '", "score":' + info.score + ', "seqid":' + info.seqid + ', "nresAlign":' + info.nresAlign + ', "data": [';
71483
- for(let j = 0, jl = startPosArray.length; j < jl; ++j) {
71484
- let startPos = startPosArray[j];
71485
- let endPos = endPosArray[j];
71486
- for(let k = startPos; k <= endPos; ++k) {
71487
- const resid = chnid + '_' + ic.chainsSeq[chnid][k].resi + '_' + ic.chainsSeq[chnid][k].name;
71488
- refData += '{"' + resid + '": "' + resid2refnum[resid] + '"},\n';
71519
+ for(let structure in ic.structures) {
71520
+ refData += '{"' + structure + '": {"Ig domain" : ' + bIgDomain + ', "igs": [\n';
71521
+ for(let m = 0, ml = ic.structures[structure].length; m < ml; ++m) {
71522
+ let chnid = ic.structures[structure][m];
71523
+ let igArray = ic.chain2igArray[chnid];
71524
+
71525
+ if(igArray && igArray.length > 0) {
71526
+ refData += '{"' + chnid + '": {\n';
71527
+
71528
+ for(let i = 0, il = igArray.length; i < il; ++i) {
71529
+ let startPosArray = igArray[i].startPosArray;
71530
+ let endPosArray = igArray[i].endPosArray;
71531
+ let domainid = igArray[i].domainid;
71532
+ let info = ic.domainid2info[domainid];
71533
+ if(!info) continue;
71534
+
71535
+ refData += '"' + domainid + '": {\n';
71536
+
71537
+ refData += '"refpdbname":"' + info.refpdbname + '", "score":' + info.score + ', "seqid":' + info.seqid + ', "nresAlign":' + info.nresAlign + ', "data": [';
71538
+ for(let j = 0, jl = startPosArray.length; j < jl; ++j) {
71539
+ let startPos = startPosArray[j];
71540
+ let endPos = endPosArray[j];
71541
+ for(let k = startPos; k <= endPos; ++k) {
71542
+ const resid = chnid + '_' + ic.chainsSeq[chnid][k].resi + '_' + ic.chainsSeq[chnid][k].name;
71543
+ refData += '{"' + resid + '": "' + resid2refnum[resid] + '"},\n';
71544
+ }
71489
71545
  }
71546
+ refData += '],\n';
71547
+
71548
+ refData += '},\n';
71490
71549
  }
71491
- refData += '],\n';
71492
71550
 
71493
- refData += '},\n';
71551
+ refData += '}},\n';
71494
71552
  }
71495
-
71496
- refData += '}},\n';
71497
71553
  }
71498
- }
71499
71554
 
71500
- refData += ']\n';
71555
+ refData += ']}},\n';
71556
+ }
71501
71557
  }
71502
-
71503
- refData += '}\n';
71504
71558
  }
71505
71559
  // 2. show Kabat ref numbers
71506
71560
  else if(type == 'kabat' || type == 'Kabat') {
71507
71561
  let resid2kabat = {};
71508
71562
  for(let resid in ic.resid2refnum) {
71509
- let domainid = ic.resid2domainid[resid];
71510
- let refnumStr, refnumLabel = ic.resid2refnum[resid];
71563
+ let domainid = ic.resid2domainid[resid];
71564
+ let refnumStr, refnumLabel = ic.resid2refnum[resid];
71511
71565
 
71512
- let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
71513
- let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
71566
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
71567
+ if(!atom) continue;
71568
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
71514
71569
 
71515
- if(refnumLabel) {
71516
- let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
71517
- refnumStr = (ic.domainid2ig2kabat[domainid]) ? ic.domainid2ig2kabat[domainid][refnumStr_ori] : undefined;
71518
- }
71570
+ if(refnumLabel) {
71571
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
71572
+ refnumStr = (ic.domainid2ig2kabat[domainid]) ? ic.domainid2ig2kabat[domainid][refnumStr_ori] : undefined;
71573
+ }
71519
71574
 
71520
- resid2kabat[resid + '_' + resn] = refnumStr;
71575
+ resid2kabat[resid + '_' + resn] = refnumStr;
71521
71576
  }
71522
71577
 
71578
+ refData += '{"Kabat": ';
71523
71579
  refData += JSON.stringify(resid2kabat);
71580
+ refData += ',\n';
71524
71581
  }
71525
71582
  // 3. show IMGT ref numbers
71526
71583
  else if(type == 'imgt'|| type == 'IMGT') {
71527
71584
  let resid2imgt = {};
71528
71585
  for(let resid in ic.resid2refnum) {
71529
- let domainid = ic.resid2domainid[resid];
71530
- let refnumStr, refnumLabel = ic.resid2refnum[resid];
71586
+ let domainid = ic.resid2domainid[resid];
71587
+ let refnumStr, refnumLabel = ic.resid2refnum[resid];
71531
71588
 
71532
- let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
71533
- let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
71589
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
71590
+ if(!atom) continue;
71591
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
71534
71592
 
71535
- if(refnumLabel) {
71536
- let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
71537
- refnumStr = (ic.domainid2ig2imgt[domainid]) ? ic.domainid2ig2imgt[domainid][refnumStr_ori] : undefined;
71538
- }
71593
+ if(refnumLabel) {
71594
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
71595
+ refnumStr = (ic.domainid2ig2imgt[domainid]) ? ic.domainid2ig2imgt[domainid][refnumStr_ori] : undefined;
71596
+ }
71539
71597
 
71540
- resid2imgt[resid + '_' + resn] = refnumStr;
71598
+ resid2imgt[resid + '_' + resn] = refnumStr;
71541
71599
  }
71542
71600
 
71601
+ refData += '{"Kabat": ';
71543
71602
  refData += JSON.stringify(resid2imgt);
71603
+ refData += ',\n';
71544
71604
  }
71545
71605
 
71546
71606
 
71607
+ if(!bNoArraySymbol) {
71608
+ refData = '[' + refData + ']';
71609
+ }
71610
+
71547
71611
  if(!me.bNode) {
71548
71612
  let file_pref = Object.keys(me.utilsCls.getHlStructures()).join(',');
71549
71613
 
@@ -71936,15 +72000,13 @@ class Dssp {
71936
72000
  domainid = strandArray[strandCnt].domainid;
71937
72001
  }
71938
72002
  else {
71939
- //loopCnt = 0;
71940
72003
  refnumLabelNoPostfix = undefined;
71941
72004
  refnumLabel = undefined;
71942
72005
  }
71943
72006
  }
71944
72007
  else {
71945
- if(prevStrandCnt >= 0
71946
- // && (strandArray[prevStrandCnt].strand.substr(0, 1) == 'F' || strandArray[prevStrandCnt].strand.substr(0, 1) == 'G')) {
71947
- && (strandArray[prevStrandCnt].strand.substr(0, 1) == 'G')) {
72008
+ // if(prevStrandCnt >= 0 && (strandArray[prevStrandCnt].strand.substr(0, 1) == 'G')) {
72009
+ if(prevStrandCnt >= 0 && (strandArray[prevStrandCnt].strand.substr(0, 1) == 'G' || (strandArray[prevStrandCnt].strand.substr(0, 1) == 'F' && strandArray[strandCnt].strand.substr(0, 1) != 'G') )) {
71948
72010
  if(!bAfterGstrand) {
71949
72011
  //loopCnt = 0;
71950
72012
  refnumLabelNoPostfix = undefined;
@@ -77302,16 +77364,9 @@ class ShareLink {
77302
77364
 
77303
77365
  //statefile += ic.commands[i] + "\n";
77304
77366
 
77305
- // only output the most recent 'select saved atoms...' without " | name ..."
77367
+ // only output the most recent 'select sets...' without " | name ..."
77306
77368
  // or those select without names
77307
- // if(((prevCommandStr.indexOf('select saved atoms') !== -1 || prevCommandStr.indexOf('select sets') !== -1)
77308
- // &&(commandStr.indexOf('select') === 0 || commandStr.indexOf('select') === 0)
77309
- // && prevCommandStr.indexOf(' name ') === -1)
77310
- // ||(prevCommandStr.indexOf('pickatom') !== -1 && commandStr.indexOf('pickatom') !== -1)
77311
- // ) {
77312
-
77313
- if(prevCommandStr.indexOf('select') == 0 && prevCommandStr.indexOf('select prop') === -1
77314
- && commandStr.indexOf('select') === 0 && commandStr.indexOf('select prop') === -1
77369
+ if(prevCommandStr.indexOf('select sets') == 0 && commandStr.indexOf('select sets') === 0
77315
77370
  && prevCommandStr.indexOf(' name ') === -1) ;
77316
77371
  else if(prevCommandStr.indexOf('pickatom') !== -1 && commandStr.indexOf('pickatom') !== -1) ;
77317
77372
  // remove all "show selection" except the last one