icn3d 3.23.2 → 3.23.3

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
@@ -10602,7 +10602,7 @@ class SetDialog {
10602
10602
 
10603
10603
  html += me.htmlCls.divStr + "dl_mutation' class='" + dialogClass + "'>";
10604
10604
  html += "<div style='width:500px'>";
10605
- html += 'Please specify the mutations with a comma separated mutation list. Each mutation can be specified as "[<b>uppercase</b> PDB ID or AlphaFold UniProt ID]_[Chain ID]_[Residue Number]_[One Letter Mutant Residue]". E.g., the mutation of N501Y in the E chain of PDB 6M0J can be specified as "6M0J_E_501_Y". For AlphaFold structures, the "Chain ID" is "A".<br/><br/>';
10605
+ html += 'Please specify the mutations with a comma separated mutation list. Each mutation can be specified as "[<b>uppercase</b> PDB ID or AlphaFold UniProt ID]_[Chain Name]_[Residue Number]_[One Letter Mutant Residue]". E.g., the mutation of N501Y in the E chain of PDB 6M0J can be specified as "6M0J_E_501_Y". For AlphaFold structures, the "Chain ID" is "A".<br/>If you load a custom structure without PDB or UniProt ID, you can open "Seq. & Annotations" window and find the chain ID such as "stru_A". The part before the underscore is the structure ID, which can be used to specify the mutation such as "stru_A_...". Remember to choose "Show Mutation in: Current Page".<br/><br/>';
10606
10606
  html += "<div style='display:inline-block; width:110px'>Mutations: </div>" + me.htmlCls.inputTextStr + "id='" + me.pre + "mutationids' value='6M0J_E_484_K,6M0J_E_501_Y,6M0J_E_417_N' size=50><br/><br/>";
10607
10607
 
10608
10608
  html += '<b>ID Type</b>: ';
@@ -10675,8 +10675,9 @@ class SetDialog {
10675
10675
  html += "</div>";
10676
10676
 
10677
10677
  html += me.htmlCls.divStr + "dl_mmdbafid' class='" + dialogClass + "' style='max-width:600px'>";
10678
- html += "Append a list of PDB, MMDB, or AlphaFold UniProt structures: " + me.htmlCls.inputTextStr + "id='" + me.pre + "mmdbafid' placeholder='e.g., 1HHO,4N7N,P69905,P01942' size=30> <br><br>";
10679
- html += me.htmlCls.buttonStr + "reload_mmdbaf'>Append Biological Unit</button>" + me.htmlCls.buttonStr + "reload_mmdbaf_asym' style='margin-left:30px'>Append Asymmetric Unit (All Chains)</button>" + "<br/><br/>";
10678
+ html += "List of PDB, MMDB, or AlphaFold UniProt structures: " + me.htmlCls.inputTextStr + "id='" + me.pre + "mmdbafid' placeholder='e.g., 1HHO,4N7N,P69905,P01942' size=30> <br><br>";
10679
+ html += "<div style='display:inline-block; width:20px'></div>" + me.htmlCls.buttonStr + "reload_mmdbaf' style='width:150px'>Load Biological Unit</button>" + me.htmlCls.buttonStr + "reload_mmdbaf_asym' style='margin-left:30px; width:250px'>Load Asymmetric Unit (All Chains)</button>" + "<br/><br/>";
10680
+ html += "<div style='display:inline-block; width:20px'>or</div>" + me.htmlCls.buttonStr + "reload_mmdbaf_append' style='width:150px'>Append Biological Unit</button>" + me.htmlCls.buttonStr + "reload_mmdbaf_asym_append' style='margin-left:30px; width:250px'>Append Asymmetric ; Unit (All Chains)</button>" + "<br/><br/>";
10680
10681
 
10681
10682
  html += '<b>Note</b>: The "<b>biological unit</b>" is the <b>biochemically active form of a biomolecule</b>, <div style="width:20px; margin:6px 0 0 20px; display:inline-block;"><span id="'
10682
10683
  + me.pre + 'asu_bu2_expand" class="ui-icon ui-icon-plus icn3d-expand icn3d-link" style="width:15px;" title="Expand"></span><span id="'
@@ -11764,7 +11765,7 @@ class Events {
11764
11765
  $("#" + me.pre + id).resizable();
11765
11766
  }
11766
11767
 
11767
- async launchMmdb(ids, bBiounit, hostUrl) { let me = this.icn3dui, ic = me.icn3d, thisClass = this;
11768
+ async launchMmdb(ids, bBiounit, hostUrl, bAppend) { let me = this.icn3dui, ic = me.icn3d, thisClass = this;
11768
11769
  if(!me.cfg.notebook) dialog.dialog( "close" );
11769
11770
 
11770
11771
  let flag = bBiounit ? 1 : 0;
@@ -11779,40 +11780,41 @@ class Events {
11779
11780
 
11780
11781
  let idArray = ids.split(',');
11781
11782
 
11782
- /*
11783
- if(idArray.length == 1 && (idArray[0].length == 4 || !isNaN(idArray[0])) ) {
11784
- thisClass.setLogCmd("load mmdb" + flag + " " + ids, false);
11785
- let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
11786
- window.open(hostUrl + '?mmdbid=' + ids + '&bu=' + flag, urlTarget);
11787
- }
11788
- else {
11789
- thisClass.setLogCmd("load mmdbaf" + flag + " " + ids, false);
11790
- let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
11791
- window.open(hostUrl + '?mmdbafid=' + ids + '&bu=' + flag, urlTarget);
11792
- }
11793
- */
11794
-
11795
- // single MMDB ID could show memebranes
11796
- if(!ic.structures && idArray.length == 1 && (idArray[0].length == 4 || !isNaN(idArray[0])) ) {
11797
- thisClass.setLogCmd("load mmdb" + flag + " " + ids, false);
11798
- let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
11799
- window.open(hostUrl + '?mmdbid=' + ids + '&bu=' + flag, urlTarget);
11783
+ if(!bAppend) {
11784
+ if(idArray.length == 1 && (idArray[0].length == 4 || !isNaN(idArray[0])) ) {
11785
+ thisClass.setLogCmd("load mmdb" + flag + " " + ids, false);
11786
+ let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
11787
+ window.open(hostUrl + '?mmdbid=' + ids + '&bu=' + flag, urlTarget);
11788
+ }
11789
+ else {
11790
+ thisClass.setLogCmd("load mmdbaf" + flag + " " + ids, false);
11791
+ let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
11792
+ window.open(hostUrl + '?mmdbafid=' + ids + '&bu=' + flag, urlTarget);
11793
+ }
11800
11794
  }
11801
11795
  else {
11802
- me.cfg.mmdbafid = ids;
11803
- me.cfg.bu = flag;
11804
-
11805
- ic.bMmdbafid = true;
11806
- ic.inputid = (ic.inputid) ? ic.inputid + me.cfg.mmdbafid : me.cfg.mmdbafid;
11807
- if(me.cfg.bu == 1) {
11808
- ic.loadCmd = 'load mmdbaf1 ' + me.cfg.mmdbafid;
11796
+ // single MMDB ID could show memebranes
11797
+ if(!ic.structures && idArray.length == 1 && (idArray[0].length == 4 || !isNaN(idArray[0])) ) {
11798
+ thisClass.setLogCmd("load mmdb" + flag + " " + ids, false);
11799
+ let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
11800
+ window.open(hostUrl + '?mmdbid=' + ids + '&bu=' + flag, urlTarget);
11809
11801
  }
11810
11802
  else {
11811
- ic.loadCmd = 'load mmdbaf0 ' + me.cfg.mmdbafid;
11812
- }
11813
- me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
11803
+ me.cfg.mmdbafid = ids;
11804
+ me.cfg.bu = flag;
11814
11805
 
11815
- await ic.chainalignParserCls.downloadMmdbAf(me.cfg.mmdbafid);
11806
+ ic.bMmdbafid = true;
11807
+ ic.inputid = (ic.inputid) ? ic.inputid + me.cfg.mmdbafid : me.cfg.mmdbafid;
11808
+ if(me.cfg.bu == 1) {
11809
+ ic.loadCmd = 'load mmdbaf1 ' + me.cfg.mmdbafid;
11810
+ }
11811
+ else {
11812
+ ic.loadCmd = 'load mmdbaf0 ' + me.cfg.mmdbafid;
11813
+ }
11814
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
11815
+
11816
+ await ic.chainalignParserCls.downloadMmdbAf(me.cfg.mmdbafid);
11817
+ }
11816
11818
  }
11817
11819
  }
11818
11820
 
@@ -12554,21 +12556,28 @@ class Events {
12554
12556
 
12555
12557
  me.myEventCls.onIds("#" + me.pre + "reload_mmdbaf", "click", function(e) { me.icn3d;
12556
12558
  e.preventDefault();
12557
-
12558
- // remove space
12559
12559
  let ids = $("#" + me.pre + "mmdbafid").val();
12560
-
12561
12560
  thisClass.launchMmdb(ids, 1, hostUrl);
12562
12561
  });
12563
12562
 
12564
12563
  me.myEventCls.onIds("#" + me.pre + "reload_mmdbaf_asym", "click", function(e) { me.icn3d;
12565
12564
  e.preventDefault();
12566
-
12567
- // remove space
12568
12565
  let ids = $("#" + me.pre + "mmdbafid").val();
12569
12566
  thisClass.launchMmdb(ids, 0, hostUrl);
12570
12567
  });
12571
12568
 
12569
+ me.myEventCls.onIds("#" + me.pre + "reload_mmdbaf_append", "click", function(e) { me.icn3d;
12570
+ e.preventDefault();
12571
+ let ids = $("#" + me.pre + "mmdbafid").val();
12572
+ thisClass.launchMmdb(ids, 1, hostUrl, true);
12573
+ });
12574
+
12575
+ me.myEventCls.onIds("#" + me.pre + "reload_mmdbaf_asym_append", "click", function(e) { me.icn3d;
12576
+ e.preventDefault();
12577
+ let ids = $("#" + me.pre + "mmdbafid").val();
12578
+ thisClass.launchMmdb(ids, 0, hostUrl, true);
12579
+ });
12580
+
12572
12581
  me.myEventCls.onIds("#" + me.pre + "mmdbid", "keyup", function(e) { let ic = me.icn3d;
12573
12582
  if (e.keyCode === 13) {
12574
12583
  e.preventDefault();
@@ -41440,14 +41449,14 @@ class ShowSeq {
41440
41449
 
41441
41450
  // set hash for the loops
41442
41451
  let strand2len_start_stop = {};
41443
- let prevRefnumStr, prevPostfix;
41452
+ let prevRefnumStr, prevPostfix, prevRefnum;
41444
41453
 
41445
41454
  // sometimes one chain may have several Ig domains,set a index for each IgDomain
41446
- let index = 1;
41455
+ let index = 1, prevStrandPostfix = '', bStart = false;
41447
41456
  for(let i = 0, il = giSeq.length; i < il; ++i) {
41448
41457
  let currResi = ic.ParserUtilsCls.getResi(chnid, i);
41449
41458
  let residueid = chnid + '_' + currResi;
41450
- if(ic.residues.hasOwnProperty(residueid)) {
41459
+ //if(ic.residues.hasOwnProperty(residueid)) {
41451
41460
  refnumLabel = ic.resid2refnum[residueid];
41452
41461
  if(refnumLabel) {
41453
41462
  refnumStr_ori = refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').substr(1); // C', C''
@@ -41465,27 +41474,37 @@ class ShowSeq {
41465
41474
  strand2len_start_stop[prevStrand + prevPostfix].len = currCnt - 1;
41466
41475
  strand2len_start_stop[prevStrand + prevPostfix].end = refnumStr;
41467
41476
  strand2len_start_stop[prevStrand + prevPostfix].nextStrand = currStrand;
41468
-
41469
- console.log("end: " + residueid);
41470
41477
  }
41471
41478
 
41479
+ bStart = false;
41480
+
41481
+ currCnt = 1;
41482
+ }
41483
+
41484
+ // sometimes insertions may happen inside a strand. Reset currCnt
41485
+ if(currStrand == prevStrand && refnum > 1000 && refnumStr.substr(1,1) != '9') { // strand region
41472
41486
  currCnt = 1;
41487
+
41488
+ if(bStart && prevStrandPostfix) {
41489
+ delete strand2len_start_stop[prevStrandPostfix];
41490
+ prevStrandPostfix = '';
41491
+ }
41473
41492
  }
41474
41493
 
41475
41494
  // #9##
41476
- if(prevStrand && refnum > 1000 && refnumStr.substr(1,1) == '9') { // loop region
41495
+ if(prevStrand && currStrand != ' ' && refnum > 1000 && refnumStr.substr(1,1) == '9') { // loop region
41477
41496
  if(currCnt == 1) { // start of a loop
41478
41497
  if(strand2len_start_stop.hasOwnProperty(currStrand + postfix)) { // the strand appeared in 2nd Id domain
41479
41498
  ++index;
41480
41499
  }
41481
-
41482
- console.log("start: " + residueid + " refnumStr: " + refnumStr);
41483
41500
 
41484
41501
  postfix = refnumStr.replace(refnum.toString(), '') + '_' + index;
41485
41502
  strand2len_start_stop[currStrand + postfix] = {};
41486
41503
 
41487
41504
  strand2len_start_stop[currStrand + postfix].start = prevRefnumStr;
41488
41505
  strand2len_start_stop[currStrand + postfix].chainid = chnid;
41506
+
41507
+ //prevStrandPostfix = currStrand + postfix;
41489
41508
  }
41490
41509
  refnumStr = (parseInt(currFirstDigit) * 1000 + 900 + currCnt).toString();
41491
41510
  refnumLabel = currStrand + refnumStr;
@@ -41495,7 +41514,7 @@ class ShowSeq {
41495
41514
  }
41496
41515
  }
41497
41516
  else {
41498
- if(prevStrand && !bCustom && !kabat_or_imgt) {
41517
+ if(prevStrand && currStrand != ' ' && !bCustom && !kabat_or_imgt) {
41499
41518
  if(currCnt == 1) { // start of a loop
41500
41519
  if(strand2len_start_stop.hasOwnProperty(currStrand + postfix)) { // the strand appeared in 2nd Id domain
41501
41520
  ++index;
@@ -41508,8 +41527,11 @@ class ShowSeq {
41508
41527
 
41509
41528
  strand2len_start_stop[currStrand + postfix].start = prevRefnumStr;
41510
41529
  strand2len_start_stop[currStrand + postfix].chainid = chnid;
41511
- }
41512
41530
 
41531
+ prevStrandPostfix = currStrand + postfix;
41532
+ bStart = true;
41533
+ }
41534
+
41513
41535
  // no ref num
41514
41536
  refnumStr = (parseInt(currFirstDigit) * 1000 + 900 + currCnt).toString();
41515
41537
  refnumLabel = currStrand + refnumStr;
@@ -41518,8 +41540,9 @@ class ShowSeq {
41518
41540
  }
41519
41541
 
41520
41542
  prevRefnumStr = refnumStr;
41543
+ prevRefnum = refnum;
41521
41544
  prevPostfix = postfix;
41522
- }
41545
+ //}
41523
41546
 
41524
41547
  prevStrand = currStrand;
41525
41548
  }
@@ -41528,11 +41551,13 @@ class ShowSeq {
41528
41551
  strand2len_start_stop[prevStrand + prevPostfix].end = prevRefnumStr;
41529
41552
  //strand2len_start_stop[prevStrand].nextStrand = undefined;
41530
41553
  }
41531
-
41554
+
41532
41555
  let refnumLabelNoPostfix;
41533
41556
  // sometimes one chain may have several Ig domains,set a index for each IgDomain
41534
41557
  index = 1;
41535
- let appearedStrands = {}, currStrand_ori;
41558
+ prevStrandPostfix = '';
41559
+ bStart = false;
41560
+ let appearedStrands = {}, currStrand_ori, bShowRefnum = true;
41536
41561
  for(let i = 0, il = giSeq.length; i < il; ++i) {
41537
41562
  bLoop = false;
41538
41563
 
@@ -41541,12 +41566,12 @@ class ShowSeq {
41541
41566
  let currResi = ic.ParserUtilsCls.getResi(chnid, i);
41542
41567
  let residueid = chnid + '_' + currResi;
41543
41568
  let domainid = (bCustom) ? 0 : ic.resid2domainid[residueid];
41544
- if(!ic.residues.hasOwnProperty(residueid)) {
41545
- html += '<span></span>';
41546
- }
41547
- else {
41569
+ //if(!ic.residues.hasOwnProperty(residueid)) {
41570
+ // html += '<span></span>';
41571
+ //}
41572
+ //else {
41548
41573
  refnumLabel = ic.resid2refnum[residueid];
41549
- let bNotShow = false;
41574
+ let bHidelabel = false;
41550
41575
 
41551
41576
  if(refnumLabel) {
41552
41577
  refnumStr_ori = refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').substr(1); // C', C''
@@ -41557,7 +41582,8 @@ class ShowSeq {
41557
41582
 
41558
41583
  refnumLabelNoPostfix = currStrand + parseInt(refnumStr_ori);
41559
41584
 
41560
- if(currStrand != prevStrand) { // reset currCnt
41585
+ if(currStrand_ori != prevStrand) { // reset currCnt
41586
+ bStart = false;
41561
41587
  currCnt = 1;
41562
41588
  }
41563
41589
 
@@ -41575,30 +41601,44 @@ class ShowSeq {
41575
41601
  refnum = parseInt(refnumStr);
41576
41602
  postfix = refnumStr.replace(refnum.toString(), '') + '_' + index;
41577
41603
 
41604
+ // sometimes insertions may happen inside a strand. Reset currCnt
41605
+ if(currStrand_ori == prevStrand && refnum > 1000 && refnumStr.substr(1,1) != '9') { // strand region
41606
+ currCnt = 1;
41607
+
41608
+ if(bStart && prevStrandPostfix) {
41609
+ --index;
41610
+ prevStrandPostfix = '';
41611
+ }
41612
+ }
41613
+
41578
41614
  // #9##
41579
41615
  if(prevStrand && refnum > 1000 && refnumStr.substr(1,1) == '9') { // loop region
41580
41616
  bLoop = true;
41581
41617
 
41582
41618
  if(currCnt == 1) { // start of a loop
41583
- if(appearedStrands.hasOwnProperty(currStrand + postfix)) { // the strand appeared in 2nd Id domain
41619
+ if(appearedStrands.hasOwnProperty(currStrand_ori + postfix)) { // the strand appeared in 2nd Id domain
41584
41620
  ++index;
41585
41621
  postfix = refnumStr.replace(refnum.toString(), '') + '_' + index;
41586
41622
  }
41587
41623
 
41588
- appearedStrands[currStrand + postfix] = 1;
41624
+ appearedStrands[currStrand_ori + postfix] = 1;
41589
41625
  }
41590
41626
 
41591
- let result = this.getAdjustedRefnum(strand2len_start_stop, currStrand, currCnt, currFirstDigit, postfix);
41592
-
41627
+ let result = this.getAdjustedRefnum(strand2len_start_stop, currStrand_ori, currCnt, currFirstDigit, postfix, prevRefnum);
41628
+
41629
+ refnum = result.refnum;
41630
+ bShowRefnum = result.bShowRefnum;
41593
41631
  refnumStr = result.refnumStr;
41594
41632
  refnumLabel = result.refnumLabel;
41595
41633
  refnumLabelNoPostfix = result.refnumLabelNoPostfix;
41596
41634
 
41597
- bNotShow = result.bNotShow;
41635
+ bHidelabel = result.bHidelabel;
41598
41636
  currStrand = refnumLabel.replace(new RegExp(refnumStr,'g'), '');
41599
41637
 
41600
41638
  ++currCnt;
41601
41639
  }
41640
+
41641
+ prevRefnum = refnum;
41602
41642
  }
41603
41643
 
41604
41644
  if(bCustom) {
@@ -41636,40 +41676,59 @@ class ShowSeq {
41636
41676
  }
41637
41677
  }
41638
41678
  else {
41639
- html += this.getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bNotShow);
41679
+ if(bShowRefnum && currStrand != ' ') {
41680
+ html += this.getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bHidelabel);
41681
+ }
41682
+ else {
41683
+ html += '<span></span>';
41684
+ }
41640
41685
  }
41641
41686
  }
41642
41687
  else {
41643
41688
  let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[residueid]);
41644
41689
 
41645
41690
  // skip non-protein residues
41646
- if(ic.proteins.hasOwnProperty(atom.serial) && prevStrand && !bCustom && !kabat_or_imgt) {
41691
+ // after G strand and before A strand, just use the mapped reference number
41692
+ if((!atom || ic.proteins.hasOwnProperty(atom.serial)) && prevStrand && !bCustom && !kabat_or_imgt
41693
+ && currStrand_ori.substr(0,1) != 'G') {
41647
41694
  // no ref num
41648
41695
  bLoop = true;
41649
41696
 
41650
41697
  if(currCnt == 1) { // start of a loop
41651
- if(appearedStrands.hasOwnProperty(currStrand + postfix)) { // the strand appeared in 2nd Id domain
41698
+ if(appearedStrands.hasOwnProperty(currStrand_ori + postfix)) { // the strand appeared in 2nd Id domain
41652
41699
  ++index;
41653
41700
  }
41654
41701
 
41655
41702
  postfix = refnumStr.replace(refnum.toString(), '') + '_' + index;
41656
41703
 
41657
- appearedStrands[currStrand + postfix] = 1;
41704
+ appearedStrands[currStrand_ori + postfix] = 1;
41705
+
41706
+ bStart = true;
41707
+ prevStrandPostfix = currStrand_ori + postfix;
41658
41708
  }
41659
41709
 
41660
41710
  // use previous postfix
41661
- let result = this.getAdjustedRefnum(strand2len_start_stop, currStrand, currCnt, currFirstDigit, postfix);
41662
-
41711
+ let result = this.getAdjustedRefnum(strand2len_start_stop, currStrand_ori, currCnt, currFirstDigit, postfix, prevRefnum);
41712
+
41713
+ refnum = result.refnum;
41714
+ bShowRefnum = result.bShowRefnum;
41663
41715
  refnumStr = result.refnumStr;
41664
41716
  refnumLabel = result.refnumLabel;
41665
41717
  refnumLabelNoPostfix = result.refnumLabelNoPostfix;
41666
41718
 
41667
- bNotShow = result.bNotShow;
41719
+ prevRefnum = refnum;
41720
+
41721
+ bHidelabel = result.bHidelabel;
41668
41722
  currStrand = refnumLabel.replace(new RegExp(refnumStr,'g'), '');
41669
41723
 
41670
41724
  ++currCnt;
41671
41725
 
41672
- html += this.getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bNotShow);
41726
+ if(bShowRefnum && currStrand != ' ') {
41727
+ html += this.getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bHidelabel);
41728
+ }
41729
+ else {
41730
+ html += '<span></span>';
41731
+ }
41673
41732
  }
41674
41733
  else {
41675
41734
  html += '<span></span>';
@@ -41693,7 +41752,7 @@ class ShowSeq {
41693
41752
  // remove the postfix when comparing interactions
41694
41753
  //ic.chainsMapping[chnid][residueid] = refnumLabel;
41695
41754
  ic.chainsMapping[chnid][residueid] = refnumLabelNoPostfix;
41696
- }
41755
+ //}
41697
41756
 
41698
41757
  prevStrand = currStrand_ori; //currStrand;
41699
41758
  }
@@ -41708,10 +41767,11 @@ class ShowSeq {
41708
41767
  return {html: html, html3: html3}
41709
41768
  }
41710
41769
 
41711
- getAdjustedRefnum(strand2len_start_stop, currStrand, currCnt, currFirstDigit, postfix) { let ic = this.icn3d; ic.icn3dui;
41712
- let refnumStr, refnumLabel, refnumLabelNoPostfix;
41770
+ getAdjustedRefnum(strand2len_start_stop, currStrand, currCnt, currFirstDigit, postfix, prevRefnum) { let ic = this.icn3d; ic.icn3dui;
41771
+ let refnum, refnumStr, refnumLabel, refnumLabelNoPostfix;
41713
41772
 
41714
- let bNotShow = false; // do not show the label
41773
+ let bHidelabel = false; // do not show the label
41774
+ let bShowRefnum = true;
41715
41775
 
41716
41776
  if(strand2len_start_stop[currStrand + postfix]) {
41717
41777
  let start = parseInt(strand2len_start_stop[currStrand + postfix].start);
@@ -41723,7 +41783,6 @@ class ShowSeq {
41723
41783
  let len = strand2len_start_stop[currStrand + postfix].len;
41724
41784
  let halfLen = (strand2len_start_stop[currStrand + postfix].nextStrand) ? parseInt(len / 2.0 + 0.5) : len;
41725
41785
 
41726
- let refnum;
41727
41786
  if(currCnt <= halfLen) {
41728
41787
  refnum = start + currCnt;
41729
41788
  refnumStr = refnum + postfixStart;
@@ -41738,25 +41797,36 @@ class ShowSeq {
41738
41797
 
41739
41798
  refnumLabelNoPostfix = currStrand + refnum;
41740
41799
 
41741
- if(currCnt == 0 || currCnt == halfLen || currCnt == halfLen + 1 || currCnt == end - 1) {
41742
- bNotShow = true;
41800
+ //if(currCnt == 0 || currCnt == halfLen || currCnt == halfLen + 1 || currCnt == end - 1) {
41801
+ if(currCnt == 1 || currCnt == halfLen || currCnt == halfLen + 1 || currCnt == end - 1) {
41802
+ bHidelabel = true;
41803
+ }
41804
+
41805
+ if(currCnt == 1 && start != prevRefnum) { // skip insertions
41806
+ bShowRefnum = false;
41807
+
41808
+ refnum = 0;
41809
+ refnumStr = '';
41810
+ refnumLabel = '';
41811
+ refnumLabelNoPostfix = '';
41743
41812
  }
41744
41813
  }
41745
41814
  else {
41746
41815
  // refnumStr = (parseInt(currFirstDigit) * 1000 + 900 + currCnt).toString();
41747
41816
  // refnumLabel = currStrand + refnumStr;
41748
41817
 
41818
+ refnum = 0;
41749
41819
  refnumStr = '';
41750
41820
  refnumLabel = '';
41751
41821
  refnumLabelNoPostfix = '';
41752
41822
 
41753
- bNotShow = true;
41823
+ bHidelabel = true;
41754
41824
  }
41755
41825
 
41756
- return {refnumStr: refnumStr, refnumLabel: refnumLabel, refnumLabelNoPostfix: refnumLabelNoPostfix, bNotShow: bNotShow};
41826
+ return {refnum: refnum, refnumStr: refnumStr, refnumLabel: refnumLabel, refnumLabelNoPostfix: refnumLabelNoPostfix, bHidelabel: bHidelabel, bShowRefnum: bShowRefnum};
41757
41827
  }
41758
41828
 
41759
- getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bNotShow) { let ic = this.icn3d, me = ic.icn3dui;
41829
+ getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bHidelabel) { let ic = this.icn3d, me = ic.icn3dui;
41760
41830
  let refnum = parseInt(refnumStr).toString();
41761
41831
  let color = this.getRefnumColor(currStrand);
41762
41832
  let colorStr = 'style="color:' + color + '"';
@@ -41772,7 +41842,7 @@ class ShowSeq {
41772
41842
 
41773
41843
  html += '<span ' + colorStr + ' title="' + refnumLabel + '"><b>' + refnumLabel.substr(0, 1) + '</b>' + refnumLabel.substr(1) + '</span>';
41774
41844
  }
41775
- else if(lastTwo % 2 == 0 && lastTwo != 52 && !bNotShow) { // don't show label for the first, middle, and last loop residues
41845
+ else if(lastTwo % 2 == 0 && lastTwo != 52 && !bHidelabel) { // don't show label for the first, middle, and last loop residues
41776
41846
  // e.g., 2152a
41777
41847
  let lastTwoStr = isNaN(refnumStr) ? lastTwo + refnumStr.substr(refnumStr.length - 1, 1) : lastTwo;
41778
41848
  html += '<span ' + colorStr + ' title="' + refnumLabel + '">' + lastTwoStr + '</span>';
@@ -43187,6 +43257,8 @@ class LineGraph {
43187
43257
  drawGraphPerType(bCommonDiff, structureArray, bScatterplot, nodeArray1, nodeArray2, linkArray, name2node, heightFinal, height, textHeight, len1Split, r, gap, marginY) { let ic = this.icn3d; ic.icn3dui;
43188
43258
  let html = "";
43189
43259
 
43260
+ let bMutation = structureArray.length == 2 && structureArray[1].replace(structureArray[0], '') == '2';
43261
+
43190
43262
  // draw common interaction
43191
43263
  let label, postfix;
43192
43264
  if(bCommonDiff == 0) {
@@ -43203,11 +43275,21 @@ class LineGraph {
43203
43275
  }
43204
43276
 
43205
43277
  for(let i = 0, il = structureArray.length; i < il; ++i) {
43278
+ let labelFinal = label;
43279
+ if(bMutation) {
43280
+ if(i == 0) {
43281
+ labelFinal += "Wild Type ";
43282
+ }
43283
+ else if(i == 1) {
43284
+ labelFinal += "Mutant ";
43285
+ }
43286
+ }
43287
+
43206
43288
  if(bScatterplot) {
43207
- html += this.drawScatterplot_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, undefined, label + structureArray[i], textHeight);
43289
+ html += this.drawScatterplot_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, undefined, labelFinal + structureArray[i], textHeight);
43208
43290
  height =(len1Split[i] + 1) *(r + gap) + 2 * marginY + textHeight;
43209
43291
  } else {
43210
- html += this.drawLineGraph_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, label + structureArray[i], textHeight);
43292
+ html += this.drawLineGraph_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, labelFinal + structureArray[i], textHeight);
43211
43293
  }
43212
43294
  heightFinal += height;
43213
43295
 
@@ -54055,6 +54137,16 @@ class LoadPDB {
54055
54137
  this.icn3d = icn3d;
54056
54138
  }
54057
54139
 
54140
+ getStructureId(id, moleculeNum, bMutation) { let ic = this.icn3d; ic.icn3dui;
54141
+ let structure = id;
54142
+
54143
+ if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
54144
+ structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
54145
+ }
54146
+
54147
+ return structure;
54148
+ }
54149
+
54058
54150
  // modified from iview (http://istar.cse.cuhk.edu.hk/iview/)
54059
54151
  //This PDB parser feeds the viewer with the content of a PDB file, pdbData.
54060
54152
  loadPDB(src, pdbid, bOpm, bVector, bMutation, bAppend, type, bLastQuery) { let ic = this.icn3d, me = ic.icn3dui;
@@ -54137,12 +54229,7 @@ class LoadPDB {
54137
54229
  }
54138
54230
  }
54139
54231
 
54140
- structure = id;
54141
-
54142
- if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
54143
- //if(id == ic.defaultPdbId) {
54144
- structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
54145
- }
54232
+ structure = this.getStructureId(id, moleculeNum, bMutation);
54146
54233
 
54147
54234
  ic.molTitle = '';
54148
54235
 
@@ -54257,12 +54344,7 @@ class LoadPDB {
54257
54344
  ++moleculeNum;
54258
54345
  id = ic.defaultPdbId;
54259
54346
 
54260
- structure = id;
54261
-
54262
- if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
54263
- //if(id == ic.defaultPdbId) {
54264
- structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
54265
- }
54347
+ structure = this.getStructureId(id, moleculeNum, bMutation);
54266
54348
 
54267
54349
  //helices = [];
54268
54350
  //sheets = [];
@@ -54281,12 +54363,7 @@ class LoadPDB {
54281
54363
  ic.pmid = line.substr(19).trim();
54282
54364
  }
54283
54365
  } else if (record === 'ATOM ' || record === 'HETATM') {
54284
- structure = id;
54285
-
54286
- if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
54287
- //if(id == ic.defaultPdbId) {
54288
- structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
54289
- }
54366
+ structure = this.getStructureId(id, moleculeNum, bMutation);
54290
54367
 
54291
54368
  let alt = line.substr(16, 1);
54292
54369
  //if (alt !== " " && alt !== "A") continue;
@@ -59180,7 +59257,7 @@ class SelectByCommand {
59180
59257
  let residArray = [];
59181
59258
 
59182
59259
  if(bRefnum) {
59183
- let residArrayTmp = ic.refnum2residArray[k];
59260
+ let residArrayTmp = (ic.refnum2residArray[k]) ? ic.refnum2residArray[k] : [];
59184
59261
  for(let m = 0, ml = residArrayTmp.length; m < ml; ++m) {
59185
59262
  let residueId = residArrayTmp[m];
59186
59263
  if(residueId.substr(0, residueId.lastIndexOf('_')) == molecule_chain) {
@@ -61620,12 +61697,12 @@ if(!me.bNode) {
61620
61697
  }
61621
61698
 
61622
61699
  let prevStrand;
61700
+ let bCd19 = ic.chainid2index[chainid].length == 1 && ic.refpdbArray[ic.chainid2index[chainid][0]] == '6al5_cd19';
61623
61701
  for(let i = 0, il = segArray.length; i < il; ++i) {
61624
61702
  let seg = segArray[i];
61625
61703
  let qStart = seg.q_start;
61626
61704
  parseInt(seg.q_start);
61627
- let postfix = '';
61628
- if(isNaN(seg.q_start)) postfix = seg.q_start.substr(seg.q_start.length - 1, 1);
61705
+ if(isNaN(seg.q_start)) seg.q_start.substr(seg.q_start.length - 1, 1);
61629
61706
 
61630
61707
  // one item in "seq"
61631
61708
  // q_start and q_end are numbers, but saved in string
@@ -61636,9 +61713,10 @@ if(!me.bNode) {
61636
61713
 
61637
61714
  let resid = chainid + '_' + seg.t_start;
61638
61715
  //let refnum = qStartInt.toString() + postfix;
61639
- let refnum = qStart + postfix;
61716
+ //let refnum = qStart + postfix;
61717
+ let refnum = qStart;
61640
61718
 
61641
- let refnumLabel = thisClass.getLabelFromRefnum(refnum, prevStrand);
61719
+ let refnumLabel = thisClass.getLabelFromRefnum(refnum, prevStrand, bCd19);
61642
61720
  prevStrand = refnumLabel.replace(new RegExp(refnum,'g'), '');
61643
61721
 
61644
61722
  ic.resid2refnum[resid] = refnumLabel;
@@ -61673,7 +61751,7 @@ if(!me.bNode) {
61673
61751
  }
61674
61752
  }
61675
61753
 
61676
- getLabelFromRefnum(oriRefnum, prevStrand) { let ic = this.icn3d; ic.icn3dui;
61754
+ getLabelFromRefnum(oriRefnum, prevStrand, bCd19) { let ic = this.icn3d; ic.icn3dui;
61677
61755
  let refnum = parseInt(oriRefnum);
61678
61756
 
61679
61757
  // A^: 1xx or 2xx
@@ -61691,7 +61769,10 @@ if(!me.bNode) {
61691
61769
  // G*: 94xx
61692
61770
 
61693
61771
  if(refnum < 100) return " " + oriRefnum;
61694
- else if(refnum >= 100 && refnum < 1000) return "A^" + oriRefnum;
61772
+ else if(refnum >= 100 && refnum < 1000) {
61773
+ if(bCd19) return " " + oriRefnum;
61774
+ else return "A^" + oriRefnum;
61775
+ }
61695
61776
  else if(refnum >= 1000 && refnum < 1200) return "A" + oriRefnum;
61696
61777
  else if(refnum >= 1200 && refnum < 1300) return "A'" + oriRefnum;
61697
61778
  else if(refnum >= 1300 && refnum < 1400) return "A*" + oriRefnum;
@@ -61873,7 +61954,7 @@ class Scap {
61873
61954
 
61874
61955
  let data;
61875
61956
 
61876
- try {
61957
+ // try {
61877
61958
  data = await me.getAjaxPostPromise(url, dataObj, true, undefined, undefined, undefined, 'text');
61878
61959
 
61879
61960
  let pos = data.indexOf('\n');
@@ -61963,8 +62044,10 @@ console.log("free energy: " + energy + " kcal/mol");
61963
62044
 
61964
62045
  let atomWT = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
61965
62046
 
61966
- ic.atoms[serial].color = atomWT.color;
61967
- ic.atomPrevColors[serial] = atomWT.color;
62047
+ if(atomWT) {
62048
+ ic.atoms[serial].color = atomWT.color;
62049
+ ic.atomPrevColors[serial] = atomWT.color;
62050
+ }
61968
62051
  }
61969
62052
 
61970
62053
  let chainid = atom.structure + '_' + atom.chain;
@@ -62030,6 +62113,7 @@ console.log("free energy: " + energy + " kcal/mol");
62030
62113
  // expand the toolbar
62031
62114
  let id = ic.pre + 'selection';
62032
62115
  $("#" + id).show();
62116
+ /*
62033
62117
  }
62034
62118
  catch(err) {
62035
62119
  var aaa = 1; //alert("There are some problems in predicting the side chain of the mutant...");
@@ -62039,6 +62123,7 @@ console.log("free energy: " + energy + " kcal/mol");
62039
62123
  /// if(ic.deferredScap !== undefined) ic.deferredScap.resolve();
62040
62124
  return;
62041
62125
  }
62126
+ */
62042
62127
  }
62043
62128
 
62044
62129
  async exportPdbProfix(bHydrogen, pdb, snpStr) { let ic = this.icn3d, me = ic.icn3dui;