icn3d 3.50.0 → 3.50.1

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
@@ -106863,6 +106863,7 @@ class MmdbParser {
106863
106863
  //ic.molid2color = molid2color;
106864
106864
  //ic.chain2molid = chain2molid;
106865
106865
  ic.molid2chain = molid2chain;
106866
+
106866
106867
  // small structure with all atoms
106867
106868
  // show surface options
106868
106869
  $("#" + ic.pre + "accordion5").show();
@@ -115299,7 +115300,9 @@ class LoadPDB {
115299
115300
 
115300
115301
  let bHeader = false, bFirstAtom = true;
115301
115302
 
115302
- let segId, prevSegId;
115303
+ let segId, prevSegId, entityid;
115304
+
115305
+ if(!ic.molid2chain) ic.molid2chain = {};
115303
115306
 
115304
115307
  for (let i in lines) {
115305
115308
  let line = lines[i];
@@ -115444,6 +115447,17 @@ class LoadPDB {
115444
115447
  ic.organism = line.substr(28).toLowerCase().trim();
115445
115448
 
115446
115449
  ic.organism = ic.organism.substr(0, ic.organism.length - 1);
115450
+ } else if (record === 'COMPND') {
115451
+ if(line.indexOf('MOL_ID: ') != -1) { // COMPND MOL_ID: 1;
115452
+ let itemArray = line.trim().split(' ');
115453
+ let lastItem = itemArray[itemArray.length - 1];
115454
+ entityid = lastItem.substr(0, lastItem.length - 1);
115455
+ }
115456
+ else if(line.indexOf('CHAIN: ') != -1) { // COMPND 3 CHAIN: H;
115457
+ let itemArray = line.trim().split(' ');
115458
+ let lastItem = itemArray[itemArray.length - 1];
115459
+ ic.molid2chain[parseInt(entityid)] = structure + '_' + lastItem.substr(0, lastItem.length - 1);
115460
+ }
115447
115461
  } else if (record === 'ENDMDL') {
115448
115462
  if(ic.statefileArray) {
115449
115463
  ic.struct_statefile.push({'structure': structure, 'statefile': ic.statefileArray[moleculeNum - 1]});
@@ -116520,6 +116534,7 @@ class LoadCIF {
116520
116534
  let resnArray = atom_site.getColumn("label_comp_id");
116521
116535
  let elemArray = atom_site.getColumn("type_symbol");
116522
116536
  let nameArray = atom_site.getColumn("label_atom_id");
116537
+ let entiyidArray = atom_site.getColumn("label_entity_id");
116523
116538
 
116524
116539
  let chainArray = atom_site.getColumn("auth_asym_id");
116525
116540
 
@@ -116541,6 +116556,8 @@ class LoadCIF {
116541
116556
  let prevResn;
116542
116557
  let sChain = {};
116543
116558
  let prevModelNum = '';
116559
+ if(!ic.molid2chain) ic.molid2chain = {};
116560
+
116544
116561
  for (let i = 0; i < atomSize; ++i) {
116545
116562
  let modelNum = modelNumArray.getString(i);
116546
116563
  if(i > 0 && modelNum != prevModelNum) {
@@ -116559,6 +116576,7 @@ class LoadCIF {
116559
116576
  let resn = resnArray.getString(i);
116560
116577
  let elem = elemArray.getString(i);
116561
116578
  let atom = nameArray.getString(i);
116579
+ let entityid = entiyidArray.getString(i);
116562
116580
  let chain = chainArray.getString(i);
116563
116581
  let resi = resiArray.getString(i);
116564
116582
  let oriResi = resiOriArray.getString(i);
@@ -116665,6 +116683,8 @@ class LoadCIF {
116665
116683
  chainNum = structure + "_" + chain;
116666
116684
  oriResidueNum = chainNum + "_" + oriResi;
116667
116685
 
116686
+ ic.molid2chain[parseInt(entityid)] = chainNum;
116687
+
116668
116688
  residueNum = chainNum + "_" + resi;
116669
116689
 
116670
116690
  //let chain_resi = chain + "_" + resi;
@@ -128633,19 +128653,14 @@ class Diagram2d {
128633
128653
 
128634
128654
  //https://9c5d031c.na-hackathon-2026.pages.dev/api.json
128635
128655
  //https://www.ebi.ac.uk/pdbe/static/entry/1ffk_2_9.json, or 1ffk_1_0.json [pdbid_molid_chain]
128636
- if(!ic.chainid2molid) {
128637
- ic.chainid2molid = {};
128638
-
128639
- await ic.showAnnoCls.showAnnotations();
128640
- let molidTmp = 1;
128641
- for(let id in ic.nucleotide_chainid) {
128642
- ic.chainid2molid[id] = molidTmp;
128643
- ++molidTmp;
128656
+ let molid = 1;
128657
+ for(let i in ic.molid2chain) {
128658
+ if(ic.molid2chain[i] == chainid) {
128659
+ molid = i;
128660
+ break;
128644
128661
  }
128645
128662
  }
128646
128663
 
128647
- let molid = ic.chainid2molid[chainid] ? ic.chainid2molid[chainid] : 1;
128648
-
128649
128664
  let url = "https://www.ebi.ac.uk/pdbe/static/entry/" + pdbid.toLowerCase() + "_" + molid + "_" + chain + ".json";
128650
128665
  let apiData = await me.getAjaxPromise(url, 'json', undefined, 'The chain ' + chainid + ' with molid ' + molid + ' has no R2DT information in PDBe...');
128651
128666
 
@@ -128799,7 +128814,7 @@ class Diagram2d {
128799
128814
  if(from_type_to.length != 3) continue;
128800
128815
 
128801
128816
  let fromArray = from_type_to[0].split('|'), toArray = from_type_to[2].split('|');
128802
- if(fromArray.length != 5 || toArray.length != 5) continue;
128817
+ if(fromArray.length < 5 || toArray.length < 5) continue;
128803
128818
  if(fromArray[2] != chain || toArray[2] != chain) continue;
128804
128819
  let resi1 = fromArray[4], resi2 = toArray[4];
128805
128820
  let ncbiResid1 = ic.resid2ncbi[chainid + '_' + resi1], ncbiResid2 = ic.resid2ncbi[chainid + '_' + resi2];
@@ -128999,12 +129014,12 @@ class Diagram2d {
128999
129014
  html += " rnaCanvas.drawingView.fitToContent();\n";
129000
129015
  html += " $('.UDedZ1UaiPZJsRmm1yxA').hide();\n"; // hide the "Powered by RNAcanvas" label
129001
129016
 
129002
- html += "var pos2node = {}, id2pos = {};\n";
129017
+ html += "var pos2node = {};\n";
129003
129018
  html += "var nodes = rnaCanvas.drawing.bases;\n";
129004
129019
 
129005
129020
  html += "for (var i = 0, il = nodes.length; i < il; i++) {\n";
129006
129021
  html += " pos2node[i + 1] = nodes[i];\n";
129007
- html += " id2pos[nodes[i].id] = i + 1;\n";
129022
+ html += " nodes[i].setAttribute('resi', i + 1);\n";
129008
129023
  html += "}\n";
129009
129024
 
129010
129025
  html += "$(document).on('click', '#rnacanvasSvg svg text', function(e) {\n";
@@ -129015,19 +129030,17 @@ class Diagram2d {
129015
129030
  html += " }\n";
129016
129031
  html += " $(this)[0].setAttribute('fill', '#f8b84e');\n";
129017
129032
 
129018
- html += " var pos = id2pos[id];\n";
129019
129033
  html += " var resn = $(this).text().split(' ')[0];\n"; //C Position 8
129020
- html += " $(document).trigger('from_rnacanvas', pos + '_' + resn);\n";
129034
+ html += " $(document).trigger('from_rnacanvas', $(this).attr('resi') + '_' + resn);\n";
129021
129035
  html += " document.dispatchEvent(event);\n";
129022
129036
  html += "});\n";
129023
129037
 
129024
129038
  html += "$(document).on('mouseover', '#rnacanvasSvg svg text', function(e) {\n";
129025
129039
  html += " var id = $(this).attr('id');\n";
129026
129040
  html += " $(this)[0].setAttribute('fill', '#f8b84e');\n";
129027
-
129028
129041
  html += " if(!$(this)[0].querySelector('title')) {\n";
129029
129042
  html += " var title = document.createElementNS('http://www.w3.org/2000/svg', 'title');\n";
129030
- html += " title.textContent = ' Position ' + id2pos[id];\n";
129043
+ html += " title.textContent = ' Position ' + $(this).attr('resi');\n";
129031
129044
  html += " $(this)[0].appendChild(title);\n";
129032
129045
  html += " }\n";
129033
129046
  html += "});\n";