Skip to content

Commit

Permalink
Fixed a bug on hydrogen bonds between residues with the same residue …
Browse files Browse the repository at this point in the history
…number but different chain names. Removed duplicated names in the menu of "Defined Sets".
  • Loading branch information
jiywang3 committed Mar 12, 2020
1 parent 2eb8b6d commit 253d6b4
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 50 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Change Log
[icn3d-2.12.1](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.12.1.zip) was release on March 12, 2020. Fixed a bug on hydrogen bonds between residues with the same residue number but different chain names. Removed duplicated names in the menu of "Defined Sets".

[icn3d-2.12.0](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.12.0.zip) was release on March 2, 2020. Enabled to realign selected residues in VAST+ structure alignment. The option "Realign Selection" is in the View menu.

[icn3d-2.11.5](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.11.5.zip) was release on February 11, 2020. Add colors to aligned sequence track based on Blosum62.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## About iCn3D

"I see in 3D" (iCn3D) Structure Viewer is a WebGL-based 3D viewer using Three.js and jQuery. iCn3D synchronizes the display of 3D structure, 2D interaction, and 1D sequences and annotations. Users' custom display can be saved in a short URL or a PNG image. <b>Complete package</b> of iCn3D including Three.js and jQuery can be downloaded from [https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.12.0.zip](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.12.0.zip). The "Download ZIP" link in this page does not include third-party libraries.
"I see in 3D" (iCn3D) Structure Viewer is a WebGL-based 3D viewer using Three.js and jQuery. iCn3D synchronizes the display of 3D structure, 2D interaction, and 1D sequences and annotations. Users' custom display can be saved in a short URL or a PNG image. <b>Complete package</b> of iCn3D including Three.js and jQuery can be downloaded from [https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.12.1.zip](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.12.1.zip). The "Download ZIP" link in this page does not include third-party libraries.
* <b>View a 3D structure in iCn3D</b>:
Open the link https://www.ncbi.nlm.nih.gov/Structure/icn3d/full.html, input a PDB ID, and click "Load". You can also click "File" menu to "Open File" or input other IDs.

Expand Down
3 changes: 3 additions & 0 deletions icn3d.html
Original file line number Diff line number Diff line change
Expand Up @@ -2094,6 +2094,9 @@ <h3>Methods <a href="#Top"><span class="top">&nbsp;&nbsp;&nbsp;</span></a></h3>

<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>
<a href="https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.12.1.zip">icn3d-2.12.1</a> was release on March 12, 2020. Fixed a bug on hydrogen bonds between residues with the same residue number but different chain names. Removed duplicated names in the menu of "Defined Sets".
<br><br>

