icn3d 3.31.0 → 3.31.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
@@ -9834,7 +9834,7 @@ class ClickMenu {
9834
9834
  });
9835
9835
 
9836
9836
  me.myEventCls.onIds("#" + me.pre + "mn1_mmtfid", "click", function(e) { me.icn3d; //e.preventDefault();
9837
- me.htmlCls.dialogCls.openDlg('dl_mmtfid', 'Please input MMTF ID');
9837
+ me.htmlCls.dialogCls.openDlg('dl_mmtfid', 'Please input BCIF/MMTF ID');
9838
9838
  });
9839
9839
 
9840
9840
  // clkMn1_pdbid: function() {
@@ -12560,7 +12560,7 @@ class SetMenu {
12560
12560
 
12561
12561
  html += this.getLink('mn1_mmdbafid', 'PDB/MMDB/AlphaFold IDs' + me.htmlCls.wifiStr, 1, 2);
12562
12562
  html += this.getLink('mn1_mmdbid', 'NCBI MMDB ID (annotation) ' + me.htmlCls.wifiStr, undefined, 2);
12563
- html += this.getLink('mn1_mmtfid', 'RCSB MMTF ID (fast) ' + me.htmlCls.wifiStr, undefined, 2);
12563
+ html += this.getLink('mn1_mmtfid', 'RCSB BCIF/MMTF ID (fast) ' + me.htmlCls.wifiStr, undefined, 2);
12564
12564
  html += this.getLink('mn1_pdbid', 'RCSB PDB ID ' + me.htmlCls.wifiStr, undefined, 2);
12565
12565
 
12566
12566
  html += this.getMenuText('mn1_afwrap', 'AlphaFold Structures', undefined, undefined, 2);
@@ -14722,8 +14722,8 @@ class SetDialog {
14722
14722
  html += "</div>";
14723
14723
 
14724
14724
  html += me.htmlCls.divStr + "dl_mmtfid' class='" + dialogClass + "'>";
14725
- html += this.addNotebookTitle('dl_mmtfid', 'Please input an MMTF ID');
14726
- html += "MMTF ID: " + me.htmlCls.inputTextStr + "id='" + me.pre + "mmtfid' value='1TUP' size=8> ";
14725
+ html += this.addNotebookTitle('dl_mmtfid', 'Please input an BCIF/MMTF ID');
14726
+ html += "BCIF/MMTF ID: " + me.htmlCls.inputTextStr + "id='" + me.pre + "mmtfid' value='1TUP' size=8> ";
14727
14727
  html += me.htmlCls.buttonStr + "reload_mmtf'>Load</button>";
14728
14728
  html += "</div>";
14729
14729
 
@@ -16727,9 +16727,9 @@ class Events {
16727
16727
  me.myEventCls.onIds("#" + me.pre + "reload_mmtf", "click", function(e) { let ic = me.icn3d;
16728
16728
  e.preventDefault();
16729
16729
  if(!me.cfg.notebook) dialog.dialog( "close" );
16730
- thisClass.setLogCmd("load mmtf " + $("#" + me.pre + "mmtfid").val(), false);
16730
+ thisClass.setLogCmd("load bcif " + $("#" + me.pre + "mmtfid").val(), false);
16731
16731
  let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
16732
- window.open(hostUrl + '?mmtfid=' + $("#" + me.pre + "mmtfid").val(), urlTarget);
16732
+ window.open(hostUrl + '?bcifid=' + $("#" + me.pre + "mmtfid").val(), urlTarget);
16733
16733
  });
16734
16734
 
16735
16735
  me.myEventCls.onIds("#" + me.pre + "mmtfid", "keyup", function(e) { let ic = me.icn3d;
@@ -17826,6 +17826,7 @@ class Events {
17826
17826
  thisClass.setLogCmd('load mmcif file ' + $("#" + me.pre + "mmciffile").val(), false);
17827
17827
  ic.molTitle = "";
17828
17828
 
17829
+ /*
17829
17830
  // let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
17830
17831
  // //ic.bCid = undefined;
17831
17832
 
@@ -17843,6 +17844,19 @@ class Events {
17843
17844
  ic.InputfileType = 'mmcif';
17844
17845
  // await ic.mmcifParserCls.loadMmcifData(data);
17845
17846
  await ic.opmParserCls.loadOpmData(dataStr, undefined, undefined, 'mmcif', undefined, bText);
17847
+ */
17848
+
17849
+ let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
17850
+
17851
+ let dataObj = {'mmciffile': dataStr};
17852
+ let data = await me.getAjaxPostPromise(url, dataObj, true);
17853
+
17854
+ //ic.initUI();
17855
+ ic.init();
17856
+ ic.bInputfile = true;
17857
+ ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + data : data;
17858
+ ic.InputfileType = 'mmcif';
17859
+ await ic.mmcifParserCls.loadMmcifData(data);
17846
17860
  };
17847
17861
  reader.readAsText(file);
17848
17862
  }
@@ -41747,10 +41761,7 @@ class AnnoIg {
41747
41761
  html3 += result.html3;
41748
41762
 
41749
41763
  let kabat_or_imgt = 1;
41750
- if(!bKabatFound) {
41751
- return {html: html, html2: html2, html3: html3};
41752
- }
41753
- else {
41764
+ if(bKabatFound) {
41754
41765
  result = this.showRefNum(giSeq, chnid, kabat_or_imgt);
41755
41766
  html += result.html;
41756
41767
  html2 += result.html2;
@@ -41758,10 +41769,7 @@ class AnnoIg {
41758
41769
  }
41759
41770
 
41760
41771
  kabat_or_imgt = 2;
41761
- if(!bImgtFound) {
41762
- return {html: html, html2: html2, html3: html3};
41763
- }
41764
- else {
41772
+ if(bImgtFound) {
41765
41773
  result = this.showRefNum(giSeq, chnid, kabat_or_imgt);
41766
41774
  html += result.html;
41767
41775
  html2 += result.html2;
@@ -41775,13 +41783,57 @@ class AnnoIg {
41775
41783
  let bResult = ic.chainid2igtrack[chnid];
41776
41784
  if(!bResult) return {html: '', html2: '', html3: ''};
41777
41785
 
41786
+ let html = this.getIgAnnoHtml(chnid, giSeq, bCustom, kabat_or_imgt);
41787
+
41778
41788
  // add color to atoms
41779
41789
  if(ic.bShowRefnum) {
41780
41790
  ic.opts.color = 'ig strand';
41781
- ic.setColorCls.setColorByOptions(ic.opts, ic.dAtoms);
41791
+ // ic.setColorCls.setColorByOptions(ic.opts, ic.dAtoms);
41792
+ ic.setColorCls.setColorByOptions(ic.opts, ic.chains[chnid]);
41782
41793
  }
41783
41794
 
41784
- return this.getIgAnnoHtml(chnid, giSeq, bCustom, kabat_or_imgt);
41795
+ return html;
41796
+ }
41797
+
41798
+ setChain2igArray(chnid, giSeq, bCustom) { let ic = this.icn3d; ic.icn3dui;
41799
+ let refnumLabel;
41800
+
41801
+ let domainid2respos = {};
41802
+ for(let i = 0, il = giSeq.length; i < il; ++i) {
41803
+ let currResi = ic.ParserUtilsCls.getResi(chnid, i);
41804
+ let residueid = chnid + '_' + currResi;
41805
+ let domainid = (bCustom) ? 0 : ic.resid2domainid[residueid];
41806
+
41807
+ refnumLabel = ic.resid2refnum[residueid];
41808
+
41809
+ if(refnumLabel) {
41810
+ if(!domainid2respos[domainid]) domainid2respos[domainid] = [];
41811
+ domainid2respos[domainid].push(i);
41812
+ }
41813
+ }
41814
+
41815
+ for(let domainid in domainid2respos) {
41816
+ let posArray = domainid2respos[domainid];
41817
+ let pos, prevPos, startPosArray = [], endPosArray = [];
41818
+ for(let i = 0, il = posArray.length; i < il; ++i) {
41819
+ pos = posArray[i];
41820
+ if(i == 0) startPosArray.push(pos);
41821
+
41822
+ if(i > 0 && pos != prevPos + 1) { // a new range
41823
+ endPosArray.push(prevPos);
41824
+ startPosArray.push(pos);
41825
+ }
41826
+
41827
+ prevPos = pos;
41828
+ }
41829
+ endPosArray.push(pos);
41830
+
41831
+ let igElem = {};
41832
+ igElem.domainid = domainid;
41833
+ igElem.startPosArray = startPosArray;
41834
+ igElem.endPosArray = endPosArray;
41835
+ ic.chain2igArray[chnid].push(igElem);
41836
+ }
41785
41837
  }
41786
41838
 
41787
41839
  getIgAnnoHtml(chnid, giSeq, bCustom, kabat_or_imgt) { let ic = this.icn3d, me = ic.icn3dui;
@@ -41789,13 +41841,91 @@ class AnnoIg {
41789
41841
  let type = 'ig';
41790
41842
 
41791
41843
  if(!ic.chain2igArray) ic.chain2igArray = {};
41792
- ic.chain2igArray[chnid] = [];
41793
41844
 
41794
41845
  let bLoop = false, currStrand = '';
41795
41846
  let refnumLabel, refnumStr_ori, refnumStr;
41796
41847
 
41848
+ ic.chain2igArray[chnid] = [];
41849
+ this.setChain2igArray(chnid, giSeq, bCustom);
41850
+
41851
+ // remove Igs without BCEF strands one more time
41852
+ let igArray = ic.chain2igArray[chnid];
41853
+
41854
+ for(let i = 0, il = igArray.length; i < il; ++i) {
41855
+ let domainid = igArray[i].domainid;
41856
+ let info = ic.domainid2info[domainid];
41857
+ if(!info) continue;
41858
+
41859
+ let bBStrand = false, bCStrand = false, bEStrand = false, bFStrand = false;
41860
+
41861
+ let residHash = {};
41862
+ for(let j = 0, jl = igArray[i].startPosArray.length; j < jl; ++j) {
41863
+ let startPos = igArray[i].startPosArray[j];
41864
+ let endPos = igArray[i].endPosArray[j];
41865
+ for(let k = startPos; k <= endPos; ++k) {
41866
+ const resid = chnid + '_' + ic.chainsSeq[chnid][k].resi;
41867
+ residHash[resid] = 1;
41868
+ let refnum = ic.resid2refnum[resid];
41869
+
41870
+ if(refnum) {
41871
+ if(refnum.indexOf('B2550') != -1) bBStrand = true;
41872
+ if(refnum.indexOf('C3550') != -1) bCStrand = true;
41873
+ if(refnum.indexOf('E7550') != -1) bEStrand = true;
41874
+ if(refnum.indexOf('F8550') != -1) bFStrand = true;
41875
+ }
41876
+ }
41877
+ }
41878
+
41879
+ if(!(bBStrand && bCStrand && bEStrand && bFStrand)) {
41880
+ // reset for these residues
41881
+ for(let resid in residHash) {
41882
+ delete ic.resid2refnum[resid];
41883
+ delete ic.residIgLoop[resid];
41884
+ delete ic.resid2domainid[resid];
41885
+ }
41886
+
41887
+ let residArray = Object.keys(residHash);
41888
+
41889
+ // delete the following loops
41890
+ let lastPos = ic.setSeqAlignCls.getPosFromResi(chnid, residArray[residArray.length - 1].split('_')[2]);
41891
+
41892
+ for(let j = lastPos + 1, jl = ic.chainsSeq[chnid].length; j < jl; ++j) {
41893
+ let resi = ic.chainsSeq[chnid][j].resi;
41894
+ let resid = chnid + '_' + resi;
41895
+ if(ic.residIgLoop.hasOwnProperty(resid)) {
41896
+ delete ic.resid2refnum[resid];
41897
+ delete ic.residIgLoop[resid];
41898
+ delete ic.resid2domainid[resid];
41899
+ }
41900
+ else {
41901
+ break;
41902
+ }
41903
+ }
41904
+
41905
+ // delete the previous loops
41906
+ ic.setSeqAlignCls.getPosFromResi(chnid, residArray[0].split('_')[2]);
41907
+
41908
+ for(let j = lastPos - 1; j >= 0; --j) {
41909
+ let resi = ic.chainsSeq[chnid][j].resi;
41910
+ let resid = chnid + '_' + resi;
41911
+ if(ic.residIgLoop.hasOwnProperty(resid)) {
41912
+ delete ic.resid2refnum[resid];
41913
+ delete ic.residIgLoop[resid];
41914
+ delete ic.resid2domainid[resid];
41915
+ }
41916
+ else {
41917
+ break;
41918
+ }
41919
+ }
41920
+ }
41921
+ }
41922
+
41923
+ // reset ic.chain2igArray
41924
+ ic.chain2igArray[chnid] = [];
41925
+ this.setChain2igArray(chnid, giSeq, bCustom);
41926
+
41797
41927
  // show tracks
41798
- let domainid2respos = {};
41928
+ // let domainid2respos = {};
41799
41929
  let htmlIg = '';
41800
41930
  for(let i = 0, il = giSeq.length; i < il; ++i) {
41801
41931
  htmlIg += ic.showSeqCls.insertGap(chnid, i, '-');
@@ -41812,9 +41942,9 @@ class AnnoIg {
41812
41942
  let bHidelabel = false;
41813
41943
 
41814
41944
  if(refnumLabel) {
41815
- if(!domainid2respos[domainid]) domainid2respos[domainid] = [];
41816
- domainid2respos[domainid].push(i);
41817
-
41945
+ // if(!domainid2respos[domainid]) domainid2respos[domainid] = [];
41946
+ // domainid2respos[domainid].push(i);
41947
+
41818
41948
  refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
41819
41949
  currStrand = refnumLabel.replace(new RegExp(refnumStr_ori,'g'), '');
41820
41950
 
@@ -41884,32 +42014,6 @@ class AnnoIg {
41884
42014
  //}
41885
42015
  }
41886
42016
 
41887
- // igElem.endPos = prevPos;
41888
- // ic.chain2igArray[chnid].push(igElem);
41889
-
41890
- for(let domainid in domainid2respos) {
41891
- let posArray = domainid2respos[domainid];
41892
- let pos, prevPos, startPosArray = [], endPosArray = [];
41893
- for(let i = 0, il = posArray.length; i < il; ++i) {
41894
- pos = posArray[i];
41895
- if(i == 0) startPosArray.push(pos);
41896
-
41897
- if(i > 0 && pos != prevPos + 1) { // a new range
41898
- endPosArray.push(prevPos);
41899
- startPosArray.push(pos);
41900
- }
41901
-
41902
- prevPos = pos;
41903
- }
41904
- endPosArray.push(pos);
41905
-
41906
- let igElem = {};
41907
- igElem.domainid = domainid;
41908
- igElem.startPosArray = startPosArray;
41909
- igElem.endPosArray = endPosArray;
41910
- ic.chain2igArray[chnid].push(igElem);
41911
- }
41912
-
41913
42017
  if(me.bNode) return {html: html, html2: html2, html3: html3}
41914
42018
  let titleSpace = 120;
41915
42019
 
@@ -41967,7 +42071,8 @@ class AnnoIg {
41967
42071
  html += '</div>';
41968
42072
  html += '</div>';
41969
42073
 
41970
- let igArray = ic.chain2igArray[chnid];
42074
+ // use the updated ic.chain2igArray
42075
+ igArray = ic.chain2igArray[chnid];
41971
42076
 
41972
42077
  if(igArray.length == 0) return {html: html, html2: html2, html3: html3}
41973
42078
  let rangeArray = [], titleArray = [], fullTitleArray = [], domainArray = [];
@@ -41978,14 +42083,10 @@ class AnnoIg {
41978
42083
  if(!info) continue;
41979
42084
 
41980
42085
  let tmscore = info.score;
41981
- // let igType = ic.ref2igtype[info.refpdbname];
41982
- // let confidance = (parseFloat(tmscore) < 0.75 ) ? '?' : '';
41983
- // titleArray.push(igType + confidance + ' (TM:' + parseFloat(tmscore).toFixed(2) + ')');
41984
- // fullTitleArray.push(igType + confidance + ' (TM:' + parseFloat(tmscore).toFixed(2) + '), template: ' + info.refpdbname + ', Seq. identity: ' + parseFloat(info.seqid).toFixed(2) + ', aligned residues: ' + info.nresAlign);
41985
42086
 
41986
42087
  let igType = (parseFloat(tmscore) < ic.refnumCls.TMThreshold ) ? 'Ig' : ic.ref2igtype[info.refpdbname];
41987
42088
  titleArray.push(igType + ' (TM:' + parseFloat(tmscore).toFixed(2) + ')');
41988
- fullTitleArray.push(igType + ' (TM:' + parseFloat(tmscore).toFixed(2) + '), template: ' + info.refpdbname + ', Seq. identity: ' + parseFloat(info.seqid).toFixed(2) + ', aligned residues: ' + info.nresAlign);
42089
+ 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);
41989
42090
 
41990
42091
  domainArray.push(igType);
41991
42092
 
@@ -41998,7 +42099,7 @@ class AnnoIg {
41998
42099
  rangeArray.push(range);
41999
42100
  }
42000
42101
 
42001
- if(titleArray.length == 0) return {html: html, html2: html2, html3: html3}
42102
+ if(rangeArray.length == 0) return {html: html, html2: html2, html3: html3}
42002
42103
 
42003
42104
  // add tracks for the summary view
42004
42105
  if(!kabat_or_imgt && !bCustom) {
@@ -47034,6 +47135,15 @@ class Annotation {
47034
47135
  }
47035
47136
 
47036
47137
  async updateIg(bSelection, template) { let ic = this.icn3d, me = ic.icn3dui;
47138
+ if(bSelection) { // clear previous refnum
47139
+ let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(ic.hAtoms);
47140
+ for(let resid in residueHash) {
47141
+ if(ic.resid2refnum) delete ic.resid2refnum[resid];
47142
+ if(ic.residIgLoop) delete ic.residIgLoop[resid];
47143
+ if(ic.resid2domainid) delete ic.resid2domainid[resid];
47144
+ }
47145
+ }
47146
+
47037
47147
  // if(!ic.bIgShown) {
47038
47148
  if(!bSelection && !template) {
47039
47149
  // select all protein chains
@@ -48358,13 +48468,6 @@ class ShowSeq {
48358
48468
  html += '</div>';
48359
48469
  html3 += '</div></div>';
48360
48470
  }
48361
-
48362
- // if(ic.bShowRefnum && ic.chainid2refpdbname.hasOwnProperty(chnid) && ic.chainid2refpdbname[chnid].length > 0) {
48363
- // let result = ic.annoIgCls.showAllRefNum(giSeq, chnid);
48364
-
48365
- // html += result.html;
48366
- // html3 += result.html3;
48367
- // }
48368
48471
 
48369
48472
  if(ic.bShowCustomRefnum && ic.chainsMapping.hasOwnProperty(chnid)) {
48370
48473
  let bCustom = true;
@@ -55280,6 +55383,7 @@ class MmcifParser {
55280
55383
  let url = "https://files.rcsb.org/download/" + mmcifid + ".cif";
55281
55384
  let data = await me.getAjaxPromise(url, 'text', true);
55282
55385
 
55386
+ /*
55283
55387
  // url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
55284
55388
  // let dataObj = {'mmciffile': data};
55285
55389
  // let data2 = await me.getAjaxPostPromise(url, dataObj, true);
@@ -55292,27 +55396,33 @@ class MmcifParser {
55292
55396
 
55293
55397
  // await this.loadMmcifData(bcifJson, mmcifid);
55294
55398
  await ic.opmParserCls.loadOpmData(data, mmcifid, undefined, 'mmcif', undefined, bText);
55399
+ */
55400
+
55401
+ url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
55402
+ let dataObj = {'mmciffile': data};
55403
+ let data2 = await me.getAjaxPostPromise(url, dataObj, true);
55404
+
55405
+ await this.loadMmcifData(data2, mmcifid);
55295
55406
  }
55296
55407
 
55297
55408
  async downloadMmcifSymmetry(mmcifid, type) { let ic = this.icn3d, me = ic.icn3dui;
55298
55409
  try {
55299
- // https://files.rcsb.org/header/ is not accessible in Node.js and Mac
55300
- // Some header files are in the wrong format. So we use the full mmCIF file
55301
- //let url = (me.bNode || me.utilsCls.isMac()) ? "https://files.rcsb.org/view/" + mmcifid + ".cif" : "https://files.rcsb.org/header/" + mmcifid + ".cif";
55302
- // let url = "https://files.rcsb.org/view/" + mmcifid + ".cif";
55303
- let url = "https://files.rcsb.org/download/" + mmcifid + ".cif";
55410
+ // let url = "https://files.rcsb.org/download/" + mmcifid + ".cif";
55411
+ // let data1 = await me.getAjaxPromise(url, 'text', false, "The structure " + mmcifid + " was not found...");
55412
+ // let bText = true;
55304
55413
 
55305
- //ic.bCid = undefined;
55306
- let data1 = await me.getAjaxPromise(url, 'text', false, "The structure " + mmcifid + " was not found...");
55414
+ let url = 'https://models.rcsb.org/' + mmcifid + '.bcif';
55415
+ let data1 = await me.getXMLHttpRqstPromise(url, 'GET', 'arraybuffer', 'bcif');
55416
+ let bText = false;
55307
55417
 
55308
55418
  // url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
55309
55419
  // let dataObj = {'mmcifheader': data1};
55310
55420
 
55311
55421
  // let data = await me.getAjaxPostPromise(url, dataObj, false, "The mmCIF data of " + mmcifid + " can not be parsed...");
55312
55422
 
55313
- let bText = true;
55314
55423
  let bNoCoord = true;
55315
55424
  let bcifData = ic.bcifParserCls.getBcifJson(data1, mmcifid, bText, bNoCoord);
55425
+
55316
55426
  let data = JSON.parse(bcifData);
55317
55427
 
55318
55428
  if(data.emd !== undefined) ic.emd = data.emd;
@@ -55806,7 +55916,8 @@ class MmdbParser {
55806
55916
  chain2molid[chain] = i;
55807
55917
  molid2chain[i] = chain;
55808
55918
 
55809
- ic.chainsColor[chain] = (type !== undefined && !me.cfg.mmdbafid) ? me.parasCls.thr(me.htmlCls.GREY8) : me.parasCls.thr(color);
55919
+ // ic.chainsColor[chain] = (type !== undefined && !me.cfg.mmdbafid) ? me.parasCls.thr(me.htmlCls.GREY8) : me.parasCls.thr(color);
55920
+ if(type === undefined || me.cfg.mmdbafid) ic.chainsColor[chain] = me.parasCls.thr(color);
55810
55921
 
55811
55922
  let geneId =(molid2rescount[i].geneId === undefined) ? '' : molid2rescount[i].geneId;
55812
55923
  let geneSymbol =(molid2rescount[i].geneSymbol === undefined) ? '' : molid2rescount[i].geneSymbol;
@@ -55983,9 +56094,11 @@ class BcifParser {
55983
56094
  // let bcifJson = JSON.parse(bcifData);
55984
56095
  // await ic.mmcifParserCls.loadMmcifData(bcifJson, bcifid);
55985
56096
 
55986
- await ic.opmParserCls.loadOpmData(bcifArrayBuffer, bcifid, undefined, 'mmcif', undefined, bText);
56097
+ await ic.opmParserCls.loadOpmData(bcifArrayBuffer, bcifid, undefined, 'bcif', undefined, bText);
55987
56098
  }
55988
56099
 
56100
+ // For text mmCIF file, CIFTools library does not support atom_site.getColumn("Cartn_x").data,
56101
+ // but just support atom_site.getColumn("Cartn_x").getFloat(i). So do not use "bText = true" for now.
55989
56102
  getBcifJson(bcifData, bcifid, bText, bNoCoord) { let ic = this.icn3d, me = ic.icn3dui;
55990
56103
  let text = "";
55991
56104
 
@@ -56625,46 +56738,32 @@ class BcifParser {
56625
56738
  // Retrieve the table corresponding to the struct_oper_list category, which delineates assembly
56626
56739
  let struct_oper_list = block.getCategory("_pdbx_struct_oper_list");
56627
56740
 
56628
- let struct_oper_idArray = struct_oper_list.getColumn("id").data;
56629
- let m11Array = struct_oper_list.getColumn("matrix[1][1]").data;
56630
- let m12Array = struct_oper_list.getColumn("matrix[1][2]").data;
56631
- let m13Array = struct_oper_list.getColumn("matrix[1][3]").data;
56632
- let m14Array = struct_oper_list.getColumn("vector[1]").data;
56633
-
56634
- let m21Array = struct_oper_list.getColumn("matrix[2][1]").data;
56635
- let m22Array = struct_oper_list.getColumn("matrix[2][2]").data;
56636
- let m23Array = struct_oper_list.getColumn("matrix[2][3]").data;
56637
- let m24Array = struct_oper_list.getColumn("vector[2]").data;
56638
-
56639
- let m31Array = struct_oper_list.getColumn("matrix[3][1]").data;
56640
- let m32Array = struct_oper_list.getColumn("matrix[3][2]").data;
56641
- let m33Array = struct_oper_list.getColumn("matrix[3][3]").data;
56642
- let m34Array = struct_oper_list.getColumn("vector[3]").data;
56643
-
56644
56741
  text += ", \"assembly\":[";
56645
56742
 
56646
56743
  let pmatrix = ", \"pmatrix\":";
56647
56744
  let bPmatrix = false;
56648
56745
 
56649
56746
  let assemblySize = struct_oper_list.rowCount;
56747
+
56748
+ // could be one or more rows, struct_oper_list.getColumn("id").data is unavailable if one row
56650
56749
  for (let i = 0; i < assemblySize; ++i) {
56651
- let struct_oper_id = struct_oper_idArray[i];
56750
+ let struct_oper_id = struct_oper_list.getColumn("id").getString(i);
56652
56751
  if(struct_oper_id == "X0") continue;
56653
56752
 
56654
- let m11 = m11Array[i];
56655
- let m12 = m12Array[i];
56656
- let m13 = m13Array[i];
56657
- let m14 = m14Array[i];
56658
-
56659
- let m21 = m21Array[i];
56660
- let m22 = m22Array[i];
56661
- let m23 = m23Array[i];
56662
- let m24 = m24Array[i];
56663
-
56664
- let m31 = m31Array[i];
56665
- let m32 = m32Array[i];
56666
- let m33 = m33Array[i];
56667
- let m34 = m34Array[i];
56753
+ let m11 = struct_oper_list.getColumn("matrix[1][1]").getFloat(i);
56754
+ let m12 = struct_oper_list.getColumn("matrix[1][2]").getFloat(i);
56755
+ let m13 = struct_oper_list.getColumn("matrix[1][3]").getFloat(i);
56756
+ let m14 = struct_oper_list.getColumn("vector[1]").getFloat(i);
56757
+
56758
+ let m21 = struct_oper_list.getColumn("matrix[2][1]").getFloat(i);
56759
+ let m22 = struct_oper_list.getColumn("matrix[2][2]").getFloat(i);
56760
+ let m23 = struct_oper_list.getColumn("matrix[2][3]").getFloat(i);
56761
+ let m24 = struct_oper_list.getColumn("vector[2]").getFloat(i);
56762
+
56763
+ let m31 = struct_oper_list.getColumn("matrix[3][1]").getFloat(i);
56764
+ let m32 = struct_oper_list.getColumn("matrix[3][2]").getFloat(i);
56765
+ let m33 = struct_oper_list.getColumn("matrix[3][3]").getFloat(i);
56766
+ let m34 = struct_oper_list.getColumn("vector[3]").getFloat(i);
56668
56767
 
56669
56768
  let matrix = "[" + m11 + "," + m21 + "," + m31 + ", 0, "
56670
56769
  + m12 + "," + m22 + "," + m32 + ", 0, "
@@ -56686,9 +56785,6 @@ class BcifParser {
56686
56785
  text += "]";
56687
56786
 
56688
56787
  if(bPmatrix) text += pmatrix;
56689
-
56690
- struct_oper_idArray = m11Array = m12Array = m13Array = m14Array = m21Array = m22Array = m23Array
56691
- = m24Array = m31Array = m32Array = m33Array = m34Array = [];
56692
56788
  }
56693
56789
 
56694
56790
  if(vDisulfides.length > 0) {
@@ -56973,10 +57069,11 @@ class OpmParser {
56973
57069
  try {
56974
57070
  if(!pdbid) pdbid = ic.defaultPdbId;
56975
57071
  let url = me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&opm&uid=" + pdbid.toLowerCase();
56976
-
57072
+
56977
57073
  let opmdata = await me.getAjaxPromise(url, 'jsonp', false);
56978
57074
 
56979
57075
  this.setOpmData(opmdata); // set ic.bOpm
57076
+
56980
57077
  await this.parseAtomData(data, pdbid, bFull, type, pdbid2, bText);
56981
57078
  }
56982
57079
  catch(err) {
@@ -57017,9 +57114,13 @@ class OpmParser {
57017
57114
  else
57018
57115
  */
57019
57116
 
57020
- if(type === 'mmcif') {
57021
- // ic.loadAtomDataCls.loadAtomDataIn(data, data.mmcif, 'mmcifid', undefined, undefined);
57022
- ic.loadCIFCls.loadCIF(data, pdbid, bText);
57117
+ if(type === 'mmcif' || type === 'bcif') {
57118
+ if(type === 'mmcif') {
57119
+ ic.loadAtomDataCls.loadAtomDataIn(data, data.mmcif, 'mmcifid', undefined, undefined);
57120
+ }
57121
+ else if(type === 'bcif') {
57122
+ ic.loadCIFCls.loadCIF(data, pdbid, bText);
57123
+ }
57023
57124
 
57024
57125
  if(ic.emd !== undefined) {
57025
57126
  $("#" + ic.pre + "mapWrapper1").hide();
@@ -57037,15 +57138,17 @@ class OpmParser {
57037
57138
  }
57038
57139
 
57039
57140
  // load assembly info
57040
- let assembly =(data.assembly !== undefined) ? data.assembly : [];
57041
- for(let i = 0, il = assembly.length; i < il; ++i) {
57042
- if(ic.biomtMatrices[i] == undefined) ic.biomtMatrices[i] = new THREE.Matrix4().identity();
57043
-
57044
- for(let j = 0, jl = assembly[i].length; j < jl; ++j) {
57045
- ic.biomtMatrices[i].elements[j] = assembly[i][j];
57141
+ if(type === 'mmcif') {
57142
+ let assembly =(data.assembly !== undefined) ? data.assembly : [];
57143
+ for(let i = 0, il = assembly.length; i < il; ++i) {
57144
+ if(ic.biomtMatrices[i] == undefined) ic.biomtMatrices[i] = new THREE.Matrix4().identity();
57145
+
57146
+ for(let j = 0, jl = assembly[i].length; j < jl; ++j) {
57147
+ ic.biomtMatrices[i].elements[j] = assembly[i][j];
57148
+ }
57046
57149
  }
57047
57150
  }
57048
-
57151
+
57049
57152
  if(ic.biomtMatrices !== undefined && ic.biomtMatrices.length > 1) {
57050
57153
  $("#" + ic.pre + "assemblyWrapper").show();
57051
57154
 
@@ -57054,7 +57157,7 @@ class OpmParser {
57054
57157
 
57055
57158
  ic.setStyleCls.setAtomStyleByOptions(ic.opts);
57056
57159
  ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
57057
-
57160
+
57058
57161
  await ic.ParserUtilsCls.renderStructure();
57059
57162
 
57060
57163
  if(me.cfg.rotate !== undefined) ic.resizeCanvasCls.rotStruc(me.cfg.rotate, true);
@@ -57167,6 +57270,7 @@ class PdbParser {
57167
57270
  await this.loadPdbData(data, id, undefined, bAppend);
57168
57271
  }
57169
57272
  else if(type === 'mmcif') {
57273
+ /*
57170
57274
  // let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
57171
57275
  // let dataObj = {'mmciffile': data};
57172
57276
  // let data2 = await me.getAjaxPostPromise(url, dataObj, true);
@@ -57178,6 +57282,12 @@ class PdbParser {
57178
57282
 
57179
57283
  // await ic.mmcifParserCls.loadMmcifData(bcifJson, undefined);
57180
57284
  await ic.opmParserCls.loadOpmData(data, undefined, undefined, 'mmcif', undefined, bText);
57285
+ */
57286
+
57287
+ let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
57288
+ let dataObj = {'mmciffile': data};
57289
+ let data2 = await me.getAjaxPostPromise(url, dataObj, true);
57290
+ await ic.mmcifParserCls.loadMmcifData(data2, undefined);
57181
57291
  }
57182
57292
  else if(type === 'mol2') {
57183
57293
  await ic.mol2ParserCls.loadMol2Data(data);
@@ -63524,7 +63634,8 @@ class LoadCIF {
63524
63634
  this.icn3d = icn3d;
63525
63635
  }
63526
63636
 
63527
- // loadCIF(src, bcifid, bOpm, bVector, bMutation, bAppend, type, bEsmfold, bText) { let ic = this.icn3d, me = ic.icn3dui;
63637
+ // For text mmCIF file, CIFTools library does not support atom_site.getColumn("Cartn_x").data,
63638
+ // but just support atom_site.getColumn("Cartn_x").getFloat(i). So do not use "bText = true" for now.
63528
63639
  loadCIF(bcifData, bcifid, bText, bAppend) { let ic = this.icn3d, me = ic.icn3dui;
63529
63640
  let hAtoms = {};
63530
63641
 
@@ -63539,7 +63650,6 @@ class LoadCIF {
63539
63650
 
63540
63651
  let block = parsed.result.dataBlocks[0];
63541
63652
 
63542
-
63543
63653
  let bNMR = false;
63544
63654
  // let lines = src.split('\n');
63545
63655
 
@@ -65604,6 +65714,7 @@ class ApplyCommand {
65604
65714
  }
65605
65715
  else if(command == 'defined sets') {
65606
65716
  ic.definedSetsCls.showSets();
65717
+ ic.bDefinedSets = true;
65607
65718
  }
65608
65719
  else if(command == 'delete selected sets') {
65609
65720
  ic.definedSetsCls.deleteSelectedSets();
@@ -65731,7 +65842,10 @@ class ApplyCommand {
65731
65842
  commandOri = commandOri.replace(/aligned_protein/g, 'protein_aligned');
65732
65843
 
65733
65844
  // define chains
65734
- ic.definedSetsCls.setChainsInMenu();
65845
+ if(!ic.bDefinedSets) {
65846
+ ic.definedSetsCls.setPredefinedInMenu();
65847
+ ic.bDefinedSets = true;
65848
+ }
65735
65849
 
65736
65850
  let paraArray = commandOri.split(' | '); // atom names might be case-sensitive
65737
65851
 
@@ -71540,25 +71654,6 @@ class Dssp {
71540
71654
  let result = ic.domain3dCls.c2b_NewSplitChain(currAtoms, undefined);
71541
71655
  let subdomains = result.subdomains;
71542
71656
  let pos2resi = result.pos2resi;
71543
- /*
71544
- if(subdomains.length <= 1) {
71545
- let residueArray = ic.resid2specCls.atoms2residues(Object.keys(currAtoms));
71546
- if(residueArray.length < minResidues) return domainAtomsArray;
71547
-
71548
- for(let n = 0, nl = residueArray.length; n < nl; ++n) {
71549
- let resid = residueArray[n];
71550
-
71551
- // clear previous refnum assignment if any
71552
- // if(bRerunDomain) {
71553
- delete ic.resid2refnum[resid];
71554
- delete ic.residIgLoop[resid];
71555
- // }
71556
- }
71557
-
71558
- domainAtomsArray.push(currAtoms);
71559
- }
71560
- else
71561
- */
71562
71657
 
71563
71658
  if(subdomains.length >= 1) {
71564
71659
  for(let k = 0, kl = subdomains.length; k < kl; ++k) {
@@ -71576,7 +71671,7 @@ class Dssp {
71576
71671
  domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
71577
71672
 
71578
71673
  // clear previous refnum assignment if any
71579
- delete ic.resid2refnum[resid];
71674
+ // delete ic.resid2refnum[resid];
71580
71675
  delete ic.residIgLoop[resid];
71581
71676
  }
71582
71677
  }
@@ -71623,12 +71718,11 @@ class Dssp {
71623
71718
 
71624
71719
  parseAlignData_part1(dataArray, domainidpairArray, bRound1) { let ic = this.icn3d, me = ic.icn3dui;
71625
71720
  // async parseAlignData(dataArray, domainidpairArray, bRound1) { let ic = this.icn3d, me = ic.icn3dui;
71626
- let tmscoreThreshold = 0.4; // 0.4; //0.5;
71721
+ let tmscoreThreshold = 0.45; // 0.4; //0.5;
71627
71722
  //let rmsdThreshold = 10;
71628
71723
 
71629
71724
  // find the best alignment for each chain
71630
71725
  let domainid2segs = {};
71631
- let domainid2strandcnt = {};
71632
71726
  let domainid2refpdbnamelist = {};
71633
71727
 
71634
71728
  if(!ic.chainid2refpdbname) ic.chainid2refpdbname = {};
@@ -71747,14 +71841,16 @@ class Dssp {
71747
71841
  }
71748
71842
 
71749
71843
  // count the number of matched strands
71750
- let strandHash = {};
71751
- for(let j = 0, jl = queryData[0].segs.length; j < jl; ++j) {
71752
- let seg = queryData[0].segs[j];
71753
- let q_start = parseInt(seg.q_start);
71844
+ // let strandHash = {};
71845
+ // for(let j = 0, jl = queryData[0].segs.length; j < jl; ++j) {
71846
+ // let seg = queryData[0].segs[j];
71847
+ // let q_start = parseInt(seg.q_start)
71754
71848
 
71755
- let strand = this.getStrandFromRefnum(q_start);
71756
- strandHash[strand] = 1;
71757
- }
71849
+ // let strand = this.getStrandFromRefnum(q_start);
71850
+ // strandHash[strand] = 1;
71851
+ // }
71852
+
71853
+ // let tmAdjust = 0.1;
71758
71854
  let score = parseFloat(queryData[0].score);
71759
71855
 
71760
71856
  // if the TM score difference is within 0.1 and more strands are found, use the template with more strands
@@ -71777,7 +71873,7 @@ class Dssp {
71777
71873
  }
71778
71874
 
71779
71875
  domainid2segs[domainid] = queryData[0].segs;
71780
- domainid2strandcnt[domainid] = Object.keys(strandHash).length;
71876
+ // domainid2strandcnt[domainid] = Object.keys(strandHash).length;
71781
71877
 
71782
71878
  ic.domainid2ig2kabat[domainid] = queryData[0].ig2kabat;
71783
71879
  ic.domainid2ig2imgt[domainid] = queryData[0].ig2imgt;
@@ -72108,20 +72204,6 @@ class Dssp {
72108
72204
  ic.resid2refnum_ori[resid] = refnumLabel;
72109
72205
  ic.resid2domainid[resid] = domainid;
72110
72206
  }
72111
-
72112
- // final reference numbers will be assign in ic.annoIgCls.showRefNum()
72113
-
72114
- // if(!ic.refnum2residArray.hasOwnProperty(refnum)) {
72115
- // ic.refnum2residArray[refnum] = [resid];
72116
- // }
72117
- // else {
72118
- // ic.refnum2residArray[refnum].push(resid);
72119
- // }
72120
-
72121
- // if(!ic.chainsMapping.hasOwnProperty(chainid)) {
72122
- // ic.chainsMapping[chainid] = {};
72123
- // }
72124
- // ic.chainsMapping[chainid][resid] = refnumLabel;
72125
72207
  //}
72126
72208
  }
72127
72209
  }
@@ -72146,34 +72228,6 @@ class Dssp {
72146
72228
  ic.chainid2igtrack[chainid] = this.ajdustRefnum(giSeq, chainid);
72147
72229
  }
72148
72230
  }
72149
-
72150
- /*
72151
- if(Object.keys(ic.resid2refnum).length > 0) {
72152
- ic.bShowRefnum = true;
72153
-
72154
- // open sequence view
72155
- ic.hAtomsRefnum = {};
72156
- //ic.bResetAnno = true;
72157
- if(ic.bAnnoShown) {
72158
- for(let chain in ic.protein_chainid) {
72159
- let chainidBase = ic.protein_chainid[chain];
72160
- ic.showSeqCls.showSeq(chain, chainidBase, 'protein');
72161
- }
72162
- }
72163
- else {
72164
- await ic.showAnnoCls.showAnnotations();
72165
- }
72166
-
72167
- ic.annotationCls.setAnnoViewAndDisplay('detailed view');
72168
- }
72169
- else if(!me.bNode) {
72170
- if(!ic.bNoIg) {
72171
- // alert("No Ig reference numbers are assigned based on the reference structures in iCn3D...");
72172
- console.log("No Ig reference numbers are assigned based on the reference structures in iCn3D...");
72173
- ic.bNoIg = true;
72174
- }
72175
- }
72176
- */
72177
72231
  }
72178
72232
 
72179
72233
  getStrandFromRefnum(oriRefnum, prevStrand) { let ic = this.icn3d; ic.icn3dui;
@@ -72837,15 +72891,13 @@ class Dssp {
72837
72891
  domainid = strandArray[strandCnt].domainid;
72838
72892
  }
72839
72893
  else {
72840
- //loopCnt = 0;
72841
72894
  refnumLabelNoPostfix = undefined;
72842
72895
  refnumLabel = undefined;
72843
72896
  }
72844
72897
  }
72845
72898
  else {
72846
- if(prevStrandCnt >= 0
72847
- // && (strandArray[prevStrandCnt].strand.substr(0, 1) == 'F' || strandArray[prevStrandCnt].strand.substr(0, 1) == 'G')) {
72848
- && (strandArray[prevStrandCnt].strand.substr(0, 1) == 'G')) {
72899
+ // if(prevStrandCnt >= 0 && (strandArray[prevStrandCnt].strand.substr(0, 1) == 'G')) {
72900
+ if(prevStrandCnt >= 0 && (strandArray[prevStrandCnt].strand.substr(0, 1) == 'G' || (strandArray[prevStrandCnt].strand.substr(0, 1) == 'F' && strandArray[strandCnt].strand.substr(0, 1) != 'G') )) {
72849
72901
  if(!bAfterGstrand) {
72850
72902
  //loopCnt = 0;
72851
72903
  refnumLabelNoPostfix = undefined;
@@ -78203,16 +78255,9 @@ class ShareLink {
78203
78255
 
78204
78256
  //statefile += ic.commands[i] + "\n";
78205
78257
 
78206
- // only output the most recent 'select saved atoms...' without " | name ..."
78258
+ // only output the most recent 'select sets...' without " | name ..."
78207
78259
  // or those select without names
78208
- // if(((prevCommandStr.indexOf('select saved atoms') !== -1 || prevCommandStr.indexOf('select sets') !== -1)
78209
- // &&(commandStr.indexOf('select') === 0 || commandStr.indexOf('select') === 0)
78210
- // && prevCommandStr.indexOf(' name ') === -1)
78211
- // ||(prevCommandStr.indexOf('pickatom') !== -1 && commandStr.indexOf('pickatom') !== -1)
78212
- // ) {
78213
-
78214
- if(prevCommandStr.indexOf('select') == 0 && prevCommandStr.indexOf('select prop') === -1
78215
- && commandStr.indexOf('select') === 0 && commandStr.indexOf('select prop') === -1
78260
+ if(prevCommandStr.indexOf('select sets') == 0 && commandStr.indexOf('select sets') === 0
78216
78261
  && prevCommandStr.indexOf(' name ') === -1) ;
78217
78262
  else if(prevCommandStr.indexOf('pickatom') !== -1 && commandStr.indexOf('pickatom') !== -1) ;
78218
78263
  // remove all "show selection" except the last one