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.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.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,25 +42698,36 @@ 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
+
42706
+ if(currCnt == 1 && start != prevRefnum) { // skip insertions
42707
+ bShowRefnum = false;
42708
+
42709
+ refnum = 0;
42710
+ refnumStr = '';
42711
+ refnumLabel = '';
42712
+ refnumLabelNoPostfix = '';
42644
42713
  }
42645
42714
  }
42646
42715
  else {
42647
42716
  // refnumStr = (parseInt(currFirstDigit) * 1000 + 900 + currCnt).toString();
42648
42717
  // refnumLabel = currStrand + refnumStr;
42649
42718
 
42719
+ refnum = 0;
42650
42720
  refnumStr = '';
42651
42721
  refnumLabel = '';
42652
42722
  refnumLabelNoPostfix = '';
42653
42723
 
42654
- bNotShow = true;
42724
+ bHidelabel = true;
42655
42725
  }
42656
42726
 
42657
- return {refnumStr: refnumStr, refnumLabel: refnumLabel, refnumLabelNoPostfix: refnumLabelNoPostfix, bNotShow: bNotShow};
42727
+ return {refnum: refnum, refnumStr: refnumStr, refnumLabel: refnumLabel, refnumLabelNoPostfix: refnumLabelNoPostfix, bHidelabel: bHidelabel, bShowRefnum: bShowRefnum};
42658
42728
  }
42659
42729
 
42660
- getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bNotShow) { let ic = this.icn3d, me = ic.icn3dui;
42730
+ getRefnumHtml(residueid, refnumStr, refnumStr_ori, refnumLabel, currStrand, bLoop, bHidelabel) { let ic = this.icn3d, me = ic.icn3dui;
42661
42731
  let refnum = parseInt(refnumStr).toString();
42662
42732
  let color = this.getRefnumColor(currStrand);
42663
42733
  let colorStr = 'style="color:' + color + '"';
@@ -42673,7 +42743,7 @@ class ShowSeq {
42673
42743
 
42674
42744
  html += '<span ' + colorStr + ' title="' + refnumLabel + '"><b>' + refnumLabel.substr(0, 1) + '</b>' + refnumLabel.substr(1) + '</span>';
42675
42745
  }
42676
- else if(lastTwo % 2 == 0 && lastTwo != 52 && !bNotShow) { // don't show label for the first, middle, and last loop residues
42746
+ else if(lastTwo % 2 == 0 && lastTwo != 52 && !bHidelabel) { // don't show label for the first, middle, and last loop residues
42677
42747
  // e.g., 2152a
42678
42748
  let lastTwoStr = isNaN(refnumStr) ? lastTwo + refnumStr.substr(refnumStr.length - 1, 1) : lastTwo;
42679
42749
  html += '<span ' + colorStr + ' title="' + refnumLabel + '">' + lastTwoStr + '</span>';
@@ -44088,6 +44158,8 @@ class LineGraph {
44088
44158
  drawGraphPerType(bCommonDiff, structureArray, bScatterplot, nodeArray1, nodeArray2, linkArray, name2node, heightFinal, height, textHeight, len1Split, r, gap, marginY) { let ic = this.icn3d; ic.icn3dui;
44089
44159
  let html = "";
44090
44160
 
44161
+ let bMutation = structureArray.length == 2 && structureArray[1].replace(structureArray[0], '') == '2';
44162
+
44091
44163
  // draw common interaction
44092
44164
  let label, postfix;
44093
44165
  if(bCommonDiff == 0) {
@@ -44104,11 +44176,21 @@ class LineGraph {
44104
44176
  }
44105
44177
 
44106
44178
  for(let i = 0, il = structureArray.length; i < il; ++i) {
44179
+ let labelFinal = label;
44180
+ if(bMutation) {
44181
+ if(i == 0) {
44182
+ labelFinal += "Wild Type ";
44183
+ }
44184
+ else if(i == 1) {
44185
+ labelFinal += "Mutant ";
44186
+ }
44187
+ }
44188
+
44107
44189
  if(bScatterplot) {
44108
- html += this.drawScatterplot_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, undefined, label + structureArray[i], textHeight);
44190
+ html += this.drawScatterplot_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, undefined, labelFinal + structureArray[i], textHeight);
44109
44191
  height =(len1Split[i] + 1) *(r + gap) + 2 * marginY + textHeight;
44110
44192
  } else {
44111
- html += this.drawLineGraph_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, label + structureArray[i], textHeight);
44193
+ html += this.drawLineGraph_base(nodeArray1[i], nodeArray2[i], linkArray[i], name2node, heightFinal, labelFinal + structureArray[i], textHeight);
44112
44194
  }
44113
44195
  heightFinal += height;
44114
44196
 
@@ -54956,6 +55038,16 @@ class LoadPDB {
54956
55038
  this.icn3d = icn3d;
54957
55039
  }
54958
55040
 
55041
+ getStructureId(id, moleculeNum, bMutation) { let ic = this.icn3d; ic.icn3dui;
55042
+ let structure = id;
55043
+
55044
+ if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
55045
+ structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
55046
+ }
55047
+
55048
+ return structure;
55049
+ }
55050
+
54959
55051
  // modified from iview (http://istar.cse.cuhk.edu.hk/iview/)
54960
55052
  //This PDB parser feeds the viewer with the content of a PDB file, pdbData.
54961
55053
  loadPDB(src, pdbid, bOpm, bVector, bMutation, bAppend, type, bLastQuery) { let ic = this.icn3d, me = ic.icn3dui;
@@ -55038,12 +55130,7 @@ class LoadPDB {
55038
55130
  }
55039
55131
  }
55040
55132
 
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
- }
55133
+ structure = this.getStructureId(id, moleculeNum, bMutation);
55047
55134
 
55048
55135
  ic.molTitle = '';
55049
55136
 
@@ -55158,12 +55245,7 @@ class LoadPDB {
55158
55245
  ++moleculeNum;
55159
55246
  id = ic.defaultPdbId;
55160
55247
 
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
- }
55248
+ structure = this.getStructureId(id, moleculeNum, bMutation);
55167
55249
 
55168
55250
  //helices = [];
55169
55251
  //sheets = [];
@@ -55182,12 +55264,7 @@ class LoadPDB {
55182
55264
  ic.pmid = line.substr(19).trim();
55183
55265
  }
55184
55266
  } 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
- }
55267
+ structure = this.getStructureId(id, moleculeNum, bMutation);
55191
55268
 
55192
55269
  let alt = line.substr(16, 1);
55193
55270
  //if (alt !== " " && alt !== "A") continue;
@@ -60081,7 +60158,7 @@ class SelectByCommand {
60081
60158
  let residArray = [];
60082
60159
 
60083
60160
  if(bRefnum) {
60084
- let residArrayTmp = ic.refnum2residArray[k];
60161
+ let residArrayTmp = (ic.refnum2residArray[k]) ? ic.refnum2residArray[k] : [];
60085
60162
  for(let m = 0, ml = residArrayTmp.length; m < ml; ++m) {
60086
60163
  let residueId = residArrayTmp[m];
60087
60164
  if(residueId.substr(0, residueId.lastIndexOf('_')) == molecule_chain) {
@@ -62521,12 +62598,12 @@ if(!me.bNode) {
62521
62598
  }
62522
62599
 
62523
62600
  let prevStrand;
62601
+ let bCd19 = ic.chainid2index[chainid].length == 1 && ic.refpdbArray[ic.chainid2index[chainid][0]] == '6al5_cd19';
62524
62602
  for(let i = 0, il = segArray.length; i < il; ++i) {
62525
62603
  let seg = segArray[i];
62526
62604
  let qStart = seg.q_start;
62527
62605
  parseInt(seg.q_start);
62528
- let postfix = '';
62529
- if(isNaN(seg.q_start)) postfix = seg.q_start.substr(seg.q_start.length - 1, 1);
62606
+ if(isNaN(seg.q_start)) seg.q_start.substr(seg.q_start.length - 1, 1);
62530
62607
 
62531
62608
  // one item in "seq"
62532
62609
  // q_start and q_end are numbers, but saved in string
@@ -62537,9 +62614,10 @@ if(!me.bNode) {
62537
62614
 
62538
62615
  let resid = chainid + '_' + seg.t_start;
62539
62616
  //let refnum = qStartInt.toString() + postfix;
62540
- let refnum = qStart + postfix;
62617
+ //let refnum = qStart + postfix;
62618
+ let refnum = qStart;
62541
62619
 
62542
- let refnumLabel = thisClass.getLabelFromRefnum(refnum, prevStrand);
62620
+ let refnumLabel = thisClass.getLabelFromRefnum(refnum, prevStrand, bCd19);
62543
62621
  prevStrand = refnumLabel.replace(new RegExp(refnum,'g'), '');
62544
62622
 
62545
62623
  ic.resid2refnum[resid] = refnumLabel;
@@ -62574,7 +62652,7 @@ if(!me.bNode) {
62574
62652
  }
62575
62653
  }
62576
62654
 
62577
- getLabelFromRefnum(oriRefnum, prevStrand) { let ic = this.icn3d; ic.icn3dui;
62655
+ getLabelFromRefnum(oriRefnum, prevStrand, bCd19) { let ic = this.icn3d; ic.icn3dui;
62578
62656
  let refnum = parseInt(oriRefnum);
62579
62657
 
62580
62658
  // A^: 1xx or 2xx
@@ -62592,7 +62670,10 @@ if(!me.bNode) {
62592
62670
  // G*: 94xx
62593
62671
 
62594
62672
  if(refnum < 100) return " " + oriRefnum;
62595
- else if(refnum >= 100 && refnum < 1000) return "A^" + oriRefnum;
62673
+ else if(refnum >= 100 && refnum < 1000) {
62674
+ if(bCd19) return " " + oriRefnum;
62675
+ else return "A^" + oriRefnum;
62676
+ }
62596
62677
  else if(refnum >= 1000 && refnum < 1200) return "A" + oriRefnum;
62597
62678
  else if(refnum >= 1200 && refnum < 1300) return "A'" + oriRefnum;
62598
62679
  else if(refnum >= 1300 && refnum < 1400) return "A*" + oriRefnum;
@@ -62774,7 +62855,7 @@ class Scap {
62774
62855
 
62775
62856
  let data;
62776
62857
 
62777
- try {
62858
+ // try {
62778
62859
  data = await me.getAjaxPostPromise(url, dataObj, true, undefined, undefined, undefined, 'text');
62779
62860
 
62780
62861
  let pos = data.indexOf('\n');
@@ -62864,8 +62945,10 @@ console.log("free energy: " + energy + " kcal/mol");
62864
62945
 
62865
62946
  let atomWT = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
62866
62947
 
62867
- ic.atoms[serial].color = atomWT.color;
62868
- ic.atomPrevColors[serial] = atomWT.color;
62948
+ if(atomWT) {
62949
+ ic.atoms[serial].color = atomWT.color;
62950
+ ic.atomPrevColors[serial] = atomWT.color;
62951
+ }
62869
62952
  }
62870
62953
 
62871
62954
  let chainid = atom.structure + '_' + atom.chain;
@@ -62931,6 +63014,7 @@ console.log("free energy: " + energy + " kcal/mol");
62931
63014
  // expand the toolbar
62932
63015
  let id = ic.pre + 'selection';
62933
63016
  $("#" + id).show();
63017
+ /*
62934
63018
  }
62935
63019
  catch(err) {
62936
63020
  alert("There are some problems in predicting the side chain of the mutant...");
@@ -62940,6 +63024,7 @@ console.log("free energy: " + energy + " kcal/mol");
62940
63024
  /// if(ic.deferredScap !== undefined) ic.deferredScap.resolve();
62941
63025
  return;
62942
63026
  }
63027
+ */
62943
63028
  }
62944
63029
 
62945
63030
  async exportPdbProfix(bHydrogen, pdb, snpStr) { let ic = this.icn3d, me = ic.icn3dui;