icn3d 3.23.2 → 3.23.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/icn3d.module.js CHANGED
@@ -11503,7 +11503,7 @@ class SetDialog {
11503
11503
 
11504
11504
  html += me.htmlCls.divStr + "dl_mutation' class='" + dialogClass + "'>";
11505
11505
  html += "<div style='width:500px'>";
11506
- 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/>';
11506
+ 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/>';
11507
11507
  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/>";
11508
11508
 
11509
11509
  html += '<b>ID Type</b>: ';
@@ -11576,8 +11576,9 @@ class SetDialog {
11576
11576
  html += "</div>";
11577
11577
 
11578
11578
  html += me.htmlCls.divStr + "dl_mmdbafid' class='" + dialogClass + "' style='max-width:600px'>";
11579
- 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>";
11580
- 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/>";
11579
+ 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>";
11580
+ 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/>";
11581
+ 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/>";
11581
11582
 
11582
11583
  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="'
11583
11584
  + me.pre + 'asu_bu2_expand" class="ui-icon ui-icon-plus icn3d-expand icn3d-link" style="width:15px;" title="Expand"></span><span id="'
@@ -12665,7 +12666,7 @@ class Events {
12665
12666
  $("#" + me.pre + id).resizable();
12666
12667
  }
12667
12668
 
12668
- async launchMmdb(ids, bBiounit, hostUrl) { let me = this.icn3dui, ic = me.icn3d, thisClass = this;
12669
+ async launchMmdb(ids, bBiounit, hostUrl, bAppend) { let me = this.icn3dui, ic = me.icn3d, thisClass = this;
12669
12670
  if(!me.cfg.notebook) dialog.dialog( "close" );
12670
12671
 
12671
12672
  let flag = bBiounit ? 1 : 0;
@@ -12680,40 +12681,41 @@ class Events {
12680
12681
 
12681
12682
  let idArray = ids.split(',');
12682
12683
 
12683
- /*
12684
- if(idArray.length == 1 && (idArray[0].length == 4 || !isNaN(idArray[0])) ) {
12685
- thisClass.setLogCmd("load mmdb" + flag + " " + ids, false);
12686
- let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
12687
- window.open(hostUrl + '?mmdbid=' + ids + '&bu=' + flag, urlTarget);
12688
- }
12689
- else {
12690
- thisClass.setLogCmd("load mmdbaf" + flag + " " + ids, false);
12691
- let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
12692
- window.open(hostUrl + '?mmdbafid=' + ids + '&bu=' + flag, urlTarget);
12693
- }
12694
- */
12695
-
12696
- // single MMDB ID could show memebranes
12697
- if(!ic.structures && idArray.length == 1 && (idArray[0].length == 4 || !isNaN(idArray[0])) ) {
12698
- thisClass.setLogCmd("load mmdb" + flag + " " + ids, false);
12699
- let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
12700
- window.open(hostUrl + '?mmdbid=' + ids + '&bu=' + flag, urlTarget);
12684
+ if(!bAppend) {
12685
+ if(idArray.length == 1 && (idArray[0].length == 4 || !isNaN(idArray[0])) ) {
12686
+ thisClass.setLogCmd("load mmdb" + flag + " " + ids, false);
12687
+ let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
12688
+ window.open(hostUrl + '?mmdbid=' + ids + '&bu=' + flag, urlTarget);
12689
+ }
12690
+ else {
12691
+ thisClass.setLogCmd("load mmdbaf" + flag + " " + ids, false);
12692
+ let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
12693
+ window.open(hostUrl + '?mmdbafid=' + ids + '&bu=' + flag, urlTarget);
12694
+ }
12701
12695
  }
12702
12696
  else {
12703
- me.cfg.mmdbafid = ids;
12704
- me.cfg.bu = flag;
12705
-
12706
- ic.bMmdbafid = true;
12707
- ic.inputid = (ic.inputid) ? ic.inputid + me.cfg.mmdbafid : me.cfg.mmdbafid;
12708
- if(me.cfg.bu == 1) {
12709
- ic.loadCmd = 'load mmdbaf1 ' + me.cfg.mmdbafid;
12697
+ // single MMDB ID could show memebranes
12698
+ if(!ic.structures && idArray.length == 1 && (idArray[0].length == 4 || !isNaN(idArray[0])) ) {
12699
+ thisClass.setLogCmd("load mmdb" + flag + " " + ids, false);
12700
+ let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
12701
+ window.open(hostUrl + '?mmdbid=' + ids + '&bu=' + flag, urlTarget);
12710
12702
  }
12711
12703
  else {
12712
- ic.loadCmd = 'load mmdbaf0 ' + me.cfg.mmdbafid;
12713
- }
12714
- me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
12704
+ me.cfg.mmdbafid = ids;
12705
+ me.cfg.bu = flag;
12715
12706
 
12716
- await ic.chainalignParserCls.downloadMmdbAf(me.cfg.mmdbafid);
12707
+ ic.bMmdbafid = true;
12708
+ ic.inputid = (ic.inputid) ? ic.inputid + me.cfg.mmdbafid : me.cfg.mmdbafid;
12709
+ if(me.cfg.bu == 1) {
12710
+ ic.loadCmd = 'load mmdbaf1 ' + me.cfg.mmdbafid;
12711
+ }
12712
+ else {
12713
+ ic.loadCmd = 'load mmdbaf0 ' + me.cfg.mmdbafid;
12714
+ }
12715
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
12716
+
12717
+ await ic.chainalignParserCls.downloadMmdbAf(me.cfg.mmdbafid);
12718
+ }
12717
12719
  }
12718
12720
  }
12719
12721
 
@@ -13455,21 +13457,28 @@ class Events {
13455
13457
 
13456
13458
  me.myEventCls.onIds("#" + me.pre + "reload_mmdbaf", "click", function(e) { me.icn3d;
13457
13459
  e.preventDefault();
13458
-
13459
- // remove space
13460
13460
  let ids = $("#" + me.pre + "mmdbafid").val();
13461
-
13462
13461
  thisClass.launchMmdb(ids, 1, hostUrl);
13463
13462
  });
13464
13463
 
13465
13464
  me.myEventCls.onIds("#" + me.pre + "reload_mmdbaf_asym", "click", function(e) { me.icn3d;
13466
13465
  e.preventDefault();
13467
-
13468
- // remove space
13469
13466
  let ids = $("#" + me.pre + "mmdbafid").val();
13470
13467
  thisClass.launchMmdb(ids, 0, hostUrl);
13471
13468
  });
13472
13469
 
13470
+ me.myEventCls.onIds("#" + me.pre + "reload_mmdbaf_append", "click", function(e) { me.icn3d;
13471
+ e.preventDefault();
13472
+ let ids = $("#" + me.pre + "mmdbafid").val();
13473
+ thisClass.launchMmdb(ids, 1, hostUrl, true);
13474
+ });
13475
+
13476
+ me.myEventCls.onIds("#" + me.pre + "reload_mmdbaf_asym_append", "click", function(e) { me.icn3d;
13477
+ e.preventDefault();
13478
+ let ids = $("#" + me.pre + "mmdbafid").val();
13479
+ thisClass.launchMmdb(ids, 0, hostUrl, true);
13480
+ });
13481
+
13473
13482
  me.myEventCls.onIds("#" + me.pre + "mmdbid", "keyup", function(e) { let ic = me.icn3d;
13474
13483
  if (e.keyCode === 13) {
13475
13484
  e.preventDefault();
@@ -42341,14 +42350,14 @@ class ShowSeq {
42341
42350
 
42342
42351
  // set hash for the loops
42343
42352
  let strand2len_start_stop = {};
42344
- let prevRefnumStr, prevPostfix;
42353
+ let prevRefnumStr, prevPostfix, prevRefnum;
42345
42354
 
42346
42355
  // sometimes one chain may have several Ig domains,set a index for each IgDomain
42347
- let index = 1;
42356
+ let index = 1, prevStrandPostfix = '', bStart = false;
42348
42357
  for(let i = 0, il = giSeq.length; i < il; ++i) {
42349
42358
  let currResi = ic.ParserUtilsCls.getResi(chnid, i);
42350
42359
  let residueid = chnid + '_' + currResi;
42351
- if(ic.residues.hasOwnProperty(residueid)) {
42360
+ //if(ic.residues.hasOwnProperty(residueid)) {
42352
42361
  refnumLabel = ic.resid2refnum[residueid];
42353
42362
  if(refnumLabel) {
42354
42363
  refnumStr_ori = refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').substr(1); // C', C''
@@ -42366,27 +42375,37 @@ class ShowSeq {
42366
42375
  strand2len_start_stop[prevStrand + prevPostfix].len = currCnt - 1;
42367
42376
  strand2len_start_stop[prevStrand + prevPostfix].end = refnumStr;
42368
42377
  strand2len_start_stop[prevStrand + prevPostfix].nextStrand = currStrand;
42369
-
42370
- console.log("end: " + residueid);
42371
42378
  }
42372
42379
 
42380
+ bStart = false;
42381
+
42382
+ currCnt = 1;
42383
+ }
42384
+
42385
+ // sometimes insertions may happen inside a strand. Reset currCnt
42386
+ if(currStrand == prevStrand && refnum > 1000 && refnumStr.substr(1,1) != '9') { // strand region
42373
42387
  currCnt = 1;
42388
+
42389
+ if(bStart && prevStrandPostfix) {
42390
+ delete strand2len_start_stop[prevStrandPostfix];
42391
+ prevStrandPostfix = '';
42392
+ }
42374
42393
  }
42375
42394
 
42376
42395
  // #9##
42377
- if(prevStrand && refnum > 1000 && refnumStr.substr(1,1) == '9') { // loop region
42396
+ if(prevStrand && currStrand != ' ' && refnum > 1000 && refnumStr.substr(1,1) == '9') { // loop region
42378
42397
  if(currCnt == 1) { // start of a loop
42379
42398
  if(strand2len_start_stop.hasOwnProperty(currStrand + postfix)) { // the strand appeared in 2nd Id domain
42380
42399
  ++index;
42381
42400
  }
42382
-
42383
- console.log("start: " + residueid + " refnumStr: " + refnumStr);
42384
42401
 
42385
42402
  postfix = refnumStr.replace(refnum.toString(), '') + '_' + index;
42386
42403
  strand2len_start_stop[currStrand + postfix] = {};
42387
42404
 
42388
42405
  strand2len_start_stop[currStrand + postfix].start = prevRefnumStr;
42389
42406
  strand2len_start_stop[currStrand + postfix].chainid = chnid;
42407
+
42408
+ //prevStrandPostfix = currStrand + postfix;
42390
42409
  }
42391
42410
  refnumStr = (parseInt(currFirstDigit) * 1000 + 900 + currCnt).toString();
42392
42411
  refnumLabel = currStrand + refnumStr;
@@ -42396,7 +42415,7 @@ class ShowSeq {
42396
42415
  }
42397
42416
  }
42398
42417
  else {
42399
- if(prevStrand && !bCustom && !kabat_or_imgt) {
42418
+ if(prevStrand && currStrand != ' ' && !bCustom && !kabat_or_imgt) {
42400
42419
  if(currCnt == 1) { // start of a loop
42401
42420
  if(strand2len_start_stop.hasOwnProperty(currStrand + postfix)) { // the strand appeared in 2nd Id domain
42402
42421
  ++index;
@@ -42409,8 +42428,11 @@ class ShowSeq {
42409
42428
 
42410
42429
  strand2len_start_stop[currStrand + postfix].start = prevRefnumStr;
42411
42430
  strand2len_start_stop[currStrand + postfix].chainid = chnid;
42412
- }
42413
42431
 
42432
+ prevStrandPostfix = currStrand + postfix;
42433
+ bStart = true;
42434
+ }
42435
+
42414
42436
  // no ref num
42415
42437
  refnumStr = (parseInt(currFirstDigit) * 1000 + 900 + currCnt).toString();
42416
42438
  refnumLabel = currStrand + refnumStr;
@@ -42419,8 +42441,9 @@ class ShowSeq {
42419
42441
  }
42420
42442
 
42421
42443
  prevRefnumStr = refnumStr;
42444
+ prevRefnum = refnum;
42422
42445
  prevPostfix = postfix;
42423
- }
42446
+ //}
42424
42447
 
42425
42448
  prevStrand = currStrand;
42426
42449
  }
@@ -42429,11 +42452,13 @@ class ShowSeq {
42429
42452
  strand2len_start_stop[prevStrand + prevPostfix].end = prevRefnumStr;
42430
42453
  //strand2len_start_stop[prevStrand].nextStrand = undefined;
42431
42454
  }
42432
-
42455
+
42433
42456
  let refnumLabelNoPostfix;
42434
42457
  // sometimes one chain may have several Ig domains,set a index for each IgDomain
42435
42458
  index = 1;
42436
- let appearedStrands = {}, currStrand_ori;
42459
+ prevStrandPostfix = '';
42460
+ bStart = false;
42461
+ let appearedStrands = {}, currStrand_ori, bShowRefnum = true;
42437
42462
  for(let i = 0, il = giSeq.length; i < il; ++i) {
42438
42463
  bLoop = false;
42439
42464
 
@@ -42442,12 +42467,12 @@ class ShowSeq {
42442
42467
  let currResi = ic.ParserUtilsCls.getResi(chnid, i);
42443
42468
  let residueid = chnid + '_' + currResi;
42444
42469
  let domainid = (bCustom) ? 0 : ic.resid2domainid[residueid];
42445
- if(!ic.residues.hasOwnProperty(residueid)) {
42446
- html += '<span></span>';
42447
- }
42448
- else {
42470
+ //if(!ic.residues.hasOwnProperty(residueid)) {
42471
+ // html += '<span></span>';
42472
+ //}
42473
+ //else {
42449
42474
  refnumLabel = ic.resid2refnum[residueid];
42450
- let bNotShow = false;
42475
+ let bHidelabel = false;
42451
42476
 
42452
42477
  if(refnumLabel) {
42453
42478
  refnumStr_ori = refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').substr(1); // C', C''
@@ -42458,7 +42483,8 @@ class ShowSeq {
42458
42483
 
42459
42484
  refnumLabelNoPostfix = currStrand + parseInt(refnumStr_ori);
42460
42485
 
42461
- if(currStrand != prevStrand) { // reset currCnt
42486
+ if(currStrand_ori != prevStrand) { // reset currCnt
42487
+ bStart = false;
42462
42488
  currCnt = 1;
42463
42489
  }
42464
42490
 
@@ -42476,30 +42502,44 @@ class ShowSeq {
42476
42502
  refnum = parseInt(refnumStr);
42477
42503
  postfix = refnumStr.replace(refnum.toString(), '') + '_' + index;
42478
42504
 
42505
+ // sometimes insertions may happen inside a strand. Reset currCnt
42506
+ if(currStrand_ori == prevStrand && refnum > 1000 && refnumStr.substr(1,1) != '9') { // strand region
42507
+ currCnt = 1;
42508
+
42509
+ if(bStart && prevStrandPostfix) {
42510
+ --index;
42511
+ prevStrandPostfix = '';
42512
+ }
42513
+ }
42514
+
42479
42515
  // #9##
42480
42516
  if(prevStrand && refnum > 1000 && refnumStr.substr(1,1) == '9') { // loop region
42481
42517
  bLoop = true;
42482
42518
 
42483
42519
  if(currCnt == 1) { // start of a loop
42484
- if(appearedStrands.hasOwnProperty(currStrand + postfix)) { // the strand appeared in 2nd Id domain
42520
+ if(appearedStrands.hasOwnProperty(currStrand_ori + postfix)) { // the strand appeared in 2nd Id domain
42485
42521
  ++index;
42486
42522
  postfix = refnumStr.replace(refnum.toString(), '') + '_' + index;
42487
42523
  }
42488
42524
 
42489
- appearedStrands[currStrand + postfix] = 1;
42525
+ appearedStrands[currStrand_ori + postfix] = 1;
42490
42526
  }
42491
42527
 
42492
- let result = this.getAdjustedRefnum(strand2len_start_stop, currStrand, currCnt, currFirstDigit, postfix);
42493
-
42528
+ let result = this.getAdjustedRefnum(strand2len_start_stop, currStrand_ori, currCnt, currFirstDigit, postfix, prevRefnum);
42529
+
42530
+ refnum = result.refnum;
42531
+ bShowRefnum = result.bShowRefnum;
42494
42532
  refnumStr = result.refnumStr;
42495
42533
  refnumLabel = result.refnumLabel;
42496
42534
  refnumLabelNoPostfix = result.refnumLabelNoPostfix;
42497
42535
 
42498
- bNotShow = result.bNotShow;
42536
+ bHidelabel = result.bHidelabel;
42499
42537
  currStrand = refnumLabel.replace(new RegExp(refnumStr,'g'), '');
42500
42538
 
42501
42539
  ++currCnt;
42502
42540
  }
42541
+
42542
+ prevRefnum = refnum;
42503
42543
  }
42504
42544
 
42505
42545
  if(bCustom) {
@@ -42537,40 +42577,59 @@ class ShowSeq {
42537
42577
  }
42538
42578
  }
42539
42579
  else {
42540
- html += this.getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bNotShow);
42580
+ if(bShowRefnum && currStrand != ' ') {
42581
+ html += this.getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bHidelabel);
42582
+ }
42583
+ else {
42584
+ html += '<span></span>';
42585
+ }
42541
42586
  }
42542
42587
  }
42543
42588
  else {
42544
42589
  let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[residueid]);
42545
42590
 
42546
42591
  // skip non-protein residues
42547
- if(ic.proteins.hasOwnProperty(atom.serial) && prevStrand && !bCustom && !kabat_or_imgt) {
42592
+ // after G strand and before A strand, just use the mapped reference number
42593
+ if((!atom || ic.proteins.hasOwnProperty(atom.serial)) && prevStrand && !bCustom && !kabat_or_imgt
42594
+ && (!currStrand_ori || currStrand_ori.substr(0,1) != 'G')) {
42548
42595
  // no ref num
42549
42596
  bLoop = true;
42550
42597
 
42551
42598
  if(currCnt == 1) { // start of a loop
42552
- if(appearedStrands.hasOwnProperty(currStrand + postfix)) { // the strand appeared in 2nd Id domain
42599
+ if(appearedStrands.hasOwnProperty(currStrand_ori + postfix)) { // the strand appeared in 2nd Id domain
42553
42600
  ++index;
42554
42601
  }
42555
42602
 
42556
42603
  postfix = refnumStr.replace(refnum.toString(), '') + '_' + index;
42557
42604
 
42558
- appearedStrands[currStrand + postfix] = 1;
42605
+ appearedStrands[currStrand_ori + postfix] = 1;
42606
+
42607
+ bStart = true;
42608
+ prevStrandPostfix = currStrand_ori + postfix;
42559
42609
  }
42560
42610
 
42561
42611
  // use previous postfix
42562
- let result = this.getAdjustedRefnum(strand2len_start_stop, currStrand, currCnt, currFirstDigit, postfix);
42563
-
42612
+ let result = this.getAdjustedRefnum(strand2len_start_stop, currStrand_ori, currCnt, currFirstDigit, postfix, prevRefnum);
42613
+
42614
+ refnum = result.refnum;
42615
+ bShowRefnum = result.bShowRefnum;
42564
42616
  refnumStr = result.refnumStr;
42565
42617
  refnumLabel = result.refnumLabel;
42566
42618
  refnumLabelNoPostfix = result.refnumLabelNoPostfix;
42567
42619
 
42568
- bNotShow = result.bNotShow;
42620
+ prevRefnum = refnum;
42621
+
42622
+ bHidelabel = result.bHidelabel;
42569
42623
  currStrand = refnumLabel.replace(new RegExp(refnumStr,'g'), '');
42570
42624
 
42571
42625
  ++currCnt;
42572
42626
 
42573
- html += this.getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bNotShow);
42627
+ if(bShowRefnum && currStrand != ' ') {
42628
+ html += this.getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bHidelabel);
42629
+ }
42630
+ else {
42631
+ html += '<span></span>';
42632
+ }
42574
42633
  }
42575
42634
  else {
42576
42635
  html += '<span></span>';
@@ -42594,7 +42653,7 @@ class ShowSeq {
42594
42653
  // remove the postfix when comparing interactions
42595
42654
  //ic.chainsMapping[chnid][residueid] = refnumLabel;
42596
42655
  ic.chainsMapping[chnid][residueid] = refnumLabelNoPostfix;
42597
- }
42656
+ //}
42598
42657
 
42599
42658
  prevStrand = currStrand_ori; //currStrand;
42600
42659
  }
@@ -42609,10 +42668,11 @@ class ShowSeq {
42609
42668
  return {html: html, html3: html3}
42610
42669
  }
42611
42670
 
42612
- getAdjustedRefnum(strand2len_start_stop, currStrand, currCnt, currFirstDigit, postfix) { let ic = this.icn3d; ic.icn3dui;
42613
- let refnumStr, refnumLabel, refnumLabelNoPostfix;
42671
+ getAdjustedRefnum(strand2len_start_stop, currStrand, currCnt, currFirstDigit, postfix, prevRefnum) { let ic = this.icn3d; ic.icn3dui;
42672
+ let refnum, refnumStr, refnumLabel, refnumLabelNoPostfix;
42614
42673
 
42615
- let bNotShow = false; // do not show the label
42674
+ let bHidelabel = false; // do not show the label
42675
+ let bShowRefnum = true;
42616
42676
 
42617
42677
  if(strand2len_start_stop[currStrand + postfix]) {
42618
42678
  let start = parseInt(strand2len_start_stop[currStrand + postfix].start);
@@ -42624,7 +42684,6 @@ class ShowSeq {
42624
42684
  let len = strand2len_start_stop[currStrand + postfix].len;
42625
42685
  let halfLen = (strand2len_start_stop[currStrand + postfix].nextStrand) ? parseInt(len / 2.0 + 0.5) : len;
42626
42686
 
42627
- let refnum;
42628
42687
  if(currCnt <= halfLen) {
42629
42688
  refnum = start + currCnt;
42630
42689
  refnumStr = refnum + postfixStart;
@@ -42639,28 +42698,42 @@ class ShowSeq {
42639
42698
 
42640
42699
  refnumLabelNoPostfix = currStrand + refnum;
42641
42700
 
42642
- if(currCnt == 0 || currCnt == halfLen || currCnt == halfLen + 1 || currCnt == end - 1) {
42643
- bNotShow = true;
42701
+ //if(currCnt == 0 || currCnt == halfLen || currCnt == halfLen + 1 || currCnt == end - 1) {
42702
+ // if(currCnt == 1 || currCnt == halfLen || currCnt == halfLen + 1 || currCnt == end - 1) {
42703
+ // bHidelabel = true;
42704
+ // }
42705
+ if(currCnt == 1 || currCnt == end - 1) {
42706
+ bHidelabel = true;
42707
+ }
42708
+
42709
+ if(currCnt == 1 && start != prevRefnum) { // skip insertions
42710
+ bShowRefnum = false;
42711
+
42712
+ refnum = 0;
42713
+ refnumStr = '';
42714
+ refnumLabel = '';
42715
+ refnumLabelNoPostfix = '';
42644
42716
  }
42645
42717
  }
42646
42718
  else {
42647
42719
  // refnumStr = (parseInt(currFirstDigit) * 1000 + 900 + currCnt).toString();
42648
42720
  // refnumLabel = currStrand + refnumStr;
42649
42721
 
42722
+ refnum = 0;
42650
42723
  refnumStr = '';
42651
42724
  refnumLabel = '';
42652
42725
  refnumLabelNoPostfix = '';
42653
42726
 
42654
- bNotShow = true;
42727
+ bHidelabel = true;
42655
42728
  }
42656
42729
 
42657
- return {refnumStr: refnumStr, refnumLabel: refnumLabel, refnumLabelNoPostfix: refnumLabelNoPostfix, bNotShow: bNotShow};
42730
+ return {refnum: refnum, refnumStr: refnumStr, refnumLabel: refnumLabel, refnumLabelNoPostfix: refnumLabelNoPostfix, bHidelabel: bHidelabel, bShowRefnum: bShowRefnum};
42658
42731
  }
42659
42732
 
42660
- getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bNotShow) { let ic = this.icn3d, me = ic.icn3dui;
42733
+ getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bHidelabel) { let ic = this.icn3d, me = ic.icn3dui;
42661
42734
  let refnum = parseInt(refnumStr).toString();
42662
42735
  let color = this.getRefnumColor(currStrand);
42663
- let colorStr = 'style="color:' + color + '"';
42736
+ let colorStr = (!bLoop) ? 'style="color:' + color + '; text-decoration: underline overline;"' : 'style="color:' + color + '"';
42664
42737
 
42665
42738
  let lastTwo = parseInt(refnum.substr(refnum.length - 2, 2));
42666
42739
  parseInt(refnum.substr(refnum.length - 3, 3));
@@ -42673,7 +42746,7 @@ class ShowSeq {
42673
42746
 
42674
42747
  html += '<span ' + colorStr + ' title="' + refnumLabel + '"><b>' + refnumLabel.substr(0, 1) + '</b>' + refnumLabel.substr(1) + '</span>';
42675
42748
  }
42676
- else if(lastTwo % 2 == 0 && lastTwo != 52 && !bNotShow) { // don't show label for the first, middle, and last loop residues
42749
+ else if(lastTwo % 2 == 0 && lastTwo != 52 && !bHidelabel) { // don't show label for the first, middle, and last loop residues
42677
42750
  // e.g., 2152a
42678
42751
  let lastTwoStr = isNaN(refnumStr) ? lastTwo + refnumStr.substr(refnumStr.length - 1, 1) : lastTwo;
42679
42752
  html += '<span ' + colorStr + ' title="' + refnumLabel + '">' + lastTwoStr + '</span>';
@@ -42687,43 +42760,43 @@ class ShowSeq {
42687
42760
 
42688
42761
  getRefnumColor(currStrand) { let ic = this.icn3d; ic.icn3dui;
42689
42762
  if(currStrand == "A^") { // deep sky blue
42690
- return '#00BFFF';
42763
+ return '#9900ff'; //'#00BFFF';
42691
42764
  }
42692
42765
  else if(currStrand == "A") { // blue
42693
- return '#0000FF';
42766
+ return '#9900ff'; //'#0000FF';
42694
42767
  }
42695
42768
  else if(currStrand == "A*") { // sky blue
42696
- return '#87CEEB';
42769
+ return '#9900ff'; //'#87CEEB';
42697
42770
  }
42698
42771
  else if(currStrand == "A'") { // steel blue
42699
- return '#4682B4';
42772
+ return '#9900ff'; //'#4682B4';
42700
42773
  }
42701
42774
  else if(currStrand == "B") { // cyan
42702
- return '#00FFFF';
42775
+ return '#4a86e8'; //'#00FFFF';
42703
42776
  }
42704
42777
  else if(currStrand == "C") { // green
42705
- return '#00FF00';
42778
+ return '#76d6ff'; //'#00FF00';
42706
42779
  }
42707
42780
  else if(currStrand == "C'") { // yellow
42708
- return '#FFFF00';
42781
+ return '#00b050'; //'#FFFF00';
42709
42782
  }
42710
42783
  else if(currStrand == "C''") { // orange
42711
- return '#FFA500';
42784
+ return '#00ff00'; //'#FFA500';
42712
42785
  }
42713
42786
  else if(currStrand == "D") { // brown
42714
- return '#A52A2A';
42787
+ return '#fffb00'; //'#A52A2A';
42715
42788
  }
42716
42789
  else if(currStrand == "E") { // pink
42717
- return '#FFC0CB';
42790
+ return '#ffd966'; //'#FFC0CB';
42718
42791
  }
42719
42792
  else if(currStrand == "F") { // magenta
42720
- return '#FF00FF';
42793
+ return '#ff9900'; //'#FF00FF';
42721
42794
  }
42722
42795
  else if(currStrand == "G") { // red
42723
- return '#FF0000';
42796
+ return '#ff2600'; //'#FF0000';
42724
42797
  }
42725
42798
  else if(currStrand == "G*") { // salmon
42726
- return '#FA8072';
42799
+ return '#ff2600'; //'#FA8072';
42727
42800
  }
42728
42801
  else {
42729
42802
  return '#000';
@@ -44088,6 +44161,8 @@ class LineGraph {
44088
44161
  drawGraphPerType(bCommonDiff, structureArray, bScatterplot, nodeArray1, nodeArray2, linkArray, name2node, heightFinal, height, textHeight, len1Split, r, gap, marginY) { let ic = this.icn3d; ic.icn3dui;
44089
44162
  let html = "";
44090
44163
 
44164
+ let bMutation = structureArray.length == 2 && structureArray[1].replace(structureArray[0], '') == '2';
44165
+
44091
44166
  // draw common interaction
44092
44167
  let label, postfix;
44093
44168
  if(bCommonDiff == 0) {
@@ -44104,11 +44179,21 @@ class LineGraph {
44104
44179
  }
44105
44180
 
44106
44181
  for(let i = 0, il = structureArray.length; i < il; ++i) {
44182
+ let labelFinal = label;
44183
+ if(bMutation) {
44184
+ if(i == 0) {
44185
+ labelFinal += "Wild Type ";
44186
+ }
44187
+ else if(i == 1) {
44188
+ labelFinal += "Mutant ";
44189
+ }
44190
+ }
44191
+
44107
44192
  if(bScatterplot) {
44108
- html += this.drawScatterplot_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, undefined, label + structureArray[i], textHeight);
44193
+ html += this.drawScatterplot_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, undefined, labelFinal + structureArray[i], textHeight);
44109
44194
  height =(len1Split[i] + 1) *(r + gap) + 2 * marginY + textHeight;
44110
44195
  } else {
44111
- html += this.drawLineGraph_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, label + structureArray[i], textHeight);
44196
+ html += this.drawLineGraph_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, labelFinal + structureArray[i], textHeight);
44112
44197
  }
44113
44198
  heightFinal += height;
44114
44199
 
@@ -54956,6 +55041,16 @@ class LoadPDB {
54956
55041
  this.icn3d = icn3d;
54957
55042
  }
54958
55043
 
55044
+ getStructureId(id, moleculeNum, bMutation) { let ic = this.icn3d; ic.icn3dui;
55045
+ let structure = id;
55046
+
55047
+ if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
55048
+ structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
55049
+ }
55050
+
55051
+ return structure;
55052
+ }
55053
+
54959
55054
  // modified from iview (http://istar.cse.cuhk.edu.hk/iview/)
54960
55055
  //This PDB parser feeds the viewer with the content of a PDB file, pdbData.
54961
55056
  loadPDB(src, pdbid, bOpm, bVector, bMutation, bAppend, type, bLastQuery) { let ic = this.icn3d, me = ic.icn3dui;
@@ -55038,12 +55133,7 @@ class LoadPDB {
55038
55133
  }
55039
55134
  }
55040
55135
 
55041
- structure = id;
55042
-
55043
- if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
55044
- //if(id == ic.defaultPdbId) {
55045
- structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
55046
- }
55136
+ structure = this.getStructureId(id, moleculeNum, bMutation);
55047
55137
 
55048
55138
  ic.molTitle = '';
55049
55139
 
@@ -55158,12 +55248,7 @@ class LoadPDB {
55158
55248
  ++moleculeNum;
55159
55249
  id = ic.defaultPdbId;
55160
55250
 
55161
- structure = id;
55162
-
55163
- if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
55164
- //if(id == ic.defaultPdbId) {
55165
- structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
55166
- }
55251
+ structure = this.getStructureId(id, moleculeNum, bMutation);
55167
55252
 
55168
55253
  //helices = [];
55169
55254
  //sheets = [];
@@ -55182,12 +55267,7 @@ class LoadPDB {
55182
55267
  ic.pmid = line.substr(19).trim();
55183
55268
  }
55184
55269
  } else if (record === 'ATOM ' || record === 'HETATM') {
55185
- structure = id;
55186
-
55187
- if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
55188
- //if(id == ic.defaultPdbId) {
55189
- structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
55190
- }
55270
+ structure = this.getStructureId(id, moleculeNum, bMutation);
55191
55271
 
55192
55272
  let alt = line.substr(16, 1);
55193
55273
  //if (alt !== " " && alt !== "A") continue;
@@ -60081,7 +60161,7 @@ class SelectByCommand {
60081
60161
  let residArray = [];
60082
60162
 
60083
60163
  if(bRefnum) {
60084
- let residArrayTmp = ic.refnum2residArray[k];
60164
+ let residArrayTmp = (ic.refnum2residArray[k]) ? ic.refnum2residArray[k] : [];
60085
60165
  for(let m = 0, ml = residArrayTmp.length; m < ml; ++m) {
60086
60166
  let residueId = residArrayTmp[m];
60087
60167
  if(residueId.substr(0, residueId.lastIndexOf('_')) == molecule_chain) {
@@ -62521,12 +62601,12 @@ if(!me.bNode) {
62521
62601
  }
62522
62602
 
62523
62603
  let prevStrand;
62604
+ let bCd19 = ic.chainid2index[chainid].length == 1 && ic.refpdbArray[ic.chainid2index[chainid][0]] == '6al5_cd19';
62524
62605
  for(let i = 0, il = segArray.length; i < il; ++i) {
62525
62606
  let seg = segArray[i];
62526
62607
  let qStart = seg.q_start;
62527
62608
  parseInt(seg.q_start);
62528
- let postfix = '';
62529
- if(isNaN(seg.q_start)) postfix = seg.q_start.substr(seg.q_start.length - 1, 1);
62609
+ if(isNaN(seg.q_start)) seg.q_start.substr(seg.q_start.length - 1, 1);
62530
62610
 
62531
62611
  // one item in "seq"
62532
62612
  // q_start and q_end are numbers, but saved in string
@@ -62537,9 +62617,10 @@ if(!me.bNode) {
62537
62617
 
62538
62618
  let resid = chainid + '_' + seg.t_start;
62539
62619
  //let refnum = qStartInt.toString() + postfix;
62540
- let refnum = qStart + postfix;
62620
+ //let refnum = qStart + postfix;
62621
+ let refnum = qStart;
62541
62622
 
62542
- let refnumLabel = thisClass.getLabelFromRefnum(refnum, prevStrand);
62623
+ let refnumLabel = thisClass.getLabelFromRefnum(refnum, prevStrand, bCd19);
62543
62624
  prevStrand = refnumLabel.replace(new RegExp(refnum,'g'), '');
62544
62625
 
62545
62626
  ic.resid2refnum[resid] = refnumLabel;
@@ -62574,7 +62655,7 @@ if(!me.bNode) {
62574
62655
  }
62575
62656
  }
62576
62657
 
62577
- getLabelFromRefnum(oriRefnum, prevStrand) { let ic = this.icn3d; ic.icn3dui;
62658
+ getLabelFromRefnum(oriRefnum, prevStrand, bCd19) { let ic = this.icn3d; ic.icn3dui;
62578
62659
  let refnum = parseInt(oriRefnum);
62579
62660
 
62580
62661
  // A^: 1xx or 2xx
@@ -62592,7 +62673,10 @@ if(!me.bNode) {
62592
62673
  // G*: 94xx
62593
62674
 
62594
62675
  if(refnum < 100) return " " + oriRefnum;
62595
- else if(refnum >= 100 && refnum < 1000) return "A^" + oriRefnum;
62676
+ else if(refnum >= 100 && refnum < 1000) {
62677
+ if(bCd19) return " " + oriRefnum;
62678
+ else return "A^" + oriRefnum;
62679
+ }
62596
62680
  else if(refnum >= 1000 && refnum < 1200) return "A" + oriRefnum;
62597
62681
  else if(refnum >= 1200 && refnum < 1300) return "A'" + oriRefnum;
62598
62682
  else if(refnum >= 1300 && refnum < 1400) return "A*" + oriRefnum;
@@ -62774,7 +62858,7 @@ class Scap {
62774
62858
 
62775
62859
  let data;
62776
62860
 
62777
- try {
62861
+ // try {
62778
62862
  data = await me.getAjaxPostPromise(url, dataObj, true, undefined, undefined, undefined, 'text');
62779
62863
 
62780
62864
  let pos = data.indexOf('\n');
@@ -62864,8 +62948,10 @@ console.log("free energy: " + energy + " kcal/mol");
62864
62948
 
62865
62949
  let atomWT = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
62866
62950
 
62867
- ic.atoms[serial].color = atomWT.color;
62868
- ic.atomPrevColors[serial] = atomWT.color;
62951
+ if(atomWT) {
62952
+ ic.atoms[serial].color = atomWT.color;
62953
+ ic.atomPrevColors[serial] = atomWT.color;
62954
+ }
62869
62955
  }
62870
62956
 
62871
62957
  let chainid = atom.structure + '_' + atom.chain;
@@ -62931,6 +63017,7 @@ console.log("free energy: " + energy + " kcal/mol");
62931
63017
  // expand the toolbar
62932
63018
  let id = ic.pre + 'selection';
62933
63019
  $("#" + id).show();
63020
+ /*
62934
63021
  }
62935
63022
  catch(err) {
62936
63023
  alert("There are some problems in predicting the side chain of the mutant...");
@@ -62940,6 +63027,7 @@ console.log("free energy: " + energy + " kcal/mol");
62940
63027
  /// if(ic.deferredScap !== undefined) ic.deferredScap.resolve();
62941
63028
  return;
62942
63029
  }
63030
+ */
62943
63031
  }
62944
63032
 
62945
63033
  async exportPdbProfix(bHydrogen, pdb, snpStr) { let ic = this.icn3d, me = ic.icn3dui;