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.js CHANGED
@@ -13410,15 +13410,7 @@ class DefinedSets {
13410
13410
  dAtoms = me.hashUtilsCls.unionHash(dAtoms, ic.alnChains[alignChain]);
13411
13411
  }
13412
13412
 
13413
- let residuesHash = {}, chains = {};
13414
- for(let i in dAtoms) {
13415
- let atom = ic.atoms[i];
13416
-
13417
- let chainid = atom.structure + '_' + atom.chain;
13418
- let resid = chainid + '_' + atom.resi;
13419
- residuesHash[resid] = 1;
13420
- chains[chainid] = 1;
13421
- }
13413
+ let residuesHash = ic.firstAtomObjCls.getResiduesFromAtoms(dAtoms);
13422
13414
 
13423
13415
  let commandname = 'protein_aligned';
13424
13416
  let commanddescr = 'aligned protein and nucleotides';
@@ -22638,8 +22630,11 @@ class Dssp {
22638
22630
  thisClass.parseDsspData(dataArray, struArray, bAppend);
22639
22631
  })
22640
22632
  .fail(function() {
22633
+ console.log("DSSP calculation had a problem with this structure " + struArray[0] + "...");
22634
+
22641
22635
  ic.pdbParserCls.loadPdbDataRender(bAppend);
22642
22636
 
22637
+ if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
22643
22638
  if(ic.deferredSecondary !== undefined) ic.deferredSecondary.resolve();
22644
22639
  });
22645
22640
  }
@@ -22873,6 +22868,9 @@ class PdbParser {
22873
22868
  thisClass.loadPdbData(data);
22874
22869
  ic.loadScriptCls.loadScript(command);
22875
22870
  }
22871
+ else if(type === 'mmcif') {
22872
+ ic.mmcifParserCls.parseMmcifData(data, undefined, command);
22873
+ }
22876
22874
  else if(type === 'mol2') {
22877
22875
  ic.mol2ParserCls.loadMol2Data(data);
22878
22876
  }
@@ -24478,6 +24476,8 @@ class RealignParser {
24478
24476
 
24479
24477
  ic.selectionCls.saveSelection(name, name);
24480
24478
 
24479
+ me.htmlCls.clickMenuCls.setLogCmd("realign", true);
24480
+
24481
24481
  let structHash = {}, struct2chain = {};
24482
24482
  ic.realignResid = {};
24483
24483
  let lastStruResi = '';
@@ -24588,7 +24588,7 @@ class RealignParser {
24588
24588
 
24589
24589
  // align seq
24590
24590
  ic.hAtoms = ic.chainalignParserCls.setMsa(chainidArray);
24591
-
24591
+
24592
24592
  ic.transformCls.zoominSelection();
24593
24593
 
24594
24594
  ic.chainalignParserCls.downloadChainalignmentPart3(undefined, chainidArray, ic.hAtoms);
@@ -24787,6 +24787,7 @@ class RealignParser {
24787
24787
 
24788
24788
  let ajaxArray = [], chainidPairArray = [];
24789
24789
  let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
24790
+ let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
24790
24791
  let structArray = Object.keys(struct2domain);
24791
24792
  for(let s = 0, sl = structArray.length; s < sl; ++s) {
24792
24793
  let struct1 = structArray[s];
@@ -24802,16 +24803,32 @@ class RealignParser {
24802
24803
  for(let j = 0, jl = chainidArray2.length; j < jl; ++j) {
24803
24804
  let chainid2 = chainidArray2[j];
24804
24805
 
24805
- let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct1][chainid1]);
24806
- let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct2][chainid2]);
24807
-
24808
- let alignAjax = $.ajax({
24809
- url: urlalign,
24810
- type: 'POST',
24811
- data: {'domains1': jsonStr_q, 'domains2': jsonStr_t},
24812
- dataType: 'jsonp',
24813
- cache: true
24814
- });
24806
+ let alignAjax;
24807
+
24808
+ if(me.cfg.aligntool != 'tmalign') {
24809
+ let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct1][chainid1]);
24810
+ let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct2][chainid2]);
24811
+
24812
+ alignAjax = $.ajax({
24813
+ url: urlalign,
24814
+ type: 'POST',
24815
+ data: {'domains1': jsonStr_q, 'domains2': jsonStr_t},
24816
+ dataType: 'jsonp',
24817
+ cache: true
24818
+ });
24819
+ }
24820
+ else {
24821
+ let pdb_target = ic.saveFileCls.getAtomPDB(struct2domain[struct1][chainid1]);
24822
+ let pdb_query = ic.saveFileCls.getAtomPDB(struct2domain[struct2][chainid2]);
24823
+
24824
+ alignAjax = $.ajax({
24825
+ url: urltmalign,
24826
+ type: 'POST',
24827
+ data: {'pdb_query': pdb_query, 'pdb_target': pdb_target},
24828
+ dataType: 'jsonp',
24829
+ cache: true
24830
+ });
24831
+ }
24815
24832
 
24816
24833
  ajaxArray.push(alignAjax);
24817
24834
  chainidPairArray.push(chainid1 + ',' + chainid2); // chainid2 is target
@@ -24892,6 +24909,8 @@ class RealignParser {
24892
24909
  base_t = base;
24893
24910
  }
24894
24911
  else {
24912
+ let hAtoms = {};
24913
+
24895
24914
  predefinedResPair = predefinedResArray[i - 1].split(' | ');
24896
24915
 
24897
24916
  let chainidpair = chainid_t + ',' + chainid;
@@ -24903,6 +24922,8 @@ class RealignParser {
24903
24922
  resiArray = predefinedResPair[0].split(",");
24904
24923
  result = thisClass.getSeqCoorResid(resiArray, chainid_t, base_t);
24905
24924
 
24925
+ hAtoms = me.hashUtilsCls.unionHash(hAtoms, result.hAtoms);
24926
+
24906
24927
  if(!struct2SeqHash[chainidpair][mmdbid_t]) struct2SeqHash[chainidpair][mmdbid_t] = '';
24907
24928
  if(!struct2CoorHash[chainidpair][mmdbid_t]) struct2CoorHash[chainidpair][mmdbid_t] = [];
24908
24929
  if(!struct2resid[chainidpair][mmdbid_t]) struct2resid[chainidpair][mmdbid_t] = [];
@@ -24914,6 +24935,7 @@ class RealignParser {
24914
24935
  // slave
24915
24936
  resiArray = predefinedResPair[1].split(",");
24916
24937
  result = thisClass.getSeqCoorResid(resiArray, chainid, base);
24938
+ hAtoms = me.hashUtilsCls.unionHash(hAtoms, result.hAtoms);
24917
24939
 
24918
24940
  if(!struct2SeqHash[chainidpair][mmdbid]) struct2SeqHash[chainidpair][mmdbid] = '';
24919
24941
  if(!struct2CoorHash[chainidpair][mmdbid]) struct2CoorHash[chainidpair][mmdbid] = [];
@@ -24922,6 +24944,18 @@ class RealignParser {
24922
24944
  struct2SeqHash[chainidpair][mmdbid] += result.seq;
24923
24945
  struct2CoorHash[chainidpair][mmdbid] = struct2CoorHash[chainidpair][mmdbid].concat(result.coor);
24924
24946
  struct2resid[chainidpair][mmdbid] = struct2resid[chainidpair][mmdbid].concat(result.resid);
24947
+
24948
+ // let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(hAtoms);
24949
+ // let residueArray = Object.keys(residueHash);
24950
+
24951
+ // let commandname = chainidpair;
24952
+ // let commanddescr = 'aligned ' + chainidpair;
24953
+ // let select = "select " + ic.resid2specCls.residueids2spec(residueArray);
24954
+
24955
+ // ic.selectionCls.addCustomSelection(residueArray, commandname, commanddescr, select, true);
24956
+
24957
+ // me.htmlCls.clickMenuCls.setLogCmd(select + " | name " + commandname, true);
24958
+ // me.htmlCls.clickMenuCls.setLogCmd("realign", true);
24925
24959
  }
24926
24960
  }
24927
24961
  else {
@@ -25021,6 +25055,7 @@ class RealignParser {
25021
25055
 
25022
25056
  getSeqCoorResid(resiArray, chainid, base) { let ic = this.icn3d, me = ic.icn3dui;
25023
25057
  let seq = '', coorArray = [], residArray = [];
25058
+ let hAtoms = {};
25024
25059
 
25025
25060
  for(let j = 0, jl = resiArray.length; j < jl; ++j) {
25026
25061
  if(resiArray[j].indexOf('-') != -1) {
@@ -25070,7 +25105,11 @@ class RealignParser {
25070
25105
  }
25071
25106
  }
25072
25107
 
25073
- return {seq: seq, coor: coorArray, resid: residArray};
25108
+ for(let i = 0, il = residArray.length; i < il; ++i) {
25109
+ hAtoms = me.hashUtilsCls.unionHash(hAtoms, ic.residues[residArray[i]]);
25110
+ }
25111
+
25112
+ return {seq: seq, coor: coorArray, resid: residArray, hAtoms: hAtoms};
25074
25113
  }
25075
25114
 
25076
25115
  getResCoorArray(resid) { let ic = this.icn3d; ic.icn3dui;
@@ -25161,6 +25200,7 @@ class ChainalignParser {
25161
25200
  // dynamicly align pairs in ic.afChainIndexHash
25162
25201
  let ajaxArray = [], indexArray = [], struArray = [];
25163
25202
  let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
25203
+ let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
25164
25204
 
25165
25205
  for(let index in ic.afChainIndexHash) {
25166
25206
  let idArray = ic.afChainIndexHash[index].split('_');
@@ -25169,17 +25209,31 @@ class ChainalignParser {
25169
25209
  mmdbid_t = idArray[2];
25170
25210
  let chain_t = idArray[3];
25171
25211
 
25172
- let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(ic.chains[mmdbid_q + '_' + chain_q]);
25173
-
25174
- let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(ic.chains[mmdbid_t + '_' + chain_t]);
25175
-
25176
- let alignAjax = $.ajax({
25177
- url: urlalign,
25178
- type: 'POST',
25179
- data: {'domains1': jsonStr_q, 'domains2': jsonStr_t},
25180
- dataType: 'jsonp',
25181
- cache: true
25182
- });
25212
+ let alignAjax;
25213
+ if(me.cfg.aligntool != 'tmalign') {
25214
+ let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(ic.chains[mmdbid_q + '_' + chain_q]);
25215
+ let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(ic.chains[mmdbid_t + '_' + chain_t]);
25216
+
25217
+ alignAjax = $.ajax({
25218
+ url: urlalign,
25219
+ type: 'POST',
25220
+ data: {'domains1': jsonStr_q, 'domains2': jsonStr_t},
25221
+ dataType: 'jsonp',
25222
+ cache: true
25223
+ });
25224
+ }
25225
+ else {
25226
+ let pdb_query = ic.saveFileCls.getAtomPDB(ic.chains[mmdbid_q + '_' + chain_q]);
25227
+ let pdb_target= ic.saveFileCls.getAtomPDB(ic.chains[mmdbid_t + '_' + chain_t]);
25228
+
25229
+ alignAjax = $.ajax({
25230
+ url: urltmalign,
25231
+ type: 'POST',
25232
+ data: {'pdb_query': pdb_query, 'pdb_target': pdb_target},
25233
+ dataType: 'jsonp',
25234
+ cache: true
25235
+ });
25236
+ }
25183
25237
 
25184
25238
  ajaxArray.push(alignAjax);
25185
25239
  indexArray.push(index - 1);
@@ -25311,6 +25365,9 @@ class ChainalignParser {
25311
25365
  // set trans and rotation matrix
25312
25366
  ic.t_trans_add = [];
25313
25367
  ic.q_trans_sub = [];
25368
+
25369
+ if(me.cfg.aligntool == 'tmalign') ic.q_trans_add = [];
25370
+
25314
25371
  ic.q_rotation = [];
25315
25372
  ic.qt_start_end = [];
25316
25373
 
@@ -25455,30 +25512,37 @@ class ChainalignParser {
25455
25512
  for(let i = 0, il = chainidArray.length; i < il; ++i) {
25456
25513
  for(let serial in ic.chains[chainidArray[i]]) {
25457
25514
  let atm = ic.atoms[serial];
25458
- //atm.coord = new THREE.Vector3(atm.coord[0], atm.coord[1], atm.coord[2]);
25459
- if(ic.q_rotation !== undefined && ic.t_trans_add.length > 0 && !me.cfg.resnum && !me.cfg.resdef) {
25515
+ //if(ic.q_rotation !== undefined && ic.t_trans_add.length > 0 && !me.cfg.resnum && !me.cfg.resdef) {
25516
+ if(ic.q_rotation !== undefined && !me.cfg.resnum && !me.cfg.resdef) {
25460
25517
  atm = this.transformAtom(atm, index, alignType);
25461
25518
  }
25462
25519
  }
25463
25520
  }
25464
-
25465
-
25466
25521
  }
25467
25522
 
25468
- transformAtom(atm, index, alignType) { let ic = this.icn3d; ic.icn3dui;
25523
+ transformAtom(atm, index, alignType) { let ic = this.icn3d, me = ic.icn3dui;
25469
25524
  if(alignType === 'target') ;
25470
25525
  else if(alignType === 'query') {
25471
- atm.coord.x -= ic.q_trans_sub[index].x;
25472
- atm.coord.y -= ic.q_trans_sub[index].y;
25473
- atm.coord.z -= ic.q_trans_sub[index].z;
25526
+ if(me.cfg.aligntool != 'tmalign') {
25527
+ atm.coord.x -= ic.q_trans_sub[index].x;
25528
+ atm.coord.y -= ic.q_trans_sub[index].y;
25529
+ atm.coord.z -= ic.q_trans_sub[index].z;
25530
+ }
25474
25531
 
25475
25532
  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;
25476
25533
  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;
25477
25534
  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;
25478
25535
 
25479
- x -= ic.t_trans_add[index].x;
25480
- y -= ic.t_trans_add[index].y;
25481
- z -= ic.t_trans_add[index].z;
25536
+ if(me.cfg.aligntool != 'tmalign') {
25537
+ x -= ic.t_trans_add[index].x;
25538
+ y -= ic.t_trans_add[index].y;
25539
+ z -= ic.t_trans_add[index].z;
25540
+ }
25541
+ else {
25542
+ x += ic.q_trans_add[index].x;
25543
+ y += ic.q_trans_add[index].y;
25544
+ z += ic.q_trans_add[index].z;
25545
+ }
25482
25546
 
25483
25547
  atm.coord.x = x;
25484
25548
  atm.coord.y = y;
@@ -25510,17 +25574,12 @@ class ChainalignParser {
25510
25574
  //ic.hAtoms = hAtoms;
25511
25575
  ic.hAtoms = me.hashUtilsCls.cloneHash(hAtoms);
25512
25576
  ic.dAtoms = me.hashUtilsCls.cloneHash(hAtoms);
25513
-
25577
+
25514
25578
  ic.ParserUtilsCls.renderStructure();
25515
25579
 
25516
25580
  //if(ic.chainidArray.length > 2) {
25517
25581
  if(chainidArray.length > 2) {
25518
- let residuesHash = {};
25519
- for(let i in hAtoms) {
25520
- let atom = ic.atoms[i];
25521
- let resid = atom.structure + '_' + atom.chain + '_' + atom.resi;
25522
- residuesHash[resid] = 1;
25523
- }
25582
+ let residuesHash = ic.firstAtomObjCls.getResiduesFromAtoms(hAtoms);
25524
25583
 
25525
25584
  let commandname = 'protein_aligned';
25526
25585
  let commanddescr = 'protein aligned';
@@ -25556,18 +25615,10 @@ class ChainalignParser {
25556
25615
  //if(me.deferred !== undefined) me.deferred.resolve(); if(ic.deferred2 !== undefined) ic.deferred2.resolve();
25557
25616
  }
25558
25617
 
25559
- downloadChainalignment(chainalign, resnum, resdef) { let ic = this.icn3d, me = ic.icn3dui;
25560
- let thisClass = this;
25561
-
25562
- ic.opts['proteins'] = 'c alpha trace';
25563
-
25564
- let alignArray = chainalign.split(',');
25565
- let domainArray = (me.cfg.domainids) ? me.cfg.domainids.split(',') : [];
25566
- if(domainArray.length < alignArray.length) domainArray = [];
25567
-
25618
+ addPostfixForChainids(chainidArray) { let ic = this.icn3d; ic.icn3dui;
25568
25619
  let struct2cnt = {};
25569
- for(let i = 0, il = alignArray.length; i < il; ++i) {
25570
- let chainid = alignArray[i];
25620
+ for(let i = 0, il = chainidArray.length; i < il; ++i) {
25621
+ let chainid = chainidArray[i];
25571
25622
  let pos = chainid.indexOf('_');
25572
25623
  let struct = chainid.substr(0, pos).toUpperCase();
25573
25624
  if(!struct2cnt.hasOwnProperty(struct)) {
@@ -25579,10 +25630,22 @@ class ChainalignParser {
25579
25630
 
25580
25631
  struct = (struct2cnt[struct] == 1) ? struct : struct + struct2cnt[struct];
25581
25632
 
25582
- alignArray[i] = struct + chainid.substr(pos);
25633
+ chainidArray[i] = struct + chainid.substr(pos);
25583
25634
  }
25584
25635
 
25585
- ic.chainidArray = alignArray;
25636
+ return chainidArray;
25637
+ }
25638
+
25639
+ downloadChainalignment(chainalign, resnum, resdef) { let ic = this.icn3d, me = ic.icn3dui;
25640
+ let thisClass = this;
25641
+
25642
+ ic.opts['proteins'] = 'c alpha trace';
25643
+
25644
+ let alignArray = chainalign.split(',');
25645
+ let domainArray = (me.cfg.domainids) ? me.cfg.domainids.split(',') : [];
25646
+ if(domainArray.length < alignArray.length) domainArray = [];
25647
+
25648
+ ic.chainidArray = this.addPostfixForChainids(alignArray);
25586
25649
 
25587
25650
  let pos1 = alignArray[0].indexOf('_');
25588
25651
  ic.mmdbid_t = alignArray[0].substr(0, pos1).toUpperCase();
@@ -25664,7 +25727,8 @@ class ChainalignParser {
25664
25727
  let chainalignFinal = ic.mmdbid_q + "_" + ic.chain_q + "," + ic.mmdbid_t + "_" + ic.chain_t;
25665
25728
  let domainalign = (domainArray.length > 0) ? domainArray[index] + "," + domainArray[0] : undefined;
25666
25729
 
25667
- if(ic.mmdbid_t.length == 4 && ic.mmdbid_q.length == 4) {
25730
+ // TM-align (me.cfg.aligntool == 'tmalign') needs to input PDB
25731
+ if(me.cfg.aligntool != 'tmalign' && ic.mmdbid_t.length == 4 && ic.mmdbid_q.length == 4) {
25668
25732
  let urlalign;
25669
25733
 
25670
25734
  if(domainArray.length > 0) {
@@ -25698,7 +25762,8 @@ class ChainalignParser {
25698
25762
  thisClass.parseChainAlignData(dataArray, alignArray, ic.mmdbid_t, ic.chain_t);
25699
25763
  })
25700
25764
  .fail(function() {
25701
- var aaa = 1; //alert("These chains can not be aligned by VAST server. You can specify the residue range and try it again...");
25765
+ let serverName = (me.cfg.aligntool == 'tmalign') ? 'TM-align' : 'VAST';
25766
+ var aaa = 1; //alert("These chains can not be aligned by " + serverName + ". You can specify the residue range and try it again...");
25702
25767
  // thisClass.parseChainAlignData(arguments, alignArray, ic.mmdbid_t, ic.chain_t);
25703
25768
  });
25704
25769
  }
@@ -25716,6 +25781,9 @@ class ChainalignParser {
25716
25781
 
25717
25782
  ic.t_trans_add = [];
25718
25783
  ic.q_trans_sub = [];
25784
+
25785
+ if(me.cfg.aligntool == 'tmalign') ic.q_trans_add = [];
25786
+
25719
25787
  ic.q_rotation = [];
25720
25788
  ic.qt_start_end = [];
25721
25789
 
@@ -25761,6 +25829,9 @@ class ChainalignParser {
25761
25829
  // need to pass C-alpha coords and get transformation matrix from backend
25762
25830
  ic.t_trans_add[index-1] = {"x":0, "y":0, "z":0};
25763
25831
  ic.q_trans_sub[index-1] = {"x":0, "y":0, "z":0};
25832
+
25833
+ if(me.cfg.aligntool == 'tmalign') ic.q_trans_add[index-1] = {"x":0, "y":0, "z":0};
25834
+
25764
25835
  ic.q_rotation[index-1] = {"x1":1, "y1":0, "z1":0, "x2":0, "y2":1, "z2":0, "x3":0, "y3":0, "z3":1};
25765
25836
  ic.qt_start_end[index-1] = undefined;
25766
25837
  }
@@ -25783,7 +25854,8 @@ class ChainalignParser {
25783
25854
  processAlign(align, index, queryData, bEqualMmdbid, bEqualChain, bNoAlert) { let ic = this.icn3d, me = ic.icn3dui;
25784
25855
  let bAligned = false;
25785
25856
  if((!align || align.length == 0) && !bNoAlert) {
25786
- var aaa = 1; //alert("These chains can not be aligned by VAST server.");
25857
+ let serverName = (me.cfg.aligntool == 'tmalign') ? 'TM-align' : 'VAST';
25858
+ var aaa = 1; //alert("These chains can not be aligned by " + serverName + ".");
25787
25859
  return bAligned;
25788
25860
  }
25789
25861
 
@@ -25816,13 +25888,20 @@ class ChainalignParser {
25816
25888
  */
25817
25889
  ic.t_trans_add[index] = align[0].t_trans_add;
25818
25890
  ic.q_trans_sub[index] = align[0].q_trans_sub;
25891
+
25892
+ if(me.cfg.aligntool == 'tmalign') ic.q_trans_add[index] = align[0].q_trans_add;
25893
+
25819
25894
  ic.q_rotation[index] = align[0].q_rotation;
25820
25895
  ic.qt_start_end[index] = align[0].segs;
25821
25896
 
25822
25897
  let rmsd = align[0].super_rmsd;
25823
25898
 
25824
- me.htmlCls.clickMenuCls.setLogCmd("RMSD of alignment: " + rmsd.toPrecision(4), false);
25825
- $("#" + ic.pre + "realignrmsd").val(rmsd.toPrecision(4));
25899
+ let logStr = "alignment RMSD: " + rmsd.toPrecision(4);
25900
+ if(me.cfg.aligntool == 'tmalign') logStr += "; TM-score: " + align[0].score.toPrecision(4);
25901
+ me.htmlCls.clickMenuCls.setLogCmd(logStr, false);
25902
+ let html = "<br><b>Alignment RMSD</b>: " + rmsd.toPrecision(4) + " &#8491;<br>";
25903
+ if(me.cfg.aligntool == 'tmalign') html += "<b>TM-score</b>: " + align[0].score.toPrecision(4) + "<br><br>";
25904
+ $("#" + ic.pre + "dl_rmsd").html(html);
25826
25905
  if(!me.cfg.bSidebyside) me.htmlCls.dialogCls.openDlg('dl_rmsd', 'RMSD of alignment');
25827
25906
 
25828
25907
  bAligned = true;
@@ -26010,11 +26089,10 @@ class ChainalignParser {
26010
26089
  }
26011
26090
 
26012
26091
  // calculate secondary structures with applyCommandDssp
26013
- if(bQuery && me.cfg.masterchain) {
26092
+ if(bQuery && me.cfg.matchedchains) {
26014
26093
  $.when(ic.pdbParserCls.applyCommandDssp(true)).then(function() {
26015
26094
  let bRealign = true, bPredefined = true;
26016
26095
  ic.realignParserCls.realignChainOnSeqAlign(undefined, ic.chainidArray, bRealign, bPredefined);
26017
-
26018
26096
  // reset annotations
26019
26097
  $("#" + ic.pre + "dl_annotations").html("");
26020
26098
  ic.bAnnoShown = false;
@@ -27709,6 +27787,24 @@ class LoadScript {
27709
27787
 
27710
27788
  return;
27711
27789
  }
27790
+ else if(ic.commands[i].trim().indexOf('realign on tmalign') == 0) {
27791
+ let strArray = ic.commands[i].split("|||");
27792
+ let command = strArray[0].trim();
27793
+
27794
+ let paraArray = command.split(' | ');
27795
+ if(paraArray.length == 2) {
27796
+ let nameArray = paraArray[1].split(',');
27797
+ ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
27798
+ }
27799
+
27800
+ me.cfg.aligntool = 'tmalign';
27801
+
27802
+ $.when(thisClass.applyCommandRealignByStruct(command)).then(function() {
27803
+ thisClass.execCommandsBase(i + 1, end, steps);
27804
+ });
27805
+
27806
+ return;
27807
+ }
27712
27808
  else if(ic.commands[i].trim().indexOf('graph interaction pairs') == 0) {
27713
27809
  let strArray = ic.commands[i].split("|||");
27714
27810
  let command = strArray[0].trim();
@@ -27897,6 +27993,17 @@ class LoadScript {
27897
27993
  }
27898
27994
  thisClass.applyCommandRealignByStruct(lastCommand);
27899
27995
  }
27996
+ else if(lastCommand.indexOf('realign on tmalign') == 0) {
27997
+ let paraArray = lastCommand.split(' | ');
27998
+ if(paraArray.length == 2) {
27999
+ let nameArray = paraArray[1].split(',');
28000
+ ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
28001
+ }
28002
+
28003
+ me.cfg.aligntool = 'tmalign';
28004
+
28005
+ thisClass.applyCommandRealignByStruct(lastCommand);
28006
+ }
27900
28007
  else if(lastCommand.indexOf('graph interaction pairs') == 0) {
27901
28008
  thisClass.applyCommandGraphinteraction(lastCommand);
27902
28009
  }
@@ -27992,6 +28099,21 @@ class LoadScript {
27992
28099
 
27993
28100
  ic.chainalignParserCls.downloadMmdbAf(id);
27994
28101
  }
28102
+ /*
28103
+ else if(command.indexOf('load vastsearch') !== -1) {
28104
+ let idArray = loadStr.split(' || ');
28105
+ let mmdbafid = idArray[1].substr(idArray[1].indexOf(' ') + 1);
28106
+ ic.chainidArray = idArray[2].substr(idArray[2].indexOf(' ') + 1);
28107
+ me.cfg.matchedchains = ic.chainidArray;
28108
+
28109
+ // load multiple PDBs
28110
+ ic.bNCBI = true;
28111
+ ic.bMmdbafid = true;
28112
+
28113
+ let bQuery = true;
28114
+ ic.chainalignParserCls.downloadMmdbAf(mmdbafid, bQuery);
28115
+ }
28116
+ */
27995
28117
  else if(command.indexOf('load gi') !== -1) {
27996
28118
  me.cfg.gi = id;
27997
28119
  ic.mmdbParserCls.downloadGi(id);
@@ -28013,14 +28135,20 @@ class LoadScript {
28013
28135
  ic.alignParserCls.downloadAlignment(id);
28014
28136
  }
28015
28137
  else if(command.indexOf('load chainalignment') !== -1) {
28016
- //load chainalignment [id] | resnum [resnum] | parameters [inpara]
28138
+ //load chainalignment [id] | resnum [resnum] | resdef [resnum] | aligntool [aligntool] | parameters [inpara]
28017
28139
  let urlArray = command.split(" | ");
28018
- if(urlArray[1].indexOf('resnum') != -1) {
28019
- me.cfg.resnum = urlArray[1].substr(urlArray[1].indexOf('resnum') + 7);
28140
+ if(urlArray.length > 1 && urlArray[1].indexOf('resnum') != -1) {
28141
+ me.cfg.resnum = urlArray[1].substr(urlArray[1].indexOf('resnum') + 7);
28142
+ }
28143
+ if(urlArray.length > 2 && urlArray[2].indexOf('resdef') != -1) {
28144
+ me.cfg.resdef = urlArray[2].substr(urlArray[1].indexOf('resdef') + 7);
28145
+ }
28146
+ if(urlArray.length > 3 && urlArray[3].indexOf('aligntool') != -1) {
28147
+ me.cfg.aligntool = urlArray[3].substr(urlArray[1].indexOf('aligntool') + 10);
28020
28148
  }
28021
28149
 
28022
28150
  me.cfg.chainalign = id;
28023
- ic.chainalignParserCls.downloadChainalignment(id, me.cfg.resnum);
28151
+ ic.chainalignParserCls.downloadChainalignment(id, me.cfg.resnum, me.cfg.resdef);
28024
28152
  }
28025
28153
  else if(command.indexOf('load url') !== -1) {
28026
28154
  let typeStr = load_parameters[1]; // type pdb
@@ -29820,6 +29948,7 @@ class ShowSeq {
29820
29948
  html3 += '<div class="icn3d-dl_sequence">';
29821
29949
  // html to display protein positions(10, 20, etc)
29822
29950
  //if(Object.keys(ic.chains[chnid]).length > 10) {
29951
+
29823
29952
  if(ic.giSeq[chnid].length > 10) {
29824
29953
  htmlTmp = '<div class="icn3d-residueLine" style="white-space:nowrap;">';
29825
29954
  let atom = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.chains[chnid]);
@@ -30195,6 +30324,56 @@ class ShowSeq {
30195
30324
  html += '</div>';
30196
30325
  html3 += '</div></div>';
30197
30326
  }
30327
+ /*
30328
+ else if(chnid == '4YHY_B') {
30329
+ // test reference num
30330
+ let resid2refnum = {};
30331
+
30332
+ let refData = {6: 'A1050', 22: 'B2050', 36: 'C3050', 48: 'C`3250', 61: 'C``3750', 70: 'D4050', 81: 'E5050', 96: 'F6050', 112: 'G7050'};
30333
+
30334
+ //ic.chainsMapping[chnid][chnid + '_' + resObject2.resi] = resObject1.resn + resObject1.resi;
30335
+ for(let resi in refData) {
30336
+ let resid = chnid + '_' + resi;
30337
+ resid2refnum[resid] = refData[resi];
30338
+ }
30339
+
30340
+
30341
+ htmlTmp = '<div class="icn3d-dl_sequence">';
30342
+ htmlTmp += '<div class="icn3d-residueLine" style="white-space:nowrap;">';
30343
+ htmlTmp += '<div class="icn3d-annoTitle" anno="0" title="Ig Reference Numbers">Ig Reference Numbers</div>';
30344
+ htmlTmp += '<span class="icn3d-residueNum"></span>';
30345
+ html3 += htmlTmp + '<br>';
30346
+ html += htmlTmp + '<span class="icn3d-seqLine">';
30347
+ for(let i = 0, il = giSeq.length; i < il; ++i) {
30348
+ html += this.insertGap(chnid, i, '-');
30349
+ if(i >= ic.matchedPos[chnid] && i - ic.matchedPos[chnid] < ic.chainsSeq[chnid].length) {
30350
+ let currResi = ic.chainsSeq[chnid][i - ic.matchedPos[chnid]].resi;
30351
+ let residueid = chnid + '_' + currResi;
30352
+ if(!ic.residues.hasOwnProperty(residueid)) {
30353
+ html += '<span></span>';
30354
+ }
30355
+ else {
30356
+ let atom = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.residues[residueid]);
30357
+ let resi_ori = atom.resi_ori;
30358
+ html += '<span>';
30359
+ if( resid2refnum.hasOwnProperty(residueid)) {
30360
+ html += resid2refnum[residueid] + ' ';
30361
+ }
30362
+ html += '</span>';
30363
+ }
30364
+ }
30365
+ else {
30366
+ html += '<span></span>';
30367
+ }
30368
+ }
30369
+ html += '<span class="icn3d-residueNum"></span>';
30370
+ html += '</span>';
30371
+ html += '<br>';
30372
+ html += '</div>';
30373
+ html += '</div>';
30374
+ html3 += '</div></div>';
30375
+ }
30376
+ */
30198
30377
  }
30199
30378
  $("#" + ic.pre + 'dt_giseq_' + chnid).html(html);
30200
30379
  $("#" + ic.pre + 'ov_giseq_' + chnid).html(html2);
@@ -30320,12 +30499,24 @@ class AddTrack {
30320
30499
  //var title = 'fasta ' + fasta.substr(0, 5);
30321
30500
  let title = $("#" + ic.pre + "fasta_title").val();
30322
30501
 
30502
+ let structure = chainid.substr(0, chainid.indexOf('_'));
30503
+ let targets = chainid;
30504
+ if(structure.length == 5) { // e.g., 1TUP2
30505
+ targets = targets.substr(0,4);
30506
+ }
30507
+ else if(structure.length > 5) { // AlphaFold UniProt
30508
+ targets = '';
30509
+ for(let i = 0, il = ic.chainsSeq[chainid].length; i < il; ++i) {
30510
+ targets += ic.chainsSeq[chainid][i].name;
30511
+ }
30512
+ }
30513
+
30323
30514
  //var text = $("#" + ic.pre + "track_text").val();
30324
30515
  let url = 'https://www.ncbi.nlm.nih.gov/Structure/pwaln/pwaln.fcgi?from=track';
30325
30516
  $.ajax({
30326
30517
  url: url,
30327
30518
  type: 'POST',
30328
- data : {'targets': chainid, 'queries': fasta},
30519
+ data : {'targets': targets, 'queries': fasta},
30329
30520
  dataType: 'jsonp',
30330
30521
  //dataType: 'json',
30331
30522
  tryCount : 0,
@@ -30911,12 +31102,14 @@ class AddTrack {
30911
31102
  }
30912
31103
 
30913
31104
  alignSequenceToStructure(chainid, data, title) { let ic = this.icn3d, me = ic.icn3dui;
30914
- let query, target;
31105
+ let query, target, firstKey;
30915
31106
 
30916
31107
  if(data.data !== undefined) {
30917
31108
  query = data.data[0].query;
30918
31109
  //target = data.data[0].targets[chainid.replace(/_/g, '')];
30919
- target = data.data[0].targets[chainid];
31110
+ //target = data.data[0].targets[chainid];
31111
+ firstKey = Object.keys(data.data[0].targets)[0];
31112
+ target = data.data[0].targets[firstKey];
30920
31113
 
30921
31114
  target = target.hsps[0];
30922
31115
  }
@@ -30932,7 +31125,8 @@ class AddTrack {
30932
31125
  target.scores.bit_score;
30933
31126
 
30934
31127
  //var targetSeq = data.targets[chainid.replace(/_/g, '')].seqdata;
30935
- let targetSeq = data.targets[chainid].seqdata;
31128
+ //let targetSeq = data.targets[chainid].seqdata;
31129
+ let targetSeq = data.targets[firstKey].seqdata;
30936
31130
  let querySeq = query.seqdata;
30937
31131
 
30938
31132
  let segArray = target.segs;
@@ -31663,6 +31857,10 @@ class AnnoCddSite {
31663
31857
 
31664
31858
  let chainWithData = {};
31665
31859
 
31860
+ if(me.bNode) {
31861
+ if(!ic.resid2cdd) ic.resid2cdd = {};
31862
+ if(!ic.resid2site) ic.resid2site = {};
31863
+ }
31666
31864
  for(let i = 0, il = dataArray.length; i < il; ++i) {
31667
31865
  let data = (bSeq) ? dataArray[i][0] : dataArray[i];
31668
31866
 
@@ -31678,6 +31876,7 @@ class AnnoCddSite {
31678
31876
  let html2 = html;
31679
31877
  let html3 = html;
31680
31878
  let domainArray = cddData.doms;
31879
+ if(me.bNode && !ic.resid2cdd[chnid]) ic.resid2cdd[chnid] = [];
31681
31880
  let result = thisClass.setDomainFeature(domainArray, chnid, true, html, html2, html3);
31682
31881
 
31683
31882
  ic.chainid2pssmid[chnid] = {pssmid2name: result.pssmid2name, pssmid2fromArray: result.pssmid2fromArray, pssmid2toArray: result.pssmid2toArray};
@@ -31696,6 +31895,7 @@ class AnnoCddSite {
31696
31895
 
31697
31896
  // features
31698
31897
  let featuteArray = cddData.motifs;
31898
+ if(me.bNode && !ic.resid2site[chnid]) ic.resid2site[chnid] = [];
31699
31899
  result = thisClass.setDomainFeature(featuteArray, chnid, false, html, html2, html3, acc2domain);
31700
31900
 
31701
31901
  html = result.html; // + '</div>';
@@ -31760,6 +31960,12 @@ class AnnoCddSite {
31760
31960
  let pos = thisClass.getAdjustedResi(i, chnid, ic.matchedPos, ic.chainsSeq, ic.baseResi);
31761
31961
 
31762
31962
  html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" title="' + c + pos + '" class="icn3d-residue">' + cFull + '</span>';
31963
+ if(me.bNode) {
31964
+ let obj = {};
31965
+ obj[chnid + '_' + pos] = 'site: ' + siteArray[index].title;
31966
+ ic.resid2site[chnid].push(obj);
31967
+ }
31968
+
31763
31969
  html2 += ic.showSeqCls.insertGapOverview(chnid, i);
31764
31970
  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);
31765
31971
  //if(emptyWidth < 0) emptyWidth = 0;
@@ -31933,6 +32139,16 @@ class AnnoCddSite {
31933
32139
  //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;
31934
32140
  let pos = thisClass.getAdjustedResi(i, chnid, ic.matchedPos, ic.chainsSeq, ic.baseResi);
31935
32141
  html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" title="' + c + pos + '" class="icn3d-residue">' + cFull + '</span>';
32142
+ if(me.bNode) {
32143
+ let obj = {};
32144
+ obj[chnid + '_' + pos] = fulltitle;
32145
+ if(bDomain) {
32146
+ ic.resid2cdd[chnid].push(obj);
32147
+ }
32148
+ else {
32149
+ ic.resid2site[chnid].push(obj);
32150
+ }
32151
+ }
31936
32152
  }
31937
32153
  else {
31938
32154
  html += '<span>-</span>'; //'<span>-</span>';
@@ -32029,29 +32245,56 @@ class AnnoCddSite {
32029
32245
  let title = cFull +(i+1 + ic.baseResi[chnid]).toString();
32030
32246
  if(type == 'ssbond') {
32031
32247
  title = 'Residue ' + resid + ' has disulfide bond with';
32248
+ let sstitle = '';
32032
32249
  if(resid2resids[resid] !== undefined) {
32033
32250
  for(let j = 0, jl = resid2resids[resid].length; j < jl; ++j) {
32034
- title += ' residue ' + resid2resids[resid][j];
32251
+ sstitle += ' residue ' + resid2resids[resid][j];
32035
32252
  }
32036
32253
  }
32254
+ title += sstitle;
32255
+
32256
+ if(me.bNode) {
32257
+ let obj = {};
32258
+ obj[resid] = 'disulfide bond with' + sstitle;
32259
+ ic.resid2ssbond[chnid].push(obj);
32260
+ }
32037
32261
  }
32038
32262
  else if(type == 'crosslink') {
32039
32263
  title = 'Residue ' + resid + ' has cross-linkage with';
32264
+ let cltitle = '';
32040
32265
  if(resid2resids[resid] !== undefined) {
32041
32266
  for(let j = 0, jl = resid2resids[resid].length; j < jl; ++j) {
32042
- title += ' residue ' + resid2resids[resid][j];
32267
+ cltitle += ' residue ' + resid2resids[resid][j];
32043
32268
  }
32044
32269
  }
32270
+ title += cltitle;
32271
+
32272
+ if(me.bNode) {
32273
+ let obj = {};
32274
+ obj[resid] = 'cross-linkage with' + cltitle;
32275
+ ic.resid2crosslink[chnid].push(obj);
32276
+ }
32277
+ }
32278
+ else {
32279
+ title = 'Residue ' + resid + ' has connection with';
32280
+ let cltitle = '';
32281
+ if(resid2resids[resid] !== undefined) {
32282
+ for(let j = 0, jl = resid2resids[resid].length; j < jl; ++j) {
32283
+ cltitle += ' residue ' + resid2resids[resid][j];
32284
+ }
32285
+ }
32286
+ title += cltitle;
32045
32287
  }
32288
+
32046
32289
  html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" title="' + title + '" class="icn3d-residue">' + c + '</span>';
32047
32290
  html2 += ic.showSeqCls.insertGapOverview(chnid, i);
32048
32291
  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);
32049
32292
  //if(emptyWidth < 0) emptyWidth = 0;
32050
32293
  if(emptyWidth >= 0) {
32051
- html2 += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
32052
- html2 += '<div style="display:inline-block; background-color:#000; width:' + widthPerRes + 'px;" title="' + title + '">&nbsp;</div>';
32053
- prevEmptyWidth += emptyWidth;
32054
- prevLineWidth += widthPerRes;
32294
+ html2 += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
32295
+ html2 += '<div style="display:inline-block; background-color:#000; width:' + widthPerRes + 'px;" title="' + title + '">&nbsp;</div>';
32296
+ prevEmptyWidth += emptyWidth;
32297
+ prevLineWidth += widthPerRes;
32055
32298
  }
32056
32299
  }
32057
32300
  else {
@@ -32117,7 +32360,12 @@ class AnnoSsbond {
32117
32360
  this.showSsbond_base(chnid, chnidBase);
32118
32361
  }
32119
32362
  }
32120
- showSsbond_base(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
32363
+ showSsbond_base(chnid, chnidBase) { let ic = this.icn3d, me = ic.icn3dui;
32364
+ if(me.bNode) {
32365
+ if(!ic.resid2ssbond) ic.resid2ssbond = {};
32366
+ if(!ic.resid2ssbond[chnid]) ic.resid2ssbond[chnid] = [];
32367
+ }
32368
+
32121
32369
  let chainid = chnidBase;
32122
32370
  let resid2resids = {};
32123
32371
  let structure = chainid.substr(0, chainid.indexOf('_'));
@@ -33138,12 +33386,11 @@ class ApplyCommand {
33138
33386
  let bPosition = false;
33139
33387
  for(let i = 1, il = paraArray.length; i < il; ++i) {
33140
33388
  let wordArray = paraArray[i].split(' ');
33141
-
33142
33389
  if(wordArray[0] == 'x') {
33143
33390
  bPosition = true;
33144
- x = wordArray[1];
33145
- y = wordArray[3];
33146
- z = wordArray[5];
33391
+ x = parseFloat(wordArray[1]);
33392
+ y = parseFloat(wordArray[3]);
33393
+ z = parseFloat(wordArray[5]);
33147
33394
  }
33148
33395
  else if(wordArray[0] == 'size') {
33149
33396
  size = paraArray[i].substr(paraArray[i].lastIndexOf(' ') + 1);
@@ -33161,9 +33408,9 @@ class ApplyCommand {
33161
33408
 
33162
33409
  if(!bPosition) {
33163
33410
  let position = ic.applyCenterCls.centerAtoms(me.hashUtilsCls.hash2Atoms(ic.hAtoms, ic.atoms));
33164
- x = position.center.x;
33165
- y = position.center.y;
33166
- z = position.center.z;
33411
+ x = parseFloat(position.center.x);
33412
+ y = parseFloat(position.center.y);
33413
+ z = parseFloat(position.center.z);
33167
33414
  }
33168
33415
 
33169
33416
  ic.analysisCls.addLabel(text, x,y,z, size, color, background, type);
@@ -33634,7 +33881,23 @@ class ApplyCommand {
33634
33881
  let id = command.substr(command.lastIndexOf(' ') + 1);
33635
33882
  me.htmlCls.eventsCls.saveHtml(id);
33636
33883
  }
33637
-
33884
+ else if(command.indexOf('resdef') == 0) {
33885
+ me.cfg.resdef = command.substr(command.indexOf(' ') + 1);
33886
+ }
33887
+ else if(command.indexOf('vast_search_chainid') == 0) {
33888
+ ic.chainidArray = commandOri.substr(commandOri.indexOf(' ') + 1).split(',');
33889
+
33890
+ let bRealign = true, bPredefined = true;
33891
+ ic.realignParserCls.realignChainOnSeqAlign(undefined, ic.chainidArray, bRealign, bPredefined);
33892
+
33893
+ // reset annotations
33894
+ // $("#" + ic.pre + "dl_annotations").html("");
33895
+ // ic.bAnnoShown = false;
33896
+ // if($('#' + ic.pre + 'dl_selectannotations').dialog( 'isOpen' )) {
33897
+ // $('#' + ic.pre + 'dl_selectannotations').dialog( 'close' );
33898
+ // }
33899
+ }
33900
+
33638
33901
  // special, select ==========
33639
33902
 
33640
33903
  else if(command.indexOf('select displayed set') !== -1) {
@@ -34049,9 +34312,8 @@ class SelectByCommand {
34049
34312
  }
34050
34313
  }
34051
34314
 
34052
- selectBySpec(select, commandname, commanddesc, bDisplay) { let ic = this.icn3d, me = ic.icn3dui;
34315
+ selectBySpec(select, commandname, commanddesc, bDisplay, bNoUpdateAll) { let ic = this.icn3d, me = ic.icn3dui;
34053
34316
  select =(select.trim().substr(0, 6) === 'select') ? select.trim().substr(7) : select.trim();
34054
-
34055
34317
  ic.hAtoms = {};
34056
34318
 
34057
34319
  // selection definition is similar to Chimera: https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/frameatom_spec.html
@@ -34365,8 +34627,8 @@ class SelectByCommand {
34365
34627
  if(commandname != "") {
34366
34628
  ic.selectionCls.addCustomSelection(residueAtomArray, commandname, commanddesc, select, bSelectResidues);
34367
34629
 
34368
- let nameArray = [commandname];
34369
- ic.definedSetsCls.changeCustomAtoms(nameArray);
34630
+ let nameArray = [commandname];
34631
+ if(!bNoUpdateAll) ic.definedSetsCls.changeCustomAtoms(nameArray);
34370
34632
  }
34371
34633
  }
34372
34634
  }
@@ -36030,7 +36292,7 @@ class ParserUtils {
36030
36292
 
36031
36293
  if(rmsd) {
36032
36294
  me.htmlCls.clickMenuCls.setLogCmd("realignment RMSD: " + rmsd.toPrecision(4), false);
36033
- $("#" + ic.pre + "realignrmsd").val(rmsd.toPrecision(4));
36295
+ $("#" + ic.pre + "dl_rmsd").html("<br><b>Realignment RMSD</b>: " + rmsd.toPrecision(4) + " &#8491;<br><br>");
36034
36296
  if(!me.cfg.bSidebyside) me.htmlCls.dialogCls.openDlg('dl_rmsd', 'Realignment RMSD');
36035
36297
  }
36036
36298
 
@@ -36099,7 +36361,7 @@ class ParserUtils {
36099
36361
  resi2pos_q[resi] = i + 1;
36100
36362
  }
36101
36363
 
36102
- for(let i = 0, il = ic.realignResid[struct_t].length; i < il; ++i) {
36364
+ for(let i = 0, il = ic.realignResid[struct_t].length; i < il && i < ic.realignResid[struct_q].length; ++i) {
36103
36365
  let resid_t = ic.realignResid[struct_t][i].resid;
36104
36366
  let pos_t = resid_t.lastIndexOf('_');
36105
36367
  let resi_t = parseInt(resid_t.substr(pos_t + 1));
@@ -36400,7 +36662,7 @@ class ParserUtils {
36400
36662
  let rmsd = ic.rmsd_supr.rmsd;
36401
36663
 
36402
36664
  me.htmlCls.clickMenuCls.setLogCmd("RMSD of alignment to OPM: " + rmsd.toPrecision(4), false);
36403
- $("#" + ic.pre + "realignrmsd").val(rmsd.toPrecision(4));
36665
+ $("#" + ic.pre + "dl_rmsd").html("<br><b>RMSD of alignment to OPM</b>: " + rmsd.toPrecision(4) + " &#8491;<br><br>");
36404
36666
  if(!me.cfg.bSidebyside) me.htmlCls.dialogCls.openDlg('dl_rmsd', 'RMSD of alignment to OPM');
36405
36667
 
36406
36668
  let dxymaxsq = 0;
@@ -36700,7 +36962,7 @@ class MmcifParser {
36700
36962
 
36701
36963
  //Ajax call was used to get the atom data from the "mmcifid". This function was deferred
36702
36964
  //so that it can be chained together with other deferred functions for sequential execution.
36703
- downloadMmcif(mmcifid) { let ic = this.icn3d, me = ic.icn3dui;
36965
+ downloadMmcif(mmcifid) { let ic = this.icn3d; ic.icn3dui;
36704
36966
  let thisClass = this;
36705
36967
 
36706
36968
  let url, dataType;
@@ -36726,34 +36988,7 @@ class MmcifParser {
36726
36988
  //ic.ParserUtilsCls.hideLoading();
36727
36989
  },
36728
36990
  success: function(data) {
36729
- url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
36730
- $.ajax({
36731
- url: url,
36732
- type: 'POST',
36733
- data : {'mmciffile': data},
36734
- dataType: 'jsonp',
36735
- cache: true,
36736
- tryCount : 0,
36737
- retryLimit : 0, //1
36738
- beforeSend: function() {
36739
- ic.ParserUtilsCls.showLoading();
36740
- },
36741
- complete: function() {
36742
- //ic.ParserUtilsCls.hideLoading();
36743
- },
36744
- success: function(data) {
36745
- thisClass.loadMmcifData(data, mmcifid);
36746
- },
36747
- error : function(xhr, textStatus, errorThrown ) {
36748
- this.tryCount++;
36749
- if(this.tryCount <= this.retryLimit) {
36750
- //try again
36751
- $.ajax(this);
36752
- return;
36753
- }
36754
- return;
36755
- }
36756
- });
36991
+ thisClass.parseMmcifData(data, mmcifid);
36757
36992
  },
36758
36993
  error : function(xhr, textStatus, errorThrown ) {
36759
36994
  this.tryCount++;
@@ -36767,6 +37002,40 @@ class MmcifParser {
36767
37002
  });
36768
37003
  }
36769
37004
 
37005
+ parseMmcifData(data, mmcifid, command) { let ic = this.icn3d, me = ic.icn3dui;
37006
+ let thisClass = this;
37007
+
37008
+ let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
37009
+ $.ajax({
37010
+ url: url,
37011
+ type: 'POST',
37012
+ data : {'mmciffile': data},
37013
+ dataType: 'jsonp',
37014
+ cache: true,
37015
+ tryCount : 0,
37016
+ retryLimit : 0, //1
37017
+ beforeSend: function() {
37018
+ ic.ParserUtilsCls.showLoading();
37019
+ },
37020
+ complete: function() {
37021
+ //ic.ParserUtilsCls.hideLoading();
37022
+ },
37023
+ success: function(data) {
37024
+ thisClass.loadMmcifData(data, mmcifid);
37025
+ if(command) ic.loadScriptCls.loadScript(command);
37026
+ },
37027
+ error : function(xhr, textStatus, errorThrown ) {
37028
+ this.tryCount++;
37029
+ if(this.tryCount <= this.retryLimit) {
37030
+ //try again
37031
+ $.ajax(this);
37032
+ return;
37033
+ }
37034
+ return;
37035
+ }
37036
+ });
37037
+ }
37038
+
36770
37039
  downloadMmcifSymmetry(mmcifid, type) { let ic = this.icn3d; ic.icn3dui;
36771
37040
  let thisClass = this;
36772
37041
 
@@ -37309,6 +37578,7 @@ class HlSeq {
37309
37578
 
37310
37579
  if($(that).hasClass('icn3d-seqTitle')) {
37311
37580
  let chainid = $(that).attr('chain');
37581
+ let resn = $(that).attr('resn');
37312
37582
 
37313
37583
  if(ic.bAlignSeq) {
37314
37584
  ic.bSelectAlignResidue = false;
@@ -37333,20 +37603,24 @@ class HlSeq {
37333
37603
  }
37334
37604
 
37335
37605
  $(that).toggleClass('icn3d-highlightSeq');
37336
-
37337
37606
  let commandname, commanddescr, position;
37338
- if(!ic.bAnnotations) {
37339
- if(ic.bAlignSeq) {
37340
- commandname = "align_" + chainid;
37607
+ if(resn) {
37608
+ commandname = resn;
37609
+ }
37610
+ else {
37611
+ if(!ic.bAnnotations) {
37612
+ if(ic.bAlignSeq) {
37613
+ commandname = "align_" + chainid;
37614
+ }
37615
+ else {
37616
+ commandname = chainid;
37617
+ }
37341
37618
  }
37342
37619
  else {
37343
- commandname = chainid;
37620
+ commandname = $(that).attr('setname');
37621
+ commanddescr = $(that).attr('title');
37344
37622
  }
37345
37623
  }
37346
- else {
37347
- commandname = $(that).attr('setname');
37348
- commanddescr = $(that).attr('title');
37349
- }
37350
37624
 
37351
37625
  if($(that).hasClass('icn3d-highlightSeq')) {
37352
37626
  if(!ic.bAnnotations) {
@@ -37356,14 +37630,13 @@ class HlSeq {
37356
37630
  }
37357
37631
  else {
37358
37632
  ic.currSelectedSets = [commandname];
37359
- //ic.selectionCls.selectAChain(chainid, commandname, true);
37360
37633
  ic.selectionCls.selectAChain(chainid, commandname, ic.bAlignSeq);
37361
37634
  }
37362
37635
 
37363
37636
  if(ic.bAlignSeq) {
37364
37637
  me.htmlCls.clickMenuCls.setLogCmd('select alignChain ' + chainid, true);
37365
37638
  }
37366
- else {
37639
+ else {
37367
37640
  me.htmlCls.clickMenuCls.setLogCmd('select chain ' + chainid, true);
37368
37641
  }
37369
37642
 
@@ -37378,14 +37651,35 @@ class HlSeq {
37378
37651
  if($(that).attr('gi') !== undefined) {
37379
37652
  if(ic.bCtrl || ic.bShift) {
37380
37653
  ic.currSelectedSets.push(chainid);
37381
- ic.selectionCls.selectAChain(chainid, chainid, false, true);
37654
+ if(resn) {
37655
+ let prevHAtoms = me.hashUtilsCls.cloneHash(ic.hAtoms);
37656
+ let bNoUpdateAll = true;
37657
+ ic.selByCommCls.selectBySpec('select :3' + resn, commandname, commandname, false, bNoUpdateAll);
37658
+ ic.hAtoms = me.hashUtilsCls.unionHash(ic.hAtoms, prevHAtoms);
37659
+ ic.hlUpdateCls.updateHlAll(resn, undefined, true, true);
37660
+ }
37661
+ else {
37662
+ ic.selectionCls.selectAChain(chainid, chainid, false, true);
37663
+ }
37382
37664
  }
37383
37665
  else {
37384
37666
  ic.currSelectedSets = [chainid];
37385
- ic.selectionCls.selectAChain(chainid, chainid, false);
37667
+ if(resn) {
37668
+ let bNoUpdateAll = true;
37669
+ ic.selByCommCls.selectBySpec('select :3' + resn, commandname, commandname, false, bNoUpdateAll);
37670
+ ic.hlUpdateCls.updateHlAll(resn, undefined, true, true);
37671
+ }
37672
+ else {
37673
+ ic.selectionCls.selectAChain(chainid, chainid, false);
37674
+ }
37386
37675
  }
37387
37676
 
37388
- me.htmlCls.clickMenuCls.setLogCmd('select chain ' + chainid, true);
37677
+ if(resn) {
37678
+ me.htmlCls.clickMenuCls.setLogCmd('select :3' + resn, true);
37679
+ }
37680
+ else {
37681
+ me.htmlCls.clickMenuCls.setLogCmd('select chain ' + chainid, true);
37682
+ }
37389
37683
 
37390
37684
  let setNames = ic.currSelectedSets.join(' or ');
37391
37685
  //if(ic.currSelectedSets.length > 1) me.htmlCls.clickMenuCls.setLogCmd('select saved atoms ' + setNames, true);
@@ -37600,8 +37894,7 @@ class ShowAnno {
37600
37894
  }
37601
37895
 
37602
37896
  //show annotations such as SNPs, ClinVar, domains, binding sites, etc.
37603
- showAnnotations() { let ic = this.icn3d, me = ic.icn3dui;
37604
- let thisClass = this;
37897
+ showAnnotations_part1() { let ic = this.icn3d, me = ic.icn3dui;
37605
37898
  me.htmlCls.dialogCls.openDlg('dl_selectannotations', 'Sequences and Annotations');
37606
37899
  // add note about assembly
37607
37900
  if((ic.bAssemblyNote === undefined || !ic.bAssemblyNote) && ic.asuCnt !== undefined ) {
@@ -37623,6 +37916,9 @@ class ShowAnno {
37623
37916
  ic.annotationCls.setAnnoView('overview');
37624
37917
  }
37625
37918
 
37919
+ let nucleotide_chainid = {}, chemical_chainid = {}, chemical_set = {};
37920
+ ic.protein_chainid = {};
37921
+
37626
37922
  if(ic.bAnnoShown === undefined || !ic.bAnnoShown || ic.bResetAnno) { // ic.bResetAnno when loading another structure
37627
37923
  let chainArray = Object.keys(ic.chains);
37628
37924
 
@@ -37631,7 +37927,13 @@ class ShowAnno {
37631
37927
  if(ic.resi2disease_nonempty === undefined) ic.resi2disease_nonempty = {};
37632
37928
  if(ic.baseResi === undefined) ic.baseResi = {};
37633
37929
  if(ic.matchedPos === undefined) ic.matchedPos = {};
37634
- let dialogWidth =(me.cfg.notebook) ? me.htmlCls.WIDTH / 2 : $("#" + ic.pre + "dl_selectannotations").dialog( "option", "width" );
37930
+ let dialogWidth;
37931
+ if(me.bNode) { // no $().dialog
37932
+ dialogWidth = 500;
37933
+ }
37934
+ else {
37935
+ dialogWidth =(me.cfg.notebook) ? me.htmlCls.WIDTH / 2 : $("#" + ic.pre + "dl_selectannotations").dialog( "option", "width" );
37936
+ }
37635
37937
  ic.seqAnnWidth = dialogWidth - 120 - 30*2 - 50; // title: 120px, start and end resi: 30px, extra space on the left and right: 50px
37636
37938
  ic.maxAnnoLength = 1;
37637
37939
  for(let chainid in ic.chainsSeq) {
@@ -37639,8 +37941,7 @@ class ShowAnno {
37639
37941
  ic.maxAnnoLength = ic.chainsSeq[chainid].length;
37640
37942
  }
37641
37943
  }
37642
- let nucleotide_chainid = {}, chemical_chainid = {}, chemical_set = {};
37643
- ic.protein_chainid = {};
37944
+
37644
37945
  for(let i = 0, il = chainArray.length; i < il; ++i) {
37645
37946
  Math.round(chainArray[i].indexOf('_'));
37646
37947
  //if(pos > 4) continue; // NMR structures with structure id such as 2K042,2K043, ...
@@ -37698,7 +37999,21 @@ class ShowAnno {
37698
37999
  } // for(let r = 0
37699
38000
  } // if(me.cfg.mmdbid
37700
38001
  } // for(let i = 0
38002
+ }
37701
38003
 
38004
+ return {'nucleotide_chainid': nucleotide_chainid, 'chemical_chainid': chemical_chainid, 'chemical_set': chemical_set};
38005
+ }
38006
+
38007
+ showAnnotations() { let ic = this.icn3d, me = ic.icn3dui;
38008
+ let thisClass = this;
38009
+
38010
+ let result = this.showAnnotations_part1();
38011
+
38012
+ let nucleotide_chainid = result.nucleotide_chainid;
38013
+ let chemical_chainid = result.chemical_chainid;
38014
+ let chemical_set = result.chemical_set;
38015
+
38016
+ if(ic.bAnnoShown === undefined || !ic.bAnnoShown || ic.bResetAnno) { // ic.bResetAnno when loading another structure
37702
38017
  if(me.cfg.blast_rep_id === undefined) {
37703
38018
  if(ic.bFullUi) {
37704
38019
  if(me.cfg.mmtfid !== undefined) { // mmtf data do NOT have the missing residues
@@ -37814,8 +38129,10 @@ class ShowAnno {
37814
38129
  }
37815
38130
  ic.bAnnoShown = true;
37816
38131
  }
38132
+
37817
38133
  showAnnoSeqData(nucleotide_chainid, chemical_chainid, chemical_set) { let ic = this.icn3d, me = ic.icn3dui;
37818
- this.getAnnotationData();
38134
+ if(!me.bNode) this.getAnnotationData();
38135
+
37819
38136
  let i = 0;
37820
38137
  for(let chain in nucleotide_chainid) {
37821
38138
  this.getSequenceData(chain, nucleotide_chainid[chain], 'nucleotide', i);
@@ -37838,12 +38155,15 @@ class ShowAnno {
37838
38155
  this.getCombinedSequenceData(name, chemical_set[name], i);
37839
38156
  ++i;
37840
38157
  }
37841
- this.enableHlSeq();
37842
38158
 
37843
- setTimeout(function(){
37844
- ic.annotationCls.hideAllAnno();
37845
- ic.annotationCls.clickCdd();
37846
- }, 0);
38159
+ if(!me.bNode) {
38160
+ this.enableHlSeq();
38161
+
38162
+ setTimeout(function(){
38163
+ ic.annotationCls.hideAllAnno();
38164
+ ic.annotationCls.clickCdd();
38165
+ }, 0);
38166
+ }
37847
38167
  }
37848
38168
 
37849
38169
  getAnnotationData() { let ic = this.icn3d, me = ic.icn3dui;
@@ -37880,15 +38200,17 @@ class ShowAnno {
37880
38200
  $("#" + ic.pre + "anno_" + chnid).append("<br><hr><br>");
37881
38201
  ++index;
37882
38202
  }
37883
- ic.annoCddSiteCls.setToolTip();
38203
+
38204
+ if(!me.bNode) ic.annoCddSiteCls.setToolTip();
38205
+
37884
38206
  // show the sequence and 3D structure
37885
38207
  //var url = "https://eme.utilsCls.ncbi.nlm.nih.gov/entrez/eUtilsCls/efetch.fcgi?db=protein&retmode=json&rettype=fasta&id=" + chnidBaseArray;
37886
38208
  let url = me.htmlCls.baseUrl + "/vastdyn/vastdyn.cgi?chainlist=" + chnidBaseArray;
37887
38209
 
37888
- if(ic.chainid_seq !== undefined) {
38210
+ if(ic.chainid_seq !== undefined) {
37889
38211
  this.processSeqData(ic.chainid_seq);
37890
38212
  }
37891
- else {
38213
+ else {
37892
38214
  $.ajax({
37893
38215
  url: url,
37894
38216
  dataType: 'jsonp', //'text',
@@ -37907,7 +38229,7 @@ class ShowAnno {
37907
38229
  return;
37908
38230
  }
37909
38231
  thisClass.enableHlSeq();
37910
- console.log( "No data were found for the protein " + chnidBaseArray + "..." );
38232
+ if(!me.bNode) console.log( "No data were found for the protein " + chnidBaseArray + "..." );
37911
38233
  for(let chnid in ic.protein_chainid) {
37912
38234
  let chnidBase = ic.protein_chainid[chnid];
37913
38235
  ic.showSeqCls.setAlternativeSeq(chnid, chnidBase);
@@ -37963,7 +38285,7 @@ class ShowAnno {
37963
38285
  let firstChainid = residArray[0].substr(0, pos);
37964
38286
  let sid =(me.cfg.mmdbid !== undefined && ic.chainid2sid !== undefined) ? ic.chainid2sid[firstChainid] : undefined;
37965
38287
  if(sid !== undefined) {
37966
- 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>";
38288
+ 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>";
37967
38289
  }
37968
38290
  else {
37969
38291
  chemName = "<b>" + name + "</b>";
@@ -37975,7 +38297,8 @@ class ShowAnno {
37975
38297
  // sequence, detailed view
37976
38298
  let htmlTmp = '<div id="' + ic.pre + 'giseq_sequence" class="icn3d-dl_sequence">';
37977
38299
  let chainType = 'Chem.', chainTypeFull = 'Chemical';
37978
- htmlTmp += '<div class="icn3d-seqTitle2" anno="sequence"><span style="white-space:nowrap;" title="' + chainTypeFull + ' ' + name + '">' + chainType + ' ' + name + '</span></div>';
38300
+ //htmlTmp += '<div class="icn3d-seqTitle2" anno="sequence"><span style="white-space:nowrap;" title="' + chainTypeFull + ' ' + name + '">' + chainType + ' ' + name + '</span></div>';
38301
+ 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>';
37979
38302
  htmlTmp += '<span class="icn3d-residueNum" style="width:60px!important;" title="starting protein sequence number">Count: ' + residArray.length + '</span>';
37980
38303
  htmlTmp += '<span class="icn3d-seqLine">';
37981
38304
  // sequence, overview
@@ -38032,7 +38355,7 @@ class ShowAnno {
38032
38355
  }
38033
38356
  }
38034
38357
  else {
38035
- console.log( "No data were found for the protein " + chnid + "..." );
38358
+ if(!me.bNode) console.log( "No data were found for the protein " + chnid + "..." );
38036
38359
  ic.showSeqCls.setAlternativeSeq(chnid, chnidBase);
38037
38360
  }
38038
38361
  if(me.cfg.blast_rep_id != chnid) {
@@ -38221,9 +38544,12 @@ class ShowAnno {
38221
38544
  ic.hAtoms = me.hashUtilsCls.cloneHash(prevHAtoms);
38222
38545
  } // align seq to structure
38223
38546
  } // for loop
38224
- this.enableHlSeq();
38225
- // get CDD/Binding sites
38226
- ic.annoCddSiteCls.showCddSiteAll();
38547
+
38548
+ if(!me.bNode) {
38549
+ this.enableHlSeq();
38550
+ // get CDD/Binding sites
38551
+ ic.annoCddSiteCls.showCddSiteAll();
38552
+ }
38227
38553
  }
38228
38554
 
38229
38555
  enableHlSeq() { let ic = this.icn3d, me = ic.icn3dui;
@@ -38316,6 +38642,10 @@ class AnnoContact {
38316
38642
  }
38317
38643
  }
38318
38644
  showInteraction_base(chnid, chnidBase) { let ic = this.icn3d, me = ic.icn3dui;
38645
+ if(me.bNode) {
38646
+ if(!ic.resid2contact) ic.resid2contact = {};
38647
+ if(!ic.resid2contact[chnid]) ic.resid2contact[chnid] = [];
38648
+ }
38319
38649
  // set interaction
38320
38650
  if(ic.chainname2residues === undefined) ic.chainname2residues = {};
38321
38651
  let radius = 4;
@@ -38425,6 +38755,12 @@ class AnnoContact {
38425
38755
  // let pos = ic.chainsSeq[chnid][i - ic.matchedPos[chnid] ].resi;
38426
38756
  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;
38427
38757
  html += '<span id="' + pre + '_' + ic.pre + chnid + '_' + pos + '" title="' + cFull + pos + '" class="icn3d-residue">' + c + '</span>';
38758
+ if(me.bNode) {
38759
+ let obj = {};
38760
+ obj[chnid + '_' + pos] = fulltitle;
38761
+ ic.resid2contact[chnid].push(obj);
38762
+ }
38763
+
38428
38764
  html2 += ic.showSeqCls.insertGapOverview(chnid, i);
38429
38765
  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);
38430
38766
  //if(emptyWidth < 0) emptyWidth = 0;
@@ -38485,11 +38821,17 @@ class AnnoCrossLink {
38485
38821
  this.showCrosslink_base(chnid, chnidBase);
38486
38822
  }
38487
38823
  }
38488
- showCrosslink_base(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
38824
+ showCrosslink_base(chnid, chnidBase) { let ic = this.icn3d, me = ic.icn3dui;
38825
+ if(me.bNode) {
38826
+ if(!ic.resid2crosslink) ic.resid2crosslink = {};
38827
+ if(!ic.resid2crosslink[chnid]) ic.resid2crosslink[chnid] = [];
38828
+ }
38829
+
38489
38830
  let chainid = chnidBase;
38490
38831
  let resid2resids = {};
38491
38832
  let structure = chainid.substr(0, chainid.indexOf('_'));
38492
38833
  let clbondArray = ic.clbondpnts[structure];
38834
+
38493
38835
  if(clbondArray === undefined) {
38494
38836
  $("#" + ic.pre + "dt_crosslink_" + chnid).html('');
38495
38837
  $("#" + ic.pre + "ov_crosslink_" + chnid).html('');
@@ -38526,16 +38868,16 @@ class AnnoDomain {
38526
38868
  this.icn3d = icn3d;
38527
38869
  }
38528
38870
 
38529
- showDomainPerStructure(index) { let ic = this.icn3d, me = ic.icn3dui;
38871
+ showDomainPerStructure(index) { let ic = this.icn3d; ic.icn3dui;
38530
38872
  let thisClass = this;
38531
38873
  //var chnid = Object.keys(ic.protein_chainid)[0];
38532
38874
  //var pdbid = chnid.substr(0, chnid.indexOf('_'));
38533
38875
  let pdbArray = Object.keys(ic.structures);
38534
38876
  // show 3D domains
38535
38877
  let pdbid = pdbArray[index];
38536
- me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&domain&molinfor&uid=" + pdbid;
38878
+ //let url = me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&domain&molinfor&uid=" + pdbid;
38537
38879
 
38538
- if(index == 0 && ic.mmdb_data !== undefined) {
38880
+ if(index == 0 && ic.mmdb_data !== undefined) {
38539
38881
  for(let chnid in ic.protein_chainid) {
38540
38882
  if(chnid.indexOf(pdbid) !== -1) {
38541
38883
  this.showDomainWithData(chnid, ic.mmdb_data);
@@ -38549,7 +38891,7 @@ class AnnoDomain {
38549
38891
  }
38550
38892
  }
38551
38893
  }
38552
- else {
38894
+ else {
38553
38895
  // calculate 3D domains on-the-fly
38554
38896
  //ic.protein_chainid[chainArray[i]]
38555
38897
  let data = {};
@@ -38606,6 +38948,7 @@ class AnnoDomain {
38606
38948
  for(let i = 0, il = pdbArray.length; i < il; ++i) {
38607
38949
  ic.bAjaxDoneArray[i] = false;
38608
38950
  }
38951
+
38609
38952
  for(let i = 0, il = pdbArray.length; i < il; ++i) {
38610
38953
  this.showDomainPerStructure(i);
38611
38954
  }
@@ -38650,6 +38993,7 @@ class AnnoDomain {
38650
38993
  let fromArray = [], toArray = [];
38651
38994
  let resiHash = {};
38652
38995
  let resCnt = 0;
38996
+
38653
38997
  for(let i = 0, il = subdomainArray.length; i < il; ++i) {
38654
38998
  let domainFrom = Math.round(subdomainArray[i][0]) - 1; // convert 1-based to 0-based
38655
38999
  let domainTo = Math.round(subdomainArray[i][1]) - 1;
@@ -38676,6 +39020,25 @@ class AnnoDomain {
38676
39020
  resiHash[j+1] = 1;
38677
39021
  }
38678
39022
  }
39023
+
39024
+ // save 3D domain info for node.js script
39025
+ if(me.bNode) {
39026
+ let domainName = '3D domain ' +(index+1).toString();
39027
+
39028
+ if(!ic.resid2domain) ic.resid2domain = {};
39029
+ if(!ic.resid2domain[chnid]) ic.resid2domain[chnid] = [];
39030
+ for(let i = 0, il = fromArray.length; i < il; ++i) {
39031
+ let from = fromArray[i];
39032
+ let to = toArray[i];
39033
+ for(let j = from; j <= to; ++j) {
39034
+ // 0-based
39035
+ let obj = {};
39036
+ obj[chnid + '_' + (j+1).toString()] = domainName;
39037
+ ic.resid2domain[chnid].push(obj);
39038
+ }
39039
+ }
39040
+ }
39041
+
38679
39042
  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>';
38680
39043
  let htmlTmp3 = '<span class="icn3d-residueNum" title="residue count">' + resCnt.toString() + ' Res</span>';
38681
39044
  html3 += htmlTmp2 + htmlTmp3 + '<br>';
@@ -38755,6 +39118,59 @@ class AnnoSnpClinVar {
38755
39118
  this.icn3d = icn3d;
38756
39119
  }
38757
39120
 
39121
+ showSnp(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
39122
+ this.showSnpClinvar(chnid, chnidBase, true);
39123
+ }
39124
+ showClinvar(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
39125
+ this.showSnpClinvar(chnid, chnidBase, false);
39126
+ }
39127
+
39128
+ //Show the annotations of SNPs and ClinVar.
39129
+ showSnpClinvar(chnid, chnidBase, bSnpOnly) { let ic = this.icn3d, me = ic.icn3dui;
39130
+ let thisClass = this;
39131
+
39132
+ // get gi from acc
39133
+ //var url2 = "https://www.ncbi.nlm.nih.gov/Structure/icn3d/chainid2repgi.txt";
39134
+ let url2 = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid=" + chnidBase;
39135
+ $.ajax({
39136
+ url: url2,
39137
+ dataType: 'jsonp', //'text',
39138
+ cache: true,
39139
+ tryCount : 0,
39140
+ retryLimit : 0, //1
39141
+ success: function(data2) {
39142
+ //ic.chainid2repgi = JSON.parse(data2);
39143
+ //var gi = ic.chainid2repgi[chnidBase];
39144
+ let snpgi = data2.snpgi;
39145
+ let gi = data2.gi;
39146
+ if(bSnpOnly) {
39147
+ thisClass.showSnpPart2(chnid, chnidBase, snpgi);
39148
+ }
39149
+ else {
39150
+ 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];
39151
+ let giUsed = snpgi;
39152
+ if(specialGiArray.includes(gi)) giUsed = gi;
39153
+ thisClass.showClinvarPart2(chnid, chnidBase, giUsed);
39154
+ }
39155
+ },
39156
+ error : function(xhr, textStatus, errorThrown ) {
39157
+ this.tryCount++;
39158
+ if(this.tryCount <= this.retryLimit) {
39159
+ //try again
39160
+ $.ajax(this);
39161
+ return;
39162
+ }
39163
+ if(bSnpOnly) {
39164
+ thisClass.processNoSnp(chnid);
39165
+ }
39166
+ else {
39167
+ thisClass.processNoClinvar(chnid);
39168
+ }
39169
+ return;
39170
+ }
39171
+ });
39172
+ }
39173
+
38758
39174
  navClinVar(chnid) { let ic = this.icn3d; ic.icn3dui;
38759
39175
  let thisClass = this;
38760
39176
  ic.currClin[chnid] = - 1;
@@ -39190,7 +39606,7 @@ class AnnoSnpClinVar {
39190
39606
 
39191
39607
  return html;
39192
39608
  }
39193
- processSnpClinvar(data, chnid, chnidBase, bSnpOnly, bVirus) { let ic = this.icn3d; ic.icn3dui;
39609
+ processSnpClinvar(data, chnid, chnidBase, bSnpOnly, bVirus) { let ic = this.icn3d, me = ic.icn3dui;
39194
39610
  let html = '<div id="' + ic.pre + chnid + '_snpseq_sequence" class="icn3d-dl_sequence">';
39195
39611
  let html2 = html;
39196
39612
  let html3 = html;
@@ -39207,6 +39623,16 @@ class AnnoSnpClinVar {
39207
39623
  let resi2clinAllele = {};
39208
39624
  let posHash = {}, posClinHash = {};
39209
39625
  let prevSnpStr = '';
39626
+ if(me.bNode) {
39627
+ if(bSnpOnly) {
39628
+ if(!ic.resid2snp) ic.resid2snp = {};
39629
+ if(!ic.resid2snp[chnid]) ic.resid2snp[chnid] = [];
39630
+ }
39631
+ else {
39632
+ if(!ic.resid2clinvar) ic.resid2clinvar = {};
39633
+ if(!ic.resid2clinvar[chnid]) ic.resid2clinvar[chnid] = [];
39634
+ }
39635
+ }
39210
39636
  for(let i = 0, il = lineArray.length; i < il; ++i) {
39211
39637
  //bSnpOnly: false
39212
39638
  //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
@@ -39220,6 +39646,19 @@ class AnnoSnpClinVar {
39220
39646
  prevSnpStr = snpStr;
39221
39647
  let resiStr = snpStr.substr(0, snpStr.length - 3);
39222
39648
  let resi = Math.round(resiStr);
39649
+
39650
+ if(me.bNode) {
39651
+ let obj = {};
39652
+ obj[chnid + '_' + resi] = snpStr;
39653
+
39654
+ if(bSnpOnly) {
39655
+ ic.resid2snp[chnid].push(obj);
39656
+ }
39657
+ else {
39658
+ ic.resid2clinvar[chnid].push(obj);
39659
+ }
39660
+ }
39661
+
39223
39662
  snpStr.substr(snpStr.length - 3, 1);
39224
39663
  let snpRes = snpStr.substr(snpStr.indexOf('>') + 1); //snpStr.substr(snpStr.length - 1, 1);
39225
39664
  //var rsnum = bSnpOnly ? '' : fieldArray[4];
@@ -39347,58 +39786,7 @@ class AnnoSnpClinVar {
39347
39786
  }
39348
39787
  });
39349
39788
  }
39350
- showSnp(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
39351
- this.showSnpClinvar(chnid, chnidBase, true);
39352
- }
39353
- showClinvar(chnid, chnidBase) { let ic = this.icn3d; ic.icn3dui;
39354
- this.showSnpClinvar(chnid, chnidBase, false);
39355
- }
39356
-
39357
- //Show the annotations of SNPs and ClinVar.
39358
- showSnpClinvar(chnid, chnidBase, bSnpOnly) { let ic = this.icn3d, me = ic.icn3dui;
39359
- let thisClass = this;
39360
39789
 
39361
- // get gi from acc
39362
- //var url2 = "https://www.ncbi.nlm.nih.gov/Structure/icn3d/chainid2repgi.txt";
39363
- let url2 = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid=" + chnidBase;
39364
- $.ajax({
39365
- url: url2,
39366
- dataType: 'jsonp', //'text',
39367
- cache: true,
39368
- tryCount : 0,
39369
- retryLimit : 0, //1
39370
- success: function(data2) {
39371
- //ic.chainid2repgi = JSON.parse(data2);
39372
- //var gi = ic.chainid2repgi[chnidBase];
39373
- let snpgi = data2.snpgi;
39374
- let gi = data2.gi;
39375
- if(bSnpOnly) {
39376
- thisClass.showSnpPart2(chnid, chnidBase, snpgi);
39377
- }
39378
- else {
39379
- 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];
39380
- let giUsed = snpgi;
39381
- if(specialGiArray.includes(gi)) giUsed = gi;
39382
- thisClass.showClinvarPart2(chnid, chnidBase, giUsed);
39383
- }
39384
- },
39385
- error : function(xhr, textStatus, errorThrown ) {
39386
- this.tryCount++;
39387
- if(this.tryCount <= this.retryLimit) {
39388
- //try again
39389
- $.ajax(this);
39390
- return;
39391
- }
39392
- if(bSnpOnly) {
39393
- thisClass.processNoSnp(chnid);
39394
- }
39395
- else {
39396
- thisClass.processNoClinvar(chnid);
39397
- }
39398
- return;
39399
- }
39400
- });
39401
- }
39402
39790
  showSnpPart2(chnid, chnidBase, gi) { let ic = this.icn3d; ic.icn3dui;
39403
39791
  let thisClass = this;
39404
39792
  if(gi !== undefined) {
@@ -43044,14 +43432,13 @@ class Label {
43044
43432
  }
43045
43433
  else {
43046
43434
  let factor = (label.factor) ? oriFactor * label.factor : oriFactor;
43047
-
43048
43435
  bb = this.textSpriteCls.makeTextSprite(label.text, {fontsize: parseInt(labelsize), textColor: labelcolor, borderColor: labelbackground, backgroundColor: labelbackground, alpha: labelalpha, bSchematic: 0, factor: factor});
43049
43436
  }
43050
43437
  }
43051
43438
 
43052
43439
  let labelOffset = (name == 'schematic' || name == 'residue') ? 0 : ic.coilWidth; // 0.3
43053
- bb.position.set(label.position.x + labelOffset, label.position.y + labelOffset, label.position.z + labelOffset);
43054
- ic.mdl.add(bb);
43440
+ bb.position.set(parseFloat(label.position.x) + labelOffset, parseFloat(label.position.y) + labelOffset, parseFloat(label.position.z) + labelOffset);
43441
+ ic.mdl.add(bb);
43055
43442
  // do not add labels to objects for pk
43056
43443
  }
43057
43444
  }
@@ -55345,10 +55732,10 @@ class SetMenu {
55345
55732
  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>";
55346
55733
  }
55347
55734
 
55348
- setIcon(iconType, id, title, iconStyle, url, bText) { let me = this.icn3dui;
55735
+ setIcon(iconType, id, title, iconStyle, url, bText, bHighlight) { let me = this.icn3dui;
55349
55736
  if(me.bNode) return '';
55350
55737
 
55351
- let color = 'color:#1c94c4; ';
55738
+ let color = (bHighlight) ? 'color:#f8b84e; ' : 'color:#1c94c4; ';
55352
55739
  let bkgdColor = ' background-color:#EEE; ';
55353
55740
  let cssCursor = (iconType == 'text') ? '' : 'cursor:pointer;';
55354
55741
 
@@ -55395,7 +55782,7 @@ class SetMenu {
55395
55782
  // View menu
55396
55783
  html += tdStrBorder + this.setIcon(iconType, 'show_selected', 'View Selection', 'eye') + "</td>";
55397
55784
  html += tdStr + this.setIcon(iconType, 'tool_selectedcenter', 'Zoom in Selection', 'search-plus') + "</td>";
55398
- html += tdStr + this.setIcon(iconType, 'alternate', "Alternate the Structures by keying the letter 'a'", 'a', undefined, true) + "</td>";
55785
+ html += tdStr + this.setIcon(iconType, 'alternate', "Alternate the Structures by keying the letter 'a'", 'a', undefined, true, true) + "</td>";
55399
55786
  html += tdStr + this.setIcon(iconType, 'tool_resetOrientation', 'Reset Orientation', 'undo-alt') + "</td>";
55400
55787
 
55401
55788
  // Style menu
@@ -55609,7 +55996,9 @@ class SetMenu {
55609
55996
 
55610
55997
  html += "<li id='" + me.pre + "mn2_realignWrap'><span>Realign Selection</span>";
55611
55998
  html += "<ul>";
55612
- html += me.htmlCls.setHtmlCls.getRadio('mn2_realign', 'mn2_realignonstruct', 'by Structure Alignment ' + me.htmlCls.wifiStr, true);
55999
+
56000
+ html += me.htmlCls.setHtmlCls.getRadio('mn2_realign', 'mn2_realignonstruct', 'by Structure Alignment ' + me.htmlCls.wifiStr);
56001
+
55613
56002
  html += me.htmlCls.setHtmlCls.getRadio('mn2_realign', 'mn2_realignonseqalign', 'by Sequence Alignment ' + me.htmlCls.wifiStr);
55614
56003
  html += me.htmlCls.setHtmlCls.getRadio('mn2_realign', 'mn2_realignresbyres', 'Residue by Residue');
55615
56004
  html += "</ul>";
@@ -57393,10 +57782,10 @@ class Dialog {
57393
57782
  height = 500;
57394
57783
  }
57395
57784
  else if(id === me.pre + 'dl_rmsd') {
57396
- position ={ my: "right top", at: "right top", of: "#" + me.pre + "canvas", collision: "none" };
57785
+ position ={ my: "left bottom", at: "left+20 bottom-20", of: "#" + me.pre + "canvas", collision: "none" };
57397
57786
  }
57398
57787
  else if(id === me.pre + 'dl_legend') {
57399
- position ={ my: "right top", at: "right-20 top+60", of: "#" + me.pre + "canvas", collision: "none" };
57788
+ position ={ my: "left bottom", at: "left+20 bottom-20", of: "#" + me.pre + "canvas", collision: "none" };
57400
57789
  }
57401
57790
  else if(id === me.pre + 'dl_symd') {
57402
57791
  position ={ my: "left top", at: "right-200 bottom-200", of: "#" + me.pre + "canvas", collision: "none" };
@@ -57706,23 +58095,19 @@ class SetDialog {
57706
58095
 
57707
58096
  html += me.htmlCls.divStr + "dl_alignaf' class='" + dialogClass + "'>";
57708
58097
  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/>";
57709
- html += me.htmlCls.buttonStr + "reload_alignaf'>Align</button>";
58098
+ 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>";
57710
58099
  html += "</div>";
57711
58100
 
57712
58101
  html += me.htmlCls.divStr + "dl_chainalign' class='" + dialogClass + "'>";
57713
- /*
57714
- 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/>";
57715
- html += me.htmlCls.buttonStr + "reload_chainalign'>Align</button><br/><br/>";
57716
- 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>";
57717
- html += "</div>";
57718
- */
57719
58102
  html += "<div style='width:550px'>";
57720
58103
  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/>";
57721
58104
  html += "<b>Chain IDs</b>: " + me.htmlCls.inputTextStr + "id='" + me.pre + "chainalignids' value='P69905,P01942,1HHO_A' size=50><br/><br/>";
57722
58105
  html += "<b>Optional 1</b>, full chains are used for structure alignment<br/><br/>";
57723
58106
  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/>";
57724
58107
  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/>";
57725
- 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/>";
58108
+ //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/>";
58109
+ 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/>";
58110
+
57726
58111
  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>";
57727
58112
  html += "</div></div>";
57728
58113
 
@@ -57764,6 +58149,7 @@ class SetDialog {
57764
58149
  html += "File type: ";
57765
58150
  html += "<select id='" + me.pre + "filetype'>";
57766
58151
  html += me.htmlCls.optionStr + "'pdb' selected>PDB</option>";
58152
+ html += me.htmlCls.optionStr + "'mmcif'>mmCIF</option>";
57767
58153
  html += me.htmlCls.optionStr + "'mol2'>Mol2</option>";
57768
58154
  html += me.htmlCls.optionStr + "'sdf'>SDF</option>";
57769
58155
  html += me.htmlCls.optionStr + "'xyz'>XYZ</option>";
@@ -58067,7 +58453,7 @@ class SetDialog {
58067
58453
  html += "<div style='text-indent:1.1em'><select id='" + me.pre + "atomsCustomRealignByStruct' multiple size='5' style='min-width:130px;'>";
58068
58454
  html += "</select></div>";
58069
58455
 
58070
- html += "<div>2. " + me.htmlCls.buttonStr + "applyRealignByStruct'>Realign by Structure</button></div><br>";
58456
+ 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>";
58071
58457
  html += "</div>";
58072
58458
 
58073
58459
 
@@ -58441,31 +58827,7 @@ class SetDialog {
58441
58827
  html += "</div>";
58442
58828
  html += "</div>";
58443
58829
 
58444
- html += "<div class='icn3d-box' style='width:520px;'><b>Annotations:&nbsp;</b><br><table border=0><tr>";
58445
- let tmpStr1 = "<td style='min-width:110px;'><span style='white-space:nowrap'>";
58446
- let tmpStr2 = "<td style='min-width:130px;'><span style='white-space:nowrap'>";
58447
-
58448
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_all'>All" + me.htmlCls.space2 + "</span></td>";
58449
- html += tmpStr2 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_cdd' checked>Conserved Domains" + me.htmlCls.space2 + "</span></td>";
58450
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_clinvar'>ClinVar" + me.htmlCls.space2 + "</span></td>";
58451
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_binding'>Functional Sites" + me.htmlCls.space2 + "</span></td>";
58452
- html += "</tr><tr>";
58453
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_custom'>Custom" + me.htmlCls.space2 + "</span></td>";
58454
- html += tmpStr2 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_3dd'>3D Domains" + me.htmlCls.space2 + "</span></td>";
58455
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_snp'>SNPs" + me.htmlCls.space2 + "</span></td>";
58456
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_interact'>Interactions" + me.htmlCls.space2 + "</span></td>";
58457
- html += "<td></td>";
58458
- html += "</tr><tr>";
58459
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_ssbond'>Disulfide Bonds" + me.htmlCls.space2 + "</span></td>";
58460
- html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_crosslink'>Cross-Linkages" + me.htmlCls.space2 + "</span></td>";
58461
- if(me.cfg.opmid !== undefined) {
58462
- 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>";
58463
- }
58464
- else {
58465
- 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>";
58466
- }
58467
- html += "<td></td>";
58468
- html += "</tr></table></div>";
58830
+ html += this.getAnnoHeader();
58469
58831
 
58470
58832
  html += "<button style='white-space:nowrap; margin-left:5px;' id='" + me.pre + "showallchains'>Show All Chains</button><br>";
58471
58833
 
@@ -58549,7 +58911,7 @@ class SetDialog {
58549
58911
  html += "</div>";
58550
58912
 
58551
58913
  html += me.htmlCls.divStr + "dl_rmsd' class='" + dialogClass + "'>";
58552
- html += "<br><b>Alignment RMSD</b>: " + me.htmlCls.inputTextStr + "id='" + me.pre + "realignrmsd' value='35' size='10'>&#8491;<br><br>";
58914
+
58553
58915
  html += "</div>";
58554
58916
 
58555
58917
  html += me.htmlCls.divStr + "dl_buriedarea' class='" + dialogClass + "'>";
@@ -58580,6 +58942,39 @@ class SetDialog {
58580
58942
 
58581
58943
  return html;
58582
58944
  }
58945
+
58946
+ getAnnoHeader() { let me = this.icn3dui; me.icn3d;
58947
+ let html = '';
58948
+
58949
+ html += "<div id='" + me.pre + "annoHeaderSection' class='icn3d-box' style='width:520px;'><b>Annotations:&nbsp;</b><br>";
58950
+ html += "<div id='" + me.pre + "annoHeader'><table border=0><tr>";
58951
+ let tmpStr1 = "<td style='min-width:110px;'><span style='white-space:nowrap'>";
58952
+ let tmpStr2 = "<td style='min-width:130px;'><span style='white-space:nowrap'>";
58953
+
58954
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_all'>All" + me.htmlCls.space2 + "</span></td>";
58955
+ html += tmpStr2 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_cdd' checked>Conserved Domains" + me.htmlCls.space2 + "</span></td>";
58956
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_clinvar'>ClinVar" + me.htmlCls.space2 + "</span></td>";
58957
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_binding'>Functional Sites" + me.htmlCls.space2 + "</span></td>";
58958
+ html += "</tr><tr>";
58959
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_custom'>Custom" + me.htmlCls.space2 + "</span></td>";
58960
+ html += tmpStr2 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_3dd'>3D Domains" + me.htmlCls.space2 + "</span></td>";
58961
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_snp'>SNPs" + me.htmlCls.space2 + "</span></td>";
58962
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_interact'>Interactions" + me.htmlCls.space2 + "</span></td>";
58963
+ html += "<td></td>";
58964
+ html += "</tr><tr>";
58965
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_ssbond'>Disulfide Bonds" + me.htmlCls.space2 + "</span></td>";
58966
+ html += tmpStr1 + me.htmlCls.inputCheckStr + "id='" + me.pre + "anno_crosslink'>Cross-Linkages" + me.htmlCls.space2 + "</span></td>";
58967
+ if(me.cfg.opmid !== undefined) {
58968
+ 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>";
58969
+ }
58970
+ else {
58971
+ 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>";
58972
+ }
58973
+ html += "<td></td>";
58974
+ html += "</tr></table></div></div>";
58975
+
58976
+ return html;
58977
+ }
58583
58978
  }
58584
58979
 
58585
58980
  /**
@@ -58712,6 +59107,24 @@ class Events {
58712
59107
  ic.saveFileCls.saveFile(structureStr + '-' + idStr + '.html', 'html', encodeURIComponent(html));
58713
59108
  }
58714
59109
 
59110
+ getAlignParas() { let me = this.icn3dui; me.icn3d;
59111
+ let alignment = $("#" + me.pre + "chainalignids").val();
59112
+ let idArray = alignment.split(',');
59113
+ let alignment_final = '';
59114
+ for(let i = 0, il = idArray.length; i < il; ++i) {
59115
+ alignment_final += (idArray[i].indexOf('_') != -1) ? idArray[i] : idArray[i] + '_A'; // AlphaFold ID
59116
+ if(i < il - 1) alignment_final += ',';
59117
+ }
59118
+ let resalign = $("#" + me.pre + "resalignids").val();
59119
+ let predefinedres = $("#" + me.pre + "predefinedres").val().trim().replace(/\n/g, '; ');
59120
+ if(predefinedres && alignment_final.split(',').length - 1 != predefinedres.split('; ').length) {
59121
+ var aaa = 1; //alert("Please make sure the number of chains and the lines of predefined residues are the same...");
59122
+ return;
59123
+ }
59124
+
59125
+ return {"alignment": alignment_final, "resalign": resalign, "predefinedres": predefinedres};
59126
+ }
59127
+
58715
59128
  //Hold all functions related to click events.
58716
59129
  allEventFunctions() { let me = this.icn3dui, ic = me.icn3d;
58717
59130
  let thisClass = this;
@@ -58959,6 +59372,25 @@ class Events {
58959
59372
  me.htmlCls.clickMenuCls.setLogCmd("realign on structure align", true);
58960
59373
  }
58961
59374
  });
59375
+
59376
+ me.myEventCls.onIds("#" + me.pre + "applyRealignByStruct_tmalign", "click", function(e) { let ic = me.icn3d;
59377
+ e.preventDefault();
59378
+ if(!me.cfg.notebook) dialog.dialog( "close" );
59379
+ let nameArray = $("#" + me.pre + "atomsCustomRealignByStruct").val();
59380
+ if(nameArray.length > 0) {
59381
+ ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
59382
+ }
59383
+
59384
+ me.cfg.aligntool = 'tmalign';
59385
+
59386
+ ic.realignParserCls.realignOnStructAlign();
59387
+ if(nameArray.length > 0) {
59388
+ me.htmlCls.clickMenuCls.setLogCmd("realign on tmalign | " + nameArray, true);
59389
+ }
59390
+ else {
59391
+ me.htmlCls.clickMenuCls.setLogCmd("realign on tmalign", true);
59392
+ }
59393
+ });
58962
59394
  // },
58963
59395
 
58964
59396
  me.myEventCls.onIds("#" + me.pre + "applyColorSpectrumBySets", "click", function(e) { let ic = me.icn3d;
@@ -59182,62 +59614,53 @@ class Events {
59182
59614
  window.open(hostUrl + '?align=' + alignment + '&showalignseq=1&atype=0&bu=1', '_blank');
59183
59615
  });
59184
59616
 
59185
- me.myEventCls.onIds("#" + me.pre + "reload_alignaf", "click", function(e) { me.icn3d;
59617
+ me.myEventCls.onIds("#" + me.pre + "reload_alignaf", "click", function(e) { me.icn3d;
59186
59618
  e.preventDefault();
59187
59619
  if(!me.cfg.notebook) dialog.dialog( "close" );
59188
59620
  let alignment = $("#" + me.pre + "alignafid1").val() + "_A," + $("#" + me.pre + "alignafid2").val() + "_A";
59189
59621
  me.htmlCls.clickMenuCls.setLogCmd("load chains " + alignment + " | residues | resdef ", false);
59190
59622
  window.open(hostUrl + '?chainalign=' + alignment + '&resnum=&resdef=&showalignseq=1', '_blank');
59191
59623
  });
59624
+
59625
+ me.myEventCls.onIds("#" + me.pre + "reload_alignaf_tmalign", "click", function(e) { me.icn3d;
59626
+ e.preventDefault();
59627
+ if(!me.cfg.notebook) dialog.dialog( "close" );
59628
+ let alignment = $("#" + me.pre + "alignafid1").val() + "_A," + $("#" + me.pre + "alignafid2").val() + "_A";
59629
+ me.htmlCls.clickMenuCls.setLogCmd("load chains " + alignment + " | residues | resdef | align tmalign", false);
59630
+ window.open(hostUrl + '?chainalign=' + alignment + '&aligntool=tmalign&resnum=&resdef=&showalignseq=1', '_blank');
59631
+ });
59192
59632
  // },
59193
59633
  // clickReload_chainalign: function() {
59194
59634
  me.myEventCls.onIds("#" + me.pre + "reload_chainalign", "click", function(e) { me.icn3d;
59195
59635
  e.preventDefault();
59196
59636
  if(!me.cfg.notebook) dialog.dialog( "close" );
59197
- // let alignment = $("#" + me.pre + "chainalignid1").val() + "," + $("#" + me.pre + "chainalignid2").val();
59198
- let alignment = $("#" + me.pre + "chainalignids").val();
59199
- let idArray = alignment.split(',');
59200
- let alignment_final = '';
59201
- for(let i = 0, il = idArray.length; i < il; ++i) {
59202
- alignment_final += (idArray[i].indexOf('_') != -1) ? idArray[i] : idArray[i] + '_A'; // AlphaFold ID
59203
- if(i < il - 1) alignment_final += ',';
59204
- }
59205
- let resalign = $("#" + me.pre + "resalignids").val();
59206
- let predefinedres = $("#" + me.pre + "predefinedres").val().trim().replace(/\n/g, '; ');
59207
59637
 
59208
- if(predefinedres && alignment_final.split(',').length - 1 != predefinedres.split('; ').length) {
59209
- var aaa = 1; //alert("Please make sure the number of chains and the lines of predefined residues are the same...");
59210
- return;
59211
- }
59638
+ let result = thisClass.getAlignParas();
59212
59639
 
59213
- me.htmlCls.clickMenuCls.setLogCmd("load chains " + alignment_final + " | residues " + resalign + " | resdef " + predefinedres, false);
59214
- //window.open(me.htmlCls.baseUrl + 'icn3d/full.html?chainalign=' + alignment + '&resnum=' + resalign + '&resdef=' + predefinedres + '&showalignseq=1', '_blank');
59215
- window.open(hostUrl + '?chainalign=' + alignment_final + '&resnum=' + resalign + '&resdef=' + predefinedres + '&showalignseq=1', '_blank');
59640
+ me.htmlCls.clickMenuCls.setLogCmd("load chains " + result.alignment + " | residues " + result.resalign + " | resdef " + result.predefinedres, false);
59641
+ window.open(hostUrl + '?chainalign=' + result.alignment + '&resnum=' + result.resalign + '&resdef=' + result.predefinedres + '&showalignseq=1', '_blank');
59216
59642
  });
59217
59643
 
59218
59644
  me.myEventCls.onIds("#" + me.pre + "reload_chainalign_asym", "click", function(e) { me.icn3d;
59219
59645
  e.preventDefault();
59220
59646
  if(!me.cfg.notebook) dialog.dialog( "close" );
59221
- // let alignment = $("#" + me.pre + "chainalignid1").val() + "," + $("#" + me.pre + "chainalignid2").val();
59222
- let alignment = $("#" + me.pre + "chainalignids").val();
59223
- let idArray = alignment.split(',');
59224
- let alignment_final = '';
59225
- for(let i = 0, il = idArray.length; i < il; ++i) {
59226
- alignment_final += (idArray[i].indexOf('_') != -1) ? idArray[i] : idArray[i] + '_A'; // AlphaFold ID
59227
- if(i < il - 1) alignment_final += ',';
59228
- }
59229
- let resalign = $("#" + me.pre + "resalignids").val();
59230
- let predefinedres = $("#" + me.pre + "predefinedres").val().trim().replace(/\n/g, '; ');
59231
- if(predefinedres && alignment_final.split(',').length - 1 != predefinedres.split('; ').length) {
59232
- var aaa = 1; //alert("Please make sure the number of chains and the lines of predefined residues are the same...");
59233
- return;
59234
- }
59235
59647
 
59236
- me.htmlCls.clickMenuCls.setLogCmd("load chains " + alignment_final + " on asymmetric unit | residues " + resalign + " | resdef " + predefinedres, false);
59237
- //window.open(me.htmlCls.baseUrl + 'icn3d/full.html?chainalign=' + alignment + '&resnum=' + resalign + '&resdef=' + predefinedres + '&showalignseq=1&bu=0', '_blank');
59238
- window.open(hostUrl + '?chainalign=' + alignment_final + '&resnum=' + resalign + '&resdef=' + predefinedres + '&showalignseq=1&bu=0', '_blank');
59648
+ let result = thisClass.getAlignParas();
59649
+
59650
+ me.htmlCls.clickMenuCls.setLogCmd("load chains " + result.alignment + " on asymmetric unit | residues " + result.resalign + " | resdef " + result.predefinedres, false);
59651
+ window.open(hostUrl + '?chainalign=' + result.alignment + '&resnum=' + result.resalign + '&resdef=' + result.predefinedres + '&showalignseq=1&bu=0', '_blank');
59239
59652
  });
59240
59653
 
59654
+ me.myEventCls.onIds("#" + me.pre + "reload_chainalign_tmalign", "click", function(e) { me.icn3d;
59655
+ e.preventDefault();
59656
+ if(!me.cfg.notebook) dialog.dialog( "close" );
59657
+
59658
+ let result = thisClass.getAlignParas();
59659
+
59660
+ me.htmlCls.clickMenuCls.setLogCmd("load chains " + result.alignment + " on asymmetric unit | residues " + result.resalign + " | resdef " + result.predefinedres + " | align tmalign", false);
59661
+ window.open(hostUrl + '?chainalign=' + result.alignment + '&aligntool=tmalign&resnum=' + result.resalign + '&resdef=' + result.predefinedres + '&showalignseq=1&bu=0', '_blank');
59662
+ });
59663
+
59241
59664
  me.myEventCls.onIds("#" + me.pre + "reload_mutation_3d", "click", function(e) { me.icn3d;
59242
59665
  e.preventDefault();
59243
59666
  if(!me.cfg.notebook) dialog.dialog( "close" );
@@ -65544,7 +65967,7 @@ class iCn3DUI {
65544
65967
  //even when multiple iCn3D viewers are shown together.
65545
65968
  this.pre = this.cfg.divid + "_";
65546
65969
 
65547
- this.REVISION = '3.12.5';
65970
+ this.REVISION = '3.13.0';
65548
65971
 
65549
65972
  // In nodejs, iCn3D defines "window = {navigator: {}}"
65550
65973
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -65728,6 +66151,8 @@ iCn3DUI.prototype.show3DStructure = function(pdbStr) { let me = this;
65728
66151
  chainidArray.push(structureArray[i] + '_' + chainArray[i]);
65729
66152
  }
65730
66153
 
66154
+ chainidArray = ic.chainalignParserCls.addPostfixForChainids(chainidArray);
66155
+
65731
66156
  let bRealign = true, bPredefined = true;
65732
66157
  ic.realignParserCls.realignChainOnSeqAlign(undefined, chainidArray, bRealign, bPredefined);
65733
66158
  }
@@ -65735,25 +66160,40 @@ iCn3DUI.prototype.show3DStructure = function(pdbStr) { let me = this;
65735
66160
  else if(me.cfg.resdef !== undefined && me.cfg.matchedchains !== undefined) {
65736
66161
  let stru_t = Object.keys(ic.structures)[0];
65737
66162
  let chain_t = stru_t + '_' + me.cfg.masterchain;
65738
- let chainidArray = me.cfg.matchedchains.split(',');
66163
+ let domainidArray = me.cfg.matchedchains.split(',');
66164
+ let chainidArray = [];
66165
+ for(let i = 0, il = domainidArray.length; i < il; ++i) {
66166
+ let pos = domainidArray[i].lastIndexOf('_');
66167
+ let lastId = domainidArray[i].substr(pos + 1);
66168
+ if(!isNaN(lastId)) { // lastId is domain id
66169
+ chainidArray.push(domainidArray[i].substr(0, pos));
66170
+ }
66171
+ else {
66172
+ chainidArray.push(domainidArray[i]);
66173
+ }
66174
+ }
66175
+
65739
66176
  let mmdbafid = '';
65740
66177
  for(let i = 0, il = chainidArray.length; i < il; ++i) {
65741
66178
  if(i > 0) mmdbafid += ',';
65742
66179
  mmdbafid += chainidArray[i].substr(0, chainidArray[i].indexOf('_'));
65743
66180
  }
66181
+
66182
+ // realign
66183
+ ic.chainidArray = [chain_t].concat(chainidArray);
66184
+ ic.chainidArray = ic.chainalignParserCls.addPostfixForChainids(ic.chainidArray);
66185
+
66186
+ me.htmlCls.clickMenuCls.setLogCmd('resdef ' + me.cfg.resdef, true);
66187
+
66188
+ ic.loadCmd = 'vast_search_chainid ' + ic.chainidArray;
66189
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
65744
66190
 
65745
66191
  // load multiple PDBs
65746
66192
  ic.bNCBI = true;
65747
66193
  ic.bMmdbafid = true;
65748
66194
 
65749
- ic.loadCmd = 'load mmdbaf0 ' + mmdbafid;
65750
- me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
65751
-
65752
66195
  let bQuery = true;
65753
66196
  ic.chainalignParserCls.downloadMmdbAf(mmdbafid, bQuery);
65754
-
65755
- // realign
65756
- ic.chainidArray = [chain_t].concat(chainidArray);
65757
66197
  }
65758
66198
  }
65759
66199
  else if(me.cfg.url !== undefined) {
@@ -65937,7 +66377,7 @@ iCn3DUI.prototype.show3DStructure = function(pdbStr) { let me = this;
65937
66377
 
65938
66378
  ic.bChainAlign = true;
65939
66379
  ic.inputid = me.cfg.chainalign;
65940
- ic.loadCmd = 'load chainalignment ' + me.cfg.chainalign + ' | resnum ' + me.cfg.resnum + ' | resdef ' + me.cfg.resdef + ' | parameters ' + me.cfg.inpara;
66380
+ ic.loadCmd = 'load chainalignment ' + me.cfg.chainalign + ' | resnum ' + me.cfg.resnum + ' | resdef ' + me.cfg.resdef + ' | aligntool ' + me.cfg.aligntool + ' | parameters ' + me.cfg.inpara;
65941
66381
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
65942
66382
  ic.chainalignParserCls.downloadChainalignment(me.cfg.chainalign, me.cfg.resnum, me.cfg.resdef);
65943
66383
  }