icn3d 3.31.11 → 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.js CHANGED
@@ -16953,7 +16953,7 @@ class Events {
16953
16953
  //ic.initUI();
16954
16954
  ic.init();
16955
16955
  ic.bInputfile = true;
16956
- ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + data : data;
16956
+ ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + data : dataStr;
16957
16957
  ic.InputfileType = 'mmcif';
16958
16958
  // await ic.mmcifParserCls.loadMmcifData(data);
16959
16959
  await ic.opmParserCls.loadOpmData(dataStr, undefined, undefined, 'mmcif', undefined, bText);
@@ -17608,11 +17608,13 @@ class Events {
17608
17608
  let command;
17609
17609
  if(shape == 'Sphere') {
17610
17610
  ic.sphereCls.createSphereBase(pos1, color, radius, undefined, undefined, undefined, opacity);
17611
- command = 'add sphere | x1 ' + pos1.x.toPrecision(4) + ' y1 ' + pos1.y.toPrecision(4) + ' z1 ' + pos1.z.toPrecision(4) + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
17611
+ // command = 'add sphere | x1 ' + pos1.x.toPrecision(4) + ' y1 ' + pos1.y.toPrecision(4) + ' z1 ' + pos1.z.toPrecision(4) + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
17612
+ command = 'add sphere | ' + nameArray + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
17612
17613
  }
17613
17614
  else {
17614
17615
  ic.boxCls.createBox_base(pos1, radius, color, undefined, undefined, undefined, opacity);
17615
- command = 'add cube | x1 ' + pos1.x.toPrecision(4) + ' y1 ' + pos1.y.toPrecision(4) + ' z1 ' + pos1.z.toPrecision(4) + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
17616
+ // command = 'add cube | x1 ' + pos1.x.toPrecision(4) + ' y1 ' + pos1.y.toPrecision(4) + ' z1 ' + pos1.z.toPrecision(4) + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
17617
+ command = 'add cube | ' + nameArray + ' | color ' + colorStr + ' | opacity ' + opacity + ' | radius ' + radius;
17616
17618
  }
17617
17619
 
17618
17620
  thisClass.setLogCmd(command, true);
@@ -28146,14 +28148,14 @@ class Strand {
28146
28148
  // include the whole sheet or helix when highlighting
28147
28149
  let atomsAdjust = {};
28148
28150
 
28149
- //if( (bHighlight === 1 || bHighlight === 2) && !ic.bAllAtoms) {
28150
- //if( !ic.bAllAtoms) {
28151
- if( Object.keys(atoms).length < Object.keys(ic.atoms).length) {
28152
- atomsAdjust = this.getSSExpandedAtoms(atoms);
28153
- }
28154
- else {
28155
- atomsAdjust = atoms;
28156
- }
28151
+ // if( Object.keys(atoms).length < Object.keys(ic.atoms).length) {
28152
+ // atomsAdjust = this.getSSExpandedAtoms(atoms);
28153
+ // }
28154
+ // else {
28155
+ // atomsAdjust = atoms;
28156
+ // }
28157
+
28158
+ atomsAdjust = atoms;
28157
28159
 
28158
28160
  if(bHighlight === 2) {
28159
28161
  if(fill) {
@@ -28211,9 +28213,16 @@ class Strand {
28211
28213
 
28212
28214
  let maxDist = 6.0;
28213
28215
 
28216
+ //get the last residue
28217
+ let atomArray = Object.keys(atoms);
28218
+ let lastAtomSerial = atomArray[atomArray.length - 1];
28219
+ let lastAtom = atoms[lastAtomSerial];
28220
+ let lastResid = lastAtom.structure + '_' + lastAtom.chain + '_' + lastAtom.resi;
28221
+
28214
28222
  for (let i in atomsAdjust) {
28215
28223
  atom = atomsAdjust[i];
28216
28224
  let chainid = atom.structure + '_' + atom.chain;
28225
+ let resid = atom.structure + '_' + atom.chain + '_' + atom.resi;
28217
28226
  if ((atom.name === 'O' || atom.name === 'CA') && !atom.het) {
28218
28227
  // "CA" has to appear before "O"
28219
28228
 
@@ -28250,7 +28259,7 @@ class Strand {
28250
28259
  if(atom.ssend && atom.ss === 'sheet') {
28251
28260
  bSheetSegment = true;
28252
28261
  }
28253
- else if(atom.ssend && atom.ss === 'helix') {
28262
+ else if( (atom.ssend && atom.ss === 'helix') || resid == lastResid) { // partial sheet will draw as helix
28254
28263
  bHelixSegment = true;
28255
28264
  }
28256
28265
 
@@ -28357,7 +28366,7 @@ class Strand {
28357
28366
  // }
28358
28367
 
28359
28368
  //if ((atom.ssbegin || atom.ssend || (drawnResidueCount === totalResidueCount - 1) || bBrokenSs) && pnts[0].length > 0 && bSameChain) {
28360
- if ((currentChain !== atom.chain || atom.ssbegin || atom.ssend || (drawnResidueCount === totalResidueCount - 1) || bBrokenSs) && pnts[0].length > 0) {
28369
+ if ((currentChain !== atom.chain || atom.ssbegin || atom.ssend || (drawnResidueCount === totalResidueCount - 1) || bBrokenSs || resid == lastResid) && pnts[0].length > 0) {
28361
28370
  let atomName = 'CA';
28362
28371
 
28363
28372
  let prevone = [], nexttwo = [];
@@ -28500,8 +28509,11 @@ class Strand {
28500
28509
  bHelixSegment = false;
28501
28510
  } // end if (atom.ssbegin || atom.ssend)
28502
28511
 
28503
- // end of a chain
28504
- if ((currentChain !== atom.chain || ic.ParserUtilsCls.getResiNCBI(atom.structure + '_' + currentChain, currentResi) + 1 !== ic.ParserUtilsCls.getResiNCBI(chainid, atom.resi)) && pnts[0].length > 0) {
28512
+ // end of a chain, or end of selection
28513
+ if ((currentChain !== atom.chain
28514
+ || ic.ParserUtilsCls.getResiNCBI(atom.structure + '_' + currentChain, currentResi) + 1 !== ic.ParserUtilsCls.getResiNCBI(chainid, atom.resi)
28515
+ || resid == lastResid
28516
+ ) && pnts[0].length > 0) {
28505
28517
  //if ((currentChain !== atom.chain) && pnts[0].length > 0) {
28506
28518
 
28507
28519
  let atomName = 'CA';
@@ -40003,6 +40015,9 @@ class AnnoCddSite {
40003
40015
  // if(type != 'domain') setname += "_" + index + "_" + r;
40004
40016
  if(type != 'domain') setname = chnid + "_" + index + "_" + r + "_" + domain;
40005
40017
 
40018
+ //remove space in setname
40019
+ setname = setname.replace(/\s+/g, '');
40020
+
40006
40021
  if(type == 'domain') pssmid2fromArray[pssmid] = fromArray;
40007
40022
  if(type == 'domain') pssmid2toArray[pssmid] = toArray;
40008
40023
 
@@ -43903,27 +43918,12 @@ class AddTrack {
43903
43918
  });
43904
43919
 
43905
43920
  // Isoform Alignment
43906
- me.myEventCls.onIds("#" + ic.pre + "addtrack_button2c", "click", async function(e) { let ic = thisClass.icn3d;
43921
+ me.myEventCls.onIds("#" + ic.pre + "addtrack_button2c", "click", async function(e) { thisClass.icn3d;
43907
43922
  e.stopImmediatePropagation();
43908
43923
  //e.preventDefault();
43909
43924
  dialog.dialog( "close" );
43910
43925
 
43911
- let chainid = $("#" + ic.pre + "track_chainid").val();
43912
- let geneid = $("#" + ic.pre + "track_geneid").val();
43913
- if(!geneid) {
43914
- var aaa = 1; //alert("Please fill in the Gene ID...");
43915
- return;
43916
- }
43917
-
43918
- let startpos = $("#" + ic.pre + "fasta_startpos2").val();
43919
- if(!startpos) startpos = 1;
43920
-
43921
- //let colorseqby = $("#" + ic.pre + "colorseqby2").val();
43922
- //let type =(colorseqby == 'identity') ? 'identity' : 'custom';
43923
-
43924
- let type = 'identity';
43925
-
43926
- await thisClass.addExonTracks(chainid, geneid, startpos, type);
43926
+ await thisClass.addExonTracksWrap();
43927
43927
  });
43928
43928
 
43929
43929
  // BED file
@@ -45514,6 +45514,25 @@ class AddTrack {
45514
45514
  return acclistTmp;
45515
45515
  }
45516
45516
 
45517
+ async addExonTracksWrap() { let ic = this.icn3d; ic.icn3dui;
45518
+ let chainid = $("#" + ic.pre + "track_chainid").val();
45519
+ let geneid = $("#" + ic.pre + "track_geneid").val();
45520
+ if(!geneid) {
45521
+ var aaa = 1; //alert("Please fill in the Gene ID...");
45522
+ return;
45523
+ }
45524
+
45525
+ let startpos = $("#" + ic.pre + "fasta_startpos2").val();
45526
+ if(!startpos) startpos = 1;
45527
+
45528
+ //let colorseqby = $("#" + ic.pre + "colorseqby2").val();
45529
+ //let type =(colorseqby == 'identity') ? 'identity' : 'custom';
45530
+
45531
+ let type = 'identity';
45532
+
45533
+ await thisClass.addExonTracks(chainid, geneid, startpos, type);
45534
+ }
45535
+
45517
45536
  async addExonTracks(chainid, geneid, startpos, type) { let ic = this.icn3d, me = ic.icn3dui;
45518
45537
  let thisClass = this;
45519
45538
 
@@ -47708,11 +47727,12 @@ class HlSeq {
47708
47727
  ic.bAlignSeq = false;
47709
47728
  ic.bAnnotations = true;
47710
47729
  }
47711
-
47730
+
47712
47731
  if(ic.bSelectResidue === false && !ic.bShift && !ic.bCtrl) {
47732
+ // if(!ic.bShift && !ic.bCtrl) {
47713
47733
  ic.selectionCls.removeSelection();
47714
47734
  }
47715
-
47735
+
47716
47736
  // select residues
47717
47737
  $("span.ui-selected", this).each(function() {
47718
47738
  let id = $(this).attr('id');
@@ -47723,11 +47743,12 @@ class HlSeq {
47723
47743
  });
47724
47744
 
47725
47745
  ic.selectionCls.saveSelectionPrep(true);
47726
- ic.selectionCls.saveSelection(undefined, undefined, true);
47746
+ //ic.selectionCls.saveSelection(undefined, undefined, true);
47747
+ // do not use selected residues, use ic.hAtoms instead
47748
+ ic.selectionCls.saveSelection(undefined, undefined, false);
47727
47749
 
47728
47750
  //ic.residueLabelsCls.addResidueLabels(ic.hAtoms, false, 0.5);
47729
47751
  ic.hlObjectsCls.addHlObjects(); // render() is called
47730
-
47731
47752
  // get all chainid in the selected residues
47732
47753
  let chainHash = {};
47733
47754
  for(let residueid in ic.selectedResidues) {
@@ -47810,7 +47831,9 @@ class HlSeq {
47810
47831
  thisClass.selectResidues(id, this);
47811
47832
 
47812
47833
  ic.selectionCls.saveSelectionPrep(true);
47813
- ic.selectionCls.saveSelection(undefined, undefined, true);
47834
+ //ic.selectionCls.saveSelection(undefined, undefined, true);
47835
+ // do not use selected residues, use ic.hAtoms instead
47836
+ ic.selectionCls.saveSelection(undefined, undefined, false);
47814
47837
  }
47815
47838
  //});
47816
47839
 
@@ -48135,9 +48158,10 @@ class HlSeq {
48135
48158
  if(me.bNode) return;
48136
48159
 
48137
48160
  if(ic.bSelectResidue === false && !ic.bShift && !ic.bCtrl) {
48161
+ // if(!ic.bShift && !ic.bCtrl) {
48138
48162
  ic.selectionCls.removeSelection();
48139
48163
  }
48140
-
48164
+
48141
48165
  if(id !== undefined && id !== '') {
48142
48166
  // add "align_" in front of id so that full sequence and aligned sequence will not conflict
48143
48167
  //if(id.substr(0, 5) === 'align') id = id.substr(5);
@@ -65168,11 +65192,13 @@ class ApplyCommand {
65168
65192
  ic.drawCls.draw();
65169
65193
  }
65170
65194
  else if(command.indexOf('add sphere') == 0) {
65171
- this.addShape(command, 'sphere');
65195
+ this.addShape(commandOri, 'sphere');
65196
+ ic.shapeCmdHash[commandOri] = 1;
65172
65197
  //ic.drawCls.draw();
65173
65198
  }
65174
65199
  else if(command.indexOf('add cube') == 0) {
65175
- this.addShape(command, 'cube');
65200
+ this.addShape(commandOri, 'cube');
65201
+ ic.shapeCmdHash[commandOri] = 1;
65176
65202
  //ic.drawCls.draw();
65177
65203
  }
65178
65204
  else if(command.indexOf('clear shape') == 0) {
@@ -65628,8 +65654,8 @@ class ApplyCommand {
65628
65654
 
65629
65655
  ic.hlUpdateCls.updateHlAll();
65630
65656
 
65631
- // change graph color
65632
- ic.getGraphCls.updateGraphColor();
65657
+ // change graph color, was done in color command
65658
+ //ic.getGraphCls.updateGraphColor();
65633
65659
  }
65634
65660
  else if(commandOri.indexOf('remove legend') == 0) {
65635
65661
  $("#" + me.pre + "legend").hide();
@@ -65915,7 +65941,7 @@ class ApplyCommand {
65915
65941
  }
65916
65942
 
65917
65943
  addShape(command, shape) { let ic = this.icn3d, me = ic.icn3dui;
65918
- ic.shapeCmdHash[command] = 1;
65944
+ // ic.shapeCmdHash[command] = 1;
65919
65945
 
65920
65946
  let paraArray = command.split(' | ');
65921
65947
  let p1Array = paraArray[1].split(' ');
@@ -65926,7 +65952,17 @@ class ApplyCommand {
65926
65952
  colorStr = '#' + colorStr.replace(/\#/g, '');
65927
65953
  let color = me.parasCls.thr(colorStr);
65928
65954
 
65929
- let pos1 = new THREE.Vector3(parseFloat(p1Array[1]), parseFloat(p1Array[3]), parseFloat(p1Array[5]));
65955
+ let pos1;
65956
+
65957
+ if(p1Array[0] == 'x1') { // input position
65958
+ pos1 = new THREE.Vector3(parseFloat(p1Array[1]), parseFloat(p1Array[3]), parseFloat(p1Array[5]));
65959
+ }
65960
+ else { // input sets
65961
+ let nameArray = paraArray[1].split(',');
65962
+ let atomSet1 = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
65963
+ let posArray1 = ic.contactCls.getExtent(atomSet1);
65964
+ pos1 = new THREE.Vector3(posArray1[2][0], posArray1[2][1], posArray1[2][2]);
65965
+ }
65930
65966
 
65931
65967
  if(shape == 'sphere') {
65932
65968
  ic.sphereCls.createSphereBase(pos1, color, parseFloat(radius), undefined, undefined, undefined, parseFloat(opacity));
@@ -66906,7 +66942,7 @@ class SelectCollections {
66906
66942
 
66907
66943
  ic.ssbondpnts = {};
66908
66944
 
66909
- ic.bShowHighlight = false;
66945
+ ic.bShowHighlight = undefined;
66910
66946
  ic.bResetSets = true;
66911
66947
  }
66912
66948
 
@@ -67037,8 +67073,8 @@ class SelectCollections {
67037
67073
  ic.hAtoms = me.hashUtilsCls.cloneHash(ic.atoms);
67038
67074
  }
67039
67075
 
67040
- ic.opts["color"] = "structure";
67041
- ic.setStyleCls.setAtomStyleByOptions();
67076
+ ic.opts["color"] = (Object.keys(ic.structures).length == 1) ? "chain" : "structure";
67077
+ // ic.setStyleCls.setAtomStyleByOptions();
67042
67078
  ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
67043
67079
 
67044
67080
  ic.transformCls.zoominSelection();
@@ -71063,6 +71099,8 @@ class Dssp {
71063
71099
  if(bBstrand && bCstrand && bEstrand && bFstrand) break;
71064
71100
  }
71065
71101
 
71102
+ console.log("### " + bBstrand + bCstrand + bEstrand + bFstrand);
71103
+
71066
71104
  // if(refpdbname != 'CD19_6al5A_human-n1') { // relax for CD19
71067
71105
  if(!(bBstrand && bCstrand && bEstrand && bFstrand) || !(bBSheet && bCSheet && bESheet && bFSheet)) {
71068
71106
  // if(!(bBstrand && bCstrand && bEstrand && bFstrand)) {
@@ -71076,7 +71114,6 @@ class Dssp {
71076
71114
  continue;
71077
71115
  }
71078
71116
  // }
71079
-
71080
71117
  }
71081
71118
 
71082
71119
  if(!bRound1) {
@@ -71624,15 +71661,21 @@ class Dssp {
71624
71661
 
71625
71662
  let resi = refAA[i][j].trim();
71626
71663
  let refnum = refAA[refI][j].trim();
71664
+
71665
+ if(!ic.chainsMapping.hasOwnProperty(chainid)) {
71666
+ ic.chainsMapping[chainid] = {};
71667
+ }
71668
+
71669
+ let resid = chainid + '_' + resi;
71670
+
71627
71671
  if(resi && refnum) {
71628
- let resid = chainid + '_' + resi;
71629
71672
  ic.resid2refnum[resid] = refnum;
71630
71673
 
71631
- if(!ic.chainsMapping.hasOwnProperty(chainid)) {
71632
- ic.chainsMapping[chainid] = {};
71633
- }
71634
71674
  ic.chainsMapping[chainid][resid] = refnum;
71635
71675
  }
71676
+ else {
71677
+ ic.chainsMapping[chainid][resid] = resi;
71678
+ }
71636
71679
  }
71637
71680
  }
71638
71681
 
@@ -71697,6 +71740,7 @@ class Dssp {
71697
71740
 
71698
71741
  // if(bIgDomain) {
71699
71742
  for(let structure in ic.structures) {
71743
+ let bIgDomain = 0;
71700
71744
  let refDataTmp = '';
71701
71745
  for(let m = 0, ml = ic.structures[structure].length; ic.bShowRefnum && m < ml; ++m) {
71702
71746
  let chnid = ic.structures[structure][m];
@@ -71726,17 +71770,17 @@ class Dssp {
71726
71770
  refDataTmp += '],\n';
71727
71771
 
71728
71772
  refDataTmp += '},\n';
71773
+
71774
+ bIgDomain = 1;
71729
71775
  }
71730
71776
 
71731
71777
  refDataTmp += '}},\n';
71732
71778
  }
71733
71779
  }
71734
71780
 
71735
- let bIgDomain = (refDataTmp) ? 1 : 0;
71736
-
71737
71781
  refData += '{"' + structure + '": {"Ig domain" : ' + bIgDomain + ', "igs": [\n';
71738
71782
 
71739
- refData += refDataTmp;
71783
+ if(bIgDomain) refData += refDataTmp;
71740
71784
 
71741
71785
  refData += ']}},\n';
71742
71786
  }
@@ -72107,17 +72151,18 @@ class Dssp {
72107
72151
  }
72108
72152
 
72109
72153
  // assign before removing
72110
- let resid = chnid + '_' + strandArray[i].startResi;
72154
+ chnid + '_' + strandArray[i].startResi;
72111
72155
 
72112
72156
  strandArray.splice(i, 1);
72113
72157
 
72114
- if(strandTmp == 'B' || strandTmp == 'C' || strandTmp == 'E' || strandTmp == 'F') {
72115
- if(!me.bNode) console.log("Ig strand " + strandTmp + " is removed since it is too short...");
72158
+ // do not remove BCEF strands even though they are short
72159
+ // if(strandTmp == 'B' || strandTmp == 'C' || strandTmp == 'E' || strandTmp == 'F') {
72160
+ // if(!me.bNode) console.log("Ig strand " + strandTmp + " is removed since it is too short...");
72116
72161
 
72117
- let domainid = ic.resid2domainid[resid];
72118
- removeDomainidHash[domainid] = 1;
72119
- continue;
72120
- }
72162
+ // let domainid = ic.resid2domainid[resid];
72163
+ // removeDomainidHash[domainid] = 1;
72164
+ // continue;
72165
+ // }
72121
72166
  }
72122
72167
  }
72123
72168
 
@@ -72335,7 +72380,7 @@ class Dssp {
72335
72380
 
72336
72381
  // remove the postfix when comparing interactions
72337
72382
  //ic.chainsMapping[chnid][residueid] = refnumLabel;
72338
- ic.chainsMapping[chnid][residueid] = refnumLabelNoPostfix;
72383
+ ic.chainsMapping[chnid][residueid] = (refnumLabelNoPostfix) ? refnumLabelNoPostfix : currResi;
72339
72384
  }
72340
72385
  }
72341
72386
 
@@ -80488,7 +80533,7 @@ class iCn3DUI {
80488
80533
  //even when multiple iCn3D viewers are shown together.
80489
80534
  this.pre = this.cfg.divid + "_";
80490
80535
 
80491
- this.REVISION = '3.31.3';
80536
+ this.REVISION = '3.31.4';
80492
80537
 
80493
80538
  // In nodejs, iCn3D defines "window = {navigator: {}}"
80494
80539
  this.bNode = (Object.keys(window).length < 2) ? true : false;