icn3d 3.12.7 → 3.13.0

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
@@ -14310,15 +14310,7 @@ class DefinedSets {
14310
14310
  dAtoms = me.hashUtilsCls.unionHash(dAtoms, ic.alnChains[alignChain]);
14311
14311
  }
14312
14312
 
14313
- let residuesHash = {}, chains = {};
14314
- for(let i in dAtoms) {
14315
- let atom = ic.atoms[i];
14316
-
14317
- let chainid = atom.structure + '_' + atom.chain;
14318
- let resid = chainid + '_' + atom.resi;
14319
- residuesHash[resid] = 1;
14320
- chains[chainid] = 1;
14321
- }
14313
+ let residuesHash = ic.firstAtomObjCls.getResiduesFromAtoms(dAtoms);
14322
14314
 
14323
14315
  let commandname = 'protein_aligned';
14324
14316
  let commanddescr = 'aligned protein and nucleotides';
@@ -23538,8 +23530,11 @@ class Dssp {
23538
23530
  thisClass.parseDsspData(dataArray, struArray, bAppend);
23539
23531
  })
23540
23532
  .fail(function() {
23533
+ console.log("DSSP calculation had a problem with this structure " + struArray[0] + "...");
23534
+
23541
23535
  ic.pdbParserCls.loadPdbDataRender(bAppend);
23542
23536
 
23537
+ if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
23543
23538
  if(ic.deferredSecondary !== undefined) ic.deferredSecondary.resolve();
23544
23539
  });
23545
23540
  }
@@ -23773,6 +23768,9 @@ class PdbParser {
23773
23768
  thisClass.loadPdbData(data);
23774
23769
  ic.loadScriptCls.loadScript(command);
23775
23770
  }
23771
+ else if(type === 'mmcif') {
23772
+ ic.mmcifParserCls.parseMmcifData(data, undefined, command);
23773
+ }
23776
23774
  else if(type === 'mol2') {
23777
23775
  ic.mol2ParserCls.loadMol2Data(data);
23778
23776
  }
@@ -25378,6 +25376,8 @@ class RealignParser {
25378
25376
 
25379
25377
  ic.selectionCls.saveSelection(name, name);
25380
25378
 
25379
+ me.htmlCls.clickMenuCls.setLogCmd("realign", true);
25380
+
25381
25381
  let structHash = {}, struct2chain = {};
25382
25382
  ic.realignResid = {};
25383
25383
  let lastStruResi = '';
@@ -25488,7 +25488,7 @@ class RealignParser {
25488
25488
 
25489
25489
  // align seq
25490
25490
  ic.hAtoms = ic.chainalignParserCls.setMsa(chainidArray);
25491
-
25491
+
25492
25492
  ic.transformCls.zoominSelection();
25493
25493
 
25494
25494
  ic.chainalignParserCls.downloadChainalignmentPart3(undefined, chainidArray, ic.hAtoms);
@@ -25687,6 +25687,7 @@ class RealignParser {
25687
25687
 
25688
25688
  let ajaxArray = [], chainidPairArray = [];
25689
25689
  let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
25690
+ let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
25690
25691
  let structArray = Object.keys(struct2domain);
25691
25692
  for(let s = 0, sl = structArray.length; s < sl; ++s) {
25692
25693
  let struct1 = structArray[s];
@@ -25702,16 +25703,32 @@ class RealignParser {
25702
25703
  for(let j = 0, jl = chainidArray2.length; j < jl; ++j) {
25703
25704
  let chainid2 = chainidArray2[j];
25704
25705
 
25705
- let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct1][chainid1]);
25706
- let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct2][chainid2]);
25707
-
25708
- let alignAjax = $.ajax({
25709
- url: urlalign,
25710
- type: 'POST',
25711
- data: {'domains1': jsonStr_q, 'domains2': jsonStr_t},
25712
- dataType: 'jsonp',
25713
- cache: true
25714
- });
25706
+ let alignAjax;
25707
+
25708
+ if(me.cfg.aligntool != 'tmalign') {
25709
+ let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct1][chainid1]);
25710
+ let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct2][chainid2]);
25711
+
25712
+ alignAjax = $.ajax({
25713
+ url: urlalign,
25714
+ type: 'POST',
25715
+ data: {'domains1': jsonStr_q, 'domains2': jsonStr_t},
25716
+ dataType: 'jsonp',
25717
+ cache: true
25718
+ });
25719
+ }
25720
+ else {
25721
+ let pdb_target = ic.saveFileCls.getAtomPDB(struct2domain[struct1][chainid1]);
25722
+ let pdb_query = ic.saveFileCls.getAtomPDB(struct2domain[struct2][chainid2]);
25723
+
25724
+ alignAjax = $.ajax({
25725
+ url: urltmalign,
25726
+ type: 'POST',
25727
+ data: {'pdb_query': pdb_query, 'pdb_target': pdb_target},
25728
+ dataType: 'jsonp',
25729
+ cache: true
25730
+ });
25731
+ }
25715
25732
 
25716
25733
  ajaxArray.push(alignAjax);
25717
25734
  chainidPairArray.push(chainid1 + ',' + chainid2); // chainid2 is target
@@ -25792,6 +25809,8 @@ class RealignParser {
25792
25809
  base_t = base;
25793
25810
  }
25794
25811
  else {
25812
+ let hAtoms = {};
25813
+
25795
25814
  predefinedResPair = predefinedResArray[i - 1].split(' | ');
25796
25815
 
25797
25816
  let chainidpair = chainid_t + ',' + chainid;
@@ -25803,6 +25822,8 @@ class RealignParser {
25803
25822
  resiArray = predefinedResPair[0].split(",");
25804
25823
  result = thisClass.getSeqCoorResid(resiArray, chainid_t, base_t);
25805
25824
 
25825
+ hAtoms = me.hashUtilsCls.unionHash(hAtoms, result.hAtoms);
25826
+
25806
25827
  if(!struct2SeqHash[chainidpair][mmdbid_t]) struct2SeqHash[chainidpair][mmdbid_t] = '';
25807
25828
  if(!struct2CoorHash[chainidpair][mmdbid_t]) struct2CoorHash[chainidpair][mmdbid_t] = [];
25808
25829
  if(!struct2resid[chainidpair][mmdbid_t]) struct2resid[chainidpair][mmdbid_t] = [];
@@ -25814,6 +25835,7 @@ class RealignParser {
25814
25835
  // slave
25815
25836
  resiArray = predefinedResPair[1].split(",");
25816
25837
  result = thisClass.getSeqCoorResid(resiArray, chainid, base);
25838
+ hAtoms = me.hashUtilsCls.unionHash(hAtoms, result.hAtoms);
25817
25839
 
25818
25840
  if(!struct2SeqHash[chainidpair][mmdbid]) struct2SeqHash[chainidpair][mmdbid] = '';
25819
25841
  if(!struct2CoorHash[chainidpair][mmdbid]) struct2CoorHash[chainidpair][mmdbid] = [];
@@ -25822,6 +25844,18 @@ class RealignParser {
25822
25844
  struct2SeqHash[chainidpair][mmdbid] += result.seq;
25823
25845
  struct2CoorHash[chainidpair][mmdbid] = struct2CoorHash[chainidpair][mmdbid].concat(result.coor);
25824
25846
  struct2resid[chainidpair][mmdbid] = struct2resid[chainidpair][mmdbid].concat(result.resid);
25847
+
25848
+ // let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(hAtoms);
25849
+ // let residueArray = Object.keys(residueHash);
25850
+
25851
+ // let commandname = chainidpair;
25852
+ // let commanddescr = 'aligned ' + chainidpair;
25853
+ // let select = "select " + ic.resid2specCls.residueids2spec(residueArray);
25854
+
25855
+ // ic.selectionCls.addCustomSelection(residueArray, commandname, commanddescr, select, true);
25856
+
25857
+ // me.htmlCls.clickMenuCls.setLogCmd(select + " | name " + commandname, true);
25858
+ // me.htmlCls.clickMenuCls.setLogCmd("realign", true);
25825
25859
  }
25826
25860
  }
25827
25861
  else {
@@ -25921,6 +25955,7 @@ class RealignParser {
25921
25955
 
25922
25956
  getSeqCoorResid(resiArray, chainid, base) { let ic = this.icn3d, me = ic.icn3dui;
25923
25957
  let seq = '', coorArray = [], residArray = [];
25958
+ let hAtoms = {};
25924
25959
 
25925
25960
  for(let j = 0, jl = resiArray.length; j < jl; ++j) {
25926
25961
  if(resiArray[j].indexOf('-') != -1) {
@@ -25970,7 +26005,11 @@ class RealignParser {
25970
26005
  }
25971
26006
  }
25972
26007
 
25973
- return {seq: seq, coor: coorArray, resid: residArray};
26008
+ for(let i = 0, il = residArray.length; i < il; ++i) {
26009
+ hAtoms = me.hashUtilsCls.unionHash(hAtoms, ic.residues[residArray[i]]);
26010
+ }
26011
+
26012
+ return {seq: seq, coor: coorArray, resid: residArray, hAtoms: hAtoms};
25974
26013
  }
25975
26014
 
25976
26015
  getResCoorArray(resid) { let ic = this.icn3d; ic.icn3dui;
@@ -26061,6 +26100,7 @@ class ChainalignParser {
26061
26100
  // dynamicly align pairs in ic.afChainIndexHash
26062
26101
  let ajaxArray = [], indexArray = [], struArray = [];
26063
26102
  let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
26103
+ let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
26064
26104
 
26065
26105
  for(let index in ic.afChainIndexHash) {
26066
26106
  let idArray = ic.afChainIndexHash[index].split('_');
@@ -26069,17 +26109,31 @@ class ChainalignParser {
26069
26109
  mmdbid_t = idArray[2];
26070
26110
  let chain_t = idArray[3];
26071
26111
 
26072
- let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(ic.chains[mmdbid_q + '_' + chain_q]);
26073
-
26074
- let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(ic.chains[mmdbid_t + '_' + chain_t]);
26075
-
26076
- let alignAjax = $.ajax({
26077
- url: urlalign,
26078
- type: 'POST',
26079
- data: {'domains1': jsonStr_q, 'domains2': jsonStr_t},
26080
- dataType: 'jsonp',
26081
- cache: true
26082
- });
26112
+ let alignAjax;
26113
+ if(me.cfg.aligntool != 'tmalign') {
26114
+ let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(ic.chains[mmdbid_q + '_' + chain_q]);
26115
+ let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(ic.chains[mmdbid_t + '_' + chain_t]);
26116
+
26117
+ alignAjax = $.ajax({
26118
+ url: urlalign,
26119
+ type: 'POST',
26120
+ data: {'domains1': jsonStr_q, 'domains2': jsonStr_t},
26121
+ dataType: 'jsonp',
26122
+ cache: true
26123
+ });
26124
+ }
26125
+ else {
26126
+ let pdb_query = ic.saveFileCls.getAtomPDB(ic.chains[mmdbid_q + '_' + chain_q]);
26127
+ let pdb_target= ic.saveFileCls.getAtomPDB(ic.chains[mmdbid_t + '_' + chain_t]);
26128
+
26129
+ alignAjax = $.ajax({
26130
+ url: urltmalign,
26131
+ type: 'POST',
26132
+ data: {'pdb_query': pdb_query, 'pdb_target': pdb_target},
26133
+ dataType: 'jsonp',
26134
+ cache: true
26135
+ });
26136
+ }
26083
26137
 
26084
26138
  ajaxArray.push(alignAjax);
26085
26139
  indexArray.push(index - 1);
@@ -26211,6 +26265,9 @@ class ChainalignParser {
26211
26265
  // set trans and rotation matrix
26212
26266
  ic.t_trans_add = [];
26213
26267
  ic.q_trans_sub = [];
26268
+
26269
+ if(me.cfg.aligntool == 'tmalign') ic.q_trans_add = [];
26270
+
26214
26271
  ic.q_rotation = [];
26215
26272
  ic.qt_start_end = [];
26216
26273
 
@@ -26355,30 +26412,37 @@ class ChainalignParser {
26355
26412
  for(let i = 0, il = chainidArray.length; i < il; ++i) {
26356
26413
  for(let serial in ic.chains[chainidArray[i]]) {
26357
26414
  let atm = ic.atoms[serial];
26358
- //atm.coord = new THREE.Vector3(atm.coord[0], atm.coord[1], atm.coord[2]);
26359
- if(ic.q_rotation !== undefined && ic.t_trans_add.length > 0 && !me.cfg.resnum && !me.cfg.resdef) {
26415
+ //if(ic.q_rotation !== undefined && ic.t_trans_add.length > 0 && !me.cfg.resnum && !me.cfg.resdef) {
26416
+ if(ic.q_rotation !== undefined && !me.cfg.resnum && !me.cfg.resdef) {
26360
26417
  atm = this.transformAtom(atm, index, alignType);
26361
26418
  }
26362
26419
  }
26363
26420
  }
26364
-
26365
-
26366
26421
  }
26367
26422
 
26368
- transformAtom(atm, index, alignType) { let ic = this.icn3d; ic.icn3dui;
26423
+ transformAtom(atm, index, alignType) { let ic = this.icn3d, me = ic.icn3dui;
26369
26424
  if(alignType === 'target') ;
26370
26425
  else if(alignType === 'query') {
26371
- atm.coord.x -= ic.q_trans_sub[index].x;
26372
- atm.coord.y -= ic.q_trans_sub[index].y;
26373
- atm.coord.z -= ic.q_trans_sub[index].z;
26426
+ if(me.cfg.aligntool != 'tmalign') {
26427
+ atm.coord.x -= ic.q_trans_sub[index].x;
26428
+ atm.coord.y -= ic.q_trans_sub[index].y;
26429
+ atm.coord.z -= ic.q_trans_sub[index].z;
26430
+ }
26374
26431
 
26375
26432
  let x = atm.coord.x * ic.q_rotation[index].x1 + atm.coord.y * ic.q_rotation[index].y1 + atm.coord.z * ic.q_rotation[index].z1;
26376
26433
  let y = atm.coord.x * ic.q_rotation[index].x2 + atm.coord.y * ic.q_rotation[index].y2 + atm.coord.z * ic.q_rotation[index].z2;
26377
26434
  let z = atm.coord.x * ic.q_rotation[index].x3 + atm.coord.y * ic.q_rotation[index].y3 + atm.coord.z * ic.q_rotation[index].z3;
26378
26435
 
26379
- x -= ic.t_trans_add[index].x;
26380
- y -= ic.t_trans_add[index].y;
26381
- z -= ic.t_trans_add[index].z;
26436
+ if(me.cfg.aligntool != 'tmalign') {
26437
+ x -= ic.t_trans_add[index].x;
26438
+ y -= ic.t_trans_add[index].y;
26439
+ z -= ic.t_trans_add[index].z;
26440
+ }
26441
+ else {
26442
+ x += ic.q_trans_add[index].x;
26443
+ y += ic.q_trans_add[index].y;
26444
+ z += ic.q_trans_add[index].z;
26445
+ }
26382
26446
 
26383
26447
  atm.coord.x = x;
26384
26448
  atm.coord.y = y;
@@ -26410,17 +26474,12 @@ class ChainalignParser {
26410
26474
  //ic.hAtoms = hAtoms;
26411
26475
  ic.hAtoms = me.hashUtilsCls.cloneHash(hAtoms);
26412
26476
  ic.dAtoms = me.hashUtilsCls.cloneHash(hAtoms);
26413
-
26477
+
26414
26478
  ic.ParserUtilsCls.renderStructure();
26415
26479
 
26416
26480
  //if(ic.chainidArray.length > 2) {
26417
26481
  if(chainidArray.length > 2) {
26418
- let residuesHash = {};
26419
- for(let i in hAtoms) {
26420
- let atom = ic.atoms[i];
26421
- let resid = atom.structure + '_' + atom.chain + '_' + atom.resi;
26422
- residuesHash[resid] = 1;
26423
- }
26482
+ let residuesHash = ic.firstAtomObjCls.getResiduesFromAtoms(hAtoms);
26424
26483
 
26425
26484
  let commandname = 'protein_aligned';
26426
26485
  let commanddescr = 'protein aligned';
@@ -26456,18 +26515,10 @@ class ChainalignParser {
26456
26515
  //if(me.deferred !== undefined) me.deferred.resolve(); if(ic.deferred2 !== undefined) ic.deferred2.resolve();
26457
26516
  }
26458
26517
 
26459
- downloadChainalignment(chainalign, resnum, resdef) { let ic = this.icn3d, me = ic.icn3dui;
26460
- let thisClass = this;
26461
-
26462
- ic.opts['proteins'] = 'c alpha trace';
26463
-
26464
- let alignArray = chainalign.split(',');
26465
- let domainArray = (me.cfg.domainids) ? me.cfg.domainids.split(',') : [];
26466
- if(domainArray.length < alignArray.length) domainArray = [];
26467
-
26518
+ addPostfixForChainids(chainidArray) { let ic = this.icn3d; ic.icn3dui;
26468
26519
  let struct2cnt = {};
26469
- for(let i = 0, il = alignArray.length; i < il; ++i) {
26470
- let chainid = alignArray[i];
26520
+ for(let i = 0, il = chainidArray.length; i < il; ++i) {
26521
+ let chainid = chainidArray[i];
26471
26522
  let pos = chainid.indexOf('_');
26472
26523
  let struct = chainid.substr(0, pos).toUpperCase();
26473
26524
  if(!struct2cnt.hasOwnProperty(struct)) {
@@ -26479,10 +26530,22 @@ class ChainalignParser {
26479
26530
 
26480
26531
  struct = (struct2cnt[struct] == 1) ? struct : struct + struct2cnt[struct];
26481
26532
 
26482
- alignArray[i] = struct + chainid.substr(pos);
26533
+ chainidArray[i] = struct + chainid.substr(pos);
26483
26534
  }
26484
26535
 
26485
- ic.chainidArray = alignArray;
26536
+ return chainidArray;
26537
+ }
26538
+
26539
+ downloadChainalignment(chainalign, resnum, resdef) { let ic = this.icn3d, me = ic.icn3dui;
26540
+ let thisClass = this;
26541
+
26542
+ ic.opts['proteins'] = 'c alpha trace';
26543
+
26544
+ let alignArray = chainalign.split(',');
26545
+ let domainArray = (me.cfg.domainids) ? me.cfg.domainids.split(',') : [];
26546
+ if(domainArray.length < alignArray.length) domainArray = [];
26547
+
26548
+ ic.chainidArray = this.addPostfixForChainids(alignArray);
26486
26549
 
26487
26550
  let pos1 = alignArray[0].indexOf('_');
26488
26551
  ic.mmdbid_t = alignArray[0].substr(0, pos1).toUpperCase();
@@ -26564,7 +26627,8 @@ class ChainalignParser {
26564
26627
  let chainalignFinal = ic.mmdbid_q + "_" + ic.chain_q + "," + ic.mmdbid_t + "_" + ic.chain_t;
26565
26628
  let domainalign = (domainArray.length > 0) ? domainArray[index] + "," + domainArray[0] : undefined;
26566
26629
 
26567
- if(ic.mmdbid_t.length == 4 && ic.mmdbid_q.length == 4) {
26630
+ // TM-align (me.cfg.aligntool == 'tmalign') needs to input PDB
26631
+ if(me.cfg.aligntool != 'tmalign' && ic.mmdbid_t.length == 4 && ic.mmdbid_q.length == 4) {
26568
26632
  let urlalign;
26569
26633
 
26570
26634
  if(domainArray.length > 0) {
@@ -26598,7 +26662,8 @@ class ChainalignParser {
26598
26662
  thisClass.parseChainAlignData(dataArray, alignArray, ic.mmdbid_t, ic.chain_t);
26599
26663
  })
26600
26664
  .fail(function() {
26601
- alert("These chains can not be aligned by VAST server. You can specify the residue range and try it again...");
26665
+ let serverName = (me.cfg.aligntool == 'tmalign') ? 'TM-align' : 'VAST';
26666
+ alert("These chains can not be aligned by " + serverName + ". You can specify the residue range and try it again...");
26602
26667
  // thisClass.parseChainAlignData(arguments, alignArray, ic.mmdbid_t, ic.chain_t);
26603
26668
  });
26604
26669
  }
@@ -26616,6 +26681,9 @@ class ChainalignParser {
26616
26681
 
26617
26682
  ic.t_trans_add = [];
26618
26683
  ic.q_trans_sub = [];
26684
+
26685
+ if(me.cfg.aligntool == 'tmalign') ic.q_trans_add = [];
26686
+
26619
26687
  ic.q_rotation = [];
26620
26688
  ic.qt_start_end = [];
26621
26689
 
@@ -26661,6 +26729,9 @@ class ChainalignParser {
26661
26729
  // need to pass C-alpha coords and get transformation matrix from backend
26662
26730
  ic.t_trans_add[index-1] = {"x":0, "y":0, "z":0};
26663
26731
  ic.q_trans_sub[index-1] = {"x":0, "y":0, "z":0};
26732
+
26733
+ if(me.cfg.aligntool == 'tmalign') ic.q_trans_add[index-1] = {"x":0, "y":0, "z":0};
26734
+
26664
26735
  ic.q_rotation[index-1] = {"x1":1, "y1":0, "z1":0, "x2":0, "y2":1, "z2":0, "x3":0, "y3":0, "z3":1};
26665
26736
  ic.qt_start_end[index-1] = undefined;
26666
26737
  }
@@ -26683,7 +26754,8 @@ class ChainalignParser {
26683
26754
  processAlign(align, index, queryData, bEqualMmdbid, bEqualChain, bNoAlert) { let ic = this.icn3d, me = ic.icn3dui;
26684
26755
  let bAligned = false;
26685
26756
  if((!align || align.length == 0) && !bNoAlert) {
26686
- alert("These chains can not be aligned by VAST server.");
26757
+ let serverName = (me.cfg.aligntool == 'tmalign') ? 'TM-align' : 'VAST';
26758
+ alert("These chains can not be aligned by " + serverName + ".");
26687
26759
  return bAligned;
26688
26760
  }
26689
26761
 
@@ -26716,13 +26788,20 @@ class ChainalignParser {
26716
26788
  */
26717
26789
  ic.t_trans_add[index] = align[0].t_trans_add;
26718
26790
  ic.q_trans_sub[index] = align[0].q_trans_sub;
26791
+
26792
+ if(me.cfg.aligntool == 'tmalign') ic.q_trans_add[index] = align[0].q_trans_add;
26793
+
26719
26794
  ic.q_rotation[index] = align[0].q_rotation;
26720
26795
  ic.qt_start_end[index] = align[0].segs;
26721
26796
 
26722
26797
  let rmsd = align[0].super_rmsd;
26723
26798
 
26724
- me.htmlCls.clickMenuCls.setLogCmd("RMSD of alignment: " + rmsd.toPrecision(4), false);
26725
- $("#" + ic.pre + "realignrmsd").val(rmsd.toPrecision(4));
26799
+ let logStr = "alignment RMSD: " + rmsd.toPrecision(4);
26800
+ if(me.cfg.aligntool == 'tmalign') logStr += "; TM-score: " + align[0].score.toPrecision(4);
26801
+ me.htmlCls.clickMenuCls.setLogCmd(logStr, false);
26802
+ let html = "<br><b>Alignment RMSD</b>: " + rmsd.toPrecision(4) + " &#8491;<br>";
26803
+ if(me.cfg.aligntool == 'tmalign') html += "<b>TM-score</b>: " + align[0].score.toPrecision(4) + "<br><br>";
26804
+ $("#" + ic.pre + "dl_rmsd").html(html);
26726
26805
  if(!me.cfg.bSidebyside) me.htmlCls.dialogCls.openDlg('dl_rmsd', 'RMSD of alignment');
26727
26806
 
26728
26807
  bAligned = true;
@@ -26910,11 +26989,10 @@ class ChainalignParser {
26910
26989
  }
26911
26990
 
26912
26991
  // calculate secondary structures with applyCommandDssp
26913
- if(bQuery && me.cfg.masterchain) {
26992
+ if(bQuery && me.cfg.matchedchains) {
26914
26993
  $.when(ic.pdbParserCls.applyCommandDssp(true)).then(function() {
26915
26994
  let bRealign = true, bPredefined = true;
26916
26995
  ic.realignParserCls.realignChainOnSeqAlign(undefined, ic.chainidArray, bRealign, bPredefined);
26917
-
26918
26996
  // reset annotations
26919
26997
  $("#" + ic.pre + "dl_annotations").html("");
26920
26998
  ic.bAnnoShown = false;
@@ -28609,6 +28687,24 @@ class LoadScript {
28609
28687
 
28610
28688
  return;
28611
28689
  }
28690
+ else if(ic.commands[i].trim().indexOf('realign on tmalign') == 0) {
28691
+ let strArray = ic.commands[i].split("|||");
28692
+ let command = strArray[0].trim();
28693
+
28694
+ let paraArray = command.split(' | ');
28695
+ if(paraArray.length == 2) {
28696
+ let nameArray = paraArray[1].split(',');
28697
+ ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
28698
+ }
28699
+
28700
+ me.cfg.aligntool = 'tmalign';
28701
+
28702
+ $.when(thisClass.applyCommandRealignByStruct(command)).then(function() {
28703
+ thisClass.execCommandsBase(i + 1, end, steps);
28704
+ });
28705
+
28706
+ return;
28707
+ }
28612
28708
  else if(ic.commands[i].trim().indexOf('graph interaction pairs') == 0) {
28613
28709
  let strArray = ic.commands[i].split("|||");
28614
28710
  let command = strArray[0].trim();
@@ -28797,6 +28893,17 @@ class LoadScript {
28797
28893
  }
28798
28894
  thisClass.applyCommandRealignByStruct(lastCommand);
28799
28895
  }
28896
+ else if(lastCommand.indexOf('realign on tmalign') == 0) {
28897
+ let paraArray = lastCommand.split(' | ');
28898
+ if(paraArray.length == 2) {
28899
+ let nameArray = paraArray[1].split(',');
28900
+ ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
28901
+ }
28902
+
28903
+ me.cfg.aligntool = 'tmalign';
28904
+
28905
+ thisClass.applyCommandRealignByStruct(lastCommand);
28906
+ }
28800
28907
  else if(lastCommand.indexOf('graph interaction pairs') == 0) {
28801
28908
  thisClass.applyCommandGraphinteraction(lastCommand);
28802
28909
  }
@@ -28892,6 +28999,21 @@ class LoadScript {
28892
28999
 
28893
29000
  ic.chainalignParserCls.downloadMmdbAf(id);
28894
29001
  }
29002
+ /*
29003
+ else if(command.indexOf('load vastsearch') !== -1) {
29004
+ let idArray = loadStr.split(' || ');
29005
+ let mmdbafid = idArray[1].substr(idArray[1].indexOf(' ') + 1);
29006
+ ic.chainidArray = idArray[2].substr(idArray[2].indexOf(' ') + 1);
29007
+ me.cfg.matchedchains = ic.chainidArray;
29008
+
29009
+ // load multiple PDBs
29010
+ ic.bNCBI = true;
29011
+ ic.bMmdbafid = true;
29012
+
29013
+ let bQuery = true;
29014
+ ic.chainalignParserCls.downloadMmdbAf(mmdbafid, bQuery);
29015
+ }
29016
+ */
28895
29017
  else if(command.indexOf('load gi') !== -1) {
28896
29018
  me.cfg.gi = id;
28897
29019
  ic.mmdbParserCls.downloadGi(id);
@@ -28913,14 +29035,20 @@ class LoadScript {
28913
29035
  ic.alignParserCls.downloadAlignment(id);
28914
29036
  }
28915
29037
  else if(command.indexOf('load chainalignment') !== -1) {
28916
- //load chainalignment [id] | resnum [resnum] | parameters [inpara]
29038
+ //load chainalignment [id] | resnum [resnum] | resdef [resnum] | aligntool [aligntool] | parameters [inpara]
28917
29039
  let urlArray = command.split(" | ");
28918
- if(urlArray[1].indexOf('resnum') != -1) {
28919
- me.cfg.resnum = urlArray[1].substr(urlArray[1].indexOf('resnum') + 7);
29040
+ if(urlArray.length > 1 && urlArray[1].indexOf('resnum') != -1) {
29041
+ me.cfg.resnum = urlArray[1].substr(urlArray[1].indexOf('resnum') + 7);
29042
+ }
29043
+ if(urlArray.length > 2 && urlArray[2].indexOf('resdef') != -1) {
29044
+ me.cfg.resdef = urlArray[2].substr(urlArray[1].indexOf('resdef') + 7);
29045
+ }
29046
+ if(urlArray.length > 3 && urlArray[3].indexOf('aligntool') != -1) {
29047
+ me.cfg.aligntool = urlArray[3].substr(urlArray[1].indexOf('aligntool') + 10);
28920
29048
  }
28921
29049
 
28922
29050
  me.cfg.chainalign = id;
28923
- ic.chainalignParserCls.downloadChainalignment(id, me.cfg.resnum);
29051
+ ic.chainalignParserCls.downloadChainalignment(id, me.cfg.resnum, me.cfg.resdef);
28924
29052
  }
28925
29053
  else if(command.indexOf('load url') !== -1) {
28926
29054
  let typeStr = load_parameters[1]; // type pdb
@@ -30720,6 +30848,7 @@ class ShowSeq {
30720
30848
  html3 += '<div class="icn3d-dl_sequence">';
30721
30849
  // html to display protein positions(10, 20, etc)
30722
30850
  //if(Object.keys(ic.chains[chnid]).length > 10) {
30851
+
30723
30852
  if(ic.giSeq[chnid].length > 10) {
30724
30853
  htmlTmp = '<div class="icn3d-residueLine" style="white-space:nowrap;">';
30725
30854
  let atom = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.chains[chnid]);
@@ -31095,6 +31224,56 @@ class ShowSeq {
31095
31224
  html += '</div>';
31096
31225
  html3 += '</div></div>';
31097
31226
  }
31227
+ /*
31228
+ else if(chnid == '4YHY_B') {
31229
+ // test reference num
31230
+ let resid2refnum = {};
31231
+
31232
+ let refData = {6: 'A1050', 22: 'B2050', 36: 'C3050', 48: 'C`3250', 61: 'C``3750', 70: 'D4050', 81: 'E5050', 96: 'F6050', 112: 'G7050'};
31233
+
31234
+ //ic.chainsMapping[chnid][chnid + '_' + resObject2.resi] = resObject1.resn + resObject1.resi;
31235
+ for(let resi in refData) {
31236
+ let resid = chnid + '_' + resi;
31237
+ resid2refnum[resid] = refData[resi];
31238
+ }
31239
+
31240
+
31241
+ htmlTmp = '<div class="icn3d-dl_sequence">';
31242
+ htmlTmp += '<div class="icn3d-residueLine" style="white-space:nowrap;">';
31243
+ htmlTmp += '<div class="icn3d-annoTitle" anno="0" title="Ig Reference Numbers">Ig Reference Numbers</div>';
31244
+ htmlTmp += '<span class="icn3d-residueNum"></span>';
31245
+ html3 += htmlTmp + '<br>';
31246
+ html += htmlTmp + '<span class="icn3d-seqLine">';
31247
+ for(let i = 0, il = giSeq.length; i < il; ++i) {
31248
+ html += this.insertGap(chnid, i, '-');
31249
+ if(i >= ic.matchedPos[chnid] && i - ic.matchedPos[chnid] < ic.chainsSeq[chnid].length) {
31250
+ let currResi = ic.chainsSeq[chnid][i - ic.matchedPos[chnid]].resi;
31251
+ let residueid = chnid + '_' + currResi;
31252
+ if(!ic.residues.hasOwnProperty(residueid)) {
31253
+ html += '<span></span>';
31254
+ }
31255
+ else {
31256
+ let atom = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.residues[residueid]);
31257
+ let resi_ori = atom.resi_ori;
31258
+ html += '<span>';
31259
+ if( resid2refnum.hasOwnProperty(residueid)) {
31260
+ html += resid2refnum[residueid] + ' ';
31261
+ }
31262
+ html += '</span>';
31263
+ }
31264
+ }
31265
+ else {
31266
+ html += '<span></span>';
31267
+ }
31268
+ }
31269
+ html += '<span class="icn3d-residueNum"></span>';
31270
+ html += '</span>';
31271
+ html += '<br>';
31272
+ html += '</div>';
31273
+ html += '</div>';
31274
+ html3 += '</div></div>';
31275
+ }
31276
+ */
31098
31277
  }
31099
31278
  $("#" + ic.pre + 'dt_giseq_' + chnid).html(html);
31100
31279
  $("#" + ic.pre + 'ov_giseq_' + chnid).html(html2);
@@ -31220,12 +31399,24 @@ class AddTrack {
31220
31399
  //var title = 'fasta ' + fasta.substr(0, 5);
31221
31400
  let title = $("#" + ic.pre + "fasta_title").val();
31222
31401
 
31402
+ let structure = chainid.substr(0, chainid.indexOf('_'));
31403
+ let targets = chainid;
31404
+ if(structure.length == 5) { // e.g., 1TUP2
31405
+ targets = targets.substr(0,4);
31406
+ }
31407
+ else if(structure.length > 5) { // AlphaFold UniProt
31408
+ targets = '';
31409
+ for(let i = 0, il = ic.chainsSeq[chainid].length; i < il; ++i) {
31410
+ targets += ic.chainsSeq[chainid][i].name;
31411
+ }
31412
+ }
31413
+
31223
31414
  //var text = $("#" + ic.pre + "track_text").val();
31224
31415
  let url = 'https://www.ncbi.nlm.nih.gov/Structure/pwaln/pwaln.fcgi?from=track';
31225
31416
  $.ajax({
31226
31417
  url: url,
31227
31418
  type: 'POST',
31228
- data : {'targets': chainid, 'queries': fasta},
31419
+ data : {'targets': targets, 'queries': fasta},
31229
31420
  dataType: 'jsonp',
31230
31421
  //dataType: 'json',
31231
31422
  tryCount : 0,
@@ -31811,12 +32002,14 @@ class AddTrack {
31811
32002
  }
31812
32003
 
31813
32004
  alignSequenceToStructure(chainid, data, title) { let ic = this.icn3d, me = ic.icn3dui;
31814
- let query, target;
32005
+ let query, target, firstKey;
31815
32006
 
31816
32007
  if(data.data !== undefined) {
31817
32008
  query = data.data[0].query;
31818
32009
  //target = data.data[0].targets[chainid.replace(/_/g, '')];
31819
- target = data.data[0].targets[chainid];
32010
+ //target = data.data[0].targets[chainid];
32011
+ firstKey = Object.keys(data.data[0].targets)[0];
32012
+ target = data.data[0].targets[firstKey];
31820
32013
 
31821
32014
  target = target.hsps[0];
31822
32015
  }
@@ -31832,7 +32025,8 @@ class AddTrack {
31832
32025
  target.scores.bit_score;
31833
32026
 
31834
32027
  //var targetSeq = data.targets[chainid.replace(/_/g, '')].seqdata;
31835
- let targetSeq = data.targets[chainid].seqdata;
32028
+ //let targetSeq = data.targets[chainid].seqdata;
32029
+ let targetSeq = data.targets[firstKey].seqdata;
31836
32030
  let querySeq = query.seqdata;
31837
32031
 
31838
32032
  let segArray = target.segs;
@@ -32563,6 +32757,10 @@ class AnnoCddSite {
32563
32757
 
32564
32758
  let chainWithData = {};
32565
32759
 
32760
+ if(me.bNode) {
32761
+ if(!ic.resid2cdd) ic.resid2cdd = {};
32762
+ if(!ic.resid2site) ic.resid2site = {};
32763
+ }
32566
32764
  for(let i = 0, il = dataArray.length; i < il; ++i) {
32567
32765
  let data = (bSeq) ? dataArray[i][0] : dataArray[i];
32568
32766
 
@@ -32578,6 +32776,7 @@ class AnnoCddSite {
32578
32776
  let html2 = html;
32579
32777
  let html3 = html;
32580
32778
  let domainArray = cddData.doms;
32779
+ if(me.bNode && !ic.resid2cdd[chnid]) ic.resid2cdd[chnid] = [];
32581
32780
  let result = thisClass.setDomainFeature(domainArray, chnid, true, html, html2, html3);
32582
32781
 
32583
32782
  ic.chainid2pssmid[chnid] = {pssmid2name: result.pssmid2name, pssmid2fromArray: result.pssmid2fromArray, pssmid2toArray: result.pssmid2toArray};
@@ -32596,6 +32795,7 @@ class AnnoCddSite {
32596
32795
 
32597
32796
  // features
32598
32797
  let featuteArray = cddData.motifs;
32798
+ if(me.bNode && !ic.resid2site[chnid]) ic.resid2site[chnid] = [];
32599
32799
  result = thisClass.setDomainFeature(featuteArray, chnid, false, html, html2, html3, acc2domain);
32600
32800
 
32601
32801
  html = result.html; // + '</div>';
@@ -32660,6 +32860,12 @@ class AnnoCddSite {
32660
32860
  let pos = thisClass.getAdjustedResi(i, chnid, ic.matchedPos, ic.chainsSeq, ic.baseResi);
32661
32861
 
32662
32862
  html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" title="' + c + pos + '" class="icn3d-residue">' + cFull + '</span>';
32863
+ if(me.bNode) {
32864
+ let obj = {};
32865
+ obj[chnid + '_' + pos] = 'site: ' + siteArray[index].title;
32866
+ ic.resid2site[chnid].push(obj);
32867
+ }
32868
+
32663
32869
  html2 += ic.showSeqCls.insertGapOverview(chnid, i);
32664
32870
  let emptyWidth =(me.cfg.blast_rep_id == chnid) ? Math.round(ic.seqAnnWidth * i /(ic.maxAnnoLength + ic.nTotalGap) - prevEmptyWidth - prevLineWidth) : Math.round(ic.seqAnnWidth * i / ic.maxAnnoLength - prevEmptyWidth - prevLineWidth);
32665
32871
  //if(emptyWidth < 0) emptyWidth = 0;
@@ -32833,6 +33039,16 @@ class AnnoCddSite {
32833
33039
  //var pos =(i >= ic.matchedPos[chnid] && i - ic.matchedPos[chnid] < ic.chainsSeq[chnid].length) ? ic.chainsSeq[chnid][i - ic.matchedPos[chnid]].resi : ic.baseResi[chnid] + 1 + i;
32834
33040
  let pos = thisClass.getAdjustedResi(i, chnid, ic.matchedPos, ic.chainsSeq, ic.baseResi);
32835
33041
  html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" title="' + c + pos + '" class="icn3d-residue">' + cFull + '</span>';
33042
+ if(me.bNode) {
33043
+ let obj = {};
33044
+ obj[chnid + '_' + pos] = fulltitle;
33045
+ if(bDomain) {
33046
+ ic.resid2cdd[chnid].push(obj);
33047
+ }
33048
+ else {
33049
+ ic.resid2site[chnid].push(obj);
33050
+ }
33051
+ }
32836
33052
  }
32837
33053
  else {
32838
33054
  html += '<span>-</span>'; //'<span>-</span>';
@@ -32929,29 +33145,56 @@ class AnnoCddSite {
32929
33145
  let title = cFull +(i+1 + ic.baseResi[chnid]).toString();
32930
33146
  if(type == 'ssbond') {
32931
33147
  title = 'Residue ' + resid + ' has disulfide bond with';
33148
+ let sstitle = '';
32932
33149
  if(resid2resids[resid] !== undefined) {
32933
33150
  for(let j = 0, jl = resid2resids[resid].length; j < jl; ++j) {
32934
- title += ' residue ' + resid2resids[resid][j];
33151
+ sstitle += ' residue ' + resid2resids[resid][j];
32935
33152
  }
32936
33153
  }
33154
+ title += sstitle;
33155
+
33156
+ if(me.bNode) {
33157
+ let obj = {};
33158
+ obj[resid] = 'disulfide bond with' + sstitle;
33159
+ ic.resid2ssbond[chnid].push(obj);
33160
+ }
32937
33161
  }
32938
33162
  else if(type == 'crosslink') {
32939
33163
  title = 'Residue ' + resid + ' has cross-linkage with';
33164
+ let cltitle = '';
32940
33165
  if(resid2resids[resid] !== undefined) {
32941
33166
  for(let j = 0, jl = resid2resids[resid].length; j < jl; ++j) {
32942
- title += ' residue ' + resid2resids[resid][j];
33167
+ cltitle += ' residue ' + resid2resids[resid][j];
32943
33168
  }
32944
33169
  }
33170
+ title += cltitle;
33171
+
33172
+ if(me.bNode) {
33173
+ let obj = {};
33174
+ obj[resid] = 'cross-linkage with' + cltitle;
33175
+ ic.resid2crosslink[chnid].push(obj);
33176
+ }
32945
33177
  }
33178
+ else {
33179
+ title = 'Residue ' + resid + ' has connection with';
33180
+ let cltitle = '';
33181
+ if(resid2resids[resid] !== undefined) {
33182
+ for(let j = 0, jl = resid2resids[resid].length; j < jl; ++j) {
33183
+ cltitle += ' residue ' + resid2resids[resid][j];
33184
+ }
33185
+ }
33186
+ title += cltitle;
33187
+ }
33188
+
32946
33189
  html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" title="' + title + '" class="icn3d-residue">' + c + '</span>';
32947
33190
  html2 += ic.showSeqCls.insertGapOverview(chnid, i);
32948
33191
  let emptyWidth =(me.cfg.blast_rep_id == chnid) ? Math.round(ic.seqAnnWidth * i /(ic.maxAnnoLength + ic.nTotalGap) - prevEmptyWidth - prevLineWidth) : Math.round(ic.seqAnnWidth * i / ic.maxAnnoLength - prevEmptyWidth - prevLineWidth);
32949
33192
  //if(emptyWidth < 0) emptyWidth = 0;
32950
33193
  if(emptyWidth >= 0) {
32951
- html2 += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
32952
- html2 += '<div style="display:inline-block; background-color:#000; width:' + widthPerRes + 'px;" title="' + title + '">&nbsp;</div>';
32953
- prevEmptyWidth += emptyWidth;
32954
- prevLineWidth += widthPerRes;
33194
+ html2 += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
33195
+ html2 += '<div style="display:inline-block; background-color:#000; width:' + widthPerRes + 'px;" title="' + title + '">&nbsp;</div>';
33196
+ prevEmptyWidth += emptyWidth;
33197
+ prevLineWidth += widthPerRes;
32955
33198
  }
32956
33199
  }
32957
33200
  else {
@@ -33017,7 +33260,12 @@ class AnnoSsbond {
33017
33260
  this.showSsbond_base(chnid, chnidBase);
33018
33261
  }
33019
33262
  }
33020
- showSsbond_base(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
33263
+ showSsbond_base(chnid, chnidBase) { let ic = this.icn3d, me = ic.icn3dui;
33264
+ if(me.bNode) {
33265
+ if(!ic.resid2ssbond) ic.resid2ssbond = {};
33266
+ if(!ic.resid2ssbond[chnid]) ic.resid2ssbond[chnid] = [];
33267
+ }
33268
+
33021
33269
  let chainid = chnidBase;
33022
33270
  let resid2resids = {};
33023
33271
  let structure = chainid.substr(0, chainid.indexOf('_'));
@@ -34038,12 +34286,11 @@ class ApplyCommand {
34038
34286
  let bPosition = false;
34039
34287
  for(let i = 1, il = paraArray.length; i < il; ++i) {
34040
34288
  let wordArray = paraArray[i].split(' ');
34041
-
34042
34289
  if(wordArray[0] == 'x') {
34043
34290
  bPosition = true;
34044
- x = wordArray[1];
34045
- y = wordArray[3];
34046
- z = wordArray[5];
34291
+ x = parseFloat(wordArray[1]);
34292
+ y = parseFloat(wordArray[3]);
34293
+ z = parseFloat(wordArray[5]);
34047
34294
  }
34048
34295
  else if(wordArray[0] == 'size') {
34049
34296
  size = paraArray[i].substr(paraArray[i].lastIndexOf(' ') + 1);
@@ -34061,9 +34308,9 @@ class ApplyCommand {
34061
34308
 
34062
34309
  if(!bPosition) {
34063
34310
  let position = ic.applyCenterCls.centerAtoms(me.hashUtilsCls.hash2Atoms(ic.hAtoms, ic.atoms));
34064
- x = position.center.x;
34065
- y = position.center.y;
34066
- z = position.center.z;
34311
+ x = parseFloat(position.center.x);
34312
+ y = parseFloat(position.center.y);
34313
+ z = parseFloat(position.center.z);
34067
34314
  }
34068
34315
 
34069
34316
  ic.analysisCls.addLabel(text, x,y,z, size, color, background, type);
@@ -34534,7 +34781,23 @@ class ApplyCommand {
34534
34781
  let id = command.substr(command.lastIndexOf(' ') + 1);
34535
34782
  me.htmlCls.eventsCls.saveHtml(id);
34536
34783
  }
34537
-
34784
+ else if(command.indexOf('resdef') == 0) {
34785
+ me.cfg.resdef = command.substr(command.indexOf(' ') + 1);
34786
+ }
34787
+ else if(command.indexOf('vast_search_chainid') == 0) {
34788
+ ic.chainidArray = commandOri.substr(commandOri.indexOf(' ') + 1).split(',');
34789
+
34790
+ let bRealign = true, bPredefined = true;
34791
+ ic.realignParserCls.realignChainOnSeqAlign(undefined, ic.chainidArray, bRealign, bPredefined);
34792
+
34793
+ // reset annotations
34794
+ // $("#" + ic.pre + "dl_annotations").html("");
34795
+ // ic.bAnnoShown = false;
34796
+ // if($('#' + ic.pre + 'dl_selectannotations').dialog( 'isOpen' )) {
34797
+ // $('#' + ic.pre + 'dl_selectannotations').dialog( 'close' );
34798
+ // }
34799
+ }
34800
+
34538
34801
  // special, select ==========
34539
34802
 
34540
34803
  else if(command.indexOf('select displayed set') !== -1) {
@@ -34949,9 +35212,8 @@ class SelectByCommand {
34949
35212
  }
34950
35213
  }
34951
35214
 
34952
- selectBySpec(select, commandname, commanddesc, bDisplay) { let ic = this.icn3d, me = ic.icn3dui;
35215
+ selectBySpec(select, commandname, commanddesc, bDisplay, bNoUpdateAll) { let ic = this.icn3d, me = ic.icn3dui;
34953
35216
  select =(select.trim().substr(0, 6) === 'select') ? select.trim().substr(7) : select.trim();
34954
-
34955
35217
  ic.hAtoms = {};
34956
35218
 
34957
35219
  // selection definition is similar to Chimera: https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/frameatom_spec.html
@@ -35265,8 +35527,8 @@ class SelectByCommand {
35265
35527
  if(commandname != "") {
35266
35528
  ic.selectionCls.addCustomSelection(residueAtomArray, commandname, commanddesc, select, bSelectResidues);
35267
35529
 
35268
- let nameArray = [commandname];
35269
- ic.definedSetsCls.changeCustomAtoms(nameArray);
35530
+ let nameArray = [commandname];
35531
+ if(!bNoUpdateAll) ic.definedSetsCls.changeCustomAtoms(nameArray);
35270
35532
  }
35271
35533
  }
35272
35534
  }
@@ -36930,7 +37192,7 @@ class ParserUtils {
36930
37192
 
36931
37193
  if(rmsd) {
36932
37194
  me.htmlCls.clickMenuCls.setLogCmd("realignment RMSD: " + rmsd.toPrecision(4), false);
36933
- $("#" + ic.pre + "realignrmsd").val(rmsd.toPrecision(4));
37195
+ $("#" + ic.pre + "dl_rmsd").html("<br><b>Realignment RMSD</b>: " + rmsd.toPrecision(4) + " &#8491;<br><br>");
36934
37196
  if(!me.cfg.bSidebyside) me.htmlCls.dialogCls.openDlg('dl_rmsd', 'Realignment RMSD');
36935
37197
  }
36936
37198
 
@@ -36999,7 +37261,7 @@ class ParserUtils {
36999
37261
  resi2pos_q[resi] = i + 1;
37000
37262
  }
37001
37263
 
37002
- for(let i = 0, il = ic.realignResid[struct_t].length; i < il; ++i) {
37264
+ for(let i = 0, il = ic.realignResid[struct_t].length; i < il && i < ic.realignResid[struct_q].length; ++i) {
37003
37265
  let resid_t = ic.realignResid[struct_t][i].resid;
37004
37266
  let pos_t = resid_t.lastIndexOf('_');
37005
37267
  let resi_t = parseInt(resid_t.substr(pos_t + 1));
@@ -37300,7 +37562,7 @@ class ParserUtils {
37300
37562
  let rmsd = ic.rmsd_supr.rmsd;
37301
37563
 
37302
37564
  me.htmlCls.clickMenuCls.setLogCmd("RMSD of alignment to OPM: " + rmsd.toPrecision(4), false);
37303
- $("#" + ic.pre + "realignrmsd").val(rmsd.toPrecision(4));
37565
+ $("#" + ic.pre + "dl_rmsd").html("<br><b>RMSD of alignment to OPM</b>: " + rmsd.toPrecision(4) + " &#8491;<br><br>");
37304
37566
  if(!me.cfg.bSidebyside) me.htmlCls.dialogCls.openDlg('dl_rmsd', 'RMSD of alignment to OPM');
37305
37567
 
37306
37568
  let dxymaxsq = 0;
@@ -37600,7 +37862,7 @@ class MmcifParser {
37600
37862
 
37601
37863
  //Ajax call was used to get the atom data from the "mmcifid". This function was deferred
37602
37864
  //so that it can be chained together with other deferred functions for sequential execution.
37603
- downloadMmcif(mmcifid) { let ic = this.icn3d, me = ic.icn3dui;
37865
+ downloadMmcif(mmcifid) { let ic = this.icn3d; ic.icn3dui;
37604
37866
  let thisClass = this;
37605
37867
 
37606
37868
  let url, dataType;
@@ -37626,34 +37888,7 @@ class MmcifParser {
37626
37888
  //ic.ParserUtilsCls.hideLoading();
37627
37889
  },
37628
37890
  success: function(data) {
37629
- url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
37630
- $.ajax({
37631
- url: url,
37632
- type: 'POST',
37633
- data : {'mmciffile': data},
37634
- dataType: 'jsonp',
37635
- cache: true,
37636
- tryCount : 0,
37637
- retryLimit : 0, //1
37638
- beforeSend: function() {
37639
- ic.ParserUtilsCls.showLoading();
37640
- },
37641
- complete: function() {
37642
- //ic.ParserUtilsCls.hideLoading();
37643
- },
37644
- success: function(data) {
37645
- thisClass.loadMmcifData(data, mmcifid);
37646
- },
37647
- error : function(xhr, textStatus, errorThrown ) {
37648
- this.tryCount++;
37649
- if(this.tryCount <= this.retryLimit) {
37650
- //try again
37651
- $.ajax(this);
37652
- return;
37653
- }
37654
- return;
37655
- }
37656
- });
37891
+ thisClass.parseMmcifData(data, mmcifid);
37657
37892
  },
37658
37893
  error : function(xhr, textStatus, errorThrown ) {
37659
37894
  this.tryCount++;
@@ -37667,6 +37902,40 @@ class MmcifParser {
37667
37902
  });
37668
37903
  }
37669
37904
 
37905
+ parseMmcifData(data, mmcifid, command) { let ic = this.icn3d, me = ic.icn3dui;
37906
+ let thisClass = this;
37907
+
37908
+ let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
37909
+ $.ajax({
37910
+ url: url,
37911
+ type: 'POST',
37912
+ data : {'mmciffile': data},
37913
+ dataType: 'jsonp',
37914
+ cache: true,
37915
+ tryCount : 0,
37916
+ retryLimit : 0, //1
37917
+ beforeSend: function() {
37918
+ ic.ParserUtilsCls.showLoading();
37919
+ },
37920
+ complete: function() {
37921
+ //ic.ParserUtilsCls.hideLoading();
37922
+ },
37923
+ success: function(data) {
37924
+ thisClass.loadMmcifData(data, mmcifid);
37925
+ if(command) ic.loadScriptCls.loadScript(command);
37926
+ },
37927
+ error : function(xhr, textStatus, errorThrown ) {
37928
+ this.tryCount++;
37929
+ if(this.tryCount <= this.retryLimit) {
37930
+ //try again
37931
+ $.ajax(this);
37932
+ return;
37933
+ }
37934
+ return;
37935
+ }
37936
+ });
37937
+ }
37938
+
37670
37939
  downloadMmcifSymmetry(mmcifid, type) { let ic = this.icn3d; ic.icn3dui;
37671
37940
  let thisClass = this;
37672
37941
 
@@ -38209,6 +38478,7 @@ class HlSeq {
38209
38478
 
38210
38479
  if($(that).hasClass('icn3d-seqTitle')) {
38211
38480
  let chainid = $(that).attr('chain');
38481
+ let resn = $(that).attr('resn');
38212
38482
 
38213
38483
  if(ic.bAlignSeq) {
38214
38484
  ic.bSelectAlignResidue = false;
@@ -38233,20 +38503,24 @@ class HlSeq {
38233
38503
  }
38234
38504
 
38235
38505
  $(that).toggleClass('icn3d-highlightSeq');
38236
-
38237
38506
  let commandname, commanddescr, position;
38238
- if(!ic.bAnnotations) {
38239
- if(ic.bAlignSeq) {
38240
- commandname = "align_" + chainid;
38507
+ if(resn) {
38508
+ commandname = resn;
38509
+ }
38510
+ else {
38511
+ if(!ic.bAnnotations) {
38512
+ if(ic.bAlignSeq) {
38513
+ commandname = "align_" + chainid;
38514
+ }
38515
+ else {
38516
+ commandname = chainid;
38517
+ }
38241
38518
  }
38242
38519
  else {
38243
- commandname = chainid;
38520
+ commandname = $(that).attr('setname');
38521
+ commanddescr = $(that).attr('title');
38244
38522
  }
38245
38523
  }
38246
- else {
38247
- commandname = $(that).attr('setname');
38248
- commanddescr = $(that).attr('title');
38249
- }
38250
38524
 
38251
38525
  if($(that).hasClass('icn3d-highlightSeq')) {
38252
38526
  if(!ic.bAnnotations) {
@@ -38256,14 +38530,13 @@ class HlSeq {
38256
38530
  }
38257
38531
  else {
38258
38532
  ic.currSelectedSets = [commandname];
38259
- //ic.selectionCls.selectAChain(chainid, commandname, true);
38260
38533
  ic.selectionCls.selectAChain(chainid, commandname, ic.bAlignSeq);
38261
38534
  }
38262
38535
 
38263
38536
  if(ic.bAlignSeq) {
38264
38537
  me.htmlCls.clickMenuCls.setLogCmd('select alignChain ' + chainid, true);
38265
38538
  }
38266
- else {
38539
+ else {
38267
38540
  me.htmlCls.clickMenuCls.setLogCmd('select chain ' + chainid, true);
38268
38541
  }
38269
38542
 
@@ -38278,14 +38551,35 @@ class HlSeq {
38278
38551
  if($(that).attr('gi') !== undefined) {
38279
38552
  if(ic.bCtrl || ic.bShift) {
38280
38553
  ic.currSelectedSets.push(chainid);
38281
- ic.selectionCls.selectAChain(chainid, chainid, false, true);
38554
+ if(resn) {
38555
+ let prevHAtoms = me.hashUtilsCls.cloneHash(ic.hAtoms);
38556
+ let bNoUpdateAll = true;
38557
+ ic.selByCommCls.selectBySpec('select :3' + resn, commandname, commandname, false, bNoUpdateAll);
38558
+ ic.hAtoms = me.hashUtilsCls.unionHash(ic.hAtoms, prevHAtoms);
38559
+ ic.hlUpdateCls.updateHlAll(resn, undefined, true, true);
38560
+ }
38561
+ else {
38562
+ ic.selectionCls.selectAChain(chainid, chainid, false, true);
38563
+ }
38282
38564
  }
38283
38565
  else {
38284
38566
  ic.currSelectedSets = [chainid];
38285
- ic.selectionCls.selectAChain(chainid, chainid, false);
38567
+ if(resn) {
38568
+ let bNoUpdateAll = true;
38569
+ ic.selByCommCls.selectBySpec('select :3' + resn, commandname, commandname, false, bNoUpdateAll);
38570
+ ic.hlUpdateCls.updateHlAll(resn, undefined, true, true);
38571
+ }
38572
+ else {
38573
+ ic.selectionCls.selectAChain(chainid, chainid, false);
38574
+ }
38286
38575
  }
38287
38576
 
38288
- me.htmlCls.clickMenuCls.setLogCmd('select chain ' + chainid, true);
38577
+ if(resn) {
38578
+ me.htmlCls.clickMenuCls.setLogCmd('select :3' + resn, true);
38579
+ }
38580
+ else {
38581
+ me.htmlCls.clickMenuCls.setLogCmd('select chain ' + chainid, true);
38582
+ }
38289
38583
 
38290
38584
  let setNames = ic.currSelectedSets.join(' or ');
38291
38585
  //if(ic.currSelectedSets.length > 1) me.htmlCls.clickMenuCls.setLogCmd('select saved atoms ' + setNames, true);
@@ -38500,8 +38794,7 @@ class ShowAnno {
38500
38794
  }
38501
38795
 
38502
38796
  //show annotations such as SNPs, ClinVar, domains, binding sites, etc.
38503
- showAnnotations() { let ic = this.icn3d, me = ic.icn3dui;
38504
- let thisClass = this;
38797
+ showAnnotations_part1() { let ic = this.icn3d, me = ic.icn3dui;
38505
38798
  me.htmlCls.dialogCls.openDlg('dl_selectannotations', 'Sequences and Annotations');
38506
38799
  // add note about assembly
38507
38800
  if((ic.bAssemblyNote === undefined || !ic.bAssemblyNote) && ic.asuCnt !== undefined ) {
@@ -38523,6 +38816,9 @@ class ShowAnno {
38523
38816
  ic.annotationCls.setAnnoView('overview');
38524
38817
  }
38525
38818
 
38819
+ let nucleotide_chainid = {}, chemical_chainid = {}, chemical_set = {};
38820
+ ic.protein_chainid = {};
38821
+
38526
38822
  if(ic.bAnnoShown === undefined || !ic.bAnnoShown || ic.bResetAnno) { // ic.bResetAnno when loading another structure
38527
38823
  let chainArray = Object.keys(ic.chains);
38528
38824
 
@@ -38531,7 +38827,13 @@ class ShowAnno {
38531
38827
  if(ic.resi2disease_nonempty === undefined) ic.resi2disease_nonempty = {};
38532
38828
  if(ic.baseResi === undefined) ic.baseResi = {};
38533
38829
  if(ic.matchedPos === undefined) ic.matchedPos = {};
38534
- let dialogWidth =(me.cfg.notebook) ? me.htmlCls.WIDTH / 2 : $("#" + ic.pre + "dl_selectannotations").dialog( "option", "width" );
38830
+ let dialogWidth;
38831
+ if(me.bNode) { // no $().dialog
38832
+ dialogWidth = 500;
38833
+ }
38834
+ else {
38835
+ dialogWidth =(me.cfg.notebook) ? me.htmlCls.WIDTH / 2 : $("#" + ic.pre + "dl_selectannotations").dialog( "option", "width" );
38836
+ }
38535
38837
  ic.seqAnnWidth = dialogWidth - 120 - 30*2 - 50; // title: 120px, start and end resi: 30px, extra space on the left and right: 50px
38536
38838
  ic.maxAnnoLength = 1;
38537
38839
  for(let chainid in ic.chainsSeq) {
@@ -38539,8 +38841,7 @@ class ShowAnno {
38539
38841
  ic.maxAnnoLength = ic.chainsSeq[chainid].length;
38540
38842
  }
38541
38843
  }
38542
- let nucleotide_chainid = {}, chemical_chainid = {}, chemical_set = {};
38543
- ic.protein_chainid = {};
38844
+
38544
38845
  for(let i = 0, il = chainArray.length; i < il; ++i) {
38545
38846
  Math.round(chainArray[i].indexOf('_'));
38546
38847
  //if(pos > 4) continue; // NMR structures with structure id such as 2K042,2K043, ...
@@ -38598,7 +38899,21 @@ class ShowAnno {
38598
38899
  } // for(let r = 0
38599
38900
  } // if(me.cfg.mmdbid
38600
38901
  } // for(let i = 0
38902
+ }
38903
+
38904
+ return {'nucleotide_chainid': nucleotide_chainid, 'chemical_chainid': chemical_chainid, 'chemical_set': chemical_set};
38905
+ }
38601
38906
 
38907
+ showAnnotations() { let ic = this.icn3d, me = ic.icn3dui;
38908
+ let thisClass = this;
38909
+
38910
+ let result = this.showAnnotations_part1();
38911
+
38912
+ let nucleotide_chainid = result.nucleotide_chainid;
38913
+ let chemical_chainid = result.chemical_chainid;
38914
+ let chemical_set = result.chemical_set;
38915
+
38916
+ if(ic.bAnnoShown === undefined || !ic.bAnnoShown || ic.bResetAnno) { // ic.bResetAnno when loading another structure
38602
38917
  if(me.cfg.blast_rep_id === undefined) {
38603
38918
  if(ic.bFullUi) {
38604
38919
  if(me.cfg.mmtfid !== undefined) { // mmtf data do NOT have the missing residues
@@ -38714,8 +39029,10 @@ class ShowAnno {
38714
39029
  }
38715
39030
  ic.bAnnoShown = true;
38716
39031
  }
39032
+
38717
39033
  showAnnoSeqData(nucleotide_chainid, chemical_chainid, chemical_set) { let ic = this.icn3d, me = ic.icn3dui;
38718
- this.getAnnotationData();
39034
+ if(!me.bNode) this.getAnnotationData();
39035
+
38719
39036
  let i = 0;
38720
39037
  for(let chain in nucleotide_chainid) {
38721
39038
  this.getSequenceData(chain, nucleotide_chainid[chain], 'nucleotide', i);
@@ -38738,12 +39055,15 @@ class ShowAnno {
38738
39055
  this.getCombinedSequenceData(name, chemical_set[name], i);
38739
39056
  ++i;
38740
39057
  }
38741
- this.enableHlSeq();
38742
39058
 
38743
- setTimeout(function(){
38744
- ic.annotationCls.hideAllAnno();
38745
- ic.annotationCls.clickCdd();
38746
- }, 0);
39059
+ if(!me.bNode) {
39060
+ this.enableHlSeq();
39061
+
39062
+ setTimeout(function(){
39063
+ ic.annotationCls.hideAllAnno();
39064
+ ic.annotationCls.clickCdd();
39065
+ }, 0);
39066
+ }
38747
39067
  }
38748
39068
 
38749
39069
  getAnnotationData() { let ic = this.icn3d, me = ic.icn3dui;
@@ -38780,15 +39100,17 @@ class ShowAnno {
38780
39100
  $("#" + ic.pre + "anno_" + chnid).append("<br><hr><br>");
38781
39101
  ++index;
38782
39102
  }
38783
- ic.annoCddSiteCls.setToolTip();
39103
+
39104
+ if(!me.bNode) ic.annoCddSiteCls.setToolTip();
39105
+
38784
39106
  // show the sequence and 3D structure
38785
39107
  //var url = "https://eme.utilsCls.ncbi.nlm.nih.gov/entrez/eUtilsCls/efetch.fcgi?db=protein&retmode=json&rettype=fasta&id=" + chnidBaseArray;
38786
39108
  let url = me.htmlCls.baseUrl + "/vastdyn/vastdyn.cgi?chainlist=" + chnidBaseArray;
38787
39109
 
38788
- if(ic.chainid_seq !== undefined) {
39110
+ if(ic.chainid_seq !== undefined) {
38789
39111
  this.processSeqData(ic.chainid_seq);
38790
39112
  }
38791
- else {
39113
+ else {
38792
39114
  $.ajax({
38793
39115
  url: url,
38794
39116
  dataType: 'jsonp', //'text',
@@ -38807,7 +39129,7 @@ class ShowAnno {
38807
39129
  return;
38808
39130
  }
38809
39131
  thisClass.enableHlSeq();
38810
- console.log( "No data were found for the protein " + chnidBaseArray + "..." );
39132
+ if(!me.bNode) console.log( "No data were found for the protein " + chnidBaseArray + "..." );
38811
39133
  for(let chnid in ic.protein_chainid) {
38812
39134
  let chnidBase = ic.protein_chainid[chnid];
38813
39135
  ic.showSeqCls.setAlternativeSeq(chnid, chnidBase);
@@ -38863,7 +39185,7 @@ class ShowAnno {
38863
39185
  let firstChainid = residArray[0].substr(0, pos);
38864
39186
  let sid =(me.cfg.mmdbid !== undefined && ic.chainid2sid !== undefined) ? ic.chainid2sid[firstChainid] : undefined;
38865
39187
  if(sid !== undefined) {
38866
- chemName = "<b><a class='icn3d-blue' href='https://pubchem.ncbi.nlm.nih.gov/substance/" + sid + "#section=2D-Structure' target='_blank'>" + name + " <img src='https://pubchem.ncbi.nlm.nih.gov/image/imgsrv.fcgi?sid=" + sid + "'></a></b>";
39188
+ chemName = "<b>" + name + " <a class='icn3d-blue' href='https://pubchem.ncbi.nlm.nih.gov/substance/" + sid + "#section=2D-Structure' target='_blank'><img src='https://pubchem.ncbi.nlm.nih.gov/image/imgsrv.fcgi?sid=" + sid + "'></a></b>";
38867
39189
  }
38868
39190
  else {
38869
39191
  chemName = "<b>" + name + "</b>";
@@ -38875,7 +39197,8 @@ class ShowAnno {
38875
39197
  // sequence, detailed view
38876
39198
  let htmlTmp = '<div id="' + ic.pre + 'giseq_sequence" class="icn3d-dl_sequence">';
38877
39199
  let chainType = 'Chem.', chainTypeFull = 'Chemical';
38878
- htmlTmp += '<div class="icn3d-seqTitle2" anno="sequence"><span style="white-space:nowrap;" title="' + chainTypeFull + ' ' + name + '">' + chainType + ' ' + name + '</span></div>';
39200
+ //htmlTmp += '<div class="icn3d-seqTitle2" anno="sequence"><span style="white-space:nowrap;" title="' + chainTypeFull + ' ' + name + '">' + chainType + ' ' + name + '</span></div>';
39201
+ htmlTmp += '<div class="icn3d-seqTitle icn3d-link icn3d-blue" anno="sequence" gi="' + name + '" resn="' + name + '"><span style="white-space:nowrap;" title="' + chainTypeFull + ' ' + name + '">' + chainType + ' ' + name + '</span></div>';
38879
39202
  htmlTmp += '<span class="icn3d-residueNum" style="width:60px!important;" title="starting protein sequence number">Count: ' + residArray.length + '</span>';
38880
39203
  htmlTmp += '<span class="icn3d-seqLine">';
38881
39204
  // sequence, overview
@@ -38932,7 +39255,7 @@ class ShowAnno {
38932
39255
  }
38933
39256
  }
38934
39257
  else {
38935
- console.log( "No data were found for the protein " + chnid + "..." );
39258
+ if(!me.bNode) console.log( "No data were found for the protein " + chnid + "..." );
38936
39259
  ic.showSeqCls.setAlternativeSeq(chnid, chnidBase);
38937
39260
  }
38938
39261
  if(me.cfg.blast_rep_id != chnid) {
@@ -39121,9 +39444,12 @@ class ShowAnno {
39121
39444
  ic.hAtoms = me.hashUtilsCls.cloneHash(prevHAtoms);
39122
39445
  } // align seq to structure
39123
39446
  } // for loop
39124
- this.enableHlSeq();
39125
- // get CDD/Binding sites
39126
- ic.annoCddSiteCls.showCddSiteAll();
39447
+
39448
+ if(!me.bNode) {
39449
+ this.enableHlSeq();
39450
+ // get CDD/Binding sites
39451
+ ic.annoCddSiteCls.showCddSiteAll();
39452
+ }
39127
39453
  }
39128
39454
 
39129
39455
  enableHlSeq() { let ic = this.icn3d, me = ic.icn3dui;
@@ -39216,6 +39542,10 @@ class AnnoContact {
39216
39542
  }
39217
39543
  }
39218
39544
  showInteraction_base(chnid, chnidBase) { let ic = this.icn3d, me = ic.icn3dui;
39545
+ if(me.bNode) {
39546
+ if(!ic.resid2contact) ic.resid2contact = {};
39547
+ if(!ic.resid2contact[chnid]) ic.resid2contact[chnid] = [];
39548
+ }
39219
39549
  // set interaction
39220
39550
  if(ic.chainname2residues === undefined) ic.chainname2residues = {};
39221
39551
  let radius = 4;
@@ -39325,6 +39655,12 @@ class AnnoContact {
39325
39655
  // let pos = ic.chainsSeq[chnid][i - ic.matchedPos[chnid] ].resi;
39326
39656
  let pos =(i >= ic.matchedPos[chnid] && i - ic.matchedPos[chnid] < ic.chainsSeq[chnid].length) ? ic.chainsSeq[chnid][i - ic.matchedPos[chnid]].resi : ic.baseResi[chnid] + 1 + i;
39327
39657
  html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" title="' + cFull + pos + '" class="icn3d-residue">' + c + '</span>';
39658
+ if(me.bNode) {
39659
+ let obj = {};
39660
+ obj[chnid + '_' + pos] = fulltitle;
39661
+ ic.resid2contact[chnid].push(obj);
39662
+ }
39663
+
39328
39664
  html2 += ic.showSeqCls.insertGapOverview(chnid, i);
39329
39665
  let emptyWidth =(me.cfg.blast_rep_id == chnid) ? Math.round(ic.seqAnnWidth * i /(ic.maxAnnoLength + ic.nTotalGap) - prevEmptyWidth - prevLineWidth) : Math.round(ic.seqAnnWidth * i / ic.maxAnnoLength - prevEmptyWidth - prevLineWidth);
39330
39666
  //if(emptyWidth < 0) emptyWidth = 0;
@@ -39385,11 +39721,17 @@ class AnnoCrossLink {
39385
39721
  this.showCrosslink_base(chnid, chnidBase);
39386
39722
  }
39387
39723
  }
39388
- showCrosslink_base(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
39724
+ showCrosslink_base(chnid, chnidBase) { let ic = this.icn3d, me = ic.icn3dui;
39725
+ if(me.bNode) {
39726
+ if(!ic.resid2crosslink) ic.resid2crosslink = {};
39727
+ if(!ic.resid2crosslink[chnid]) ic.resid2crosslink[chnid] = [];
39728
+ }
39729
+
39389
39730
  let chainid = chnidBase;
39390
39731
  let resid2resids = {};
39391
39732
  let structure = chainid.substr(0, chainid.indexOf('_'));
39392
39733
  let clbondArray = ic.clbondpnts[structure];
39734
+
39393
39735
  if(clbondArray === undefined) {
39394
39736
  $("#" + ic.pre + "dt_crosslink_" + chnid).html('');
39395
39737
  $("#" + ic.pre + "ov_crosslink_" + chnid).html('');
@@ -39426,16 +39768,16 @@ class AnnoDomain {
39426
39768
  this.icn3d = icn3d;
39427
39769
  }
39428
39770
 
39429
- showDomainPerStructure(index) { let ic = this.icn3d, me = ic.icn3dui;
39771
+ showDomainPerStructure(index) { let ic = this.icn3d; ic.icn3dui;
39430
39772
  let thisClass = this;
39431
39773
  //var chnid = Object.keys(ic.protein_chainid)[0];
39432
39774
  //var pdbid = chnid.substr(0, chnid.indexOf('_'));
39433
39775
  let pdbArray = Object.keys(ic.structures);
39434
39776
  // show 3D domains
39435
39777
  let pdbid = pdbArray[index];
39436
- me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&domain&molinfor&uid=" + pdbid;
39778
+ //let url = me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&domain&molinfor&uid=" + pdbid;
39437
39779
 
39438
- if(index == 0 && ic.mmdb_data !== undefined) {
39780
+ if(index == 0 && ic.mmdb_data !== undefined) {
39439
39781
  for(let chnid in ic.protein_chainid) {
39440
39782
  if(chnid.indexOf(pdbid) !== -1) {
39441
39783
  this.showDomainWithData(chnid, ic.mmdb_data);
@@ -39449,7 +39791,7 @@ class AnnoDomain {
39449
39791
  }
39450
39792
  }
39451
39793
  }
39452
- else {
39794
+ else {
39453
39795
  // calculate 3D domains on-the-fly
39454
39796
  //ic.protein_chainid[chainArray[i]]
39455
39797
  let data = {};
@@ -39506,6 +39848,7 @@ class AnnoDomain {
39506
39848
  for(let i = 0, il = pdbArray.length; i < il; ++i) {
39507
39849
  ic.bAjaxDoneArray[i] = false;
39508
39850
  }
39851
+
39509
39852
  for(let i = 0, il = pdbArray.length; i < il; ++i) {
39510
39853
  this.showDomainPerStructure(i);
39511
39854
  }
@@ -39550,6 +39893,7 @@ class AnnoDomain {
39550
39893
  let fromArray = [], toArray = [];
39551
39894
  let resiHash = {};
39552
39895
  let resCnt = 0;
39896
+
39553
39897
  for(let i = 0, il = subdomainArray.length; i < il; ++i) {
39554
39898
  let domainFrom = Math.round(subdomainArray[i][0]) - 1; // convert 1-based to 0-based
39555
39899
  let domainTo = Math.round(subdomainArray[i][1]) - 1;
@@ -39576,6 +39920,25 @@ class AnnoDomain {
39576
39920
  resiHash[j+1] = 1;
39577
39921
  }
39578
39922
  }
39923
+
39924
+ // save 3D domain info for node.js script
39925
+ if(me.bNode) {
39926
+ let domainName = '3D domain ' +(index+1).toString();
39927
+
39928
+ if(!ic.resid2domain) ic.resid2domain = {};
39929
+ if(!ic.resid2domain[chnid]) ic.resid2domain[chnid] = [];
39930
+ for(let i = 0, il = fromArray.length; i < il; ++i) {
39931
+ let from = fromArray[i];
39932
+ let to = toArray[i];
39933
+ for(let j = from; j <= to; ++j) {
39934
+ // 0-based
39935
+ let obj = {};
39936
+ obj[chnid + '_' + (j+1).toString()] = domainName;
39937
+ ic.resid2domain[chnid].push(obj);
39938
+ }
39939
+ }
39940
+ }
39941
+
39579
39942
  let htmlTmp2 = '<div class="icn3d-seqTitle icn3d-link icn3d-blue" 3ddomain="' +(index+1).toString() + '" from="' + fromArray + '" to="' + toArray + '" shorttitle="' + title + '" index="' + index + '" setname="' + chnid + '_3d_domain_' +(index+1).toString() + '" anno="sequence" chain="' + chnid + '" title="' + fulltitle + '">' + title + ' </div>';
39580
39943
  let htmlTmp3 = '<span class="icn3d-residueNum" title="residue count">' + resCnt.toString() + ' Res</span>';
39581
39944
  html3 += htmlTmp2 + htmlTmp3 + '<br>';
@@ -39655,6 +40018,59 @@ class AnnoSnpClinVar {
39655
40018
  this.icn3d = icn3d;
39656
40019
  }
39657
40020
 
40021
+ showSnp(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
40022
+ this.showSnpClinvar(chnid, chnidBase, true);
40023
+ }
40024
+ showClinvar(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
40025
+ this.showSnpClinvar(chnid, chnidBase, false);
40026
+ }
40027
+
40028
+ //Show the annotations of SNPs and ClinVar.
40029
+ showSnpClinvar(chnid, chnidBase, bSnpOnly) { let ic = this.icn3d, me = ic.icn3dui;
40030
+ let thisClass = this;
40031
+
40032
+ // get gi from acc
40033
+ //var url2 = "https://www.ncbi.nlm.nih.gov/Structure/icn3d/chainid2repgi.txt";
40034
+ let url2 = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid=" + chnidBase;
40035
+ $.ajax({
40036
+ url: url2,
40037
+ dataType: 'jsonp', //'text',
40038
+ cache: true,
40039
+ tryCount : 0,
40040
+ retryLimit : 0, //1
40041
+ success: function(data2) {
40042
+ //ic.chainid2repgi = JSON.parse(data2);
40043
+ //var gi = ic.chainid2repgi[chnidBase];
40044
+ let snpgi = data2.snpgi;
40045
+ let gi = data2.gi;
40046
+ if(bSnpOnly) {
40047
+ thisClass.showSnpPart2(chnid, chnidBase, snpgi);
40048
+ }
40049
+ else {
40050
+ let specialGiArray = [6137708,1942289,224510717,2624886,253723219,2554905,75765331,3660278,312207882,319443632,342350956,1827805,109157826,1065265,40889086,6730307,163931185,494469,163931091,60594093,55669745,18655489,17942684,6980537,166235465,6435586,4139398,4389047,364506122,78101667,262118402,20664221,2624640,158430173,494395,28948777,34810587,13399647,3660342,261278854,342350965,384482350,378792570,15988303,213424334,4558333,2098365,10835631,3318817,374074330,332639529,122919696,4389286,319443573,2781341,67464020,194709238,210061039,364506106,28949044,40889076,161172338,17943181,4557976,62738484,365813173,6137343,350610552,17942703,576308,223674070,15826518,1310997,93279697,4139395,255311799,157837067,361132363,357380836,146387678,383280379,1127268,299856826,13786789,1311054,46015217,3402130,381353319,30750059,218766885,340707375,27065817,355333104,2624634,62738384,241913553,304446010];
40051
+ let giUsed = snpgi;
40052
+ if(specialGiArray.includes(gi)) giUsed = gi;
40053
+ thisClass.showClinvarPart2(chnid, chnidBase, giUsed);
40054
+ }
40055
+ },
40056
+ error : function(xhr, textStatus, errorThrown ) {
40057
+ this.tryCount++;
40058
+ if(this.tryCount <= this.retryLimit) {
40059
+ //try again
40060
+ $.ajax(this);
40061
+ return;
40062
+ }
40063
+ if(bSnpOnly) {
40064
+ thisClass.processNoSnp(chnid);
40065
+ }
40066
+ else {
40067
+ thisClass.processNoClinvar(chnid);
40068
+ }
40069
+ return;
40070
+ }
40071
+ });
40072
+ }
40073
+
39658
40074
  navClinVar(chnid) { let ic = this.icn3d; ic.icn3dui;
39659
40075
  let thisClass = this;
39660
40076
  ic.currClin[chnid] = - 1;
@@ -40090,7 +40506,7 @@ class AnnoSnpClinVar {
40090
40506
 
40091
40507
  return html;
40092
40508
  }
40093
- processSnpClinvar(data, chnid, chnidBase, bSnpOnly, bVirus) { let ic = this.icn3d; ic.icn3dui;
40509
+ processSnpClinvar(data, chnid, chnidBase, bSnpOnly, bVirus) { let ic = this.icn3d, me = ic.icn3dui;
40094
40510
  let html = '<div id="' + ic.pre + chnid + '_snpseq_sequence" class="icn3d-dl_sequence">';
40095
40511
  let html2 = html;
40096
40512
  let html3 = html;
@@ -40107,6 +40523,16 @@ class AnnoSnpClinVar {
40107
40523
  let resi2clinAllele = {};
40108
40524
  let posHash = {}, posClinHash = {};
40109
40525
  let prevSnpStr = '';
40526
+ if(me.bNode) {
40527
+ if(bSnpOnly) {
40528
+ if(!ic.resid2snp) ic.resid2snp = {};
40529
+ if(!ic.resid2snp[chnid]) ic.resid2snp[chnid] = [];
40530
+ }
40531
+ else {
40532
+ if(!ic.resid2clinvar) ic.resid2clinvar = {};
40533
+ if(!ic.resid2clinvar[chnid]) ic.resid2clinvar[chnid] = [];
40534
+ }
40535
+ }
40110
40536
  for(let i = 0, il = lineArray.length; i < il; ++i) {
40111
40537
  //bSnpOnly: false
40112
40538
  //1310770 13 14 14Y>H 368771578 150500 Hereditary cancer-predisposing syndrome; Li-Fraumeni syndrome; not specified; Li-Fraumeni syndrome 1 Likely benign; Uncertain significance; Uncertain significance; Uncertain significance 1TSR_A 120407068 NP_000537.3
@@ -40120,6 +40546,19 @@ class AnnoSnpClinVar {
40120
40546
  prevSnpStr = snpStr;
40121
40547
  let resiStr = snpStr.substr(0, snpStr.length - 3);
40122
40548
  let resi = Math.round(resiStr);
40549
+
40550
+ if(me.bNode) {
40551
+ let obj = {};
40552
+ obj[chnid + '_' + resi] = snpStr;
40553
+
40554
+ if(bSnpOnly) {
40555
+ ic.resid2snp[chnid].push(obj);
40556
+ }
40557
+ else {
40558
+ ic.resid2clinvar[chnid].push(obj);
40559
+ }
40560
+ }
40561
+
40123
40562
  snpStr.substr(snpStr.length - 3, 1);
40124
40563
  let snpRes = snpStr.substr(snpStr.indexOf('>') + 1); //snpStr.substr(snpStr.length - 1, 1);
40125
40564
  //var rsnum = bSnpOnly ? '' : fieldArray[4];
@@ -40247,58 +40686,7 @@ class AnnoSnpClinVar {
40247
40686
  }
40248
40687
  });
40249
40688
  }
40250
- showSnp(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
40251
- this.showSnpClinvar(chnid, chnidBase, true);
40252
- }
40253
- showClinvar(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
40254
- this.showSnpClinvar(chnid, chnidBase, false);
40255
- }
40256
-
40257
- //Show the annotations of SNPs and ClinVar.
40258
- showSnpClinvar(chnid, chnidBase, bSnpOnly) { let ic = this.icn3d, me = ic.icn3dui;
40259
- let thisClass = this;
40260
40689
 
40261
- // get gi from acc
40262
- //var url2 = "https://www.ncbi.nlm.nih.gov/Structure/icn3d/chainid2repgi.txt";
40263
- let url2 = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid=" + chnidBase;
40264
- $.ajax({
40265
- url: url2,
40266
- dataType: 'jsonp', //'text',
40267
- cache: true,
40268
- tryCount : 0,
40269
- retryLimit : 0, //1
40270
- success: function(data2) {
40271
- //ic.chainid2repgi = JSON.parse(data2);
40272
- //var gi = ic.chainid2repgi[chnidBase];
40273
- let snpgi = data2.snpgi;
40274
- let gi = data2.gi;
40275
- if(bSnpOnly) {
40276
- thisClass.showSnpPart2(chnid, chnidBase, snpgi);
40277
- }
40278
- else {
40279
- let specialGiArray = [6137708,1942289,224510717,2624886,253723219,2554905,75765331,3660278,312207882,319443632,342350956,1827805,109157826,1065265,40889086,6730307,163931185,494469,163931091,60594093,55669745,18655489,17942684,6980537,166235465,6435586,4139398,4389047,364506122,78101667,262118402,20664221,2624640,158430173,494395,28948777,34810587,13399647,3660342,261278854,342350965,384482350,378792570,15988303,213424334,4558333,2098365,10835631,3318817,374074330,332639529,122919696,4389286,319443573,2781341,67464020,194709238,210061039,364506106,28949044,40889076,161172338,17943181,4557976,62738484,365813173,6137343,350610552,17942703,576308,223674070,15826518,1310997,93279697,4139395,255311799,157837067,361132363,357380836,146387678,383280379,1127268,299856826,13786789,1311054,46015217,3402130,381353319,30750059,218766885,340707375,27065817,355333104,2624634,62738384,241913553,304446010];
40280
- let giUsed = snpgi;
40281
- if(specialGiArray.includes(gi)) giUsed = gi;
40282
- thisClass.showClinvarPart2(chnid, chnidBase, giUsed);
40283
- }
40284
- },
40285
- error : function(xhr, textStatus, errorThrown ) {
40286
- this.tryCount++;
40287
- if(this.tryCount <= this.retryLimit) {
40288
- //try again
40289
- $.ajax(this);
40290
- return;
40291
- }
40292
- if(bSnpOnly) {
40293
- thisClass.processNoSnp(chnid);
40294
- }
40295
- else {
40296
- thisClass.processNoClinvar(chnid);
40297
- }
40298
- return;
40299
- }
40300
- });
40301
- }
40302
40690
  showSnpPart2(chnid, chnidBase, gi) { let ic = this.icn3d; ic.icn3dui;
40303
40691
  let thisClass = this;
40304
40692
  if(gi !== undefined) {
@@ -43944,14 +44332,13 @@ class Label {
43944
44332
  }
43945
44333
  else {
43946
44334
  let factor = (label.factor) ? oriFactor * label.factor : oriFactor;
43947
-
43948
44335
  bb = this.textSpriteCls.makeTextSprite(label.text, {fontsize: parseInt(labelsize), textColor: labelcolor, borderColor: labelbackground, backgroundColor: labelbackground, alpha: labelalpha, bSchematic: 0, factor: factor});
43949
44336
  }
43950
44337
  }
43951
44338
 
43952
44339
  let labelOffset = (name == 'schematic' || name == 'residue') ? 0 : ic.coilWidth; // 0.3
43953
- bb.position.set(label.position.x + labelOffset, label.position.y + labelOffset, label.position.z + labelOffset);
43954
- ic.mdl.add(bb);
44340
+ bb.position.set(parseFloat(label.position.x) + labelOffset, parseFloat(label.position.y) + labelOffset, parseFloat(label.position.z) + labelOffset);
44341
+ ic.mdl.add(bb);
43955
44342
  // do not add labels to objects for pk
43956
44343
  }
43957
44344
  }
@@ -56245,10 +56632,10 @@ class SetMenu {
56245
56632
  return "<div style='margin:3px 0px 0px 10px;'><button style='-webkit-appearance:" + buttonStyle + "; height:36px;" + bkgdColor + "' id='" + me.pre + id + "'><span style='white-space:nowrap;" + color + "' class='icn3d-commandTitle' title='" + title + "'>" + text + "</span></button></div>";
56246
56633
  }
56247
56634
 
56248
- setIcon(iconType, id, title, iconStyle, url, bText) { let me = this.icn3dui;
56635
+ setIcon(iconType, id, title, iconStyle, url, bText, bHighlight) { let me = this.icn3dui;
56249
56636
  if(me.bNode) return '';
56250
56637
 
56251
- let color = 'color:#1c94c4; ';
56638
+ let color = (bHighlight) ? 'color:#f8b84e; ' : 'color:#1c94c4; ';
56252
56639
  let bkgdColor = ' background-color:#EEE; ';
56253
56640
  let cssCursor = (iconType == 'text') ? '' : 'cursor:pointer;';
56254
56641
 
@@ -56295,7 +56682,7 @@ class SetMenu {
56295
56682
  // View menu
56296
56683
  html += tdStrBorder + this.setIcon(iconType, 'show_selected', 'View Selection', 'eye') + "</td>";
56297
56684
  html += tdStr + this.setIcon(iconType, 'tool_selectedcenter', 'Zoom in Selection', 'search-plus') + "</td>";
56298
- html += tdStr + this.setIcon(iconType, 'alternate', "Alternate the Structures by keying the letter 'a'", 'a', undefined, true) + "</td>";
56685
+ html += tdStr + this.setIcon(iconType, 'alternate', "Alternate the Structures by keying the letter 'a'", 'a', undefined, true, true) + "</td>";
56299
56686
  html += tdStr + this.setIcon(iconType, 'tool_resetOrientation', 'Reset Orientation', 'undo-alt') + "</td>";
56300
56687
 
56301
56688
  // Style menu
@@ -56509,7 +56896,9 @@ class SetMenu {
56509
56896
 
56510
56897
  html += "<li id='" + me.pre + "mn2_realignWrap'><span>Realign Selection</span>";
56511
56898
  html += "<ul>";
56512
- html += me.htmlCls.setHtmlCls.getRadio('mn2_realign', 'mn2_realignonstruct', 'by Structure Alignment ' + me.htmlCls.wifiStr, true);
56899
+
56900
+ html += me.htmlCls.setHtmlCls.getRadio('mn2_realign', 'mn2_realignonstruct', 'by Structure Alignment ' + me.htmlCls.wifiStr);
56901
+
56513
56902
  html += me.htmlCls.setHtmlCls.getRadio('mn2_realign', 'mn2_realignonseqalign', 'by Sequence Alignment ' + me.htmlCls.wifiStr);
56514
56903
  html += me.htmlCls.setHtmlCls.getRadio('mn2_realign', 'mn2_realignresbyres', 'Residue by Residue');
56515
56904
  html += "</ul>";
@@ -58293,10 +58682,10 @@ class Dialog {
58293
58682
  height = 500;
58294
58683
  }
58295
58684
  else if(id === me.pre + 'dl_rmsd') {
58296
- position ={ my: "right top", at: "right top", of: "#" + me.pre + "canvas", collision: "none" };
58685
+ position ={ my: "left bottom", at: "left+20 bottom-20", of: "#" + me.pre + "canvas", collision: "none" };
58297
58686
  }
58298
58687
  else if(id === me.pre + 'dl_legend') {
58299
- position ={ my: "right top", at: "right-20 top+60", of: "#" + me.pre + "canvas", collision: "none" };
58688
+ position ={ my: "left bottom", at: "left+20 bottom-20", of: "#" + me.pre + "canvas", collision: "none" };
58300
58689
  }
58301
58690
  else if(id === me.pre + 'dl_symd') {
58302
58691
  position ={ my: "left top", at: "right-200 bottom-200", of: "#" + me.pre + "canvas", collision: "none" };
@@ -58606,23 +58995,19 @@ class SetDialog {
58606
58995
 
58607
58996
  html += me.htmlCls.divStr + "dl_alignaf' class='" + dialogClass + "'>";
58608
58997
  html += "Enter two <a href='https://alphafold.ebi.ac.uk/' target='_blank'>AlphaFold Uniprot</a> IDs: <br/><br/>ID1: " + me.htmlCls.inputTextStr + "id='" + me.pre + "alignafid1' value='P41327' size=8>" + me.htmlCls.space3 + me.htmlCls.space3 + "ID2: " + me.htmlCls.inputTextStr + "id='" + me.pre + "alignafid2' value='P41331' size=8><br/><br/>";
58609
- html += me.htmlCls.buttonStr + "reload_alignaf'>Align</button>";
58998
+ html += me.htmlCls.buttonStr + "reload_alignaf_tmalign'>Align with TM-align</button>" + me.htmlCls.buttonStr + "reload_alignaf' style='margin-left:30px'>Align with VAST</button>";
58610
58999
  html += "</div>";
58611
59000
 
58612
59001
  html += me.htmlCls.divStr + "dl_chainalign' class='" + dialogClass + "'>";
58613
- /*
58614
- html += "Enter the PDB chain IDs in the form of pdbid_chain(e.g., 1HHO_A, case sensitive): <br/><br/>ID1: " + me.htmlCls.inputTextStr + "id='" + me.pre + "chainalignid1' value='1HHO_A' size=8>" + me.htmlCls.space3 + me.htmlCls.space3 + "ID2: " + me.htmlCls.inputTextStr + "id='" + me.pre + "chainalignid2' value='4N7N_A' size=8><br/><br/>";
58615
- html += me.htmlCls.buttonStr + "reload_chainalign'>Align</button><br/><br/>";
58616
- html += "<div style='width:450px'>(Note: To align chains in custom PDB files, you could concatenate PDB files in a single PDB file with the separation line \"ENDMDL\". Then load it in \"Open File > PDB File\" in the \"File\" menu and click \"View Sequences & Annotations\" in the \"Window\" menu. Finally select two chains in the sequence window and click \"Realign Selection\" in the \"File\" menu.)</div>";
58617
- html += "</div>";
58618
- */
58619
59002
  html += "<div style='width:550px'>";
58620
59003
  html += "All chains will be aligned to the first chain in the comma-separated chain IDs. Each chain ID has the form of PDBID_chain (e.g., 1HHO_A, case sensitive) or UniprotID (e.g., P69905 for AlphaFold structures).<br/><br/>";
58621
59004
  html += "<b>Chain IDs</b>: " + me.htmlCls.inputTextStr + "id='" + me.pre + "chainalignids' value='P69905,P01942,1HHO_A' size=50><br/><br/>";
58622
59005
  html += "<b>Optional 1</b>, full chains are used for structure alignment<br/><br/>";
58623
59006
  html += "<b>Optional 2</b>, sequence alignment (followed by structure alignemnt) based on residue numbers in the First/Master chain: <br>" + me.htmlCls.inputTextStr + "id='" + me.pre + "resalignids' placeholder='1,5,10-50' size=50><br/><br/>";
58624
59007
  html += "<b>Optional 3</b>, predefined alignment with the first chain as the master. The rest chains are aligned to the master chain. Each alignment is defined as \" | \"-separated residue lists in one line. \"10-50\" means a range of residues from 10 to 50.<br><textarea id='" + me.pre + "predefinedres' rows='5' style='width: 100%; height: " +(me.htmlCls.LOG_HEIGHT) + "px; padding: 0px; border: 0px;' placeholder='1,5,10-50 | 1,5,10-50 \n2,6,11-51 | 1,5,10-50'></textarea><br/><br/>";
58625
- html += me.htmlCls.buttonStr + "reload_chainalign_asym'>Align Asymmetric Unit</button>" + me.htmlCls.buttonStr + "reload_chainalign' style='margin-left:30px'>Align Biological Unit</button><br/><br/>";
59008
+ //html += me.htmlCls.buttonStr + "reload_chainalign_asym'>Align Asymmetric Unit</button>" + me.htmlCls.buttonStr + "reload_chainalign' style='margin-left:30px'>Align Biological Unit</button><br/><br/>";
59009
+ html += me.htmlCls.buttonStr + "reload_chainalign_tmalign'>Align with TM-align</button>" + me.htmlCls.buttonStr + "reload_chainalign_asym' style='margin-left:30px'>Align with VAST</button><br/><br/>";
59010
+
58626
59011
  html += "(Note: To align chains in custom PDB files, you could load them in \"File > Open File > PDB Files (appendable)\" and click \"Analysis > Defined Sets\". Finally select multiple chains in Defined Sets and click \"File > Realign Selection\".)<br><br>";
58627
59012
  html += "</div></div>";
58628
59013
 
@@ -58664,6 +59049,7 @@ class SetDialog {
58664
59049
  html += "File type: ";
58665
59050
  html += "<select id='" + me.pre + "filetype'>";
58666
59051
  html += me.htmlCls.optionStr + "'pdb' selected>PDB</option>";
59052
+ html += me.htmlCls.optionStr + "'mmcif'>mmCIF</option>";
58667
59053
  html += me.htmlCls.optionStr + "'mol2'>Mol2</option>";
58668
59054
  html += me.htmlCls.optionStr + "'sdf'>SDF</option>";
58669
59055
  html += me.htmlCls.optionStr + "'xyz'>XYZ</option>";
@@ -58967,7 +59353,7 @@ class SetDialog {
58967
59353
  html += "<div style='text-indent:1.1em'><select id='" + me.pre + "atomsCustomRealignByStruct' multiple size='5' style='min-width:130px;'>";
58968
59354
  html += "</select></div>";
58969
59355
 
58970
- html += "<div>2. " + me.htmlCls.buttonStr + "applyRealignByStruct'>Realign by Structure</button></div><br>";
59356
+ html += "<div>2. " + me.htmlCls.buttonStr + "applyRealignByStruct_tmalign'>Realign with TM-align</button>" + me.htmlCls.buttonStr + "applyRealignByStruct' style='margin-left:30px'>Realign with VAST</button></div><br>";
58971
59357
  html += "</div>";
58972
59358
 
58973
59359
 
@@ -59341,31 +59727,7 @@ class SetDialog {
59341
59727
  html += "</div>";
59342
59728
  html += "</div>";
59343
59729
 
59344
- html += "<div class='icn3d-box' style='width:520px;'><b>Annotations:&nbsp;</b><br><table border=0><tr>";
59345
- let tmpStr1 = "<td style='min-width:110px;'><span style='white-space:nowrap'>";
59346
- let tmpStr2 = "<td style='min-width:130px;'><span style='white-space:nowrap'>";
59347
-
59348
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_all'>All" + me.htmlCls.space2 + "</span></td>";
59349
- html += tmpStr2 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_cdd' checked>Conserved Domains" + me.htmlCls.space2 + "</span></td>";
59350
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_clinvar'>ClinVar" + me.htmlCls.space2 + "</span></td>";
59351
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_binding'>Functional Sites" + me.htmlCls.space2 + "</span></td>";
59352
- html += "</tr><tr>";
59353
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_custom'>Custom" + me.htmlCls.space2 + "</span></td>";
59354
- html += tmpStr2 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_3dd'>3D Domains" + me.htmlCls.space2 + "</span></td>";
59355
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_snp'>SNPs" + me.htmlCls.space2 + "</span></td>";
59356
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_interact'>Interactions" + me.htmlCls.space2 + "</span></td>";
59357
- html += "<td></td>";
59358
- html += "</tr><tr>";
59359
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_ssbond'>Disulfide Bonds" + me.htmlCls.space2 + "</span></td>";
59360
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_crosslink'>Cross-Linkages" + me.htmlCls.space2 + "</span></td>";
59361
- if(me.cfg.opmid !== undefined) {
59362
- html += "<td style='min-width:110px;'><span id='" + me.pre + "anno_transmemli' style='white-space:nowrap'>" + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_transmem'>Transmembrane" + me.htmlCls.space2 + "</span></td>";
59363
- }
59364
- else {
59365
- html += "<td style='min-width:110px;'><span id='" + me.pre + "anno_transmemli' style='display:none; white-space:nowrap'>" + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_transmem'>Transmembrane" + me.htmlCls.space2 + "</span></td>";
59366
- }
59367
- html += "<td></td>";
59368
- html += "</tr></table></div>";
59730
+ html += this.getAnnoHeader();
59369
59731
 
59370
59732
  html += "<button style='white-space:nowrap; margin-left:5px;' id='" + me.pre + "showallchains'>Show All Chains</button><br>";
59371
59733
 
@@ -59449,7 +59811,7 @@ class SetDialog {
59449
59811
  html += "</div>";
59450
59812
 
59451
59813
  html += me.htmlCls.divStr + "dl_rmsd' class='" + dialogClass + "'>";
59452
- html += "<br><b>Alignment RMSD</b>: " + me.htmlCls.inputTextStr + "id='" + me.pre + "realignrmsd' value='35' size='10'>&#8491;<br><br>";
59814
+
59453
59815
  html += "</div>";
59454
59816
 
59455
59817
  html += me.htmlCls.divStr + "dl_buriedarea' class='" + dialogClass + "'>";
@@ -59480,6 +59842,39 @@ class SetDialog {
59480
59842
 
59481
59843
  return html;
59482
59844
  }
59845
+
59846
+ getAnnoHeader() { let me = this.icn3dui; me.icn3d;
59847
+ let html = '';
59848
+
59849
+ html += "<div id='" + me.pre + "annoHeaderSection' class='icn3d-box' style='width:520px;'><b>Annotations:&nbsp;</b><br>";
59850
+ html += "<div id='" + me.pre + "annoHeader'><table border=0><tr>";
59851
+ let tmpStr1 = "<td style='min-width:110px;'><span style='white-space:nowrap'>";
59852
+ let tmpStr2 = "<td style='min-width:130px;'><span style='white-space:nowrap'>";
59853
+
59854
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_all'>All" + me.htmlCls.space2 + "</span></td>";
59855
+ html += tmpStr2 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_cdd' checked>Conserved Domains" + me.htmlCls.space2 + "</span></td>";
59856
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_clinvar'>ClinVar" + me.htmlCls.space2 + "</span></td>";
59857
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_binding'>Functional Sites" + me.htmlCls.space2 + "</span></td>";
59858
+ html += "</tr><tr>";
59859
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_custom'>Custom" + me.htmlCls.space2 + "</span></td>";
59860
+ html += tmpStr2 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_3dd'>3D Domains" + me.htmlCls.space2 + "</span></td>";
59861
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_snp'>SNPs" + me.htmlCls.space2 + "</span></td>";
59862
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_interact'>Interactions" + me.htmlCls.space2 + "</span></td>";
59863
+ html += "<td></td>";
59864
+ html += "</tr><tr>";
59865
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_ssbond'>Disulfide Bonds" + me.htmlCls.space2 + "</span></td>";
59866
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_crosslink'>Cross-Linkages" + me.htmlCls.space2 + "</span></td>";
59867
+ if(me.cfg.opmid !== undefined) {
59868
+ html += "<td style='min-width:110px;'><span id='" + me.pre + "anno_transmemli' style='white-space:nowrap'>" + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_transmem'>Transmembrane" + me.htmlCls.space2 + "</span></td>";
59869
+ }
59870
+ else {
59871
+ html += "<td style='min-width:110px;'><span id='" + me.pre + "anno_transmemli' style='display:none; white-space:nowrap'>" + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_transmem'>Transmembrane" + me.htmlCls.space2 + "</span></td>";
59872
+ }
59873
+ html += "<td></td>";
59874
+ html += "</tr></table></div></div>";
59875
+
59876
+ return html;
59877
+ }
59483
59878
  }
59484
59879
 
59485
59880
  /**
@@ -59612,6 +60007,24 @@ class Events {
59612
60007
  ic.saveFileCls.saveFile(structureStr + '-' + idStr + '.html', 'html', encodeURIComponent(html));
59613
60008
  }
59614
60009
 
60010
+ getAlignParas() { let me = this.icn3dui; me.icn3d;
60011
+ let alignment = $("#" + me.pre + "chainalignids").val();
60012
+ let idArray = alignment.split(',');
60013
+ let alignment_final = '';
60014
+ for(let i = 0, il = idArray.length; i < il; ++i) {
60015
+ alignment_final += (idArray[i].indexOf('_') != -1) ? idArray[i] : idArray[i] + '_A'; // AlphaFold ID
60016
+ if(i < il - 1) alignment_final += ',';
60017
+ }
60018
+ let resalign = $("#" + me.pre + "resalignids").val();
60019
+ let predefinedres = $("#" + me.pre + "predefinedres").val().trim().replace(/\n/g, '; ');
60020
+ if(predefinedres && alignment_final.split(',').length - 1 != predefinedres.split('; ').length) {
60021
+ alert("Please make sure the number of chains and the lines of predefined residues are the same...");
60022
+ return;
60023
+ }
60024
+
60025
+ return {"alignment": alignment_final, "resalign": resalign, "predefinedres": predefinedres};
60026
+ }
60027
+
59615
60028
  //Hold all functions related to click events.
59616
60029
  allEventFunctions() { let me = this.icn3dui, ic = me.icn3d;
59617
60030
  let thisClass = this;
@@ -59859,6 +60272,25 @@ class Events {
59859
60272
  me.htmlCls.clickMenuCls.setLogCmd("realign on structure align", true);
59860
60273
  }
59861
60274
  });
60275
+
60276
+ me.myEventCls.onIds("#" + me.pre + "applyRealignByStruct_tmalign", "click", function(e) { let ic = me.icn3d;
60277
+ e.preventDefault();
60278
+ if(!me.cfg.notebook) dialog.dialog( "close" );
60279
+ let nameArray = $("#" + me.pre + "atomsCustomRealignByStruct").val();
60280
+ if(nameArray.length > 0) {
60281
+ ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
60282
+ }
60283
+
60284
+ me.cfg.aligntool = 'tmalign';
60285
+
60286
+ ic.realignParserCls.realignOnStructAlign();
60287
+ if(nameArray.length > 0) {
60288
+ me.htmlCls.clickMenuCls.setLogCmd("realign on tmalign | " + nameArray, true);
60289
+ }
60290
+ else {
60291
+ me.htmlCls.clickMenuCls.setLogCmd("realign on tmalign", true);
60292
+ }
60293
+ });
59862
60294
  // },
59863
60295
 
59864
60296
  me.myEventCls.onIds("#" + me.pre + "applyColorSpectrumBySets", "click", function(e) { let ic = me.icn3d;
@@ -60082,62 +60514,53 @@ class Events {
60082
60514
  window.open(hostUrl + '?align=' + alignment + '&showalignseq=1&atype=0&bu=1', '_blank');
60083
60515
  });
60084
60516
 
60085
- me.myEventCls.onIds("#" + me.pre + "reload_alignaf", "click", function(e) { me.icn3d;
60517
+ me.myEventCls.onIds("#" + me.pre + "reload_alignaf", "click", function(e) { me.icn3d;
60086
60518
  e.preventDefault();
60087
60519
  if(!me.cfg.notebook) dialog.dialog( "close" );
60088
60520
  let alignment = $("#" + me.pre + "alignafid1").val() + "_A," + $("#" + me.pre + "alignafid2").val() + "_A";
60089
60521
  me.htmlCls.clickMenuCls.setLogCmd("load chains " + alignment + " | residues | resdef ", false);
60090
60522
  window.open(hostUrl + '?chainalign=' + alignment + '&resnum=&resdef=&showalignseq=1', '_blank');
60091
60523
  });
60524
+
60525
+ me.myEventCls.onIds("#" + me.pre + "reload_alignaf_tmalign", "click", function(e) { me.icn3d;
60526
+ e.preventDefault();
60527
+ if(!me.cfg.notebook) dialog.dialog( "close" );
60528
+ let alignment = $("#" + me.pre + "alignafid1").val() + "_A," + $("#" + me.pre + "alignafid2").val() + "_A";
60529
+ me.htmlCls.clickMenuCls.setLogCmd("load chains " + alignment + " | residues | resdef | align tmalign", false);
60530
+ window.open(hostUrl + '?chainalign=' + alignment + '&aligntool=tmalign&resnum=&resdef=&showalignseq=1', '_blank');
60531
+ });
60092
60532
  // },
60093
60533
  // clickReload_chainalign: function() {
60094
60534
  me.myEventCls.onIds("#" + me.pre + "reload_chainalign", "click", function(e) { me.icn3d;
60095
60535
  e.preventDefault();
60096
60536
  if(!me.cfg.notebook) dialog.dialog( "close" );
60097
- // let alignment = $("#" + me.pre + "chainalignid1").val() + "," + $("#" + me.pre + "chainalignid2").val();
60098
- let alignment = $("#" + me.pre + "chainalignids").val();
60099
- let idArray = alignment.split(',');
60100
- let alignment_final = '';
60101
- for(let i = 0, il = idArray.length; i < il; ++i) {
60102
- alignment_final += (idArray[i].indexOf('_') != -1) ? idArray[i] : idArray[i] + '_A'; // AlphaFold ID
60103
- if(i < il - 1) alignment_final += ',';
60104
- }
60105
- let resalign = $("#" + me.pre + "resalignids").val();
60106
- let predefinedres = $("#" + me.pre + "predefinedres").val().trim().replace(/\n/g, '; ');
60107
60537
 
60108
- if(predefinedres && alignment_final.split(',').length - 1 != predefinedres.split('; ').length) {
60109
- alert("Please make sure the number of chains and the lines of predefined residues are the same...");
60110
- return;
60111
- }
60538
+ let result = thisClass.getAlignParas();
60112
60539
 
60113
- me.htmlCls.clickMenuCls.setLogCmd("load chains " + alignment_final + " | residues " + resalign + " | resdef " + predefinedres, false);
60114
- //window.open(me.htmlCls.baseUrl + 'icn3d/full.html?chainalign=' + alignment + '&resnum=' + resalign + '&resdef=' + predefinedres + '&showalignseq=1', '_blank');
60115
- window.open(hostUrl + '?chainalign=' + alignment_final + '&resnum=' + resalign + '&resdef=' + predefinedres + '&showalignseq=1', '_blank');
60540
+ me.htmlCls.clickMenuCls.setLogCmd("load chains " + result.alignment + " | residues " + result.resalign + " | resdef " + result.predefinedres, false);
60541
+ window.open(hostUrl + '?chainalign=' + result.alignment + '&resnum=' + result.resalign + '&resdef=' + result.predefinedres + '&showalignseq=1', '_blank');
60116
60542
  });
60117
60543
 
60118
60544
  me.myEventCls.onIds("#" + me.pre + "reload_chainalign_asym", "click", function(e) { me.icn3d;
60119
60545
  e.preventDefault();
60120
60546
  if(!me.cfg.notebook) dialog.dialog( "close" );
60121
- // let alignment = $("#" + me.pre + "chainalignid1").val() + "," + $("#" + me.pre + "chainalignid2").val();
60122
- let alignment = $("#" + me.pre + "chainalignids").val();
60123
- let idArray = alignment.split(',');
60124
- let alignment_final = '';
60125
- for(let i = 0, il = idArray.length; i < il; ++i) {
60126
- alignment_final += (idArray[i].indexOf('_') != -1) ? idArray[i] : idArray[i] + '_A'; // AlphaFold ID
60127
- if(i < il - 1) alignment_final += ',';
60128
- }
60129
- let resalign = $("#" + me.pre + "resalignids").val();
60130
- let predefinedres = $("#" + me.pre + "predefinedres").val().trim().replace(/\n/g, '; ');
60131
- if(predefinedres && alignment_final.split(',').length - 1 != predefinedres.split('; ').length) {
60132
- alert("Please make sure the number of chains and the lines of predefined residues are the same...");
60133
- return;
60134
- }
60135
60547
 
60136
- me.htmlCls.clickMenuCls.setLogCmd("load chains " + alignment_final + " on asymmetric unit | residues " + resalign + " | resdef " + predefinedres, false);
60137
- //window.open(me.htmlCls.baseUrl + 'icn3d/full.html?chainalign=' + alignment + '&resnum=' + resalign + '&resdef=' + predefinedres + '&showalignseq=1&bu=0', '_blank');
60138
- window.open(hostUrl + '?chainalign=' + alignment_final + '&resnum=' + resalign + '&resdef=' + predefinedres + '&showalignseq=1&bu=0', '_blank');
60548
+ let result = thisClass.getAlignParas();
60549
+
60550
+ me.htmlCls.clickMenuCls.setLogCmd("load chains " + result.alignment + " on asymmetric unit | residues " + result.resalign + " | resdef " + result.predefinedres, false);
60551
+ window.open(hostUrl + '?chainalign=' + result.alignment + '&resnum=' + result.resalign + '&resdef=' + result.predefinedres + '&showalignseq=1&bu=0', '_blank');
60139
60552
  });
60140
60553
 
60554
+ me.myEventCls.onIds("#" + me.pre + "reload_chainalign_tmalign", "click", function(e) { me.icn3d;
60555
+ e.preventDefault();
60556
+ if(!me.cfg.notebook) dialog.dialog( "close" );
60557
+
60558
+ let result = thisClass.getAlignParas();
60559
+
60560
+ me.htmlCls.clickMenuCls.setLogCmd("load chains " + result.alignment + " on asymmetric unit | residues " + result.resalign + " | resdef " + result.predefinedres + " | align tmalign", false);
60561
+ window.open(hostUrl + '?chainalign=' + result.alignment + '&aligntool=tmalign&resnum=' + result.resalign + '&resdef=' + result.predefinedres + '&showalignseq=1&bu=0', '_blank');
60562
+ });
60563
+
60141
60564
  me.myEventCls.onIds("#" + me.pre + "reload_mutation_3d", "click", function(e) { me.icn3d;
60142
60565
  e.preventDefault();
60143
60566
  if(!me.cfg.notebook) dialog.dialog( "close" );
@@ -66444,7 +66867,7 @@ class iCn3DUI {
66444
66867
  //even when multiple iCn3D viewers are shown together.
66445
66868
  this.pre = this.cfg.divid + "_";
66446
66869
 
66447
- this.REVISION = '3.12.5';
66870
+ this.REVISION = '3.13.0';
66448
66871
 
66449
66872
  // In nodejs, iCn3D defines "window = {navigator: {}}"
66450
66873
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -66628,6 +67051,8 @@ iCn3DUI.prototype.show3DStructure = function(pdbStr) { let me = this;
66628
67051
  chainidArray.push(structureArray[i] + '_' + chainArray[i]);
66629
67052
  }
66630
67053
 
67054
+ chainidArray = ic.chainalignParserCls.addPostfixForChainids(chainidArray);
67055
+
66631
67056
  let bRealign = true, bPredefined = true;
66632
67057
  ic.realignParserCls.realignChainOnSeqAlign(undefined, chainidArray, bRealign, bPredefined);
66633
67058
  }
@@ -66635,25 +67060,40 @@ iCn3DUI.prototype.show3DStructure = function(pdbStr) { let me = this;
66635
67060
  else if(me.cfg.resdef !== undefined && me.cfg.matchedchains !== undefined) {
66636
67061
  let stru_t = Object.keys(ic.structures)[0];
66637
67062
  let chain_t = stru_t + '_' + me.cfg.masterchain;
66638
- let chainidArray = me.cfg.matchedchains.split(',');
67063
+ let domainidArray = me.cfg.matchedchains.split(',');
67064
+ let chainidArray = [];
67065
+ for(let i = 0, il = domainidArray.length; i < il; ++i) {
67066
+ let pos = domainidArray[i].lastIndexOf('_');
67067
+ let lastId = domainidArray[i].substr(pos + 1);
67068
+ if(!isNaN(lastId)) { // lastId is domain id
67069
+ chainidArray.push(domainidArray[i].substr(0, pos));
67070
+ }
67071
+ else {
67072
+ chainidArray.push(domainidArray[i]);
67073
+ }
67074
+ }
67075
+
66639
67076
  let mmdbafid = '';
66640
67077
  for(let i = 0, il = chainidArray.length; i < il; ++i) {
66641
67078
  if(i > 0) mmdbafid += ',';
66642
67079
  mmdbafid += chainidArray[i].substr(0, chainidArray[i].indexOf('_'));
66643
67080
  }
67081
+
67082
+ // realign
67083
+ ic.chainidArray = [chain_t].concat(chainidArray);
67084
+ ic.chainidArray = ic.chainalignParserCls.addPostfixForChainids(ic.chainidArray);
67085
+
67086
+ me.htmlCls.clickMenuCls.setLogCmd('resdef ' + me.cfg.resdef, true);
67087
+
67088
+ ic.loadCmd = 'vast_search_chainid ' + ic.chainidArray;
67089
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
66644
67090
 
66645
67091
  // load multiple PDBs
66646
67092
  ic.bNCBI = true;
66647
67093
  ic.bMmdbafid = true;
66648
67094
 
66649
- ic.loadCmd = 'load mmdbaf0 ' + mmdbafid;
66650
- me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
66651
-
66652
67095
  let bQuery = true;
66653
67096
  ic.chainalignParserCls.downloadMmdbAf(mmdbafid, bQuery);
66654
-
66655
- // realign
66656
- ic.chainidArray = [chain_t].concat(chainidArray);
66657
67097
  }
66658
67098
  }
66659
67099
  else if(me.cfg.url !== undefined) {
@@ -66837,7 +67277,7 @@ iCn3DUI.prototype.show3DStructure = function(pdbStr) { let me = this;
66837
67277
 
66838
67278
  ic.bChainAlign = true;
66839
67279
  ic.inputid = me.cfg.chainalign;
66840
- ic.loadCmd = 'load chainalignment ' + me.cfg.chainalign + ' | resnum ' + me.cfg.resnum + ' | resdef ' + me.cfg.resdef + ' | parameters ' + me.cfg.inpara;
67280
+ ic.loadCmd = 'load chainalignment ' + me.cfg.chainalign + ' | resnum ' + me.cfg.resnum + ' | resdef ' + me.cfg.resdef + ' | aligntool ' + me.cfg.aligntool + ' | parameters ' + me.cfg.inpara;
66841
67281
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
66842
67282
  ic.chainalignParserCls.downloadChainalignment(me.cfg.chainalign, me.cfg.resnum, me.cfg.resdef);
66843
67283
  }