<a href="https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.12.0.zip">icn3d-2.12.0</a> was release on March 2, 2020. Enabled to realign selected residues in VAST+ structure alignment. The option "Realign Selection" is in the View menu.
<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": "2.12.0",
"version": "2.12.1",
"description": "iCn3D Structure Viewer",
"main": "index.html",
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions src/icn3d/other_full.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ iCn3D.prototype.isValidHbond = function (atom, atomHbond, threshold) { var me =

//if (idealGeometry[donor.index] === AtomGeometry.Trigonal){ // 120
var outOfPlane1 = this.calcPlaneAngle(donorAtom, acceptorAtom);
if (outOfPlane1 !== undefined && outOfPlane1 > maxHbondDonPlaneAngle) return false;
if (outOfPlane1 !== undefined && outOfPlane1 > maxHbondDonPlaneAngle) {
return false;
}
//}

var acceptorAngles = this.calcAngles(acceptorAtom, donorAtom);
Expand Down Expand Up @@ -356,7 +358,7 @@ iCn3D.prototype.calculateChemicalHbonds = function (startAtoms, targetAtoms, thr
&& (atom.name === 'N' || atom.name === 'O') && (atomHbond[j].name === 'O' || atomHbond[j].name === 'N') ) {

if(atom.name === atomHbond[j].name) continue;
if(Math.abs(atom.resi - atomHbond[j].resi) <= 1) continue; // peptide bond
if(atom.structure == atomHbond[j].structure && atom.chain == atomHbond[j].chain && Math.abs(atom.resi - atomHbond[j].resi) <= 1) continue; // peptide bond

// protein backbone hydrogen
// https://en.wikipedia.org/wiki/DSSP_(hydrogen_bond_estimation_algorithm)
Expand Down
49 changes: 17 additions & 32 deletions src/icn3dui/full_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (!$.ui.dialog.prototype._makeDraggableBase) {
}

var iCn3DUI = function(cfg) { var me = this; //"use strict";
this.REVISION = '2.12.0';
this.REVISION = '2.12.1';

me.bFullUi = true;

Expand Down Expand Up @@ -1014,16 +1014,6 @@ iCn3DUI.prototype = {
me.setLogCmd(cmd, true);

me.showAnnotations();
/*
if(Object.keys(me.icn3d.proteins).length > 0) {
$.when(me.applyCommandAnnotationsAndCddSite(cmd)).then(function() {
// do something afterward
});
}
else {
me.applyCommandAnnotationsAndCddSiteBase(cmd);
}
*/
}

if(me.cfg.closepopup) {
Expand Down Expand Up @@ -6506,17 +6496,22 @@ iCn3DUI.prototype = {
});
},

clickSeqSaveSelection: function() { var me = this; //"use strict";
$(document).on("click", "#" + me.pre + "seq_saveselection", function(e) {
e.stopImmediatePropagation();
dialog.dialog( "close" );

saveSelectionPrep: function() { var me = this; //"use strict";
if(!$('#' + me.pre + 'dl_definedsets').hasClass('ui-dialog-content') || !$('#' + me.pre + 'dl_definedsets').dialog( 'isOpen' )) {
me.openDialog(me.pre + 'dl_definedsets', 'Select sets');
$("#" + me.pre + "atomsCustom").resizable();
}

me.bSelectResidue = false;
me.bSelectAlignResidue = false;
},

clickSeqSaveSelection: function() { var me = this; //"use strict";
$(document).on("click", "#" + me.pre + "seq_saveselection", function(e) {
e.stopImmediatePropagation();
dialog.dialog( "close" );

me.saveSelectionPrep();

var name = $("#" + me.pre + "seq_command_name").val().replace(/\s+/g, '_');
//var description = $("#" + me.pre + "seq_command_desc").val();
Expand All @@ -6529,12 +6524,7 @@ iCn3DUI.prototype = {
$(document).on("click", "#" + me.pre + "seq_saveselection2", function(e) {
e.stopImmediatePropagation();

if(!$('#' + me.pre + 'dl_definedsets').hasClass('ui-dialog-content') || !$('#' + me.pre + 'dl_definedsets').dialog( 'isOpen' )) {
me.openDialog(me.pre + 'dl_definedsets', 'Select sets');
$("#" + me.pre + "atomsCustom").resizable();
}

me.bSelectResidue = false;
me.saveSelectionPrep();

var name = $("#" + me.pre + "seq_command_name2").val().replace(/\s+/g, '_');
//var description = $("#" + me.pre + "seq_command_desc2").val();
Expand All @@ -6547,19 +6537,14 @@ iCn3DUI.prototype = {

clickAlignSeqSaveSelection: function() { var me = this; //"use strict";
$(document).on("click", "#" + me.pre + "alignseq_saveselection", function(e) {
e.stopImmediatePropagation();

if(!$('#' + me.pre + 'dl_definedsets').hasClass('ui-dialog-content') || !$('#' + me.pre + 'dl_definedsets').dialog( 'isOpen' )) {
me.openDialog(me.pre + 'dl_definedsets', 'Select sets');
$("#" + me.pre + "atomsCustom").resizable();
}
e.stopImmediatePropagation();

me.bSelectAlignResidue = false;
me.saveSelectionPrep();

var name = $("#" + me.pre + "alignseq_command_name").val().replace(/\s+/g, '_');
//var description = $("#" + me.pre + "alignseq_command_desc").val();
var name = $("#" + me.pre + "alignseq_command_name").val().replace(/\s+/g, '_');
//var description = $("#" + me.pre + "alignseq_command_desc").val();

me.saveSelection(name, name);
me.saveSelection(name, name);

//$( ".icn3d-accordion" ).accordion(me.closeAc);
});
Expand Down
23 changes: 22 additions & 1 deletion src/icn3dui/highlight/hl_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ iCn3DUI.prototype.removeHl2D = function() { var me = this; //"use strict";
// remove highlight in the menu of defined sets
iCn3DUI.prototype.removeHlMenus = function() { var me = this; //"use strict";
$("#" + me.pre + "atomsCustom").val("");
$("#" + me.pre + "atomsCustom")[0].blur();
};

iCn3DUI.prototype.updateHlAll = function(commandnameArray, bSetMenu, bUnion, bForceHighlight) { var me = this; //"use strict";
Expand Down Expand Up @@ -226,6 +227,7 @@ iCn3DUI.prototype.updateHlMenus = function(commandnameArray) { var me = this; //

if($("#" + me.pre + "atomsCustom").length) {
$("#" + me.pre + "atomsCustom").html(definedAtomsHtml);
$("#" + me.pre + "atomsCustom")[0].blur();
}
};

Expand All @@ -235,7 +237,26 @@ iCn3DUI.prototype.setAtomMenu = function (commandnameArray) { var me = this; //"
var nameArray1 = (me.icn3d.defNames2Residues !== undefined) ? Object.keys(me.icn3d.defNames2Residues) : [];
var nameArray2 = (me.icn3d.defNames2Atoms !== undefined) ? Object.keys(me.icn3d.defNames2Atoms) : [];

var nameArray = nameArray1.concat(nameArray2).sort();
/*
var nameHash = {};
for(var i = 0, il = nameArray1.length; i < il; ++i) {
nameHash[nameArray1[i]] = 1;
}
for(var i = 0, il = nameArray2.length; i < il; ++i) {
nameHash[nameArray2[i]] = 1;
}
var nameArray = Object.keys(nameHash);
*/

var nameArrayTmp = nameArray1.concat(nameArray2).sort();

var nameArray = [];
$.each(nameArrayTmp, function(i, el){
if($.inArray(el, nameArray) === -1) nameArray.push(el);
});

//for(var i in me.icn3d.defNames2Atoms) {
for(var i = 0, il = nameArray.length; i < il; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion src/icn3dui/parsers/mmcif_mmdb_parser_align.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ iCn3DUI.prototype.downloadChainAlignment = function (chainalign) { var me = this
iCn3DUI.prototype.set2DDiagramsForAlign = function (mmdbid1, mmdbid2) { var me = this; //"use strict";
me.openDialog(me.pre + 'dl_2ddgm', 'Interactions');

var url1 = me.baseUrl + "mmdb_strview.cgi?v=2&program=icn3d&uid="+mmdbid1+"&intrac=1";
var url1 = me.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&uid="+mmdbid1+"&intrac=1";
var url2 = me.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&uid="+mmdbid2+"&intrac=1";

if(me.cfg.inpara !== undefined) {
Expand Down
40 changes: 29 additions & 11 deletions src/icn3dui/parsers/pdb_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,25 +231,29 @@ iCn3DUI.prototype.transformToOpmOri = function(pdbid, chainresiCalphaHash2, bRes
var chainresiCalphaHash1 = me.icn3d.getChainCalpha(me.icn3d.chains, me.icn3d.atoms, bResi_ori);

var coordsFrom = [], coordsTo = [];
var bOneChain = (Object.keys(chainresiCalphaHash1.chainresiCalphaHash).length == 1 || Object.keys(chainresiCalphaHash2.chainresiCalphaHash).length == 1) ? true : false;
for(var chainresi in chainresiCalphaHash1.chainresiCalphaHash) {
if(chainresiCalphaHash2.chainresiCalphaHash.hasOwnProperty(chainresi)) {
var coord1 = chainresiCalphaHash1.chainresiCalphaHash[chainresi];
var coord2 = chainresiCalphaHash2.chainresiCalphaHash[chainresi];

coordsFrom.push(coord1);
coordsTo.push(coord2);
if(coord1.length == coord2.length || bOneChain) {
coordsFrom = coordsFrom.concat(coord1);
coordsTo = coordsTo.concat(coord2);
}

if(coordsFrom.length > 500) break; // no need to use all c-alpha
}
}

var n = coordsFrom.length;
//var n = coordsFrom.length;
var n = (coordsFrom.length < coordsTo.length) ? coordsFrom.length : coordsTo.length;

if(n > 2) {
if(n >= 4) {
me.icn3d.rmsd_supr = me.rmsd_supr(coordsFrom, coordsTo, n);

// apply matrix for each atom
if(me.icn3d.rmsd_supr.rot !== undefined) {
if(me.icn3d.rmsd_supr.rot !== undefined && me.icn3d.rmsd_supr.rsmd < 0.1) {
var rot = me.icn3d.rmsd_supr.rot;
var centerFrom = me.icn3d.rmsd_supr.trans1;
var centerTo = me.icn3d.rmsd_supr.trans2;
Expand Down Expand Up @@ -294,42 +298,56 @@ iCn3DUI.prototype.transformToOpmOri = function(pdbid, chainresiCalphaHash2, bRes
};

iCn3DUI.prototype.realign = function() { var me = this; //"use strict";
me.saveSelectionPrep();

var index = Object.keys(me.icn3d.defNames2Atoms).length;
var name = 'alseq_' + index;

me.saveSelection(name, name);

var structHash = {};
var lastResi = 0;
var lastStruResi = '';
for(var serial in me.icn3d.hAtoms) {
var atom = me.icn3d.atoms[serial];
if( (me.icn3d.proteins.hasOwnProperty(serial) && atom.name == "CA")
|| (me.icn3d.nucleotides.hasOwnProperty(serial) && (atom.name == "O3'" || atom.name == "O3*")) ) {
if(atom.resi == lastResi) continue; // e.g., Alt A and B
if(atom.structure + '_' + atom.resi == lastStruResi) continue; // e.g., Alt A and B

if(!structHash.hasOwnProperty(atom.structure)) {
structHash[atom.structure] = [];
}

structHash[atom.structure].push(atom.coord.clone());

lastResi = atom.resi;
lastStruResi = atom.structure + '_' + atom.resi;
}
}

var structArray = Object.keys(structHash);

if(structArray.length >= 2 && structHash[structArray[0]].length == structHash[structArray[1]].length) {
// if(structHash[structArray[0]].length != structHash[structArray[1]].length) alert("The number of selected residues in each structure should be the same...");

// if(structArray.length >= 2 && structHash[structArray[0]].length == structHash[structArray[1]].length) {
if(structArray.length >= 2) {
var firstStruct = structArray[0];
var secondStruct = structArray[1];

// transform from the second structure to the first structure
var coordsFrom = structHash[secondStruct];
var coordsTo = structHash[firstStruct];

var n = coordsFrom.length;
//var n = coordsFrom.length;
var n = (coordsFrom.length < coordsTo.length) ? coordsFrom.length : coordsTo.length;

if(n > 2) {
if(n < 4) alert("Please select at least four residues in each structure...");
if(n >= 4) {
me.icn3d.rmsd_supr = me.rmsd_supr(coordsFrom, coordsTo, n);

// apply matrix for each atom
if(me.icn3d.rmsd_supr.rot !== undefined) {
var rot = me.icn3d.rmsd_supr.rot;
if(rot[0] === null) alert("Please select more residues in each structure...");

var centerFrom = me.icn3d.rmsd_supr.trans1;
var centerTo = me.icn3d.rmsd_supr.trans2;
//var rsmd = me.icn3d.rmsd_supr.rsmd;
Expand Down
7 changes: 7 additions & 0 deletions src/icn3dui/selection/sets.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ iCn3DUI.prototype.deleteSelectedSets = function() { var me = this; //"use strict
iCn3DUI.prototype.changeCustomAtoms = function (nameArray, bUpdateHlMenus) { var me = this; //"use strict";
me.icn3d.hAtoms = {};

/*
var nameArray = [];
$.each(inNameArray, function(i, el){
if($.inArray(el, nameArray) === -1) nameArray.push(el);
});
*/

for(var i = 0; i < nameArray.length; ++i) {
var selectedSet = nameArray[i];

Expand Down
3 changes: 2 additions & 1 deletion src/utils/rmsd_supr.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ iCn3DUI.prototype.null_basis = function(a0, v1, v2, v3, epsi) { var me = this; /
// the null space contains only the zero vector
k0 = 0;
v1[0] = 0.0; v1[1] = 0.0; v1[2] = 0.0;
return;
//return;
return {'k': k0, 'v1': v1, 'v2': v2, 'v3': v3};
}
}
}
Expand Down

0 comments on commit 253d6b4

Please sign in to comment.