Skip to content

Commit

Permalink
Merge pull request #193 in STRUC/icn3d from release282 to master
Browse files Browse the repository at this point in the history
* commit 'fad38f182f3ef1a8acde15117b7cac019dc01329':
  Reduced the size of three.js (version 103) library. Added links to dbSNP in the mouseover texts of SNP annotations. Replaced eutils with vastdyn.cgi
  • Loading branch information
jiywang3 committed Oct 30, 2019
2 parents fc5e189 + fad38f1 commit 1ce16be
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 9 deletions.
2 changes: 1 addition & 1 deletion icn3d.html
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ <h2>Menus, Commands, and Methods of the advanced interface<img src="https://www.
<ul>
<li>"$1HHO,4N7N" uses "$" to indicate structure selection.<br/>
<li>".A,B,C" uses "." to indicate chain selection.<br/>
<li>":5-10,KRDE,chemicals" uses ":" to indicate residue selection. Residue selection could be residue number (5-10), one-letter sequence (KRDE), or predefined names: "proteins", "nucleotides", "chemicals", "ions", and "water".<br/>
<li>":5-10,KRDE,chemicals" uses the colon ":" to indicate residue selection. Residue selection could be residue number (5-10), one-letter IUPAC abbreviations (KRDE), or predefined names: "proteins", "nucleotides", "chemicals", "ions", and "water". IUPAC abbreviations can be written either as a contiguous string (e.g., ":KRDE"), in order to find all instances of that sequence in the structure, or they can be separated by commas (e.g., ":K,R,D,E") to select all residues of a given type in the structure (in the latter case, select all Lysine, Arginine, Aspartic Acid, and Glutamic Acid in the structure). <br/>
<li>"@CA,C" uses "@" to indicate atom selection.<br/>
<li>Partial definition is allowed, e.g., ":1-10" selects all residue IDs 1-10 in all chains.<br/>
<li>Different selections can be united (with "<b>or</b>", default), intersected (with "<b>and</b>"), or negated (with "<b>not</b>"). For example, ":1-10 or :K" selects all residues 1-10 and all Lys residues. ":1-10 and :K" selects all Lys residues in the range of residue number 1-10. ":1-10 or not :K" selects all residues 1-10, which are not Lys residues.<br/>
Expand Down
10 changes: 9 additions & 1 deletion src/icn3dui/common_full_simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,9 @@ iCn3DUI.prototype.shareLinkUrl = function(bAllCommands) { var me = this;

if(key === 'rotate' && value === 'right') continue;

// commands will be added in the for loop below: for(var il = me.icn3d.commands...
if(key === 'command') continue;

if(key === 'options') {
if(Object.keys(value).length > 0) url += key + '=' + JSON.stringify(value) + '&';
}
Expand All @@ -626,7 +629,8 @@ iCn3DUI.prototype.shareLinkUrl = function(bAllCommands) { var me = this;

var start = 0;
if(inparaWithoutCommand !== undefined) {
url += inparaWithoutCommand.substr(1) + '&command=';
//url += inparaWithoutCommand.substr(1) + '&command=';
url += 'command=';
start = 1;
}
else {
Expand Down Expand Up @@ -673,6 +677,10 @@ iCn3DUI.prototype.shareLinkUrl = function(bAllCommands) { var me = this;
) {
// do nothing
}
// remove all "show selection" except the last one
else if(prevCommandStr == 'show selection' && me.icn3d.commands.slice(i).toString().indexOf('show selection') != -1) {
// do nothing
}
else if(prevCommandStr.indexOf(toggleStr) !== -1) {
++cntToggle;
}
Expand Down
37 changes: 34 additions & 3 deletions src/icn3dui/full_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1764,14 +1764,45 @@ iCn3DUI.prototype = {
exportSpherePairs: function() { var me = this;
var tmpText = '';
var cnt = 0;
for(var resid1 in me.resid2ResidhashSphere) {
for(var resid1 in me.resid2ResidhashSphere) { // e.g., resid1: 1KQ2_A_6 ASN
var resid1Final = resid1.substr(0, resid1.indexOf(' '));

var caSerial1, caSerial2, tmpSerial;
for(var serial in me.icn3d.residues[resid1Final]) {
if(me.icn3d.calphas.hasOwnProperty(serial)) {
caSerial1 = serial;
break;
}
tmpSerial = serial;
}
if(caSerial1 === undefined) caSerial1 = tmpSerial;

var ca1 = me.icn3d.atoms[caSerial1];
var caVec1 = new THREE.Vector3(ca1.coord.x, ca1.coord.y, ca1.coord.z);

for(var resid2 in me.resid2ResidhashSphere[resid1]) {
tmpText += '<tr><td>' + resid1 + '</td><td>' + resid2 + '</td></tr>';
var resid2Final = resid2.substr(0, resid2.indexOf(' '));

for(var serial in me.icn3d.residues[resid2Final]) {
if(me.icn3d.calphas.hasOwnProperty(serial)) {
caSerial2 = serial;
break;
}
tmpSerial = serial;
}
if(caSerial2 === undefined) caSerial2 = tmpSerial;

var ca2 = me.icn3d.atoms[caSerial2];
var caVec2 = new THREE.Vector3(ca2.coord.x, ca2.coord.y, ca2.coord.z);

var dist = caVec1.distanceTo(caVec2).toFixed(1);

tmpText += '<tr><td>' + resid1 + '</td><td>' + resid2 + '</td><td align="center">' + dist + '</td></tr>';
++cnt;
}
}

var text = '<html><body><div style="text-align:center"><br><b>' + cnt + ' residue pairs in sphere</b>:<br><br><table align=center border=1 cellpadding=10 cellspacing=0><tr><th>Residue ID 1</th><th>Residue ID 2</th></tr>';
var text = '<html><body><div style="text-align:center"><br><b>' + cnt + ' residue pairs in sphere</b>:<br><br><table align=center border=1 cellpadding=10 cellspacing=0><tr><th>Residue ID 1</th><th>Residue ID 2</th><th align="center">C&alpha;-C&alpha; Dist (&#8491;)</th></tr>';

text += tmpText;

Expand Down
2 changes: 1 addition & 1 deletion src/icn3dui/html/set_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ iCn3DUI.prototype.setAdvanced = function(index) { var me = this;
html += " <b>Specification:</b> In the selection \"$1HHO,4N7N.A,B,C:5-10,KRDE,chemicals@CA,C\":";
html += " <ul><li>\"$1HHO,4N7N\" uses \"$\" to indicate structure selection.<br/>";
html += " <li>\".A,B,C\" uses \".\" to indicate chain selection.<br/>";
html += " <li>\":5-10,KRDE,chemicals\" uses the colon \":\" to indicate residue selection. Residue selection could be residue number (5-10), one-letter IUPAC abbreviations (KRDE), or predefined names: \"proteins\", \"nucleotides\", \"chemicals\", \"ions\", and \"water\".<br/>";
html += " <li>\":5-10,KRDE,chemicals\" uses the colon \":\" to indicate residue selection. Residue selection could be residue number (5-10), one-letter IUPAC abbreviations (KRDE), or predefined names: \"proteins\", \"nucleotides\", \"chemicals\", \"ions\", and \"water\". IUPAC abbreviations can be written either as a contiguous string (e.g., \":KRDE\"), in order to find all instances of that sequence in the structure, or they can be separated by commas (e.g., \":K,R,D,E\") to select all residues of a given type in the structure (in the latter case, select all Lysine, Arginine, Aspartic Acid, and Glutamic Acid in the structure).<br/>";
html += " <li>\"@CA,C\" uses \"@\" to indicate atom selection.<br/>";
html += " <li>Partial definition is allowed, e.g., \":1-10\" selects all residue IDs 1-10 in all chains.<br/>";
html += " <li>Different selections can be unioned (with \"<b>or</b>\", default), intersected (with \"<b>and</b>\"), or negated (with \"<b>not</b>\"). For example, \":1-10 or :K\" selects all residues 1-10 and all Lys residues. \":1-10 and :K\" selects all Lys residues in the range of residue number 1-10. \":1-10 or not :K\" selects all residues 1-10, which are not Lys residues.<br/>";
Expand Down
4 changes: 4 additions & 0 deletions src/icn3dui/selection/advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ iCn3DUI.prototype.selectBySpec = function (select, commandname, commanddesc, bDi

me.icn3d.hAtoms = me.icn3d.cloneHash(atomHash);

if(Object.keys(me.icn3d.hAtoms).length == 0) {
alert("No residues were selected. Please try another search.");
}

if(bDisplay === undefined || bDisplay) me.updateHlAll();

var residueAtomArray;
Expand Down
9 changes: 6 additions & 3 deletions src/icn3dui/selection/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -1126,14 +1126,14 @@ iCn3DUI.prototype.applyCommand = function (commandStr) { var me = this;
me.selectAChain(idArray[i], 'align_' + idArray[i], true);
}
}
else if(command.indexOf('select zone cutoff') == 0) {
else if(commandOri.indexOf('select zone cutoff') == 0) {
if(me.bSetChainsAdvancedMenu === undefined || !me.bSetChainsAdvancedMenu) {
me.setPredefinedInMenu();

me.bSetChainsAdvancedMenu = true;
}

var paraArray = command.split(' | '); // | sets a,b,c
var paraArray = commandOri.split(' | '); // | sets a,b,c
var radius = parseFloat(paraArray[0].substr(paraArray[0].lastIndexOf(' ') + 1));

var nameArray = [];
Expand All @@ -1142,7 +1142,10 @@ iCn3DUI.prototype.applyCommand = function (commandStr) { var me = this;
nameArray = nameStr.split(",");
}

me.pickCustomSphere(radius, nameArray);
if(!me.bSphereCalc) me.pickCustomSphere(radius, nameArray);
me.bSphereCalc = true;

me.updateHlAll();
}
else if(command.indexOf('set surface opacity') == 0) {
var value = command.substr(command.lastIndexOf(' ') + 1);
Expand Down

0 comments on commit 1ce16be

Please sign in to comment.