icn3d 3.51.3 → 3.52.0
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 +75 -33
- package/icn3d.min.js +3 -3
- package/icn3d.module.js +75 -33
- package/package.json +1 -1
package/icn3d.js
CHANGED
|
@@ -101152,20 +101152,12 @@ class GetGraph {
|
|
|
101152
101152
|
let thickness = me.htmlCls.coilValue;
|
|
101153
101153
|
let prevChain = '', prevResName = '', prevResi = 0;
|
|
101154
101154
|
// add chemicals as well
|
|
101155
|
-
let residHash =
|
|
101156
|
-
for(let
|
|
101157
|
-
let atom = ic.
|
|
101155
|
+
let residHash = ic.firstAtomObjCls.getResiduesFromAtoms(atomSet);
|
|
101156
|
+
for(let resid in residHash) {
|
|
101157
|
+
let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
|
|
101158
101158
|
|
|
101159
|
-
if(atom.chain != 'DUM' && (bAnyAtom || atom.het || (atom.name == "CA" && atom.elem == "C") || atom.name == "O3'" || atom.name == "O3*" || atom.name == "P")) {
|
|
101160
|
-
|
|
101161
|
-
//if(atom.chain != 'DUM' &&(atom.name == "CA" || atom.name == "P")) {
|
|
101162
|
-
let resid = atom.structure + '_' + atom.chain + '_' + atom.resi;
|
|
101163
|
-
if(residHash.hasOwnProperty(resid)) {
|
|
101164
|
-
continue;
|
|
101165
|
-
}
|
|
101166
|
-
else {
|
|
101167
|
-
residHash[resid] = 1;
|
|
101168
|
-
}
|
|
101159
|
+
//if(atom.chain != 'DUM' && (bAnyAtom || atom.het || (atom.name == "CA" && atom.elem == "C") || atom.name == "O3'" || atom.name == "O3*" || atom.name == "P")) {
|
|
101160
|
+
if(atom.chain != 'DUM') {
|
|
101169
101161
|
let resName = me.utilsCls.residueName2Abbr(atom.resn) + atom.resi;
|
|
101170
101162
|
if(labelType == 'chain' || labelType == 'structure') resName += '.' + atom.chain;
|
|
101171
101163
|
if(labelType == 'structure') resName += '.' + atom.structure;
|
|
@@ -108113,12 +108105,15 @@ class OpmParser {
|
|
|
108113
108105
|
|
|
108114
108106
|
async loadOpmData(data, pdbid, bFull, type, pdbid2, bText) { let ic = this.icn3d, me = ic.icn3dui;
|
|
108115
108107
|
try {
|
|
108116
|
-
|
|
108117
|
-
let url = me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&opm&uid=" + pdbid.toLowerCase();
|
|
108108
|
+
if(!pdbid) pdbid = ic.defaultPdbId;
|
|
108118
108109
|
|
|
108119
|
-
|
|
108120
|
-
|
|
108121
|
-
|
|
108110
|
+
//if(me.cfg.mmtfid === undefined && me.cfg.bcifid === undefined) { // skip opm for bcif files
|
|
108111
|
+
let url = me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&opm&uid=" + pdbid.toLowerCase();
|
|
108112
|
+
|
|
108113
|
+
let opmdata = await me.getAjaxPromise(url, 'jsonp', false);
|
|
108114
|
+
|
|
108115
|
+
this.setOpmData(opmdata); // set ic.bOpm
|
|
108116
|
+
//}
|
|
108122
108117
|
|
|
108123
108118
|
await this.parseAtomData(data, pdbid, bFull, type, pdbid2, bText);
|
|
108124
108119
|
}
|
|
@@ -116295,6 +116290,36 @@ class LoadCIF {
|
|
|
116295
116290
|
this.icn3d = icn3d;
|
|
116296
116291
|
}
|
|
116297
116292
|
|
|
116293
|
+
// Fast replacements for ic.loadPDBCls.isSecondary(), which does a linear scan
|
|
116294
|
+
// ($.inArray, or a hand-rolled loop with a substr() per comparison for bNMR) over
|
|
116295
|
+
// residArray - and gets called up to 6 times per atom in the main atom loop below.
|
|
116296
|
+
// buildSecondarySet() precomputes, once per model, exactly what isSecondary would
|
|
116297
|
+
// have compared against on every call (the raw resid strings for non-NMR, or the
|
|
116298
|
+
// structure-prefix-stripped "chain_resi" strings for NMR - matching isSecondary's
|
|
116299
|
+
// two branches exactly), so membership becomes an O(1) Set lookup instead of an
|
|
116300
|
+
// O(residArray.length) scan repeated for every atom. isSecondary's 4th parameter
|
|
116301
|
+
// (bNonFull) is intentionally not replicated here: in the actual implementation
|
|
116302
|
+
// it's dead (the only reference to it is commented out), so it has no behavior to
|
|
116303
|
+
// preserve.
|
|
116304
|
+
buildSecondarySet(residArray, bNMR) {
|
|
116305
|
+
let s = new Set();
|
|
116306
|
+
if(!bNMR) {
|
|
116307
|
+
for(let i = 0, il = residArray.length; i < il; ++i) s.add(residArray[i]);
|
|
116308
|
+
}
|
|
116309
|
+
else {
|
|
116310
|
+
for(let i = 0, il = residArray.length; i < il; ++i) {
|
|
116311
|
+
let r = residArray[i];
|
|
116312
|
+
s.add(r.substr(r.indexOf('_') + 1));
|
|
116313
|
+
}
|
|
116314
|
+
}
|
|
116315
|
+
return s;
|
|
116316
|
+
}
|
|
116317
|
+
|
|
116318
|
+
isSecondaryFast(resid, secondarySet, bNMR) {
|
|
116319
|
+
if(!bNMR) return secondarySet.has(resid);
|
|
116320
|
+
return secondarySet.has(resid.substr(resid.indexOf('_') + 1));
|
|
116321
|
+
}
|
|
116322
|
+
|
|
116298
116323
|
loadCIF(bcifData, bcifid, bText, bAppend) { let ic = this.icn3d, me = ic.icn3dui;
|
|
116299
116324
|
let hAtoms = {};
|
|
116300
116325
|
|
|
@@ -116671,7 +116696,10 @@ class LoadCIF {
|
|
|
116671
116696
|
// check 3QUM
|
|
116672
116697
|
let chainArray = atom_site.getColumn("auth_asym_id");
|
|
116673
116698
|
|
|
116674
|
-
|
|
116699
|
+
// label_seq_id used to be fetched into "resiArray" here and decoded into
|
|
116700
|
+
// "resi" below, but that value was always immediately overwritten by
|
|
116701
|
+
// auth_seq_id (oriResi) before being used anywhere - decoding it per atom
|
|
116702
|
+
// was pure wasted work, so it is no longer fetched at all.
|
|
116675
116703
|
let resiOriArray = atom_site.getColumn("auth_seq_id");
|
|
116676
116704
|
let altArray = atom_site.getColumn("label_alt_id");
|
|
116677
116705
|
|
|
@@ -116684,6 +116712,14 @@ class LoadCIF {
|
|
|
116684
116712
|
let autochainArray = atom_site.getColumn("label_asym_id");
|
|
116685
116713
|
let modelNumArray = atom_site.getColumn("pdbx_PDB_model_num");
|
|
116686
116714
|
|
|
116715
|
+
// built once per model instead of scanned per atom - see isSecondaryFast()
|
|
116716
|
+
let sheetSet = this.buildSecondarySet(sheetArray, bNMR);
|
|
116717
|
+
let sheetStartSet = this.buildSecondarySet(sheetStart, bNMR);
|
|
116718
|
+
let sheetEndSet = this.buildSecondarySet(sheetEnd, bNMR);
|
|
116719
|
+
let helixSet = this.buildSecondarySet(helixArray, bNMR);
|
|
116720
|
+
let helixStartSet = this.buildSecondarySet(helixStart, bNMR);
|
|
116721
|
+
let helixEndSet = this.buildSecondarySet(helixEnd, bNMR);
|
|
116722
|
+
|
|
116687
116723
|
// get the bond info
|
|
116688
116724
|
let ligSeqHash = {}, prevAutochain = '';
|
|
116689
116725
|
let prevResn;
|
|
@@ -116710,14 +116746,13 @@ class LoadCIF {
|
|
|
116710
116746
|
let atom = nameArray.getString(i);
|
|
116711
116747
|
let entityid = entiyidArray.getString(i);
|
|
116712
116748
|
let chain = chainArray.getString(i);
|
|
116713
|
-
let resi = resiArray.getString(i);
|
|
116714
116749
|
let oriResi = resiOriArray.getString(i);
|
|
116715
116750
|
let alt = altArray.getString(i);
|
|
116716
116751
|
let bFactor = bArray.getString(i);
|
|
116717
116752
|
|
|
116718
116753
|
let autochain = autochainArray.getString(i);
|
|
116719
116754
|
|
|
116720
|
-
resi = oriResi;
|
|
116755
|
+
let resi = oriResi;
|
|
116721
116756
|
|
|
116722
116757
|
let molecueType;
|
|
116723
116758
|
if(atom_hetatm == "ATOM") {
|
|
@@ -116872,26 +116907,26 @@ class LoadCIF {
|
|
|
116872
116907
|
|
|
116873
116908
|
// Assign secondary structures from the input
|
|
116874
116909
|
// if a residue is assigned both sheet and helix, it is assigned as sheet
|
|
116875
|
-
if(
|
|
116910
|
+
if(this.isSecondaryFast(residueNum, sheetSet, bNMR)) {
|
|
116876
116911
|
ic.atoms[serial].ss = 'sheet';
|
|
116877
|
-
if(
|
|
116912
|
+
if(this.isSecondaryFast(residueNum, sheetStartSet, bNMR)) {
|
|
116878
116913
|
ic.atoms[serial].ssbegin = true;
|
|
116879
116914
|
}
|
|
116880
116915
|
|
|
116881
116916
|
// do not use else if. Some residues are both start and end of secondary structure
|
|
116882
|
-
if(
|
|
116917
|
+
if(this.isSecondaryFast(residueNum, sheetEndSet, bNMR)) {
|
|
116883
116918
|
ic.atoms[serial].ssend = true;
|
|
116884
116919
|
}
|
|
116885
116920
|
}
|
|
116886
|
-
else if(
|
|
116921
|
+
else if(this.isSecondaryFast(residueNum, helixSet, bNMR)) {
|
|
116887
116922
|
ic.atoms[serial].ss = 'helix';
|
|
116888
116923
|
|
|
116889
|
-
if(
|
|
116924
|
+
if(this.isSecondaryFast(residueNum, helixStartSet, bNMR)) {
|
|
116890
116925
|
ic.atoms[serial].ssbegin = true;
|
|
116891
116926
|
}
|
|
116892
116927
|
|
|
116893
116928
|
// do not use else if. Some residues are both start and end of secondary structure
|
|
116894
|
-
if(
|
|
116929
|
+
if(this.isSecondaryFast(residueNum, helixEndSet, bNMR)) {
|
|
116895
116930
|
ic.atoms[serial].ssend = true;
|
|
116896
116931
|
}
|
|
116897
116932
|
}
|
|
@@ -117009,7 +117044,7 @@ class LoadCIF {
|
|
|
117009
117044
|
*/
|
|
117010
117045
|
|
|
117011
117046
|
// clear memory
|
|
117012
|
-
atom_hetatmArray = resnArray = elemArray = nameArray = chainArray =
|
|
117047
|
+
atom_hetatmArray = resnArray = elemArray = nameArray = chainArray = resiOriArray
|
|
117013
117048
|
= altArray = bArray = xArray = yArray = zArray = autochainArray = [];
|
|
117014
117049
|
|
|
117015
117050
|
let mChainSeq = {};
|
|
@@ -117181,7 +117216,6 @@ class LoadCIF {
|
|
|
117181
117216
|
// check the bonds between chemicals and all other atoms
|
|
117182
117217
|
let processedChemicals = {};
|
|
117183
117218
|
for(let i in ic.chemicals) {
|
|
117184
|
-
console.log(" i = ", i, " processedChemicals = ", processedChemicals);
|
|
117185
117219
|
if(processedChemicals.hasOwnProperty(i)) continue;
|
|
117186
117220
|
|
|
117187
117221
|
let atom = ic.atoms[i];
|
|
@@ -120659,6 +120693,7 @@ class DefinedSets {
|
|
|
120659
120693
|
}
|
|
120660
120694
|
}
|
|
120661
120695
|
//}
|
|
120696
|
+
|
|
120662
120697
|
return residuesHash;
|
|
120663
120698
|
}
|
|
120664
120699
|
|
|
@@ -122589,6 +122624,8 @@ class Selection {
|
|
|
122589
122624
|
selectMainChains() { let ic = this.icn3d, me = ic.icn3dui;
|
|
122590
122625
|
let currHAtoms = me.hashUtilsCls.cloneHash(ic.hAtoms);
|
|
122591
122626
|
|
|
122627
|
+
ic.opts.pk = 'atom';
|
|
122628
|
+
|
|
122592
122629
|
ic.hAtoms = ic.applyDisplayCls.selectMainChainSubset(currHAtoms);
|
|
122593
122630
|
|
|
122594
122631
|
ic.hlUpdateCls.showHighlight();
|
|
@@ -122598,6 +122635,8 @@ class Selection {
|
|
|
122598
122635
|
selectSideChains() { let ic = this.icn3d, me = ic.icn3dui;
|
|
122599
122636
|
let currHAtoms = me.hashUtilsCls.cloneHash(ic.hAtoms);
|
|
122600
122637
|
|
|
122638
|
+
ic.opts.pk = 'atom';
|
|
122639
|
+
|
|
122601
122640
|
ic.hAtoms = this.getSideAtoms(currHAtoms);
|
|
122602
122641
|
ic.hlUpdateCls.showHighlight();
|
|
122603
122642
|
}
|
|
@@ -122619,6 +122658,8 @@ class Selection {
|
|
|
122619
122658
|
selectMainSideChains() { let ic = this.icn3d, me = ic.icn3dui;
|
|
122620
122659
|
let residHash = ic.firstAtomObjCls.getResiduesFromAtoms(ic.hAtoms);
|
|
122621
122660
|
|
|
122661
|
+
ic.opts.pk = 'residue';
|
|
122662
|
+
|
|
122622
122663
|
ic.hAtoms = {};
|
|
122623
122664
|
for(let resid in residHash) {
|
|
122624
122665
|
ic.hAtoms = me.hashUtilsCls.unionHash(ic.hAtoms, ic.residues[resid]);
|
|
@@ -122795,8 +122836,9 @@ class Selection {
|
|
|
122795
122836
|
description = name;
|
|
122796
122837
|
}
|
|
122797
122838
|
|
|
122798
|
-
if(Object.keys(ic.selectedResidues).length > 0) {
|
|
122799
|
-
if(ic.pk == 1) {
|
|
122839
|
+
//if(Object.keys(ic.selectedResidues).length > 0) {
|
|
122840
|
+
// if(ic.pk == 1) {
|
|
122841
|
+
if(ic.opts.pk == 'atom') {
|
|
122800
122842
|
let bAtom = true;
|
|
122801
122843
|
this.selectResidueList(ic.hAtoms, name, description, undefined, undefined, bAtom);
|
|
122802
122844
|
//ic.hlUpdateCls.updateHlAll();
|
|
@@ -122823,7 +122865,7 @@ class Selection {
|
|
|
122823
122865
|
me.htmlCls.clickMenuCls.setLogCmd('select ' + ic.resid2specCls.residueids2spec(Object.keys(ic.selectedResidues)), true);
|
|
122824
122866
|
}
|
|
122825
122867
|
}
|
|
122826
|
-
}
|
|
122868
|
+
//}
|
|
122827
122869
|
}
|
|
122828
122870
|
|
|
122829
122871
|
saveSelInCommand() { let ic = this.icn3d, me = ic.icn3dui;
|
|
@@ -135875,7 +135917,7 @@ class iCn3DUI {
|
|
|
135875
135917
|
//even when multiple iCn3D viewers are shown together.
|
|
135876
135918
|
this.pre = this.cfg.divid + "_";
|
|
135877
135919
|
|
|
135878
|
-
this.REVISION = '3.
|
|
135920
|
+
this.REVISION = '3.52.0';
|
|
135879
135921
|
|
|
135880
135922
|
// In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
|
|
135881
135923
|
this.bNode = (Object.keys(window).length < 3) ? true : false;
|