icn3d 3.36.0 → 3.36.2

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
@@ -15459,6 +15459,9 @@ class Events {
15459
15459
  if(bPng) {
15460
15460
  let result = await me.htmlCls.setHtmlCls.loadPng(dataStr);
15461
15461
  dataStr = result.pdb;
15462
+
15463
+ if(!dataStr) return; // old iCn3D PNG with sharable link
15464
+
15462
15465
  if(!ic.statefileArray) ic.statefileArray = [];
15463
15466
  ic.statefileArray.push(result.statefile);
15464
15467
  }
@@ -19234,11 +19237,11 @@ class SetHtml {
19234
19237
  if(pos == -1 && posState == -1) {
19235
19238
  var aaa = 1; //alert('Please load a PNG image saved by clicking the menu "File > Save File > iCn3D PNG Image"...');
19236
19239
  }
19237
- // else if(!bReturn && pos != -1) { // no need to return pdb and state files
19238
- // let url = imageStr.substr(pos + matchedStr.length);
19239
- // me.htmlCls.clickMenuCls.setLogCmd('load iCn3D PNG image ' + $("#" + me.pre + "pngimage").val(), false);
19240
- // window.open(url, '_self');
19241
- // }
19240
+ else if(pos != -1) {
19241
+ let url = imageStr.substr(pos + matchedStr.length);
19242
+ me.htmlCls.clickMenuCls.setLogCmd('load iCn3D PNG image ' + $("#" + me.pre + "pngimage").val(), false);
19243
+ window.open(url, '_self');
19244
+ }
19242
19245
  else if(posState != -1) {
19243
19246
  let matchedStrData = "Start of data file======\n";
19244
19247
  let posData = imageStr.indexOf(matchedStrData);
@@ -56017,9 +56020,9 @@ class MmdbParser {
56017
56020
  let color =(molid2rescount[i].color === undefined) ? '#CCCCCC' : '#' +( '000000' + molid2rescount[i].color.toString( 16 ) ).slice( - 6 );
56018
56021
  let chainName =(molid2rescount[i].chain === undefined) ? '' : molid2rescount[i].chain.trim();
56019
56022
  // remove "_" in chain name
56020
- if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
56023
+ // if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
56021
56024
  chainName = chainName.replace(/_/g, '');
56022
- }
56025
+ // }
56023
56026
 
56024
56027
  if(chainNameHash[chainName] === undefined) {
56025
56028
  chainNameHash[chainName] = 1;
@@ -56432,7 +56435,7 @@ class BcifParser {
56432
56435
 
56433
56436
  let bFull = (atomSize * 10 > ic.maxatomcnt) ? false : true;
56434
56437
 
56435
- let atom_hetatmArray, resnArray, elemArray, nameArray, chainArray, resiArray, resiOriArray, altArray, bArray, xArray, yArray, zArray, autochainArray = [];
56438
+ let atom_hetatmArray, resnArray, elemArray, nameArray, chainArray, resiArray, resiOriArray, altArray, bArray, xArray, yArray, zArray, autochainArray, modelNumArray;
56436
56439
 
56437
56440
  if(!bNoCoord) {
56438
56441
  atom_hetatmArray = atom_site.getColumn("group_PDB");
@@ -56453,6 +56456,7 @@ class BcifParser {
56453
56456
  zArray = atom_site.getColumn("Cartn_z");
56454
56457
 
56455
56458
  autochainArray = atom_site.getColumn("label_asym_id");
56459
+ modelNumArray = atom_site.getColumn("pdbx_PDB_model_num");
56456
56460
 
56457
56461
  // get the bond info
56458
56462
  let ligSeqHash = {}, prevAutochain = '';
@@ -56626,17 +56630,14 @@ class BcifParser {
56626
56630
  text += ", \"atoms\":[\n";
56627
56631
  prevResn = "";
56628
56632
  serial = 1;
56629
-
56630
- let structure = atom_site.getColumn("pdbx_PDB_model_num").getString(0);
56631
-
56632
- if(structure == "1") {
56633
- structure = bcifid;
56634
- }
56635
- else {
56636
- structure = bcifid + structure;
56637
- }
56633
+ let structure = bcifid;
56638
56634
 
56639
56635
  for (let i = 0; i < atomSize; ++i) {
56636
+ let modelNum = modelNumArray.getString(i);
56637
+ if(modelNum != "1" && modelNum != "") {
56638
+ structure = bcifid + modelNum;
56639
+ }
56640
+
56640
56641
  let atom_hetatm = atom_hetatmArray.getString(i);
56641
56642
  let resn = resnArray.getString(i);
56642
56643
  let elem = elemArray.getString(i);
@@ -56835,6 +56836,8 @@ class BcifParser {
56835
56836
  // print sequences
56836
56837
  text += ", \"sequences\":{";
56837
56838
  let bData = false;
56839
+ // need to consider different models in NMR structures
56840
+ // But this function is only used for meta data,
56838
56841
  for(let chain in sChain) {
56839
56842
  let seq;
56840
56843
  if(ligSeqHash.hasOwnProperty(chain)) {
@@ -60768,9 +60771,9 @@ class LoadAtomData {
60768
60771
  let chain = data.moleculeInfor[molid].chain.trim();
60769
60772
 
60770
60773
  // remove "_" in chain name
60771
- if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
60774
+ // if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
60772
60775
  chain = chain.replace(/_/g, '');
60773
- }
60776
+ // }
60774
60777
 
60775
60778
  let chainid = pdbidTmp + '_' + chain;
60776
60779
 
@@ -60912,9 +60915,9 @@ class LoadAtomData {
60912
60915
  atm.chain = atm.chain.trim(); //.replace(/_/g, '');
60913
60916
 
60914
60917
  // remove "_" in chain name
60915
- if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
60918
+ // if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
60916
60919
  atm.chain = atm.chain.replace(/_/g, '');
60917
- }
60920
+ // }
60918
60921
 
60919
60922
  // mmcif has pre-assigned structure in mmcifparser.cgi output
60920
60923
  if(type === 'mmdbid' || type === 'align') {
@@ -63846,13 +63849,13 @@ class LoadCIF {
63846
63849
  // if(!bMutation && !bAppend) {
63847
63850
  if(!bAppend) {
63848
63851
  ic.init();
63849
- moleculeNum = 1;
63852
+ moleculeNum = 0; //1;
63850
63853
  serial = 0;
63851
63854
  }
63852
63855
  else {
63853
63856
  ic.oriNStru = (ic.structures) ? Object.keys(ic.structures).length : 0;
63854
63857
 
63855
- moleculeNum = ic.oriNStru + 1; //Object.keys(ic.structures).length + 1;
63858
+ moleculeNum = ic.oriNStru; //ic.oriNStru + 1; //Object.keys(ic.structures).length + 1;
63856
63859
  // Concatenation of two pdbs will have several atoms for the same serial
63857
63860
  serial = (ic.atoms) ? Object.keys(ic.atoms).length : 0;
63858
63861
  }
@@ -63867,8 +63870,6 @@ class LoadCIF {
63867
63870
 
63868
63871
  let structure = id;
63869
63872
  let CSerial, prevCSerial, OSerial, prevOSerial;
63870
-
63871
- let bFirstAtom = true;
63872
63873
 
63873
63874
  let cifArray = (bText) ? bcifData.split('ENDMDL\n') : [bcifData];
63874
63875
 
@@ -64172,12 +64173,27 @@ class LoadCIF {
64172
64173
  let zArray = atom_site.getColumn("Cartn_z");
64173
64174
 
64174
64175
  let autochainArray = atom_site.getColumn("label_asym_id");
64176
+ let modelNumArray = atom_site.getColumn("pdbx_PDB_model_num");
64175
64177
 
64176
64178
  // get the bond info
64177
64179
  let ligSeqHash = {}, prevAutochain = '';
64178
64180
  let prevResn;
64179
64181
  let sChain = {};
64182
+ let prevModelNum = '';
64180
64183
  for (let i = 0; i < atomSize; ++i) {
64184
+ let modelNum = modelNumArray.getString(i);
64185
+ if(i > 0 && modelNum != prevModelNum) {
64186
+ ++moleculeNum;
64187
+
64188
+ if(modelNum == "1") {
64189
+ structure = id;
64190
+ }
64191
+ else {
64192
+ structure = id + modelNum;
64193
+ }
64194
+ }
64195
+ prevModelNum = modelNum;
64196
+
64181
64197
  let atom_hetatm = atom_hetatmArray.getString(i);
64182
64198
  let resn = resnArray.getString(i);
64183
64199
  let elem = elemArray.getString(i);
@@ -64222,11 +64238,11 @@ class LoadCIF {
64222
64238
 
64223
64239
  sChain[chain] = 1;
64224
64240
 
64225
- if(bFirstAtom) {
64226
- structure = ic.loadPDBCls.getStructureId(id, moleculeNum);
64241
+ // if(bFirstAtom) {
64242
+ // structure = ic.loadPDBCls.getStructureId(id, moleculeNum);
64227
64243
 
64228
- bFirstAtom = false;
64229
- }
64244
+ // bFirstAtom = false;
64245
+ // }
64230
64246
 
64231
64247
  // "CA" has to appear before "O". Otherwise the cartoon of secondary structure will have breaks
64232
64248
  // Concatenation of two pdbs will have several atoms for the same serial
@@ -67827,6 +67843,12 @@ class DefinedSets {
67827
67843
  let prevLabel = 'or';
67828
67844
 
67829
67845
  for(let i = 0, il = idArray.length; i < il; ++i) {
67846
+ // replace 1CD8_A_1 with 1CD8_A1
67847
+ let tmpArray = idArray[i].split('_');
67848
+ if(tmpArray.length == 3 && !isNaN(tmpArray[2])) {
67849
+ idArray[i] = tmpArray[0] + '_' + tmpArray[1] + tmpArray[2];
67850
+ }
67851
+
67830
67852
  if(idArray[i] === 'or' || idArray[i] === 'and' || idArray[i] === 'not') {
67831
67853
  prevLabel = idArray[i];
67832
67854
  continue;
@@ -69356,6 +69378,7 @@ class SelectByCommand {
69356
69378
  }
69357
69379
  else {
69358
69380
  chainStr = testStr.substr(periodPos + 1);
69381
+
69359
69382
  //replace "A_1" with "A"
69360
69383
  chainStr = chainStr.replace(/_/g, '');
69361
69384
 
@@ -69483,7 +69506,6 @@ class SelectByCommand {
69483
69506
 
69484
69507
  for(let l = 0, ll = residArray.length; l < ll; ++l) {
69485
69508
  let residueId = residArray[l];
69486
-
69487
69509
  if(i === 0) {
69488
69510
  residueHash[residueId] = 1;
69489
69511
  }
@@ -82199,7 +82221,7 @@ class iCn3DUI {
82199
82221
  //even when multiple iCn3D viewers are shown together.
82200
82222
  this.pre = this.cfg.divid + "_";
82201
82223
 
82202
- this.REVISION = '3.36.0';
82224
+ this.REVISION = '3.36.1';
82203
82225
 
82204
82226
  // In nodejs, iCn3D defines "window = {navigator: {}}"
82205
82227
  this.bNode = (Object.keys(window).length < 2) ? true : false;