Commit 063873b2 authored by jdurrant's avatar jdurrant
Browse files

Before removing cruft from old hydrogen/halogen-bond code.

parent 6c2f57df
...@@ -17,10 +17,25 @@ WIP ...@@ -17,10 +17,25 @@ WIP
hydrogen_halogen_bond_angle_cutoff hydrogen_halogen_bond_angle_cutoff
11. Removed ability to toggle on and off cylinder interactions, to simplify UI. Always on for those interaction where appropriate. 11. Removed ability to toggle on and off cylinder interactions, to simplify UI. Always on for those interaction where appropriate.
12. Some interactions are shown as spheres, others as bonds. Keeps it simplier. 12. Some interactions are shown as spheres, others as bonds. Keeps it simplier.
13. Improved ability to detect salt bridges even if protein and ligand models do not have hydrogen atoms. TODO: Try to detect hydrogen bonds too.
TODO:
Halogen bonds mention in all documentation? Halogen bonds mention in all documentation?
Halogen bonds counted twice? Good to check. In the chart in log file. Halogen bonds counted twice? Good to check. In the chart in log file.
CAPTURE WARNINGS. Also, move no-hydrogen warning to below table to be less
obtrusive.
Consider "S" as donor/acceptors? Need to investigate.
Much of hydrogen-bond detecting code should go into mol. Also, use protein
definitions where possible, like you do for electrostatics. But in case of
hydrogen bonds detecvt only on the ffly (otherwise too many).
Test should also test version of protein without hydrogens
2.0 2.0
--- ---
......
// Transcrypt'ed from Python, 2021-11-05 16:24:09 // Transcrypt'ed from Python, 2021-11-09 00:25:33
import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
var __name__ = '__future__'; var __name__ = '__future__';
export var all_feature_names = []; export var all_feature_names = [];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2020 Jacob D. Durrant. // details. Copyright 2020 Jacob D. Durrant.
// Transcrypt'ed from Python, 2021-11-05 16:24:08 // Transcrypt'ed from Python, 2021-11-09 00:25:32
var binana = {}; var binana = {};
import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
import * as __module_binana__ from './binana.js'; import * as __module_binana__ from './binana.js';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2020 Jacob D. Durrant. // details. Copyright 2020 Jacob D. Durrant.
// Transcrypt'ed from Python, 2021-11-05 16:24:08 // Transcrypt'ed from Python, 2021-11-09 00:25:32
var __future__ = {}; var __future__ = {};
var binana = {}; var binana = {};
var math = {}; var math = {};
......
...@@ -2,13 +2,21 @@ ...@@ -2,13 +2,21 @@
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2020 Jacob D. Durrant. // details. Copyright 2020 Jacob D. Durrant.
// Transcrypt'ed from Python, 2021-11-05 16:24:09 // Transcrypt'ed from Python, 2021-11-09 00:25:33
var binana = {}; var binana = {};
var math = {};
import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
import {fabs} from './binana._utils.shim.js';
import * as shim from './binana._utils.shim.js';
import * as __module_binana__utils__ from './binana._utils.js';
__nest__ (binana, '_utils', __module_binana__utils__);
import {angle_between_three_points} from './binana._utils._math_functions.js';
import {r_just, round_to_thousandths_to_str} from './binana._utils.shim.js'; import {r_just, round_to_thousandths_to_str} from './binana._utils.shim.js';
import {Point} from './binana._structure.point.js'; import {Point} from './binana._structure.point.js';
import * as __module_binana__ from './binana.js'; import * as __module_binana__ from './binana.js';
__nest__ (binana, '', __module_binana__); __nest__ (binana, '', __module_binana__);
import * as __module_math__ from './math.js';
__nest__ (math, '', __module_math__);
var __name__ = 'binana._structure.atom'; var __name__ = 'binana._structure.atom';
export var Atom = __class__ ('Atom', [object], { export var Atom = __class__ ('Atom', [object], {
__module__: __name__, __module__: __name__,
...@@ -55,22 +63,22 @@ export var Atom = __class__ ('Atom', [object], { ...@@ -55,22 +63,22 @@ export var Atom = __class__ ('Atom', [object], {
get create_pdb_line () {return __get__ (this, function (self, index) { get create_pdb_line () {return __get__ (this, function (self, index) {
var output = 'ATOM '; var output = 'ATOM ';
var output = ((output + r_just (str (index), 6)) + r_just (self.atom_name, 5)) + r_just (self.residue, 4); var output = ((output + r_just (str (index), 6)) + r_just (self.atom_name, 5)) + r_just (self.residue, 4);
var output = output + r_just (round_to_thousandths_to_str (self.coordinates.x), 18); output += r_just (round_to_thousandths_to_str (self.coordinates.x), 18);
var output = output + r_just (round_to_thousandths_to_str (self.coordinates.y), 8); output += r_just (round_to_thousandths_to_str (self.coordinates.y), 8);
var output = output + r_just (round_to_thousandths_to_str (self.coordinates.z), 8); output += r_just (round_to_thousandths_to_str (self.coordinates.z), 8);
var output = output + r_just (self.element, 24); output += r_just (self.element, 24);
return output; return output;
});}, });},
get number_of_neighbors () {return __get__ (this, function (self) { get number_of_neighbors () {return __get__ (this, function (self) {
return len (self.indecies_of_atoms_connecting); return len (self.indecies_of_atoms_connecting);
});}, });},
get add_neighbor_atom_index () {return __get__ (this, function (self, index) { get add_neighbor_atom_index () {return __get__ (this, function (self, index) {
if (!(__in__ (index, self.indecies_of_atoms_connecting))) { if (!__in__ (index, self.indecies_of_atoms_connecting)) {
self.indecies_of_atoms_connecting.append (index); self.indecies_of_atoms_connecting.append (index);
} }
});}, });},
get side_chain_or_backbone () {return __get__ (this, function (self) { get side_chain_or_backbone () {return __get__ (this, function (self) {
if (self.atom_name.strip () == 'CA' || self.atom_name.strip () == 'C' || self.atom_name.strip () == 'O' || self.atom_name.strip () == 'N') { if (__in__ (self.atom_name.strip (), ['CA', 'C', 'O', 'N'])) {
return 'BACKBONE'; return 'BACKBONE';
} }
else { else {
...@@ -164,6 +172,29 @@ export var Atom = __class__ ('Atom', [object], { ...@@ -164,6 +172,29 @@ export var Atom = __class__ ('Atom', [object], {
if (self.residue.strip () == '') { if (self.residue.strip () == '') {
self.residue = ' MOL'; self.residue = ' MOL';
} }
});},
get has_sp3_geometry () {return __get__ (this, function (self, parent_mol) {
var ncrs = (function () {
var __accu0__ = [];
for (var i of self.indecies_of_atoms_connecting) {
__accu0__.append (parent_mol.all_atoms [i].coordinates);
}
return __accu0__;
}) ();
var ccr = self.coordinates;
var to_deg = 180.0 / math.pi;
var angles = [angle_between_three_points (ncrs [0], ccr, ncrs [1]) * to_deg];
if (len (ncrs) > 2) {
angles.append (angle_between_three_points (ncrs [0], ccr, ncrs [2]) * to_deg);
angles.append (angle_between_three_points (ncrs [1], ccr, ncrs [2]) * to_deg);
}
if (len (ncrs) > 3) {
angles.append (angle_between_three_points (ncrs [0], ccr, ncrs [3]) * to_deg);
angles.append (angle_between_three_points (ncrs [1], ccr, ncrs [3]) * to_deg);
angles.append (angle_between_three_points (ncrs [2], ccr, ncrs [3]) * to_deg);
}
var average_angle = sum (angles) / float (len (angles));
return fabs (average_angle - 109.0) < 5.0;
});} });}
}); });
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2020 Jacob D. Durrant. // details. Copyright 2020 Jacob D. Durrant.
// Transcrypt'ed from Python, 2021-11-05 16:24:08 // Transcrypt'ed from Python, 2021-11-09 00:25:33
var binana = {}; var binana = {};
var math = {}; var math = {};
import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
...@@ -12,7 +12,7 @@ import * as shim from './binana._utils.shim.js'; ...@@ -12,7 +12,7 @@ import * as shim from './binana._utils.shim.js';
import * as __module_binana__utils__ from './binana._utils.js'; import * as __module_binana__utils__ from './binana._utils.js';
__nest__ (binana, '_utils', __module_binana__utils__); __nest__ (binana, '_utils', __module_binana__utils__);
import {_set_default} from './binana._utils.shim.js'; import {_set_default} from './binana._utils.shim.js';
import {angle_between_three_points, cross_product, dihedral, distance, vector_subtraction} from './binana._utils._math_functions.js'; import {cross_product, dihedral, distance, vector_subtraction} from './binana._utils._math_functions.js';
import {Atom} from './binana._structure.atom.js'; import {Atom} from './binana._structure.atom.js';
import {Point} from './binana._structure.point.js'; import {Point} from './binana._structure.point.js';
import * as __module_math__ from './math.js'; import * as __module_math__ from './math.js';
...@@ -21,6 +21,7 @@ import * as __module_binana__ from './binana.js'; ...@@ -21,6 +21,7 @@ import * as __module_binana__ from './binana.js';
__nest__ (binana, '', __module_binana__); __nest__ (binana, '', __module_binana__);
var __name__ = 'binana._structure.mol'; var __name__ = 'binana._structure.mol';
export var textwrap = shim; export var textwrap = shim;
export var _max_donor_X_dist = dict ({'H': 1.3, 'I': 2.04 * 1.4, 'BR': 1.86 * 1.4, 'Br': 1.86 * 1.4, 'CL': 1.71 * 1.4, 'Cl': 1.71 * 1.4, 'F': 1.33 * 1.4});
export var Mol = __class__ ('Mol', [object], { export var Mol = __class__ ('Mol', [object], {
__module__: __name__, __module__: __name__,
get __init__ () {return __get__ (this, function (self) { get __init__ () {return __get__ (this, function (self) {
...@@ -36,6 +37,7 @@ export var Mol = __class__ ('Mol', [object], { ...@@ -36,6 +37,7 @@ export var Mol = __class__ ('Mol', [object], {
self.protein_resnames = ['ALA', 'ARG', 'ASN', 'ASP', 'ASH', 'ASX', 'CYS', 'CYM', 'CYX', 'GLN', 'GLU', 'GLH', 'GLX', 'GLY', 'HIS', 'HID', 'HIE', 'HIP', 'ILE', 'LEU', 'LYS', 'LYN', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL']; self.protein_resnames = ['ALA', 'ARG', 'ASN', 'ASP', 'ASH', 'ASX', 'CYS', 'CYM', 'CYX', 'GLN', 'GLU', 'GLH', 'GLX', 'GLY', 'HIS', 'HID', 'HIE', 'HIP', 'ILE', 'LEU', 'LYS', 'LYN', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL'];
self.aromatic_rings = []; self.aromatic_rings = [];
self.charges = []; self.charges = [];
self.has_hydrogens = false;
});}, });},
get load_pdb_from_text () {return __get__ (this, function (self, text_content, filename_to_use, min_x, max_x, min_y, max_y, min_z, max_z) { get load_pdb_from_text () {return __get__ (this, function (self, text_content, filename_to_use, min_x, max_x, min_y, max_y, min_z, max_z) {
if (typeof filename_to_use == 'undefined' || (filename_to_use != null && filename_to_use.hasOwnProperty ("__kwargtrans__"))) {; if (typeof filename_to_use == 'undefined' || (filename_to_use != null && filename_to_use.hasOwnProperty ("__kwargtrans__"))) {;
...@@ -88,37 +90,28 @@ export var Mol = __class__ ('Mol', [object], { ...@@ -88,37 +90,28 @@ export var Mol = __class__ ('Mol', [object], {
if (len (line) >= 7 && (line.__getslice__ (0, 4, 1) == 'ATOM' || line.__getslice__ (0, 6, 1) == 'HETATM')) { if (len (line) >= 7 && (line.__getslice__ (0, 4, 1) == 'ATOM' || line.__getslice__ (0, 6, 1) == 'HETATM')) {
var temp_atom = Atom (); var temp_atom = Atom ();
temp_atom.read_pdb_line (line); temp_atom.read_pdb_line (line);
if (temp_atom.element == 'H') {
self.has_hydrogens = true;
}
if (temp_atom.coordinates.x > min_x && temp_atom.coordinates.x < max_x && temp_atom.coordinates.y > min_y && temp_atom.coordinates.y < max_y && temp_atom.coordinates.z > min_z && temp_atom.coordinates.z < max_z) { if (temp_atom.coordinates.x > min_x && temp_atom.coordinates.x < max_x && temp_atom.coordinates.y > min_y && temp_atom.coordinates.y < max_y && temp_atom.coordinates.z > min_z && temp_atom.coordinates.z < max_z) {
if (self.max_x < temp_atom.coordinates.x) { self.max_x = max (self.max_x, temp_atom.coordinates.x);
self.max_x = temp_atom.coordinates.x; self.max_y = max (self.max_y, temp_atom.coordinates.y);
} self.max_z = max (self.max_z, temp_atom.coordinates.z);
if (self.max_y < temp_atom.coordinates.y) { self.min_x = min (self.min_x, temp_atom.coordinates.x);
self.max_y = temp_atom.coordinates.y; self.min_y = min (self.min_y, temp_atom.coordinates.y);
} self.min_z = min (self.min_z, temp_atom.coordinates.z);
if (self.max_z < temp_atom.coordinates.z) {
self.max_z = temp_atom.coordinates.z;
}
if (self.min_x > temp_atom.coordinates.x) {
self.min_x = temp_atom.coordinates.x;
}
if (self.min_y > temp_atom.coordinates.y) {
self.min_y = temp_atom.coordinates.y;
}
if (self.min_z > temp_atom.coordinates.z) {
self.min_z = temp_atom.coordinates.z;
}
var key = (((((temp_atom.atom_name.strip () + '_') + str (temp_atom.resid)) + '_') + temp_atom.residue.strip ()) + '_') + temp_atom.chain.strip (); var key = (((((temp_atom.atom_name.strip () + '_') + str (temp_atom.resid)) + '_') + temp_atom.residue.strip ()) + '_') + temp_atom.chain.strip ();
if (__in__ (key, atom_already_loaded) && __in__ (temp_atom.residue.strip (), self.protein_resnames)) { if (__in__ (key, atom_already_loaded) && __in__ (temp_atom.residue.strip (), self.protein_resnames)) {
self.printout (('Warning: Duplicate protein atom detected: "' + temp_atom.line.strip ()) + '". Not loading this duplicate.'); self.printout (('Warning: Duplicate protein atom detected: "' + temp_atom.line.strip ()) + '". Not loading this duplicate.');
print (''); print ('');
} }
if (!__in__ (key, atom_already_loaded) || !(__in__ (temp_atom.residue.strip (), self.protein_resnames))) { if (!__in__ (key, atom_already_loaded) || !__in__ (temp_atom.residue.strip (), self.protein_resnames)) {
atom_already_loaded.append (key); atom_already_loaded.append (key);
self.all_atoms [autoindex] = temp_atom; self.all_atoms [autoindex] = temp_atom;
if (!__in__ (temp_atom.residue.__getslice__ (-(3), null, 1), self.protein_resnames)) { if (!__in__ (temp_atom.residue.__getslice__ (-(3), null, 1), self.protein_resnames)) {
self.non_protein_atoms [autoindex] = temp_atom; self.non_protein_atoms [autoindex] = temp_atom;
} }
var autoindex = autoindex + 1; autoindex++;
} }
} }
} }
...@@ -127,6 +120,10 @@ export var Mol = __class__ ('Mol', [object], { ...@@ -127,6 +120,10 @@ export var Mol = __class__ ('Mol', [object], {
self.create_bonds_by_distance (); self.create_bonds_by_distance ();
self.assign_aromatic_rings (); self.assign_aromatic_rings ();
self.assign_charges (); self.assign_charges ();
if (!(self.has_hydrogens)) {
self.printout ('WARNING: Detected molecule with no hydrogen atoms. Did you forget to add them? Adding hydrogen atoms improves salt-bridge and hydrogen-bond detection.');
print ('');
}
});}, });},
get load_pdb_file () {return __get__ (this, function (self, filename, min_x, max_x, min_y, max_y, min_z, max_z) { get load_pdb_file () {return __get__ (this, function (self, filename, min_x, max_x, min_y, max_y, min_z, max_z) {
if (typeof min_x == 'undefined' || (min_x != null && min_x.hasOwnProperty ("__kwargtrans__"))) {; if (typeof min_x == 'undefined' || (min_x != null && min_x.hasOwnProperty ("__kwargtrans__"))) {;
...@@ -174,11 +171,13 @@ export var Mol = __class__ ('Mol', [object], { ...@@ -174,11 +171,13 @@ export var Mol = __class__ ('Mol', [object], {
f.close (); f.close ();
});}, });},
get save_pdb_string () {return __get__ (this, function (self) { get save_pdb_string () {return __get__ (this, function (self) {
var to_output = ''; return ''.join ((function () {
for (var atom_index of self.all_atoms.py_keys ()) { var __accu0__ = [];
to_output += self.all_atoms [atom_index].create_pdb_line (atom_index) + '\n'; for (var atom_index of self.all_atoms.py_keys ()) {
} __accu0__.append (self.all_atoms [atom_index].create_pdb_line (atom_index) + '\n');
return to_output; }
return py_iter (__accu0__);
}) ());
});}, });},
get add_new_atom () {return __get__ (this, function (self, atom) { get add_new_atom () {return __get__ (this, function (self, atom) {
var t = 1; var t = 1;
...@@ -200,7 +199,7 @@ export var Mol = __class__ ('Mol', [object], { ...@@ -200,7 +199,7 @@ export var Mol = __class__ ('Mol', [object], {
self.all_atoms [atom_index].residue = resname; self.all_atoms [atom_index].residue = resname;
} }
});}, });},
get connected_atoms_of_given_element () {return __get__ (this, function (self, index, connected_atom_element) { get connected_atoms_of_element () {return __get__ (this, function (self, index, connected_atom_element) {
var atom = self.all_atoms [index]; var atom = self.all_atoms [index];
var connected_atoms = []; var connected_atoms = [];
for (var index2 of atom.indecies_of_atoms_connecting) { for (var index2 of atom.indecies_of_atoms_connecting) {
...@@ -230,7 +229,7 @@ export var Mol = __class__ ('Mol', [object], { ...@@ -230,7 +229,7 @@ export var Mol = __class__ ('Mol', [object], {
for (var atom_index of self.all_atoms.py_keys ()) { for (var atom_index of self.all_atoms.py_keys ()) {
var atom = self.all_atoms [atom_index]; var atom = self.all_atoms [atom_index];
var key = (((atom.residue + '_') + str (atom.resid)) + '_') + atom.chain; var key = (((atom.residue + '_') + str (atom.resid)) + '_') + atom.chain;
if (first === true) { if (first) {
var curr_res = key; var curr_res = key;
var first = false; var first = false;
} }
...@@ -244,181 +243,143 @@ export var Mol = __class__ ('Mol', [object], { ...@@ -244,181 +243,143 @@ export var Mol = __class__ ('Mol', [object], {
} }
self.check_protein_format_process_residue (residue, last_key); self.check_protein_format_process_residue (residue, last_key);
});}, });},
get warn_bad_atom_name () {return __get__ (this, function (self, py_name, residue) {
self.printout (((('Warning: There is no atom named "' + py_name) + '" in the protein residue ') + residue) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine secondary structure. If this residue is far from the active site, this warning may not affect the NNScore.');
print ('');
});},
get check_protein_format_process_residue () {return __get__ (this, function (self, residue, last_key) { get check_protein_format_process_residue () {return __get__ (this, function (self, residue, last_key) {
var temp = last_key.strip ().py_split ('_'); var temp = last_key.strip ().py_split ('_');
var resname = temp [0]; var resname = temp [0];
var real_resname = resname.__getslice__ (-(3), null, 1); var real_resname = resname.__getslice__ (-(3), null, 1);
var resid = temp [1];
var chain = temp [2];
if (__in__ (real_resname, self.protein_resnames)) { if (__in__ (real_resname, self.protein_resnames)) {
if (!__in__ ('N', residue)) { if (!__in__ ('N', residue)) {
self.printout (('Warning: There is no atom named "N" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine secondary structure. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('N', last_key);
print ('');
} }
if (!__in__ ('C', residue)) { if (!__in__ ('C', residue)) {
self.printout (('Warning: There is no atom named "C" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine secondary structure. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('C', last_key);
print ('');
} }
if (!__in__ ('CA', residue)) { if (!__in__ ('CA', residue)) {
self.printout (('Warning: There is no atom named "CA" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine secondary structure. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('CA', last_key);
print ('');
} }
if (real_resname == 'GLU' || real_resname == 'GLH' || real_resname == 'GLX') { if (__in__ (real_resname, ['GLU', 'GLH', 'GLX'])) {
if (!__in__ ('OE1', residue)) { if (!__in__ ('OE1', residue)) {
self.printout (('Warning: There is no atom named "OE1" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine salt-bridge interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('OE1', last_key);
print ('');
} }
if (!__in__ ('OE2', residue)) { if (!__in__ ('OE2', residue)) {
self.printout (('Warning: There is no atom named "OE2" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine salt-bridge interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('OE2', last_key);
print ('');
} }
} }
if (real_resname == 'ASP' || real_resname == 'ASH' || real_resname == 'ASX') { if (__in__ (real_resname, ['ASP', 'ASH', 'ASX'])) {
if (!__in__ ('OD1', residue)) { if (!__in__ ('OD1', residue)) {
self.printout (('Warning: There is no atom named "OD1" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine salt-bridge interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('OD1', last_key);
print ('');
} }
if (!__in__ ('OD2', residue)) { if (!__in__ ('OD2', residue)) {
self.printout (('Warning: There is no atom named "OD2" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine salt-bridge interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('OD2', last_key);
print ('');
} }
} }
if (real_resname == 'LYS' || real_resname == 'LYN') { if (__in__ (real_resname, ['LYS', 'LYN']) && !__in__ ('NZ', residue)) {
if (!__in__ ('NZ', residue)) { self.warn_bad_atom_name ('NZ', last_key);
self.printout (('Warning: There is no atom named "NZ" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-cation and salt-bridge interactions. If this residue is far from the active site, this warning may not affect the NNScore.');
print ('');
}
} }
if (real_resname == 'ARG') { if (real_resname == 'ARG') {
if (!__in__ ('NH1', residue)) { if (!__in__ ('NH1', residue)) {
self.printout (('Warning: There is no atom named "NH1" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-cation and salt-bridge interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('NH1', last_key);
print ('');
} }
if (!__in__ ('NH2', residue)) { if (!__in__ ('NH2', residue)) {
self.printout (('Warning: There is no atom named "NH2" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-cation and salt-bridge interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('NH2', last_key);
print ('');
} }
} }
if (real_resname == 'HIS' || real_resname == 'HID' || real_resname == 'HIE' || real_resname == 'HIP') { if (__in__ (real_resname, ['HIS', 'HID', 'HIE', 'HIP'])) {
if (!__in__ ('NE2', residue)) { if (!__in__ ('NE2', residue)) {
self.printout (('Warning: There is no atom named "NE2" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-cation and salt-bridge interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('NE2', last_key);
print ('');
} }
if (!__in__ ('ND1', residue)) { if (!__in__ ('ND1', residue)) {
self.printout (('Warning: There is no atom named "ND1" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-cation and salt-bridge interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('ND1', last_key);
print ('');
} }
} }
if (real_resname == 'PHE') { if (real_resname == 'PHE') {
if (!__in__ ('CG', residue)) { if (!__in__ ('CG', residue)) {
self.printout (('Warning: There is no atom named "CG" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('CG', last_key);
print ('');
} }
if (!__in__ ('CD1', residue)) { if (!__in__ ('CD1', residue)) {
self.printout (('Warning: There is no atom named "CD1" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('CD1', last_key);
print ('');
} }
if (!__in__ ('CD2', residue)) { if (!__in__ ('CD2', residue)) {
self.printout (('Warning: There is no atom named "CD2" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('CD2', last_key);
print ('');
} }
if (!__in__ ('CE1', residue)) { if (!__in__ ('CE1', residue)) {
self.printout (('Warning: There is no atom named "CE1" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('CE1', last_key);
print ('');
} }
if (!__in__ ('CE2', residue)) { if (!__in__ ('CE2', residue)) {
self.printout (('Warning: There is no atom named "CE2" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('CE2', last_key);
print ('');
} }
if (!__in__ ('CZ', residue)) { if (!__in__ ('CZ', residue)) {
self.printout (('Warning: There is no atom named "CZ" in the protein residue ' + last_key) + '. Please use standard naming conventions for all protein residues. This atom is needed to determine pi-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); self.warn_bad_atom_name ('CZ', last_key);
print ('');
} }
} }
if (real_resname == 'TYR') { if (real_resname == 'TYR') {
if (!__in__ ('CG', residue)) { if (!__in__ ('CG', residue)) {