diff --git a/README.md b/README.md index b226cbf9..36a94b92 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ We provided two versions of iCn3D widgets: [basic interface](https://www.ncbi.nl Either of these widgets could be easily added to your own web pages. Please see the [help page](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html) for more details. -Complete package of iCn3D including Three.js and jQuery can be downloaded from [https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.0.zip](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.0.zip). The "Download ZIP" link in this page does not include these third-party libraries. +Complete package of iCn3D including Three.js and jQuery can be downloaded from [https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.0.1.zip](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.0.1.zip). The "Download ZIP" link in this page does not include these third-party libraries. ## Usage @@ -86,21 +86,7 @@ gulp gh-pages ## Change log -The beta version [icn3d-0.9.0-dev](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-0.9.0-dev.zip) was release on Jan 17, 2016. - -The beta version [icn3d-0.9.1-dev](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-0.9.1-dev.zip) was release on Feb 9, 2016. The surface generation was switched from the iview version (surface.js) to the more efficient 3Dmol version (ProteinSurface4.js and marchingcube.js). - -The beta version [icn3d-0.9.2-dev](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-0.9.2-dev.zip) was release on March 4, 2016. CSS namespace was added. The file simple_ui.js was reorganized to share some codes with full_ui.js. A "Schematic" style was added to show one letter residue name in the C-alpha (for protein) or phosphorus (for nucleotide) position. - -The beta version [icn3d-0.9.3-dev](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-0.9.3-dev.zip) was release on March 9, 2016. Improved the following features: "Back" and "Forward" button, Export State, Open State. - -The beta version [icn3d-0.9.4-dev](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-0.9.4-dev.zip) was release on March 14, 2016. Added "Fog" and "Slab" features. - -The beta version [icn3d-0.9.5-dev](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-0.9.5-dev.zip) was release on April 4, 2016. Enabled to import Mol2, SDF, XYZ, PDB, and mmCIF files. Added "Schematic" style for ligands. Improved the coordination between picking on 3D structure and selection on sequences. - -The beta version [icn3d-0.9.6-dev](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-0.9.6-dev.zip) was release on April 21, 2016. Enabled to export and import selection file where each custom sets of atoms are defined. Javascript files and CSS files are versioned. Developers can use the default latest version or specify the specific version in their pages. - -The production version [icn3d-1.0](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.0.zip) was release on April 28, 2016. +The production version [icn3d-1.0.1](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.0.1.zip) was release on May 16, 2016. All previous releases can be found at the [help page](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#log). ## Contact diff --git a/gulpfile.js b/gulpfile.js index 05099dee..706aa362 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -27,7 +27,7 @@ gulp.task('libs', "node_modules/jquery/dist/jquery.min.js", "node_modules/jquery-ui/jquery-ui.min.js", "node_modules/three/three.min.js", - "node_modules/three/three_v71.min.js", + "node_modules/three/three_0.71.1.min.js", ]) .pipe(gulp.dest(dist + '/lib')); }); diff --git a/icn3d.html b/icn3d.html index 55a70a16..df99f857 100644 --- a/icn3d.html +++ b/icn3d.html @@ -101,11 +101,15 @@

What is iCn3D Structure Viewer?Include three.js and jQuery javascript libraries in the <head> of your html page
  • Position the widget with an html div
  • Initialize the widget with desired parameters
  • + + +
  • Hints for using iCn3D
    +

  • @@ -365,6 +369,8 @@

    What is iCn3D Structure Viewer?Change Log +
    @@ -456,7 +462,10 @@

    How to use iCn3D Structure Viewer in your html page:Hints for using iCn3D
    + @@ -529,7 +538,7 @@

    URL parameters for the advanced interface showseqNoYesSet "true" or "1" to show the sequence window. The default is "false". showalignseqNoYesSet "true" or "1" to show the aligned sequence window. The default is "false". -commandNoYesBesides the "Script/Log" section, commands can also be attached to the url parameter "command". Several commands can be concatenated with the separator ";", e.g., full.html?mmdbid=1kq2&command=select :1-20; color green. +commandNoYesBesides the "Script/Log" section, commands can also be attached to the url parameter "command". Several commands can be concatenated with the separator ";", e.g., full.html?mmdbid=3gvu&command=select .A:38-40 or .A:42 or .A:45 or .A:61 or .A:63 or .A:77-78 or .A:82 or .A:91 or .A:107-108 or .A:110 or .A:114 or .A:162 or .A:172-173; style proteins stick; color atom; set surface Van der Waals surface; add label ATP-binding Site | size 18 | color #0000ff | background #cccccc | type custom; select .STI; color green; toggle highlight.
    @@ -1466,8 +1475,43 @@

    API Documents of the advanced UI library iCn3DUI +

    Change Log:back to top

    +The production version icn3d-1.0.1 was release on May 16, 2016. +

    + +The production version icn3d-1.0.0 was release on April 28, 2016. +

    + +The beta version icn3d-0.9.6-dev was release on April 21, 2016. Enabled to export and import selection file where each custom sets of atoms are defined. Javascript files and CSS files are versioned. Developers can use the default latest version or specify the specific version in their pages. +

    + +The beta version icn3d-0.9.5-dev was release on April 4, 2016. Enabled to import Mol2, SDF, XYZ, PDB, and mmCIF files. Added "Schematic" style for ligands. Improved the coordination between picking on 3D structure and selection on sequences. +

    + +The beta version icn3d-0.9.4-dev was release on March 14, 2016. Added "Fog" and "Slab" features. +

    + +The beta version icn3d-0.9.3-dev was release on March 9, 2016. Improved the following features: "Back" and "Forward" button, Export State, Open State. +

    + +The beta version icn3d-0.9.2-dev was release on March 4, 2016. CSS namespace was added. The file simple_ui.js was reorganized to share some codes with full_ui.js. A "Schematic" style was added to show one letter residue name in the C-alpha (for protein) or phosphorus (for nucleotide) position. +

    + +The beta version icn3d-0.9.2-dev was release on March 4, 2016. CSS namespace was added. The file simple_ui.js was reorganized to share some codes with full_ui.js. A "Schematic" style was added to show one letter residue name in the C-alpha (for protein) or phosphorus (for nucleotide) position. +

    + +The beta version icn3d-0.9.1-dev was release on Feb 9, 2016. The surface generation was switched from the iview version (surface.js) to the more efficient 3Dmol version (ProteinSurface4.js and marchingcube.js). +

    + +The beta version icn3d-0.9.0-dev was release on Jan 17, 2016. + +
    diff --git a/package.json b/package.json index 69074f8b..04d0c7ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "icn3d", - "version": "1.0.0", + "version": "1.0.1", "description": "iCn3D Structure Viewer", "main": "index.html", "scripts": { diff --git a/src/full_ui.js b/src/full_ui.js index 1be7fabe..a02576b9 100644 --- a/src/full_ui.js +++ b/src/full_ui.js @@ -585,7 +585,10 @@ iCn3DUI.prototype = { me.bInitial = false; } else { - me.updateMenus(me.bInitial); + //me.updateMenus(me.bInitial); + if(me.bInitial) me.setProteinsNucleotidesLigands(); + me.updateMenus(false); + me.updateSeqWinForCurrentAtoms(); me.bInitial = false; @@ -844,7 +847,7 @@ iCn3DUI.prototype = { sequencesHtml = "Select Sequences: touch to select, touch again to deselect, multiple selection is allowed without Ctrl key, click \"Save Selection\" to save the current selection
    "; } - sequencesHtml += "
    Name:   Description:

    "; + sequencesHtml += "
    Name:   Description:

    "; sequencesHtml += resCategories + scroll + "
    "; @@ -875,10 +878,12 @@ iCn3DUI.prototype = { var structure = i.substr(0, dashPos); var chain = i.substr(dashPos + 1); -// if(me.icn3d.chainsSeq[i] !== undefined) { - seqHtml += "" + me.icn3d.chainsSeq[i][0].resi + ""; + var maxResi = 1; + if(me.icn3d.chainsSeq[i] !== undefined) { // me.icn3d.chainsSeq[i] should be defined, just in case + seqHtml += "" + me.icn3d.chainsSeq[i][0].resi + ""; - var maxResi = parseInt(me.icn3d.chainsSeq[i][0].resi); + maxResi = parseInt(me.icn3d.chainsSeq[i][0].resi); + } for(var k=0, kl=seqLength; k < kl; ++k) { var resiId = structure + "_" + chain + "_" + me.icn3d.chainsSeq[i][k].resi; @@ -964,7 +969,7 @@ iCn3DUI.prototype = { sequencesHtml = "Select Aligned Sequences: touch to select, touch again to deselect, multiple selection is allowed without Ctrl key, click \"Save Selection\" to save the current selection
    "; } - sequencesHtml += "
    Selection: Name:   Description:

    "; + sequencesHtml += "
    Selection: Name:   Description:

    "; sequencesHtml += resCategories + scroll + "
    "; @@ -1739,6 +1744,7 @@ iCn3DUI.prototype = { // :5-10,LYS,ligands: residues, could be 'proteins', 'nucleotides', 'ligands', 'ions', and 'water' // @CA,C: atoms // wild card * can be used to select all + var currHighlightAtoms = {}; var poundPos = commandArray[i].indexOf('#'); var periodPos = commandArray[i].indexOf('.'); @@ -1866,11 +1872,11 @@ iCn3DUI.prototype = { if(atomStr === '*' || atomStr === me.icn3d.atoms[m].name) { // me.icn3d.highlightAtoms[m] = 1; if(i === 0) { - me.icn3d.highlightAtoms[m] = 1; + currHighlightAtoms[m] = 1; atomHash[m] = 1; } else { - me.icn3d.highlightAtoms[m] = undefined; + currHighlightAtoms[m] = undefined; atomHash[m] = undefined; } } @@ -1897,11 +1903,11 @@ iCn3DUI.prototype = { if(atomStr === '*' || atomStr === me.icn3d.atoms[m].name) { // me.icn3d.highlightAtoms[m] = 1; if(i === 0) { - me.icn3d.highlightAtoms[m] = 1; + currHighlightAtoms[m] = 1; atomHash[m] = 1; } else { - me.icn3d.highlightAtoms[m] = undefined; + currHighlightAtoms[m] = undefined; atomHash[m] = undefined; } } @@ -1912,6 +1918,13 @@ iCn3DUI.prototype = { } // end else } // end for(var mc = 0 } // for (j + + if(i === 0) { + me.icn3d.highlightAtoms = me.icn3d.cloneHash(currHighlightAtoms); + } + else { + me.icn3d.highlightAtoms = me.icn3d.intersectHash(me.icn3d.highlightAtoms, currHighlightAtoms); + } } // for (i if(bDisplay === undefined || bDisplay) me.updateSeqWinForCurrentAtoms(); @@ -2802,6 +2815,12 @@ iCn3DUI.prototype = { me.icn3d.bShowHighlight = true; } } + else if(command.indexOf('clear selection') !== -1) { + //if(me.icn3d.prevHighlightObjects.length > 0) { // remove + me.icn3d.removeHighlightObjects(); + me.icn3d.bShowHighlight = false; + //} + } else if(command.indexOf('set assembly on') !== -1) { me.icn3d.bAssembly = true; } @@ -3142,7 +3161,7 @@ iCn3DUI.prototype = { //html += "
  • Select"; //html += " "; //html += "
  • "; - html += "
  • Picking"; + html += "
  • Picking with
    \"Alt\" + Click"; html += " "; html += "
  • "; @@ -3404,7 +3424,7 @@ iCn3DUI.prototype = { html += "
  • "; html += "
  • "; // html += "
  • "; - html += "
  • "; + html += "
  • "; html += " "; html += " "; html += "
  • Opacity"; @@ -3451,7 +3471,6 @@ iCn3DUI.prototype = { html += "
  • Reset
  • "; html += "
  • Reset Orien.
  • "; html += "
  • Center
  • "; - html += "
  • Zoom in
  • "; html += "
  • Backward
  • "; html += "
  • Forward
  • "; if(me.cfg.cid === undefined) { @@ -3476,7 +3495,7 @@ iCn3DUI.prototype = { if(me.cfg.cid === undefined) { html += "
  • "; } - html += "
  • "; + html += "
  • "; html += " "; html += " "; html += "
  • Distance"; @@ -3711,7 +3730,8 @@ iCn3DUI.prototype = { html += ""; html += "
    "; - html += " Threshold: "; html += " "; html += " "; html += " "; @@ -3721,8 +3741,7 @@ iCn3DUI.prototype = { html += " "; html += " "; html += " "; - html += " Å
    "; - html += " "; + html += " Å "; html += "
    "; html += "
    Select
    All
    "; - if(me.cfg.cid === undefined) { html += "
    "; @@ -3836,13 +3853,15 @@ iCn3DUI.prototype = { // html += "
    "; - html += "
    "; + html += "
    "; - html += "
    "; + //html += "
    "; - if(me.cfg.align === undefined) { -// html += "
    "; - } + //if(me.cfg.align === undefined) { + html += "
    "; + //} + + html += "
    "; html += "
    "; @@ -3853,8 +3872,6 @@ iCn3DUI.prototype = { }, updateMenus: function(bInitial) { var me = this; - if(bInitial) me.setProteinsNucleotidesLigands(); - var structuresHtml = me.setStructureMenu(bInitial); var chainsHtml = me.setChainMenu(bInitial); var alignChainsHtml = me.setAlignChainMenu(bInitial); @@ -3875,6 +3892,8 @@ iCn3DUI.prototype = { }, selectAllUpdateMenuSeq: function(bInitial, bShowHighlight) { var me = this; + if(bInitial) me.setProteinsNucleotidesLigands(); + this.updateMenus(bInitial); //var residueArray = this.getResiduesUpdateHighlight(Object.keys(me.icn3d.chains)); @@ -5294,8 +5313,8 @@ iCn3DUI.prototype = { }); }, - clickMenu6_selectedcenter: function() { var me = this; - $("#" + me.pre + "menu6_selectedcenter").add("#" + me.pre + "zoomin_selection").click(function (e) { + clickmenu2_selectedcenter: function() { var me = this; + $("#" + me.pre + "menu2_selectedcenter").add("#" + me.pre + "zoomin_selection").click(function (e) { //e.preventDefault(); me.setLogCommand('zoom selection', true); @@ -6630,17 +6649,33 @@ iCn3DUI.prototype = { } }, + clearHighlight: function() { var me = this; + // e.preventDefault(); + + me.setLogCommand("clear selection", true); + + //if(me.icn3d.prevHighlightObjects.length > 0) { // remove + me.icn3d.removeHighlightObjects(); + me.icn3d.render(); + + me.removeSeqChainBkgd(); + me.removeSeqResidueBkgd(); + + me.bSelectResidue = false; + //} + }, + clickToggleHighlight: function() { var me = this; $("#" + me.pre + "toggleHighlight").add("#" + me.pre + "toggleHighlight2").click(function (e) { me.toggleHighlight(); }); $(document).on("click", "#" + me.pre + "seq_clearselection", function(e) { - me.toggleHighlight(); + me.clearHighlight(); }); $(document).on("click", "#" + me.pre + "alignseq_clearselection", function(e) { - me.toggleHighlight(); + me.clearHighlight(); }); }, @@ -6972,7 +7007,7 @@ iCn3DUI.prototype = { me.clickMenu6_addlabelNo(); me.clickMenu6_distanceYes(); me.clickMenu6_distanceNo(); - me.clickMenu6_selectedcenter(); + me.clickmenu2_selectedcenter(); me.clickMenu6_center(); me.clickMenu6_resetorientation(); me.clickMenu6_rotateleft(); @@ -7153,7 +7188,19 @@ iCn3DUI.prototype = { iCn3DUI.prototype.getLinkToStructureSummary = function(bLog) { var me = this; - var url = (me.cfg.cid !== undefined) ? "https://www.ncbi.nlm.nih.gov/pccompound/?term=" : "https://www.ncbi.nlm.nih.gov/structure/?term="; + var url = "https://www.ncbi.nlm.nih.gov/structure/?term="; + + if(me.cfg.cid !== undefined) { + url = "https://www.ncbi.nlm.nih.gov/pccompound/?term="; + } + else { + if(me.inputid.indexOf(",") !== -1) { + url = "https://www.ncbi.nlm.nih.gov/structure/?term="; + } + else { + url = "https://www.ncbi.nlm.nih.gov/Structure/mmdb/mmdbsrv.cgi?uid="; + } + } if(me.inputid === undefined) { url = "https://www.ncbi.nlm.nih.gov/pccompound/?term=" + me.moleculeTitle; @@ -8326,7 +8373,7 @@ iCn3DUI.prototype = { alert("This gi " + mmdbid + " has no corresponding 3D structure..."); } else { - alert("This mmdbid " + mmdbid + " has no corresponding 3D structure..."); + alert("This mmdbid " + mmdbid + " with the parameters " + me.cfg.inpara + " has no corresponding 3D structure..."); } return false; @@ -8676,7 +8723,7 @@ iCn3DUI.prototype = { mmdbid2pdbid[mmdbidTmp] = pdbidTmp; } - me.icn3d.moleculeTitle += "" + structure.pdbid.toUpperCase() + ""; + me.icn3d.moleculeTitle += "" + structure.pdbid.toUpperCase() + ""; if(structure.descr !== undefined) me.pmid += structure.descr.pubmedid; if(i === 0) { @@ -8700,7 +8747,7 @@ iCn3DUI.prototype = { if(data.molid2chain !== undefined) { var chainHash = {}; // there may have different chains with the same names in assembly for (var molid in data.molid2chain) { - var chain = data.molid2chain[molid].chain; + var chain = data.molid2chain[molid].chain.trim(); // some space at the beginning if(chainHash[chain] === undefined) { chainHash[chain] = 1; } @@ -8717,7 +8764,7 @@ iCn3DUI.prototype = { for (var mmdbid in data.molid2chain) { var chainNameHash = {}; // chain name may be the same in assembly for (var molid in data.molid2chain[mmdbid]) { - var chainName = data.molid2chain[mmdbid][molid].chain; + var chainName = data.molid2chain[mmdbid][molid].chain.trim(); if(chainNameHash[chainName] === undefined) { chainNameHash[chainName] = 1; } @@ -8746,7 +8793,7 @@ iCn3DUI.prototype = { for (var mmdbid in data.molid2chain) { var chainNameHash = {}; // chain name may be the same in assembly for (var molid in data.molid2chain[mmdbid]) { - var chainName = data.molid2chain[mmdbid][molid].chain; + var chainName = data.molid2chain[mmdbid][molid].chain.trim(); if(chainNameHash[chainName] === undefined) { chainNameHash[chainName] = 1; } @@ -8926,7 +8973,7 @@ iCn3DUI.prototype = { atm.resi = parseInt(atm.resi); // has to be integer - // modify resi icne MMDB used the same resi as in PDB where resi is not continuous + // modify resi since MMDB used the same resi as in PDB where resi is not continuous // No need to modify mmcif resi if(type === 'mmdbid') { oldResi = atm.resi; @@ -8939,7 +8986,7 @@ iCn3DUI.prototype = { ++missingResIndex; } - if(atm.resi !== prevOldResi) { + if(atm.resi !== prevOldResi || molid !== prevMolid) { atm.resi = prevResi + 1; } else { @@ -8977,10 +9024,13 @@ iCn3DUI.prototype = { me.icn3d.het = true; } else if (atm.mt === 'l') { // ligands and ions - me.icn3d.ligands[serial] = 1; - //if (atm.bonds.length === 0) me.icn3d.ions[serial] = 1; - if (atm.elem === atm.resn) me.icn3d.ions[serial] = 1; + if (atm.elem === atm.resn) { + me.icn3d.ions[serial] = 1; + } + else { + me.icn3d.ligands[serial] = 1; + } me.icn3d.het = true; } @@ -9038,7 +9088,7 @@ iCn3DUI.prototype = { secondaries = 'c'; } - if(atm.resi != prevResi) { + if( atm.resi != prevResi || molid != prevMolid ) { // mmdbid 2por has different molid, same resi if(me.icn3d.chainsSeq[chainid] === undefined) { me.icn3d.chainsSeq[chainid] = []; bChainSeqSet = false; @@ -9065,7 +9115,7 @@ iCn3DUI.prototype = { if(atm.resi % 10 === 0) numberStr = atm.resi.toString(); me.icn3d.chainsSeq[chainid].push(resObject); - me.icn3d.chainsAnno[chainid][0].push(numberStr); + me.icn3d.chainsAnno[chainid][0].push(numberStr); me.icn3d.chainsAnno[chainid][1].push(secondaries); } diff --git a/src/icn3d.js b/src/icn3d.js index 852c71b2..3a30c960 100644 --- a/src/icn3d.js +++ b/src/icn3d.js @@ -180,7 +180,7 @@ var iCn3D = function (id) { me.switchHighlightLevel(); - // key event has to use the document because it requires teh focus + // key event has to use the document because it requires the focus me.typetext = false; //http://unixpapa.com/js/key.html @@ -188,7 +188,7 @@ var iCn3D = function (id) { if(e.keyCode === 16) { // shiftKey me.bShiftKey = false; } - if(e.keyCode === 17 || e.keyCode === 224) { // ctrlKey or apple command key + if(e.keyCode === 17 || e.keyCode === 224 || e.keyCode === 91) { // ctrlKey or apple command key me.bCtrlKey = false; } }); @@ -197,7 +197,7 @@ var iCn3D = function (id) { if(e.shiftKey || e.keyCode === 16) { me.bShiftKey = true; } - if(e.ctrlKey || e.keyCode === 17 || e.keyCode === 224) { + if(e.ctrlKey || e.keyCode === 17 || e.keyCode === 224 || e.keyCode === 91) { me.bCtrlKey = true; } @@ -394,7 +394,7 @@ var iCn3D = function (id) { me.isDragging = true; // see ref http://soledadpenades.com/articles/three-js-tutorials/object-picking/ - if(me.picking && (e.altKey || e.ctrlKey || e.shiftKey || e.keyCode === 16 || e.keyCode === 17 || e.keyCode === 224) ) { + if(me.picking && (e.altKey || e.ctrlKey || e.shiftKey || e.keyCode === 16 || e.keyCode === 17 || e.keyCode === 224 || e.keyCode === 91) ) { me.highlightlevel = me.picking; me.mouse.x = ( (x - me.container.offset().left) / me.container.width() ) * 2 - 1; @@ -5090,7 +5090,8 @@ iCn3D.prototype = { //if(this.highlightAtoms !== undefined && Object.keys(this.highlightAtoms).length > 0 && Object.keys(this.highlightAtoms).length < Object.keys(this.displayAtoms).length) { if(this.highlightAtoms !== undefined && Object.keys(this.highlightAtoms).length > 0 && Object.keys(this.highlightAtoms).length < Object.keys(this.atoms).length) { this.removeHighlightObjects(); - if(this.bShowHighlight === undefined || this.bShowHighlight) this.addHighlightObjects(undefined, false); + //if(this.bShowHighlight === undefined || this.bShowHighlight) this.addHighlightObjects(undefined, false); + if(this.bShowHighlight === undefined || this.bShowHighlight) this.addHighlightObjects(); } if(this.bRender === true) { @@ -5099,7 +5100,6 @@ iCn3D.prototype = { } }, - // zoom zoomIn: function (normalizedFactor) { // 0.1 var para = {}; @@ -5309,6 +5309,13 @@ iCn3D.prototype = { this.pickedAtomList = this.selectStrandHelixFromAtom(atom); } + if(this.picking === 0) { + this.bShowHighlight = false; + } + else { + this.bShowHighlight = true; + } + if(!this.bShiftKey && !this.bCtrlKey) { this.highlightAtoms = this.cloneHash(this.pickedAtomList); } diff --git a/src/simple_ui.js b/src/simple_ui.js index ba075817..619485ca 100644 --- a/src/simple_ui.js +++ b/src/simple_ui.js @@ -727,7 +727,19 @@ iCn3DUI.prototype = { iCn3DUI.prototype.getLinkToStructureSummary = function(bLog) { var me = this; - var url = (me.cfg.cid !== undefined) ? "https://www.ncbi.nlm.nih.gov/pccompound/?term=" : "https://www.ncbi.nlm.nih.gov/structure/?term="; + var url = "https://www.ncbi.nlm.nih.gov/structure/?term="; + + if(me.cfg.cid !== undefined) { + url = "https://www.ncbi.nlm.nih.gov/pccompound/?term="; + } + else { + if(me.inputid.indexOf(",") !== -1) { + url = "https://www.ncbi.nlm.nih.gov/structure/?term="; + } + else { + url = "https://www.ncbi.nlm.nih.gov/Structure/mmdb/mmdbsrv.cgi?uid="; + } + } if(me.inputid === undefined) { url = "https://www.ncbi.nlm.nih.gov/pccompound/?term=" + me.moleculeTitle; @@ -1900,7 +1912,7 @@ iCn3DUI.prototype = { alert("This gi " + mmdbid + " has no corresponding 3D structure..."); } else { - alert("This mmdbid " + mmdbid + " has no corresponding 3D structure..."); + alert("This mmdbid " + mmdbid + " with the parameters " + me.cfg.inpara + " has no corresponding 3D structure..."); } return false; @@ -2250,7 +2262,7 @@ iCn3DUI.prototype = { mmdbid2pdbid[mmdbidTmp] = pdbidTmp; } - me.icn3d.moleculeTitle += "" + structure.pdbid.toUpperCase() + ""; + me.icn3d.moleculeTitle += "" + structure.pdbid.toUpperCase() + ""; if(structure.descr !== undefined) me.pmid += structure.descr.pubmedid; if(i === 0) { @@ -2274,7 +2286,7 @@ iCn3DUI.prototype = { if(data.molid2chain !== undefined) { var chainHash = {}; // there may have different chains with the same names in assembly for (var molid in data.molid2chain) { - var chain = data.molid2chain[molid].chain; + var chain = data.molid2chain[molid].chain.trim(); // some space at the beginning if(chainHash[chain] === undefined) { chainHash[chain] = 1; } @@ -2291,7 +2303,7 @@ iCn3DUI.prototype = { for (var mmdbid in data.molid2chain) { var chainNameHash = {}; // chain name may be the same in assembly for (var molid in data.molid2chain[mmdbid]) { - var chainName = data.molid2chain[mmdbid][molid].chain; + var chainName = data.molid2chain[mmdbid][molid].chain.trim(); if(chainNameHash[chainName] === undefined) { chainNameHash[chainName] = 1; } @@ -2320,7 +2332,7 @@ iCn3DUI.prototype = { for (var mmdbid in data.molid2chain) { var chainNameHash = {}; // chain name may be the same in assembly for (var molid in data.molid2chain[mmdbid]) { - var chainName = data.molid2chain[mmdbid][molid].chain; + var chainName = data.molid2chain[mmdbid][molid].chain.trim(); if(chainNameHash[chainName] === undefined) { chainNameHash[chainName] = 1; } @@ -2500,7 +2512,7 @@ iCn3DUI.prototype = { atm.resi = parseInt(atm.resi); // has to be integer - // modify resi icne MMDB used the same resi as in PDB where resi is not continuous + // modify resi since MMDB used the same resi as in PDB where resi is not continuous // No need to modify mmcif resi if(type === 'mmdbid') { oldResi = atm.resi; @@ -2513,7 +2525,7 @@ iCn3DUI.prototype = { ++missingResIndex; } - if(atm.resi !== prevOldResi) { + if(atm.resi !== prevOldResi || molid !== prevMolid) { atm.resi = prevResi + 1; } else { @@ -2551,10 +2563,13 @@ iCn3DUI.prototype = { me.icn3d.het = true; } else if (atm.mt === 'l') { // ligands and ions - me.icn3d.ligands[serial] = 1; - //if (atm.bonds.length === 0) me.icn3d.ions[serial] = 1; - if (atm.elem === atm.resn) me.icn3d.ions[serial] = 1; + if (atm.elem === atm.resn) { + me.icn3d.ions[serial] = 1; + } + else { + me.icn3d.ligands[serial] = 1; + } me.icn3d.het = true; } @@ -2612,7 +2627,7 @@ iCn3DUI.prototype = { secondaries = 'c'; } - if(atm.resi != prevResi) { + if( atm.resi != prevResi || molid != prevMolid ) { // mmdbid 2por has different molid, same resi if(me.icn3d.chainsSeq[chainid] === undefined) { me.icn3d.chainsSeq[chainid] = []; bChainSeqSet = false; @@ -2639,7 +2654,7 @@ iCn3DUI.prototype = { if(atm.resi % 10 === 0) numberStr = atm.resi.toString(); me.icn3d.chainsSeq[chainid].push(resObject); - me.icn3d.chainsAnno[chainid][0].push(numberStr); + me.icn3d.chainsAnno[chainid][0].push(numberStr); me.icn3d.chainsAnno[chainid][1].push(secondaries); }