icn3d 3.31.12 → 3.31.13

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
@@ -17854,7 +17854,7 @@ class Events {
17854
17854
  //ic.initUI();
17855
17855
  ic.init();
17856
17856
  ic.bInputfile = true;
17857
- ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + data : data;
17857
+ ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + data : dataStr;
17858
17858
  ic.InputfileType = 'mmcif';
17859
17859
  // await ic.mmcifParserCls.loadMmcifData(data);
17860
17860
  await ic.opmParserCls.loadOpmData(dataStr, undefined, undefined, 'mmcif', undefined, bText);
@@ -18509,11 +18509,13 @@ class Events {
18509
18509
  let command;
18510
18510
  if(shape == 'Sphere') {
18511
18511
  ic.sphereCls.createSphereBase(pos1, color, radius, undefined, undefined, undefined, opacity);
18512
- command = 'add sphere | x1 ' + pos1.x.toPrecision(4) + ' y1 ' + pos1.y.toPrecision(4) + ' z1 ' + pos1.z.toPrecision(4) + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
18512
+ // command = 'add sphere | x1 ' + pos1.x.toPrecision(4) + ' y1 ' + pos1.y.toPrecision(4) + ' z1 ' + pos1.z.toPrecision(4) + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
18513
+ command = 'add sphere | ' + nameArray + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
18513
18514
  }
18514
18515
  else {
18515
18516
  ic.boxCls.createBox_base(pos1, radius, color, undefined, undefined, undefined, opacity);
18516
- command = 'add cube | x1 ' + pos1.x.toPrecision(4) + ' y1 ' + pos1.y.toPrecision(4) + ' z1 ' + pos1.z.toPrecision(4) + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
18517
+ // command = 'add cube | x1 ' + pos1.x.toPrecision(4) + ' y1 ' + pos1.y.toPrecision(4) + ' z1 ' + pos1.z.toPrecision(4) + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
18518
+ command = 'add cube | ' + nameArray + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
18517
18519
  }
18518
18520
 
18519
18521
  thisClass.setLogCmd(command, true);
@@ -29047,14 +29049,14 @@ class Strand {
29047
29049
  // include the whole sheet or helix when highlighting
29048
29050
  let atomsAdjust = {};
29049
29051
 
29050
- //if( (bHighlight === 1 || bHighlight === 2) && !ic.bAllAtoms) {
29051
- //if( !ic.bAllAtoms) {
29052
- if( Object.keys(atoms).length < Object.keys(ic.atoms).length) {
29053
- atomsAdjust = this.getSSExpandedAtoms(atoms);
29054
- }
29055
- else {
29056
- atomsAdjust = atoms;
29057
- }
29052
+ // if( Object.keys(atoms).length < Object.keys(ic.atoms).length) {
29053
+ // atomsAdjust = this.getSSExpandedAtoms(atoms);
29054
+ // }
29055
+ // else {
29056
+ // atomsAdjust = atoms;
29057
+ // }
29058
+
29059
+ atomsAdjust = atoms;
29058
29060
 
29059
29061
  if(bHighlight === 2) {
29060
29062
  if(fill) {
@@ -29112,9 +29114,16 @@ class Strand {
29112
29114
 
29113
29115
  let maxDist = 6.0;
29114
29116
 
29117
+ //get the last residue
29118
+ let atomArray = Object.keys(atoms);
29119
+ let lastAtomSerial = atomArray[atomArray.length - 1];
29120
+ let lastAtom = atoms[lastAtomSerial];
29121
+ let lastResid = lastAtom.structure + '_' + lastAtom.chain + '_' + lastAtom.resi;
29122
+
29115
29123
  for (let i in atomsAdjust) {
29116
29124
  atom = atomsAdjust[i];
29117
29125
  let chainid = atom.structure + '_' + atom.chain;
29126
+ let resid = atom.structure + '_' + atom.chain + '_' + atom.resi;
29118
29127
  if ((atom.name === 'O' || atom.name === 'CA') && !atom.het) {
29119
29128
  // "CA" has to appear before "O"
29120
29129
 
@@ -29151,7 +29160,7 @@ class Strand {
29151
29160
  if(atom.ssend && atom.ss === 'sheet') {
29152
29161
  bSheetSegment = true;
29153
29162
  }
29154
- else if(atom.ssend && atom.ss === 'helix') {
29163
+ else if( (atom.ssend && atom.ss === 'helix') || resid == lastResid) { // partial sheet will draw as helix
29155
29164
  bHelixSegment = true;
29156
29165
  }
29157
29166
 
@@ -29258,7 +29267,7 @@ class Strand {
29258
29267
  // }
29259
29268
 
29260
29269
  //if ((atom.ssbegin || atom.ssend || (drawnResidueCount === totalResidueCount - 1) || bBrokenSs) && pnts[0].length > 0 && bSameChain) {
29261
- if ((currentChain !== atom.chain || atom.ssbegin || atom.ssend || (drawnResidueCount === totalResidueCount - 1) || bBrokenSs) && pnts[0].length > 0) {
29270
+ if ((currentChain !== atom.chain || atom.ssbegin || atom.ssend || (drawnResidueCount === totalResidueCount - 1) || bBrokenSs || resid == lastResid) && pnts[0].length > 0) {
29262
29271
  let atomName = 'CA';
29263
29272
 
29264
29273
  let prevone = [], nexttwo = [];
@@ -29401,8 +29410,11 @@ class Strand {
29401
29410
  bHelixSegment = false;
29402
29411
  } // end if (atom.ssbegin || atom.ssend)
29403
29412
 
29404
- // end of a chain
29405
- if ((currentChain !== atom.chain || ic.ParserUtilsCls.getResiNCBI(atom.structure + '_' + currentChain, currentResi) + 1 !== ic.ParserUtilsCls.getResiNCBI(chainid, atom.resi)) && pnts[0].length > 0) {
29413
+ // end of a chain, or end of selection
29414
+ if ((currentChain !== atom.chain
29415
+ || ic.ParserUtilsCls.getResiNCBI(atom.structure + '_' + currentChain, currentResi) + 1 !== ic.ParserUtilsCls.getResiNCBI(chainid, atom.resi)
29416
+ || resid == lastResid
29417
+ ) && pnts[0].length > 0) {
29406
29418
  //if ((currentChain !== atom.chain) && pnts[0].length > 0) {
29407
29419
 
29408
29420
  let atomName = 'CA';
@@ -40904,6 +40916,9 @@ class AnnoCddSite {
40904
40916
  // if(type != 'domain') setname += "_" + index + "_" + r;
40905
40917
  if(type != 'domain') setname = chnid + "_" + index + "_" + r + "_" + domain;
40906
40918
 
40919
+ //remove space in setname
40920
+ setname = setname.replace(/\s+/g, '');
40921
+
40907
40922
  if(type == 'domain') pssmid2fromArray[pssmid] = fromArray;
40908
40923
  if(type == 'domain') pssmid2toArray[pssmid] = toArray;
40909
40924
 
@@ -44804,27 +44819,12 @@ class AddTrack {
44804
44819
  });
44805
44820
 
44806
44821
  // Isoform Alignment
44807
- me.myEventCls.onIds("#" + ic.pre + "addtrack_button2c", "click", async function(e) { let ic = thisClass.icn3d;
44822
+ me.myEventCls.onIds("#" + ic.pre + "addtrack_button2c", "click", async function(e) { thisClass.icn3d;
44808
44823
  e.stopImmediatePropagation();
44809
44824
  //e.preventDefault();
44810
44825
  dialog.dialog( "close" );
44811
44826
 
44812
- let chainid = $("#" + ic.pre + "track_chainid").val();
44813
- let geneid = $("#" + ic.pre + "track_geneid").val();
44814
- if(!geneid) {
44815
- alert("Please fill in the Gene ID...");
44816
- return;
44817
- }
44818
-
44819
- let startpos = $("#" + ic.pre + "fasta_startpos2").val();
44820
- if(!startpos) startpos = 1;
44821
-
44822
- //let colorseqby = $("#" + ic.pre + "colorseqby2").val();
44823
- //let type =(colorseqby == 'identity') ? 'identity' : 'custom';
44824
-
44825
- let type = 'identity';
44826
-
44827
- await thisClass.addExonTracks(chainid, geneid, startpos, type);
44827
+ await thisClass.addExonTracksWrap();
44828
44828
  });
44829
44829
 
44830
44830
  // BED file
@@ -46415,6 +46415,25 @@ class AddTrack {
46415
46415
  return acclistTmp;
46416
46416
  }
46417
46417
 
46418
+ async addExonTracksWrap() { let ic = this.icn3d; ic.icn3dui;
46419
+ let chainid = $("#" + ic.pre + "track_chainid").val();
46420
+ let geneid = $("#" + ic.pre + "track_geneid").val();
46421
+ if(!geneid) {
46422
+ alert("Please fill in the Gene ID...");
46423
+ return;
46424
+ }
46425
+
46426
+ let startpos = $("#" + ic.pre + "fasta_startpos2").val();
46427
+ if(!startpos) startpos = 1;
46428
+
46429
+ //let colorseqby = $("#" + ic.pre + "colorseqby2").val();
46430
+ //let type =(colorseqby == 'identity') ? 'identity' : 'custom';
46431
+
46432
+ let type = 'identity';
46433
+
46434
+ await thisClass.addExonTracks(chainid, geneid, startpos, type);
46435
+ }
46436
+
46418
46437
  async addExonTracks(chainid, geneid, startpos, type) { let ic = this.icn3d, me = ic.icn3dui;
46419
46438
  let thisClass = this;
46420
46439
 
@@ -48609,11 +48628,12 @@ class HlSeq {
48609
48628
  ic.bAlignSeq = false;
48610
48629
  ic.bAnnotations = true;
48611
48630
  }
48612
-
48631
+
48613
48632
  if(ic.bSelectResidue === false && !ic.bShift && !ic.bCtrl) {
48633
+ // if(!ic.bShift && !ic.bCtrl) {
48614
48634
  ic.selectionCls.removeSelection();
48615
48635
  }
48616
-
48636
+
48617
48637
  // select residues
48618
48638
  $("span.ui-selected", this).each(function() {
48619
48639
  let id = $(this).attr('id');
@@ -48624,11 +48644,12 @@ class HlSeq {
48624
48644
  });
48625
48645
 
48626
48646
  ic.selectionCls.saveSelectionPrep(true);
48627
- ic.selectionCls.saveSelection(undefined, undefined, true);
48647
+ //ic.selectionCls.saveSelection(undefined, undefined, true);
48648
+ // do not use selected residues, use ic.hAtoms instead
48649
+ ic.selectionCls.saveSelection(undefined, undefined, false);
48628
48650
 
48629
48651
  //ic.residueLabelsCls.addResidueLabels(ic.hAtoms, false, 0.5);
48630
48652
  ic.hlObjectsCls.addHlObjects(); // render() is called
48631
-
48632
48653
  // get all chainid in the selected residues
48633
48654
  let chainHash = {};
48634
48655
  for(let residueid in ic.selectedResidues) {
@@ -48711,7 +48732,9 @@ class HlSeq {
48711
48732
  thisClass.selectResidues(id, this);
48712
48733
 
48713
48734
  ic.selectionCls.saveSelectionPrep(true);
48714
- ic.selectionCls.saveSelection(undefined, undefined, true);
48735
+ //ic.selectionCls.saveSelection(undefined, undefined, true);
48736
+ // do not use selected residues, use ic.hAtoms instead
48737
+ ic.selectionCls.saveSelection(undefined, undefined, false);
48715
48738
  }
48716
48739
  //});
48717
48740
 
@@ -49036,9 +49059,10 @@ class HlSeq {
49036
49059
  if(me.bNode) return;
49037
49060
 
49038
49061
  if(ic.bSelectResidue === false && !ic.bShift && !ic.bCtrl) {
49062
+ // if(!ic.bShift && !ic.bCtrl) {
49039
49063
  ic.selectionCls.removeSelection();
49040
49064
  }
49041
-
49065
+
49042
49066
  if(id !== undefined && id !== '') {
49043
49067
  // add "align_" in front of id so that full sequence and aligned sequence will not conflict
49044
49068
  //if(id.substr(0, 5) === 'align') id = id.substr(5);
@@ -66069,11 +66093,13 @@ class ApplyCommand {
66069
66093
  ic.drawCls.draw();
66070
66094
  }
66071
66095
  else if(command.indexOf('add sphere') == 0) {
66072
- this.addShape(command, 'sphere');
66096
+ this.addShape(commandOri, 'sphere');
66097
+ ic.shapeCmdHash[commandOri] = 1;
66073
66098
  //ic.drawCls.draw();
66074
66099
  }
66075
66100
  else if(command.indexOf('add cube') == 0) {
66076
- this.addShape(command, 'cube');
66101
+ this.addShape(commandOri, 'cube');
66102
+ ic.shapeCmdHash[commandOri] = 1;
66077
66103
  //ic.drawCls.draw();
66078
66104
  }
66079
66105
  else if(command.indexOf('clear shape') == 0) {
@@ -66529,8 +66555,8 @@ class ApplyCommand {
66529
66555
 
66530
66556
  ic.hlUpdateCls.updateHlAll();
66531
66557
 
66532
- // change graph color
66533
- ic.getGraphCls.updateGraphColor();
66558
+ // change graph color, was done in color command
66559
+ //ic.getGraphCls.updateGraphColor();
66534
66560
  }
66535
66561
  else if(commandOri.indexOf('remove legend') == 0) {
66536
66562
  $("#" + me.pre + "legend").hide();
@@ -66816,7 +66842,7 @@ class ApplyCommand {
66816
66842
  }
66817
66843
 
66818
66844
  addShape(command, shape) { let ic = this.icn3d, me = ic.icn3dui;
66819
- ic.shapeCmdHash[command] = 1;
66845
+ // ic.shapeCmdHash[command] = 1;
66820
66846
 
66821
66847
  let paraArray = command.split(' | ');
66822
66848
  let p1Array = paraArray[1].split(' ');
@@ -66827,7 +66853,17 @@ class ApplyCommand {
66827
66853
  colorStr = '#' + colorStr.replace(/\#/g, '');
66828
66854
  let color = me.parasCls.thr(colorStr);
66829
66855
 
66830
- let pos1 = new THREE.Vector3(parseFloat(p1Array[1]), parseFloat(p1Array[3]), parseFloat(p1Array[5]));
66856
+ let pos1;
66857
+
66858
+ if(p1Array[0] == 'x1') { // input position
66859
+ pos1 = new THREE.Vector3(parseFloat(p1Array[1]), parseFloat(p1Array[3]), parseFloat(p1Array[5]));
66860
+ }
66861
+ else { // input sets
66862
+ let nameArray = paraArray[1].split(',');
66863
+ let atomSet1 = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
66864
+ let posArray1 = ic.contactCls.getExtent(atomSet1);
66865
+ pos1 = new THREE.Vector3(posArray1[2][0], posArray1[2][1], posArray1[2][2]);
66866
+ }
66831
66867
 
66832
66868
  if(shape == 'sphere') {
66833
66869
  ic.sphereCls.createSphereBase(pos1, color, parseFloat(radius), undefined, undefined, undefined, parseFloat(opacity));
@@ -67807,7 +67843,7 @@ class SelectCollections {
67807
67843
 
67808
67844
  ic.ssbondpnts = {};
67809
67845
 
67810
- ic.bShowHighlight = false;
67846
+ ic.bShowHighlight = undefined;
67811
67847
  ic.bResetSets = true;
67812
67848
  }
67813
67849
 
@@ -67938,8 +67974,8 @@ class SelectCollections {
67938
67974
  ic.hAtoms = me.hashUtilsCls.cloneHash(ic.atoms);
67939
67975
  }
67940
67976
 
67941
- ic.opts["color"] = "structure";
67942
- ic.setStyleCls.setAtomStyleByOptions();
67977
+ ic.opts["color"] = (Object.keys(ic.structures).length == 1) ? "chain" : "structure";
67978
+ // ic.setStyleCls.setAtomStyleByOptions();
67943
67979
  ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
67944
67980
 
67945
67981
  ic.transformCls.zoominSelection();
@@ -71964,6 +72000,8 @@ class Dssp {
71964
72000
  if(bBstrand && bCstrand && bEstrand && bFstrand) break;
71965
72001
  }
71966
72002
 
72003
+ console.log("### " + bBstrand + bCstrand + bEstrand + bFstrand);
72004
+
71967
72005
  // if(refpdbname != 'CD19_6al5A_human-n1') { // relax for CD19
71968
72006
  if(!(bBstrand && bCstrand && bEstrand && bFstrand) || !(bBSheet && bCSheet && bESheet && bFSheet)) {
71969
72007
  // if(!(bBstrand && bCstrand && bEstrand && bFstrand)) {
@@ -71977,7 +72015,6 @@ class Dssp {
71977
72015
  continue;
71978
72016
  }
71979
72017
  // }
71980
-
71981
72018
  }
71982
72019
 
71983
72020
  if(!bRound1) {
@@ -72525,15 +72562,21 @@ class Dssp {
72525
72562
 
72526
72563
  let resi = refAA[i][j].trim();
72527
72564
  let refnum = refAA[refI][j].trim();
72565
+
72566
+ if(!ic.chainsMapping.hasOwnProperty(chainid)) {
72567
+ ic.chainsMapping[chainid] = {};
72568
+ }
72569
+
72570
+ let resid = chainid + '_' + resi;
72571
+
72528
72572
  if(resi && refnum) {
72529
- let resid = chainid + '_' + resi;
72530
72573
  ic.resid2refnum[resid] = refnum;
72531
72574
 
72532
- if(!ic.chainsMapping.hasOwnProperty(chainid)) {
72533
- ic.chainsMapping[chainid] = {};
72534
- }
72535
72575
  ic.chainsMapping[chainid][resid] = refnum;
72536
72576
  }
72577
+ else {
72578
+ ic.chainsMapping[chainid][resid] = resi;
72579
+ }
72537
72580
  }
72538
72581
  }
72539
72582
 
@@ -73009,17 +73052,18 @@ class Dssp {
73009
73052
  }
73010
73053
 
73011
73054
  // assign before removing
73012
- let resid = chnid + '_' + strandArray[i].startResi;
73055
+ chnid + '_' + strandArray[i].startResi;
73013
73056
 
73014
73057
  strandArray.splice(i, 1);
73015
73058
 
73016
- if(strandTmp == 'B' || strandTmp == 'C' || strandTmp == 'E' || strandTmp == 'F') {
73017
- if(!me.bNode) console.log("Ig strand " + strandTmp + " is removed since it is too short...");
73059
+ // do not remove BCEF strands even though they are short
73060
+ // if(strandTmp == 'B' || strandTmp == 'C' || strandTmp == 'E' || strandTmp == 'F') {
73061
+ // if(!me.bNode) console.log("Ig strand " + strandTmp + " is removed since it is too short...");
73018
73062
 
73019
- let domainid = ic.resid2domainid[resid];
73020
- removeDomainidHash[domainid] = 1;
73021
- continue;
73022
- }
73063
+ // let domainid = ic.resid2domainid[resid];
73064
+ // removeDomainidHash[domainid] = 1;
73065
+ // continue;
73066
+ // }
73023
73067
  }
73024
73068
  }
73025
73069
 
@@ -73237,7 +73281,7 @@ class Dssp {
73237
73281
 
73238
73282
  // remove the postfix when comparing interactions
73239
73283
  //ic.chainsMapping[chnid][residueid] = refnumLabel;
73240
- ic.chainsMapping[chnid][residueid] = refnumLabelNoPostfix;
73284
+ ic.chainsMapping[chnid][residueid] = (refnumLabelNoPostfix) ? refnumLabelNoPostfix : currResi;
73241
73285
  }
73242
73286
  }
73243
73287
 
@@ -81390,7 +81434,7 @@ class iCn3DUI {
81390
81434
  //even when multiple iCn3D viewers are shown together.
81391
81435
  this.pre = this.cfg.divid + "_";
81392
81436
 
81393
- this.REVISION = '3.31.3';
81437
+ this.REVISION = '3.31.4';
81394
81438
 
81395
81439
  // In nodejs, iCn3D defines "window = {navigator: {}}"
81396
81440
  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.31.12",
3
+ "version": "3.31.13",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {