Skip to content

Commit

Permalink
Merge pull request #29 in STRUC/icn3d from release123 to master
Browse files Browse the repository at this point in the history
* commit '665dc460f8912ced3024d5ccf18d6e13a7965f4b':
  MMTF format allows https access
  • Loading branch information
jiywang3 committed Sep 13, 2016
2 parents 6c59432 + 665dc46 commit 9cb4e00
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 32 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<b>Complete package</b> of iCn3D including Three.js and jQuery can be downloaded from [https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.2.2.zip](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.2.2.zip). The "Download ZIP" link in this page does not include these third-party libraries.
<b>Complete package</b> of iCn3D including Three.js and jQuery can be downloaded from [https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.2.3.zip](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.2.3.zip). The "Download ZIP" link in this page does not include these third-party libraries.

## Usage

Expand Down Expand Up @@ -89,16 +89,14 @@ gulp gh-pages

## Change log

The production version [icn3d-1.2.3](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.2.3.zip) was release on September 13, 2016. The MMTF format started to support https.

The production version [icn3d-1.2.2](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.2.2.zip) was release on August 24, 2016. Added a switch button to switch between all atoms and selected atoms. When the mode is "selected atoms", the switch and the text "selection" next to it are colored in orange. The menu "Style", "Color", and "Surface" are colored in orange and only apply to selected atoms.

The production version [icn3d-1.2.1](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.2.1.zip) was release on August 18, 2016. Some bugs were fixed.

The production version [icn3d-1.2.0](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.2.0.zip) was release on August 17, 2016. The dialog of 2D interactions was added to show the interactions among different chains. Both the nodes (chains) and lines (interactions) can be selected. Secondary structures will be calculated if the input PDB file has no defined secondary structure information. The previous files src/icn3d.js, src/full_ui.js, and src/simple_ui.js were separated into small files.

The production version [icn3d-1.1.1](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.1.1.zip) was release on July 25, 2016. Some bugs were fixed.

The production version [icn3d-1.1.0](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.1.0.zip) was release on July 18, 2016. The new binary MMTF file format was supported. A new "Analysis" menu was added with an option to show disulfide bonds. Users can also input data from a url, either through the UI or through a encoded url parameter "?type=pdb&url=...", e.g., <a href="https://www.ncbi.nlm.nih.gov/Structure/icn3d/full.html?type=pdb&url=https%3A%2F%2Ffiles.rcsb.org%2Fview%2F1gpk.pdb">https://www.ncbi.nlm.nih.gov/Structure/icn3d/full.html?type=pdb&url=https%3A%2F%2Ffiles.rcsb.org%2Fview%2F1gpk.pdb</a>.

All previous releases can be found at the [help page](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#log).

## Contact
Expand Down
6 changes: 6 additions & 0 deletions icn3d.html
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,10 @@ <h2>Commands for the advanced interface<img src="https://www.ncbi.nlm.nih.gov/St

<tr><td>b) Other -&gt; Reset Orien.:</td> <td>reset orientation</td></tr>

<tr><td colspan="2"><br>c) Other -&gt; Display Mode</td></tr>
<tr><td><span class="indent">Apply style, color, surface to all atoms:</span></td> <td>set mode all</td></tr>
<tr><td><span class="indent">Apply style, color, surface only to selection:</span></td> <td>set mode selection</td></tr>

<tr><td>c) Other -&gt; Center:</td> <td>center selection</td></tr>

<tr><td>d) Other -&gt; Back:</td> <td>back</td></tr>
Expand Down Expand Up @@ -1516,6 +1520,8 @@ <h2>API Documents of the advanced UI library iCn3DUI<img src="https://www.ncbi.n
<a name="log"></a>
<h2>Change Log:<img src="https://www.ncbi.nlm.nih.gov/Structure/IMG/spacer.gif" width="25" height="1" border="0"><a href="#Top"><img src="https://www.ncbi.nlm.nih.gov/Structure/IMG/arrowup_blue.gif" width="12" height="12" border="0" alt="back to top"></a></h2>

The production version <a href="https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.2.3.zip">icn3d-1.2.3</a> was release on September 13, 2016. The MMTF format started to support https.

The production version <a href="https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.2.2.zip">icn3d-1.2.2</a> was release on August 18, 2016. Added a switch button to switch between all atoms and selected atoms. When the mode is "selected atoms", the switch and the text "selection" next to it are colored in orange. The menu "Style", "Color", and "Surface" are colored in orange and only apply to selected atoms.
<br><br>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "icn3d",
"version": "1.2.2",
"version": "1.2.3",
"description": "iCn3D Structure Viewer",
"main": "index.html",
"scripts": {
Expand Down
20 changes: 18 additions & 2 deletions src/icn3dui/full_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -3513,6 +3513,14 @@ iCn3DUI.prototype = {
html += " <ul class='menu'>";
html += " <li><span id='" + me.pre + "reset' class='icn3d-link'>Reset</span></li>";
html += " <li><span id='" + me.pre + "menu6_resetorientation' class='icn3d-link'>Reset Orien.</span></li>";

html += " <li>Display Mode";
html += " <ul>";
html += " <li><span id='" + me.pre + "menu6_modeall' class='icn3d-link'>Apply style, color, <br/>surface to all atoms</span></li>";
html += " <li><span id='" + me.pre + "menu6_modeselection' class='icn3d-link'>Apply style, color, <br/>surface only to selection</span></li>";
html += " </ul>";
html += " </li>";

html += " <li><span id='" + me.pre + "menu6_center' class='icn3d-link'>Center</span></li>";
html += " <li><span id='" + me.pre + "menu6_back' class='icn3d-link'>Backward</span></li>";
html += " <li><span id='" + me.pre + "menu6_forward' class='icn3d-link'>Forward</span></li>";
Expand Down Expand Up @@ -3836,8 +3844,8 @@ iCn3DUI.prototype = {
html += " <div id='" + me.pre + "selection' style='position:absolute; z-index:555; float:left; display:table-row; margin: 32px 0px 0px 3px;'>";
html += " <table style='margin-top: 3px; width:100px;'><tr valign='center'>";

html += " <td valign='top'><div class='icn3d-commandTitle' style='min-width:40px; margin-top: 24px;'><span id='" + me.pre + "modeall' title='All atoms are used when changing the style, color, or surface'>All</span><span id='" + me.pre + "modeselection' class='icn3d-modeselection' style='display:none;' title='Only selected atoms are used when changing the style, color, or surface'>Selection</span></div>";
html += " <label class='icn3d-switch'><input id='" + me.pre + "modeswitch' type='checkbox'><div class='icn3d-slider icn3d-round' style='width:34px; height:18px; margin: 12px 0px 0px 3px;'></div></label></td>";
html += " <td valign='top'><div class='icn3d-commandTitle' style='min-width:40px; margin-top: 24px; white-space: nowrap;'><span id='" + me.pre + "modeall' title='Style, color, and surface menu options will be applied to all atoms in the structure'>All atoms</span><span id='" + me.pre + "modeselection' class='icn3d-modeselection' style='display:none;' title='Style, color, and surface menu options will be applied only to selected atoms'>Selection</span></div>";
html += " <label class='icn3d-switch'><input id='" + me.pre + "modeswitch' type='checkbox'><div class='icn3d-slider icn3d-round' style='width:34px; height:18px; margin: 12px 0px 0px 3px;' title='Left (\"All atoms\"): Style, color, and surface menu options will be applied to all atoms in the structure&#13;Right (\"Selection\"): Style, color, and surface menu options will be applied only to selected atoms'></div></label></td>";

if(me.cfg.cid === undefined) {
html += " <td valign='top'><span class='icn3d-commandTitle'>Structure:</span><br/>";
Expand Down Expand Up @@ -5368,6 +5376,14 @@ iCn3DUI.prototype = {
me.setModeAndDisplay('all');
}
});

$("#" + me.pre + "menu6_modeall").click(function (e) {
me.setModeAndDisplay('all');
});

$("#" + me.pre + "menu6_modeselection").click(function (e) {
me.setModeAndDisplay('selection');
});
},

clickSeqOrAlignSeq: function() { var me = this;
Expand Down
39 changes: 16 additions & 23 deletions src/icn3dui/parsers/mmtf_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
// Contributors: Jiyao Wang, Alexander Rose, Peter Rose
// requires the library mmtf.js
iCn3DUI.prototype.downloadMmtf = function (mmtfid) { var me = this;
// The MMTF service doesn't support https, use http instead
var uri, dataType;
if(document.location.protocol === "https:") {
var url = document.location.href;
url = url.replace('https', 'http');
//window.open(url, '_self');

alert("For now, MMTF files can ONLY be retrieved by http protocol, not https. Thus MMTF format can NOT work in NCBI pages, which are https only now. Please check back later.");

return;
}

MMTF.fetch(
mmtfid,
// onLoad callback
Expand Down Expand Up @@ -50,6 +38,7 @@

var prevSS = 'coil';
var prevChain = '';
var prevResi = 0;

var serial = 0;

Expand Down Expand Up @@ -90,7 +79,7 @@
}

// no residue can be both ssbegin and ssend in DSSP calculated secondary structures
var bSetPrevResidue = 0; // 0: no need to reset, 1: reset previous residue to "ssbegin = true", 2: reset previous residue to "ssend = true"
var bSetPrevSsend = false;

if(chain !== prevChain) {
// new chain
Expand All @@ -102,19 +91,29 @@
ssbegin = false;
ssend = false;
}

// set up the end of previous chain
if(prevSS !== 'coil') {
var prevResid = structure + '_' + prevChain + '_' + prevResi.toString();

for(var i in me.icn3d.residues[prevResid]) {
me.icn3d.atoms[i].ssbegin = false;
me.icn3d.atoms[i].ssend = true;
}
}
}
else if(ss !== prevSS) {
if(prevSS === 'coil') {
ssbegin = true;
ssend = false;
}
else if(ss === 'coil') {
bSetPrevResidue = 2;
bSetPrevSsend = true;
ssbegin = false;
ssend = false;
}
else if( (prevSS === 'sheet' && ss === 'helix') || (prevSS === 'helix' && ss === 'sheet')) {
bSetPrevResidue = 1;
bSetPrevSsend = true;
ssbegin = true;
ssend = false;
}
Expand All @@ -124,14 +123,7 @@
ssend = false;
}

if(bSetPrevResidue == 1) { //1: reset previous residue to "ssbegin = true"
var prevResid = structure + '_' + chain + '_' + (resi - 1).toString();
for(var i in me.icn3d.residues[prevResid]) {
me.icn3d.atoms[i].ssbegin = true;
me.icn3d.atoms[i].ssend = false;
}
}
else if(bSetPrevResidue == 2) { //2: reset previous residue to "ssend = true"
if(bSetPrevSsend) {
var prevResid = structure + '_' + chain + '_' + (resi - 1).toString();
for(var i in me.icn3d.residues[prevResid]) {
me.icn3d.atoms[i].ssbegin = false;
Expand All @@ -141,6 +133,7 @@

prevSS = ss;
prevChain = chain;
prevResi = resi;

het = false;
bProtein = false;
Expand Down
Loading

0 comments on commit 9cb4e00

Please sign in to comment.