icn3d 3.26.7 → 3.26.9

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
@@ -6031,6 +6031,21 @@ class ClickMenu {
6031
6031
  thisClass.setLogCmd("export pdb hydrogen", true);
6032
6032
  });
6033
6033
 
6034
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportIgstrand", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6035
+ ic.refnumCls.exportRefnum('igstrand');
6036
+ thisClass.setLogCmd("export refnum igstrand", true);
6037
+ });
6038
+
6039
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportKabat", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6040
+ ic.refnumCls.exportRefnum('kabat');
6041
+ thisClass.setLogCmd("export refnum kabat", true);
6042
+ });
6043
+
6044
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportImgt", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6045
+ ic.refnumCls.exportRefnum('imgt');
6046
+ thisClass.setLogCmd("export refnum imgt", true);
6047
+ });
6048
+
6034
6049
  me.myEventCls.onIds("#" + me.pre + "mn1_exportStl", "click", function(e) { let ic = me.icn3d; //e.preventDefault();
6035
6050
  thisClass.setLogCmd("export stl file", false);
6036
6051
  //ic.threeDPrintCls.hideStabilizer();
@@ -8603,6 +8618,16 @@ class SetMenu {
8603
8618
  html += this.getLink('mn1_exportSecondary', 'Secondary Structure', undefined, 2);
8604
8619
  }
8605
8620
 
8621
+ //!!!
8622
+ /*
8623
+ html += this.getMenuText('m1_exportrefnum', 'Reference Numbers', undefined, undefined, 2);
8624
+ html += "<ul>";
8625
+ html += this.getLink('mn1_exportIgstrand', 'Ig Strand', undefined, 3);
8626
+ html += this.getLink('mn1_exportKabat', 'Kabat', undefined, 3);
8627
+ html += this.getLink('mn1_exportImgt', 'IMGT', undefined, 3);
8628
+ html += "</ul>";
8629
+ */
8630
+
8606
8631
  html += "<li><br/></li>";
8607
8632
 
8608
8633
  html += "</ul>";
@@ -12859,7 +12884,7 @@ class Events {
12859
12884
  if(esmfold_fasta.indexOf('>') != -1) { //FASTA with header
12860
12885
  let pos = esmfold_fasta.indexOf('\n');
12861
12886
  ic.esmTitle = esmfold_fasta.substr(1, pos - 1).trim();
12862
- pdbid = ic.esmTitle.substr(0, ic.esmTitle.indexOf(' '));
12887
+ pdbid = (ic.esmTitle.indexOf(' ') != -1) ? ic.esmTitle.substr(0, ic.esmTitle.indexOf(' ')) : ic.esmTitle;
12863
12888
  if(pdbid.length < 6) pdbid = pdbid.padEnd(6, '-');
12864
12889
 
12865
12890
  esmfold_fasta = esmfold_fasta.substr(pos + 1);
@@ -42092,6 +42117,7 @@ class ShowSeq {
42092
42117
  break;
42093
42118
  }
42094
42119
  }
42120
+
42095
42121
  if(kabat_or_imgt == 1 && !bKabatFound) {
42096
42122
  return {html: '', html3: ''};
42097
42123
  }
@@ -44435,9 +44461,14 @@ class LineGraph {
44435
44461
  domainAtomsArray.push(currAtoms);
44436
44462
 
44437
44463
  let residueArray = ic.resid2specCls.atoms2residues(Object.keys(currAtoms));
44464
+
44465
+ let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(currAtoms);
44466
+ let atomLast = ic.firstAtomObjCls.getLastAtomObj(currAtoms);
44467
+ let resiSum = parseInt(atomFirst.resi) + parseInt(atomLast.resi);
44468
+
44438
44469
  for(let n = 0, nl = residueArray.length; n < nl; ++n) {
44439
44470
  let resid = residueArray[n];
44440
- ic.resid2domainid[resid] = chainid + '-0' + '_' + Object.keys(currAtoms).length;
44471
+ ic.resid2domainid[resid] = chainid + '-0' + '_' + resiSum;
44441
44472
  }
44442
44473
  }
44443
44474
  else {
@@ -44457,13 +44488,17 @@ class LineGraph {
44457
44488
 
44458
44489
  domainAtomsArray.push(domainAtoms);
44459
44490
 
44491
+ let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(domainAtoms);
44492
+ let atomLast = ic.firstAtomObjCls.getLastAtomObj(domainAtoms);
44493
+ let resiSum = parseInt(atomFirst.resi) + parseInt(atomLast.resi);
44494
+
44460
44495
  for(let m = 0, ml = segArray.length; m < ml; m += 2) {
44461
44496
  let startResi = segArray[m];
44462
44497
  let endResi = segArray[m+1];
44463
44498
  for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
44464
44499
  let resid = chainid + '_' + pos2resi[n];
44465
44500
  //domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
44466
- ic.resid2domainid[resid] = chainid + '-' + k + '_' + Object.keys(domainAtoms).length;
44501
+ ic.resid2domainid[resid] = chainid + '-' + k + '_' + resiSum;
44467
44502
  }
44468
44503
  }
44469
44504
  }
@@ -44502,8 +44537,8 @@ class LineGraph {
44502
44537
  // let allPromise = Promise.allSettled(ajaxArray);
44503
44538
  // dataArray2 = await allPromise;
44504
44539
 
44505
- //split arrays into chunks of 100 jobs
44506
- let n = (me.bNode) ? 16 : 96;
44540
+ //split arrays into chunks of 96 jobs or me.cfg.maxajax jobs
44541
+ let n = (me.cfg.maxajax) ? me.cfg.maxajax : 96;
44507
44542
 
44508
44543
  for(let i = 0, il = parseInt((ajaxArray.length - 1) / n + 1); i < il; ++i) {
44509
44544
  let currAjaxArray = [];
@@ -44603,6 +44638,8 @@ class LineGraph {
44603
44638
  let refpdbname = domainidpairArray[i].substr(domainidpairArray[i].indexOf('|') + 1);
44604
44639
  //let chainid = domainid.split('-')[0];
44605
44640
 
44641
+ if(!me.bNode) console.log("refpdbname " + refpdbname + " TM-score: " + queryData[0].score);
44642
+
44606
44643
  // Ig-like domains: B (2150, 2150a, 2150b), C (3150, 3250), E (7150, 7250), F (8150, 8250) strands
44607
44644
  // Ig domain may require G (7050). But we'll leave that out for now.
44608
44645
  let bBstrand = false, bCstrand = false, bEstrand = false, bFstrand = false;
@@ -44726,6 +44763,8 @@ class LineGraph {
44726
44763
  if(!ic.resid2refnum) ic.resid2refnum = {};
44727
44764
  if(!ic.refnum2residArray) ic.refnum2residArray = {};
44728
44765
  if(!ic.chainsMapping) ic.chainsMapping = {};
44766
+
44767
+ if(!ic.refPdbList) ic.refPdbList = [];
44729
44768
  for(let chainid in chainid2segs) {
44730
44769
  let segArray = chainid2segs[chainid];
44731
44770
 
@@ -44734,7 +44773,8 @@ class LineGraph {
44734
44773
  let chainList = this.getTemplateList(chainid);
44735
44774
 
44736
44775
  //if(!me.bNode) console.log("The reference PDB(s) for chain " + chainid + " are " + chainList);
44737
- console.log("The reference PDB(s) for chain " + chainid + " are " + chainList);
44776
+ if(!me.bNode) console.log("The reference PDB(s) for chain " + chainid + " are " + chainList);
44777
+ ic.refPdbList.push("The reference PDB(s) for chain " + chainid + " are " + chainList);
44738
44778
 
44739
44779
  let prevStrand;
44740
44780
  let bCd19 = refpdbnameArray.length == 1 && refpdbnameArray[0] == 'CD19_6al5A_human_C2orV-n1';
@@ -44917,9 +44957,121 @@ class LineGraph {
44917
44957
  ic.annotationCls.setAnnoViewAndDisplay('detailed view');
44918
44958
  }
44919
44959
 
44920
- rmStrandFromRefnumlabel(refnumLabel) {
44960
+ rmStrandFromRefnumlabel(refnumLabel) { let ic = this.icn3d; ic.icn3dui;
44921
44961
  return (!refnumLabel) ? refnumLabel : refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').replace(/\+/g, '').replace(/\-/g, '').substr(1); // C', C''
44922
44962
  }
44963
+
44964
+ exportRefnum(type) { let ic = this.icn3d, me = ic.icn3dui;
44965
+ let refData = '';
44966
+
44967
+ // 1. show IgStrand ref numbers
44968
+ if(type == 'igstrand' || type == 'IgStrand') {
44969
+ // iGStrand reference numbers were adjusted when showing in sequences
44970
+ if(me.bNode) {
44971
+ for(let chnid in ic.chains) {
44972
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chnid]);
44973
+ if(ic.proteins.hasOwnProperty(atom.serial)) {
44974
+ let giSeq = [];
44975
+ for(let i = 0; i < ic.chainsSeq[chnid].length; ++i) {
44976
+ giSeq.push(ic.chainsSeq[chnid][i].name);
44977
+ }
44978
+ ic.showSeqCls.showRefNum(giSeq, chnid);
44979
+ }
44980
+ }
44981
+ }
44982
+
44983
+ let resid2refnum = {};
44984
+ for(let resid in ic.resid2refnum) {
44985
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
44986
+ if(!atom) continue;
44987
+
44988
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
44989
+
44990
+ let domainid = ic.resid2domainid[resid];
44991
+ let refnumLabel = ic.resid2refnum[resid];
44992
+
44993
+ if(refnumLabel) {
44994
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
44995
+ (ic.domainid2ig2kabat[domainid]) ? ic.domainid2ig2kabat[domainid][refnumStr_ori] : undefined;
44996
+ }
44997
+
44998
+ if(ic.resid2refnum[resid]) {
44999
+ if(ic.residIgLoop.hasOwnProperty(resid)) { // loop
45000
+ resid2refnum[resid + '_' + resn] = ic.resid2refnum[resid] + '_loop';
45001
+ }
45002
+ else {
45003
+ resid2refnum[resid + '_' + resn] = ic.resid2refnum[resid];
45004
+ }
45005
+ }
45006
+ }
45007
+
45008
+ refData += '{"ref PDB" : ' + JSON.stringify(ic.refPdbList) + ",\n";
45009
+
45010
+ refData += '"data": {\n';
45011
+ for(let chnid in ic.chains) {
45012
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chnid]);
45013
+ if(ic.proteins.hasOwnProperty(atom.serial)) {
45014
+ for(let i = 0; i < ic.chainsSeq[chnid].length; ++i) {
45015
+ const resid = chnid + '_' + ic.chainsSeq[chnid][i].resi + '_' + ic.chainsSeq[chnid][i].name;
45016
+
45017
+ refData += "'" + resid + "': '" + resid2refnum[resid] + "',\n";
45018
+ }
45019
+ }
45020
+ }
45021
+ refData += '}\n';
45022
+ refData += '}\n';
45023
+ }
45024
+ // 2. show Kabat ref numbers
45025
+ else if(type == 'kabat' || type == 'Kabat') {
45026
+ let resid2kabat = {};
45027
+ for(let resid in ic.resid2refnum) {
45028
+ let domainid = ic.resid2domainid[resid];
45029
+ let refnumStr, refnumLabel = ic.resid2refnum[resid];
45030
+
45031
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
45032
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
45033
+
45034
+ if(refnumLabel) {
45035
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
45036
+ refnumStr = (ic.domainid2ig2kabat[domainid]) ? ic.domainid2ig2kabat[domainid][refnumStr_ori] : undefined;
45037
+ }
45038
+
45039
+ resid2kabat[resid + '_' + resn] = refnumStr;
45040
+ }
45041
+
45042
+ refData += JSON.stringify(resid2kabat);
45043
+ }
45044
+ // 3. show IMGT ref numbers
45045
+ else if(type == 'imgt'|| type == 'IMGT') {
45046
+ let resid2imgt = {};
45047
+ for(let resid in ic.resid2refnum) {
45048
+ let domainid = ic.resid2domainid[resid];
45049
+ let refnumStr, refnumLabel = ic.resid2refnum[resid];
45050
+
45051
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
45052
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
45053
+
45054
+ if(refnumLabel) {
45055
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
45056
+ refnumStr = (ic.domainid2ig2imgt[domainid]) ? ic.domainid2ig2imgt[domainid][refnumStr_ori] : undefined;
45057
+ }
45058
+
45059
+ resid2imgt[resid + '_' + resn] = refnumStr;
45060
+ }
45061
+
45062
+ refData += JSON.stringify(resid2imgt);
45063
+ }
45064
+
45065
+
45066
+ if(!me.bNode) {
45067
+ let file_pref = Object.keys(me.utilsCls.getHlStructures()).join(',');
45068
+
45069
+ ic.saveFileCls.saveFile(file_pref + '_refnum_' + type + '.txt', 'text', [refData]);
45070
+ }
45071
+ else {
45072
+ return refData;
45073
+ }
45074
+ }
44923
45075
  }
44924
45076
 
44925
45077
  /**
@@ -48261,7 +48413,7 @@ class ChainalignParser {
48261
48413
  let chainid = chainidArray[i];
48262
48414
  let pos = chainid.indexOf('_');
48263
48415
  let struct = chainid.substr(0, pos);
48264
- if(struct != ic.defaultPdbId) struct = struct.toUpperCase();
48416
+ //if(struct != ic.defaultPdbId) struct = struct.toUpperCase();
48265
48417
 
48266
48418
  if(!struct2cnt.hasOwnProperty(struct)) {
48267
48419
  struct2cnt[struct] = 1;
@@ -51511,7 +51663,7 @@ class RealignParser {
51511
51663
  let pos = chainidArray[i].indexOf('_');
51512
51664
  let mmdbid = chainidArray[i].substr(0, pos); //.toUpperCase();
51513
51665
 
51514
- if(!bRealign) mmdbid = mmdbid.toUpperCase();
51666
+ // if(!bRealign) mmdbid = mmdbid.toUpperCase();
51515
51667
 
51516
51668
  if(i == 0) {
51517
51669
  mmdbid_t = mmdbid;
@@ -51690,14 +51842,12 @@ class RealignParser {
51690
51842
  for(let j = 0, jl = resiArray.length; j < jl; ++j) {
51691
51843
  if(resiArray[j].indexOf('-') != -1) {
51692
51844
  let startEnd = resiArray[j].split('-');
51693
-
51694
51845
  for(let k = parseInt(startEnd[0]); k <= parseInt(startEnd[1]); ++k) {
51695
51846
  // from VAST neighbor page, use NCBI residue number
51696
51847
  //if(me.cfg.usepdbnum === false) k += base - 1;
51697
51848
 
51698
51849
  //let seqIndex = k - base;
51699
51850
  let seqIndex = ic.setSeqAlignCls.getPosFromResi(chainid, k);
51700
-
51701
51851
  // if(ic.bNCBI) {
51702
51852
  // let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[chainid + '_' + k]);
51703
51853
  // if(atom && atom.resiNCBI) seqIndex = atom.resiNCBI - 1;
@@ -51714,9 +51864,9 @@ class RealignParser {
51714
51864
  }
51715
51865
  }
51716
51866
  else { // one residue
51867
+
51717
51868
  //let k = parseInt(resiArray[j]);
51718
51869
  let k = resiArray[j];
51719
-
51720
51870
  // from VAST neighbor page, use NCBI residue number
51721
51871
  //if(me.cfg.usepdbnum === false) k += base - 1;
51722
51872
 
@@ -54640,22 +54790,23 @@ class SetSeqAlign {
54640
54790
  }
54641
54791
 
54642
54792
  getPosFromResi(chainid, resi) { let ic = this.icn3d; ic.icn3dui;
54643
- /*
54644
- let pos = undefined; //parseInt(resi);
54645
-
54646
- for(let i = 0, il = ic.chainsSeq[chainid].length; i < il; ++i) {
54647
- if(ic.chainsSeq[chainid][i].resi == resi) {
54648
- pos = i;
54649
- break;
54650
- }
54651
- }
54652
- */
54653
54793
  let residNCBI = ic.resid2ncbi[chainid + '_' + resi];
54654
54794
  let pos = undefined;
54795
+
54655
54796
  if(residNCBI) {
54656
54797
  let resiNCBI = residNCBI.substr(residNCBI.lastIndexOf('_') + 1);
54657
54798
  pos = resiNCBI - 1;
54658
54799
  }
54800
+ // else {
54801
+ // //let il = ic.chainsSeq[chainid].length;
54802
+ // let il = (ic.chainsSeq[chainid]) ? ic.chainsSeq[chainid].length : 0;
54803
+ // for(let i = 0; i < il; ++i) {
54804
+ // if(ic.chainsSeq[chainid][i].resi == resi) {
54805
+ // pos = i;
54806
+ // break;
54807
+ // }
54808
+ // }
54809
+ // }
54659
54810
 
54660
54811
  return pos;
54661
54812
  }
@@ -56114,6 +56265,7 @@ class LoadPDB {
56114
56265
 
56115
56266
  // different residue
56116
56267
  //if(residueNum !== prevResidueNum) {
56268
+
56117
56269
  if(oriResidueNum !== prevOriResidueNum) {
56118
56270
  let residue = me.utilsCls.residueName2Abbr(resn);
56119
56271
  ic.residueId2Name[residueNum] = residue;
@@ -57454,6 +57606,11 @@ class ApplyCommand {
57454
57606
  else if(command == 'export pdb hydrogen') {
57455
57607
  await ic.scapCls.exportPdbProfix(true);
57456
57608
  }
57609
+ else if(command.indexOf('export refnum ') != -1) {
57610
+ let type = command.substr(14);
57611
+
57612
+ ic.refnumCls.exportRefnum(type);
57613
+ }
57457
57614
  else if(command == 'export secondary structure') {
57458
57615
  me.htmlCls.setHtmlCls.exportSecondary();
57459
57616
  }
@@ -67306,6 +67463,26 @@ class SaveFile {
67306
67463
  return html;
67307
67464
  }
67308
67465
 
67466
+ printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt) { let ic = this.icn3d; ic.icn3dui;
67467
+ let ssText = '';
67468
+
67469
+ // print prev
67470
+ if(prevRealSsObj) {
67471
+ if(bHelix) {
67472
+ let helixType = 1;
67473
+ ssText += prevRealSsObj.resn.padStart(5, ' ') + prevRealSsObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67474
+ + prevRealSsObj.resi.toString().padStart(5, ' ') + ' ' + helixType + ssCnt.toString().padStart(36, ' ') + '\n';
67475
+ }
67476
+ else if(bSheet) {
67477
+ let sense = 0;
67478
+ ssText += prevRealSsObj.resn.padStart(5, ' ') + prevRealSsObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67479
+ + prevRealSsObj.resi.toString().padStart(4, ' ') + ' ' + sense + '\n';
67480
+ }
67481
+ }
67482
+
67483
+ return ssText;
67484
+ }
67485
+
67309
67486
  //getAtomPDB: function(atomHash, bPqr, bPdb, bNoChem) { let ic = this.icn3d, me = ic.icn3dui;
67310
67487
  getAtomPDB(atomHash, bPqr, bNoChem, bNoHeader, chainResi2pdb, pdbid) { let ic = this.icn3d, me = ic.icn3dui;
67311
67488
  let pdbStr = '';
@@ -67338,8 +67515,6 @@ class SaveFile {
67338
67515
 
67339
67516
  let calphaHash = me.hashUtilsCls.intHash(atomHash, ic.calphas);
67340
67517
  let helixStr = 'HELIX', sheetStr = 'SHEET';
67341
- let bHelixBegin = false, bHelixEnd = true;
67342
- let bSheetBegin = false, bSheetEnd = true;
67343
67518
 
67344
67519
  let stru2header = {};
67345
67520
  for(let stru in ic.structures) {
@@ -67347,48 +67522,82 @@ class SaveFile {
67347
67522
  }
67348
67523
 
67349
67524
  // if(!bNoSs) {
67350
- let prevResi, stru, chainid;
67525
+ let prevResi, stru;
67526
+ let ssArray = [];
67351
67527
  for(let i in calphaHash) {
67352
67528
  let atom = ic.atoms[i];
67353
67529
  stru = atom.structure;
67354
- chainid = atom.structure + '_' + atom.chain;
67530
+ atom.structure + '_' + atom.chain;
67355
67531
 
67356
- if(atom.ssbegin) {
67357
- if(atom.ss == 'helix') {
67358
- bHelixBegin = true;
67359
- if(bHelixEnd) stru2header[stru] += helixStr.padEnd(15, ' ') + atom.resn.padStart(3, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67360
- + atom.resi.toString().padStart(5, ' ');
67361
- bHelixEnd = false;
67362
- prevResi = atom.resi;
67363
- }
67364
- else if(atom.ss == 'sheet') {
67365
- bSheetBegin = true;
67366
- if(bSheetEnd) stru2header[stru] += sheetStr.padEnd(17, ' ') + atom.resn.padStart(3, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67367
- + atom.resi.toString().padStart(4, ' ');
67368
- bSheetEnd = false;
67369
- }
67532
+ let ssObj = {};
67533
+ ssObj.chain = atom.chain;
67534
+ ssObj.resn = atom.resn;
67535
+ ssObj.resi = atom.resi;
67536
+
67537
+ if(parseInt(atom.resi) > parseInt(prevResi) + 1) {
67538
+ ssObj.ss = ' ';
67539
+ ssArray.push(ssObj);
67540
+ }
67541
+
67542
+ if(atom.ss == 'helix') {
67543
+ ssObj.ss = 'H';
67544
+ ssArray.push(ssObj);
67545
+ }
67546
+ else if(atom.ss == 'sheet') {
67547
+ ssObj.ss = 'S';
67548
+ ssArray.push(ssObj);
67370
67549
  }
67371
67550
 
67372
67551
  if(atom.ssend) {
67373
- if(atom.ss == 'helix') {
67374
- bHelixEnd = true;
67375
- let residEnd = ic.resid2ncbi[chainid + '_' + atom.resi];
67376
- let residStart = ic.resid2ncbi[chainid + '_' + prevResi];
67377
- let helixLen = (residEnd && residStart) ? parseInt(residEnd.substr(residEnd.lastIndexOf('_') + 1)) - parseInt(residStart.substr(residStart.lastIndexOf('_') + 1)) : 0;
67378
- let helixType = 1;
67379
- if(bHelixBegin) stru2header[stru] += atom.resn.padStart(5, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67380
- + atom.resi.toString().padStart(5, ' ') + ' ' + helixType + helixLen.toString().padStart(36, ' ') + '\n';
67381
- bHelixBegin = false;
67382
- }
67383
- else if(atom.ss == 'sheet') {
67384
- bSheetEnd = true;
67385
- let sense = 0;
67386
- if(bSheetBegin) stru2header[stru] += atom.resn.padStart(5, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67387
- + atom.resi.toString().padStart(4, ' ') + ' ' + sense + '\n';
67388
- bSheetBegin = false;
67552
+ let ssObj2 = me.hashUtilsCls.cloneHash(ssObj);
67553
+ ssObj2.ss = ' ';
67554
+ ssArray.push(ssObj2);
67555
+ }
67556
+
67557
+ prevResi = atom.resi;
67558
+ }
67559
+
67560
+ let prevSs, prevRealSsObj, ssCnt = 0, bHelix = false, bSheet = false;
67561
+ for(let i = 0, il = ssArray.length; i < il; ++i) {
67562
+ let ssObj = ssArray[i];
67563
+
67564
+ if(ssObj.ss != prevSs) {
67565
+ // print prev
67566
+ stru2header[stru] += this.printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt);
67567
+
67568
+ // print current
67569
+ ssCnt = 0;
67570
+ bHelix = false;
67571
+ bSheet = false;
67572
+ prevRealSsObj = undefined;
67573
+
67574
+ if(ssObj.ss != ' ') {
67575
+ if(ssObj.ss == 'H') {
67576
+ bHelix = true;
67577
+ prevRealSsObj = ssObj;
67578
+ stru2header[stru] += helixStr.padEnd(15, ' ') + ssObj.resn.padStart(3, ' ') + ssObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67579
+ + ssObj.resi.toString().padStart(5, ' ');
67580
+ }
67581
+ else if(ssObj.ss == 'S') {
67582
+ bSheet = true;
67583
+ prevRealSsObj = ssObj;
67584
+ stru2header[stru] += sheetStr.padEnd(17, ' ') + ssObj.resn.padStart(3, ' ') + ssObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67585
+ + ssObj.resi.toString().padStart(4, ' ');
67586
+ }
67389
67587
  }
67390
67588
  }
67589
+
67590
+ if(ssObj.ss != ' ') {
67591
+ ++ssCnt;
67592
+ prevRealSsObj = ssObj;
67593
+ }
67594
+
67595
+ prevSs = ssObj.ss;
67391
67596
  }
67597
+
67598
+ // print prev
67599
+ stru2header[stru] += this.printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt);
67600
+
67392
67601
  // add a new line in case the structure is a subset
67393
67602
  stru2header[stru] += '\n';
67394
67603
  // }
@@ -67819,7 +68028,7 @@ class SaveFile {
67819
68028
  let structureidArray = Object.keys(idHash);
67820
68029
  inputid = structureidArray.join(',');
67821
68030
 
67822
- text = inputid.toUpperCase();
68031
+ text = (me.cfg.refseqid) ? ic.inputid : inputid.toUpperCase();
67823
68032
 
67824
68033
  //idName = (isNaN(inputid) && inputid.length > 5) ? "AlphaFold ID" : "PDB ID";
67825
68034
  if(bPdb && bAlphaFold) {
@@ -71309,6 +71518,7 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
71309
71518
  }
71310
71519
  else if(me.cfg.resdef !== undefined && me.cfg.matchedchains !== undefined) {
71311
71520
  let stru_t = Object.keys(ic.structures)[0];
71521
+
71312
71522
  let chain_t = stru_t + '_' + me.cfg.masterchain;
71313
71523
  let domainidArray = me.cfg.matchedchains.split(',');
71314
71524
  let chainidArray = [];