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.module.js CHANGED
@@ -16360,6 +16360,9 @@ class Events {
16360
16360
  if(bPng) {
16361
16361
  let result = await me.htmlCls.setHtmlCls.loadPng(dataStr);
16362
16362
  dataStr = result.pdb;
16363
+
16364
+ if(!dataStr) return; // old iCn3D PNG with sharable link
16365
+
16363
16366
  if(!ic.statefileArray) ic.statefileArray = [];
16364
16367
  ic.statefileArray.push(result.statefile);
16365
16368
  }
@@ -20135,11 +20138,11 @@ class SetHtml {
20135
20138
  if(pos == -1 && posState == -1) {
20136
20139
  alert('Please load a PNG image saved by clicking the menu "File > Save File > iCn3D PNG Image"...');
20137
20140
  }
20138
- // else if(!bReturn && pos != -1) { // no need to return pdb and state files
20139
- // let url = imageStr.substr(pos + matchedStr.length);
20140
- // me.htmlCls.clickMenuCls.setLogCmd('load iCn3D PNG image ' + $("#" + me.pre + "pngimage").val(), false);
20141
- // window.open(url, '_self');
20142
- // }
20141
+ else if(pos != -1) {
20142
+ let url = imageStr.substr(pos + matchedStr.length);
20143
+ me.htmlCls.clickMenuCls.setLogCmd('load iCn3D PNG image ' + $("#" + me.pre + "pngimage").val(), false);
20144
+ window.open(url, '_self');
20145
+ }
20143
20146
  else if(posState != -1) {
20144
20147
  let matchedStrData = "Start of data file======\n";
20145
20148
  let posData = imageStr.indexOf(matchedStrData);
@@ -56918,9 +56921,9 @@ class MmdbParser {
56918
56921
  let color =(molid2rescount[i].color === undefined) ? '#CCCCCC' : '#' +( '000000' + molid2rescount[i].color.toString( 16 ) ).slice( - 6 );
56919
56922
  let chainName =(molid2rescount[i].chain === undefined) ? '' : molid2rescount[i].chain.trim();
56920
56923
  // remove "_" in chain name
56921
- if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
56924
+ // if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
56922
56925
  chainName = chainName.replace(/_/g, '');
56923
- }
56926
+ // }
56924
56927
 
56925
56928
  if(chainNameHash[chainName] === undefined) {
56926
56929
  chainNameHash[chainName] = 1;
@@ -57333,7 +57336,7 @@ class BcifParser {
57333
57336
 
57334
57337
  let bFull = (atomSize * 10 > ic.maxatomcnt) ? false : true;
57335
57338
 
57336
- let atom_hetatmArray, resnArray, elemArray, nameArray, chainArray, resiArray, resiOriArray, altArray, bArray, xArray, yArray, zArray, autochainArray = [];
57339
+ let atom_hetatmArray, resnArray, elemArray, nameArray, chainArray, resiArray, resiOriArray, altArray, bArray, xArray, yArray, zArray, autochainArray, modelNumArray;
57337
57340
 
57338
57341
  if(!bNoCoord) {
57339
57342
  atom_hetatmArray = atom_site.getColumn("group_PDB");
@@ -57354,6 +57357,7 @@ class BcifParser {
57354
57357
  zArray = atom_site.getColumn("Cartn_z");
57355
57358
 
57356
57359
  autochainArray = atom_site.getColumn("label_asym_id");
57360
+ modelNumArray = atom_site.getColumn("pdbx_PDB_model_num");
57357
57361
 
57358
57362
  // get the bond info
57359
57363
  let ligSeqHash = {}, prevAutochain = '';
@@ -57527,17 +57531,14 @@ class BcifParser {
57527
57531
  text += ", \"atoms\":[\n";
57528
57532
  prevResn = "";
57529
57533
  serial = 1;
57530
-
57531
- let structure = atom_site.getColumn("pdbx_PDB_model_num").getString(0);
57532
-
57533
- if(structure == "1") {
57534
- structure = bcifid;
57535
- }
57536
- else {
57537
- structure = bcifid + structure;
57538
- }
57534
+ let structure = bcifid;
57539
57535
 
57540
57536
  for (let i = 0; i < atomSize; ++i) {
57537
+ let modelNum = modelNumArray.getString(i);
57538
+ if(modelNum != "1" && modelNum != "") {
57539
+ structure = bcifid + modelNum;
57540
+ }
57541
+
57541
57542
  let atom_hetatm = atom_hetatmArray.getString(i);
57542
57543
  let resn = resnArray.getString(i);
57543
57544
  let elem = elemArray.getString(i);
@@ -57736,6 +57737,8 @@ class BcifParser {
57736
57737
  // print sequences
57737
57738
  text += ", \"sequences\":{";
57738
57739
  let bData = false;
57740
+ // need to consider different models in NMR structures
57741
+ // But this function is only used for meta data,
57739
57742
  for(let chain in sChain) {
57740
57743
  let seq;
57741
57744
  if(ligSeqHash.hasOwnProperty(chain)) {
@@ -61669,9 +61672,9 @@ class LoadAtomData {
61669
61672
  let chain = data.moleculeInfor[molid].chain.trim();
61670
61673
 
61671
61674
  // remove "_" in chain name
61672
- if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
61675
+ // if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
61673
61676
  chain = chain.replace(/_/g, '');
61674
- }
61677
+ // }
61675
61678
 
61676
61679
  let chainid = pdbidTmp + '_' + chain;
61677
61680
 
@@ -61813,9 +61816,9 @@ class LoadAtomData {
61813
61816
  atm.chain = atm.chain.trim(); //.replace(/_/g, '');
61814
61817
 
61815
61818
  // remove "_" in chain name
61816
- if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
61819
+ // if(parseInt(me.cfg.date) >= 20231001 || (!me.cfg.date && parseInt(me.utilsCls.getDateDigitStr()) >= 20231001)) {
61817
61820
  atm.chain = atm.chain.replace(/_/g, '');
61818
- }
61821
+ // }
61819
61822
 
61820
61823
  // mmcif has pre-assigned structure in mmcifparser.cgi output
61821
61824
  if(type === 'mmdbid' || type === 'align') {
@@ -64747,13 +64750,13 @@ class LoadCIF {
64747
64750
  // if(!bMutation && !bAppend) {
64748
64751
  if(!bAppend) {
64749
64752
  ic.init();
64750
- moleculeNum = 1;
64753
+ moleculeNum = 0; //1;
64751
64754
  serial = 0;
64752
64755
  }
64753
64756
  else {
64754
64757
  ic.oriNStru = (ic.structures) ? Object.keys(ic.structures).length : 0;
64755
64758
 
64756
- moleculeNum = ic.oriNStru + 1; //Object.keys(ic.structures).length + 1;
64759
+ moleculeNum = ic.oriNStru; //ic.oriNStru + 1; //Object.keys(ic.structures).length + 1;
64757
64760
  // Concatenation of two pdbs will have several atoms for the same serial
64758
64761
  serial = (ic.atoms) ? Object.keys(ic.atoms).length : 0;
64759
64762
  }
@@ -64768,8 +64771,6 @@ class LoadCIF {
64768
64771
 
64769
64772
  let structure = id;
64770
64773
  let CSerial, prevCSerial, OSerial, prevOSerial;
64771
-
64772
- let bFirstAtom = true;
64773
64774
 
64774
64775
  let cifArray = (bText) ? bcifData.split('ENDMDL\n') : [bcifData];
64775
64776
 
@@ -65073,12 +65074,27 @@ class LoadCIF {
65073
65074
  let zArray = atom_site.getColumn("Cartn_z");
65074
65075
 
65075
65076
  let autochainArray = atom_site.getColumn("label_asym_id");
65077
+ let modelNumArray = atom_site.getColumn("pdbx_PDB_model_num");
65076
65078
 
65077
65079
  // get the bond info
65078
65080
  let ligSeqHash = {}, prevAutochain = '';
65079
65081
  let prevResn;
65080
65082
  let sChain = {};
65083
+ let prevModelNum = '';
65081
65084
  for (let i = 0; i < atomSize; ++i) {
65085
+ let modelNum = modelNumArray.getString(i);
65086
+ if(i > 0 && modelNum != prevModelNum) {
65087
+ ++moleculeNum;
65088
+
65089
+ if(modelNum == "1") {
65090
+ structure = id;
65091
+ }
65092
+ else {
65093
+ structure = id + modelNum;
65094
+ }
65095
+ }
65096
+ prevModelNum = modelNum;
65097
+
65082
65098
  let atom_hetatm = atom_hetatmArray.getString(i);
65083
65099
  let resn = resnArray.getString(i);
65084
65100
  let elem = elemArray.getString(i);
@@ -65123,11 +65139,11 @@ class LoadCIF {
65123
65139
 
65124
65140
  sChain[chain] = 1;
65125
65141
 
65126
- if(bFirstAtom) {
65127
- structure = ic.loadPDBCls.getStructureId(id, moleculeNum);
65142
+ // if(bFirstAtom) {
65143
+ // structure = ic.loadPDBCls.getStructureId(id, moleculeNum);
65128
65144
 
65129
- bFirstAtom = false;
65130
- }
65145
+ // bFirstAtom = false;
65146
+ // }
65131
65147
 
65132
65148
  // "CA" has to appear before "O". Otherwise the cartoon of secondary structure will have breaks
65133
65149
  // Concatenation of two pdbs will have several atoms for the same serial
@@ -68728,6 +68744,12 @@ class DefinedSets {
68728
68744
  let prevLabel = 'or';
68729
68745
 
68730
68746
  for(let i = 0, il = idArray.length; i < il; ++i) {
68747
+ // replace 1CD8_A_1 with 1CD8_A1
68748
+ let tmpArray = idArray[i].split('_');
68749
+ if(tmpArray.length == 3 && !isNaN(tmpArray[2])) {
68750
+ idArray[i] = tmpArray[0] + '_' + tmpArray[1] + tmpArray[2];
68751
+ }
68752
+
68731
68753
  if(idArray[i] === 'or' || idArray[i] === 'and' || idArray[i] === 'not') {
68732
68754
  prevLabel = idArray[i];
68733
68755
  continue;
@@ -70257,6 +70279,7 @@ class SelectByCommand {
70257
70279
  }
70258
70280
  else {
70259
70281
  chainStr = testStr.substr(periodPos + 1);
70282
+
70260
70283
  //replace "A_1" with "A"
70261
70284
  chainStr = chainStr.replace(/_/g, '');
70262
70285
 
@@ -70384,7 +70407,6 @@ class SelectByCommand {
70384
70407
 
70385
70408
  for(let l = 0, ll = residArray.length; l < ll; ++l) {
70386
70409
  let residueId = residArray[l];
70387
-
70388
70410
  if(i === 0) {
70389
70411
  residueHash[residueId] = 1;
70390
70412
  }
@@ -83100,7 +83122,7 @@ class iCn3DUI {
83100
83122
  //even when multiple iCn3D viewers are shown together.
83101
83123
  this.pre = this.cfg.divid + "_";
83102
83124
 
83103
- this.REVISION = '3.36.0';
83125
+ this.REVISION = '3.36.1';
83104
83126
 
83105
83127
  // In nodejs, iCn3D defines "window = {navigator: {}}"
83106
83128
  this.bNode = (Object.keys(window).length < 2) ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.36.0",
3
+ "version": "3.36.2",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {