icn3d 3.49.2 → 3.49.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/icn3d.module.js CHANGED
@@ -129075,6 +129075,68 @@ class Diagram2d {
129075
129075
 
129076
129076
  thisClass.clickNode(this);
129077
129077
  });
129078
+
129079
+ // event for R2DT
129080
+ //document.addEventListener('click', (event) => {
129081
+ $(document).on("click", "r2dt-web", function(e) { let ic = thisClass.icn3d;
129082
+ // The 2nd element in the path is the actual clicked g element
129083
+ const path = e.originalEvent.composedPath();
129084
+ const clickedElement = path[1];
129085
+ let titleElem = clickedElement.querySelector('title');
129086
+
129087
+ if(titleElem) {
129088
+ titleElem.style.cursor = "pointer";
129089
+ let title = titleElem.textContent; // e.g., 14 (position.label in template: 14.A)
129090
+ let textArray = title.split(' ');
129091
+ let position_resn = textArray[textArray.length - 1].split('.');
129092
+ let pos = position_resn[0];
129093
+ let resn = position_resn[1].substr(0, position_resn[1].length - 1);
129094
+
129095
+ let resid = ic.ncbi2resid[ic.r2dt_chainid + '_' + pos];
129096
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
129097
+
129098
+ if(!atom) {
129099
+ var aaa = 1; //alert("This residue has no 3D coordinates...");
129100
+ }
129101
+ else {
129102
+ let oneLetterRes = me.utilsCls.residueName2Abbr(atom.resn);
129103
+
129104
+ let realResn = (resn == 'T') ? 'U' : resn;
129105
+
129106
+ if(resn != oneLetterRes && realResn != oneLetterRes) {
129107
+ var aaa = 1; //alert("The mouseover text in R2DT didn't match the residue number in 3D view...");
129108
+ }
129109
+ else {
129110
+ // highlight the selected residue
129111
+ if(ic.bCtrl || ic.bShift) {
129112
+ ic.hAtoms = me.hashUtilsCls.unionHash(ic.hAtoms, ic.residues[resid]);
129113
+ }
129114
+ else {
129115
+ ic.hAtoms = ic.residues[resid];
129116
+ }
129117
+
129118
+ ic.hlUpdateCls.showHighlight();
129119
+ }
129120
+ }
129121
+
129122
+ // highlight the selected residue in 2D
129123
+ let textElem = clickedElement.querySelector('text');
129124
+ textElem.setAttribute("stroke", "#f8b84e");
129125
+ textElem.setAttribute("stroke-width", "0.5px");
129126
+ }
129127
+
129128
+ // set cursor for all nodes
129129
+ if(!ic.bSetCursor) {
129130
+ ic.bSetCursor = true;
129131
+ let r2dt = document.querySelector('r2dt-web').shadowRoot;
129132
+ let elemArray = r2dt.querySelectorAll('g:has(title)');
129133
+ for(let i = 0, il = elemArray.length; i < il; ++i) {
129134
+ if(!elemArray[i].hasAttribute('id')) { // skip the main g element
129135
+ elemArray[i].style.cursor = "pointer";
129136
+ }
129137
+ }
129138
+ }
129139
+ });
129078
129140
  }
129079
129141
 
129080
129142
  clickNode(node) { let ic = this.icn3d, me = ic.icn3dui;
@@ -129301,12 +129363,16 @@ class Diagram2d {
129301
129363
  }
129302
129364
 
129303
129365
  async drawR2dt(chainid) { let ic = this.icn3d, me = ic.icn3dui;
129366
+ ic.r2dt_chainid = chainid;
129367
+
129304
129368
  let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid2rnaid=" + chainid;
129305
129369
 
129306
129370
  let data = await me.getAjaxPromise(url, 'jsonp');
129307
129371
 
129308
129372
  let html = '';
129309
129373
  if(data && data.rnaid) {
129374
+ ic.bSetCursor = false;
129375
+
129310
129376
  html += '<r2dt-web search=\'{"urs": "' + data.rnaid + '"}\' />';
129311
129377
  html += '<script type="text/javascript" src="https://rnacentral.github.io/r2dt-web/dist/r2dt-web.js"></script>';
129312
129378
  $("#" + me.pre + "2ddiagramDiv").html(html);
@@ -129346,15 +129412,13 @@ class Diagram2d {
129346
129412
 
129347
129413
  if(igType == 'IgV' || igType == 'IgC1' || igType == 'IgC2' || igType == 'IgI') {
129348
129414
  bFound = true;
129349
- igTypeArray.push(igType);
129350
- }
129351
- else {
129352
- igTypeArray.push('');
129353
129415
  }
129416
+
129417
+ igTypeArray.push(igType);
129354
129418
  }
129355
129419
 
129356
129420
  if(!bFound) {
129357
- var aaa = 1; //alert("The Ig type for chain " + chainid + " is " + igType + ". Currently only IgV, IgC1, IgC2 and IgI types are supported for drawing Ig diagrams.");
129421
+ var aaa = 1; //alert("The Ig type(s) for chain " + chainid + " is/are " + igTypeArray + ". Currently only IgV, IgC1, IgC2 and IgI types are supported for drawing Ig diagrams.");
129358
129422
  return;
129359
129423
  }
129360
129424
 
@@ -129389,8 +129453,8 @@ class Diagram2d {
129389
129453
  for(let i = 0, il = igArray.length; i < il; ++i) {
129390
129454
  let domainid = igArray[i].domainid;
129391
129455
  let igType = igTypeArray[i];
129392
- if(!igType) {
129393
- mainWorkbook.addWorksheet(`Sheet_${i + 1}`);
129456
+ if(!(igType == 'IgV' || igType == 'IgC1' || igType == 'IgC2' || igType == 'IgI')) {
129457
+ mainWorkbook.addWorksheet((i + 1) + ". " + igType);
129394
129458
  }
129395
129459
  else {
129396
129460
  let url = "/Structure/icn3d/template/igstrand_template_" + igType + ".xlsx";
@@ -129405,7 +129469,7 @@ class Diagram2d {
129405
129469
  // Clone the model to transfer styles and data
129406
129470
  newSheet.model = {
129407
129471
  ...worksheet.model,
129408
- name: "Ig Domain " + (i + 1)
129472
+ name: (i + 1) + ". " + igType
129409
129473
  };
129410
129474
 
129411
129475
  // Iterate over all rows that have values
@@ -135701,7 +135765,7 @@ class iCn3DUI {
135701
135765
  //even when multiple iCn3D viewers are shown together.
135702
135766
  this.pre = this.cfg.divid + "_";
135703
135767
 
135704
- this.REVISION = '3.49.1';
135768
+ this.REVISION = '3.49.2';
135705
135769
 
135706
135770
  // In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
135707
135771
  this.bNode = (Object.keys(window).length < 3) ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.49.2",
3
+ "version": "3.49.4",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {