diff --git a/CHANGES.md b/CHANGES.md index 3da6db7..5dd787e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,10 +17,25 @@ WIP 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. 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 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 --- diff --git a/javascript/lib/__future__.js b/javascript/lib/__future__.js index 9c4598f..0d9e931 100644 --- a/javascript/lib/__future__.js +++ b/javascript/lib/__future__.js @@ -1,4 +1,4 @@ -// 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'; var __name__ = '__future__'; export var all_feature_names = []; diff --git a/javascript/lib/binana._cli_params._get_params.js b/javascript/lib/binana._cli_params._get_params.js index bfd68b8..b8e511f 100644 --- a/javascript/lib/binana._cli_params._get_params.js +++ b/javascript/lib/binana._cli_params._get_params.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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'; diff --git a/javascript/lib/binana._start.js b/javascript/lib/binana._start.js index 9dc30fa..806cc64 100644 --- a/javascript/lib/binana._start.js +++ b/javascript/lib/binana._start.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 binana = {}; var math = {}; diff --git a/javascript/lib/binana._structure.atom.js b/javascript/lib/binana._structure.atom.js index 7c6f9ff..2f01d14 100644 --- a/javascript/lib/binana._structure.atom.js +++ b/javascript/lib/binana._structure.atom.js @@ -2,13 +2,21 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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 {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 {Point} from './binana._structure.point.js'; import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); +import * as __module_math__ from './math.js'; +__nest__ (math, '', __module_math__); var __name__ = 'binana._structure.atom'; export var Atom = __class__ ('Atom', [object], { __module__: __name__, @@ -55,22 +63,22 @@ export var Atom = __class__ ('Atom', [object], { get create_pdb_line () {return __get__ (this, function (self, index) { 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 (round_to_thousandths_to_str (self.coordinates.x), 18); - var output = 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); - var output = output + r_just (self.element, 24); + output += r_just (round_to_thousandths_to_str (self.coordinates.x), 18); + output += r_just (round_to_thousandths_to_str (self.coordinates.y), 8); + output += r_just (round_to_thousandths_to_str (self.coordinates.z), 8); + output += r_just (self.element, 24); return output; });}, get number_of_neighbors () {return __get__ (this, function (self) { return len (self.indecies_of_atoms_connecting); });}, 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); } });}, 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'; } else { @@ -164,6 +172,29 @@ export var Atom = __class__ ('Atom', [object], { if (self.residue.strip () == '') { 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; });} }); diff --git a/javascript/lib/binana._structure.mol.js b/javascript/lib/binana._structure.mol.js index 2eea976..5def03e 100644 --- a/javascript/lib/binana._structure.mol.js +++ b/javascript/lib/binana._structure.mol.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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'; @@ -12,7 +12,7 @@ import * as shim from './binana._utils.shim.js'; import * as __module_binana__utils__ from './binana._utils.js'; __nest__ (binana, '_utils', __module_binana__utils__); 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 {Point} from './binana._structure.point.js'; import * as __module_math__ from './math.js'; @@ -21,6 +21,7 @@ import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); var __name__ = 'binana._structure.mol'; 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], { __module__: __name__, get __init__ () {return __get__ (this, function (self) { @@ -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.aromatic_rings = []; 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) { 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], { if (len (line) >= 7 && (line.__getslice__ (0, 4, 1) == 'ATOM' || line.__getslice__ (0, 6, 1) == 'HETATM')) { var temp_atom = Atom (); 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 (self.max_x < temp_atom.coordinates.x) { - self.max_x = temp_atom.coordinates.x; - } - if (self.max_y < temp_atom.coordinates.y) { - self.max_y = temp_atom.coordinates.y; - } - 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; - } + self.max_x = max (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); + self.min_x = min (self.min_x, temp_atom.coordinates.x); + self.min_y = min (self.min_y, temp_atom.coordinates.y); + self.min_z = min (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 (); 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.'); 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); self.all_atoms [autoindex] = temp_atom; if (!__in__ (temp_atom.residue.__getslice__ (-(3), null, 1), self.protein_resnames)) { self.non_protein_atoms [autoindex] = temp_atom; } - var autoindex = autoindex + 1; + autoindex++; } } } @@ -127,6 +120,10 @@ export var Mol = __class__ ('Mol', [object], { self.create_bonds_by_distance (); self.assign_aromatic_rings (); 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) { if (typeof min_x == 'undefined' || (min_x != null && min_x.hasOwnProperty ("__kwargtrans__"))) {; @@ -174,11 +171,13 @@ export var Mol = __class__ ('Mol', [object], { f.close (); });}, get save_pdb_string () {return __get__ (this, function (self) { - var to_output = ''; - for (var atom_index of self.all_atoms.py_keys ()) { - to_output += self.all_atoms [atom_index].create_pdb_line (atom_index) + '\n'; - } - return to_output; + return ''.join ((function () { + var __accu0__ = []; + for (var atom_index of self.all_atoms.py_keys ()) { + __accu0__.append (self.all_atoms [atom_index].create_pdb_line (atom_index) + '\n'); + } + return py_iter (__accu0__); + }) ()); });}, get add_new_atom () {return __get__ (this, function (self, atom) { var t = 1; @@ -200,7 +199,7 @@ export var Mol = __class__ ('Mol', [object], { 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 connected_atoms = []; for (var index2 of atom.indecies_of_atoms_connecting) { @@ -230,7 +229,7 @@ export var Mol = __class__ ('Mol', [object], { for (var atom_index of self.all_atoms.py_keys ()) { var atom = self.all_atoms [atom_index]; var key = (((atom.residue + '_') + str (atom.resid)) + '_') + atom.chain; - if (first === true) { + if (first) { var curr_res = key; var first = false; } @@ -244,181 +243,143 @@ export var Mol = __class__ ('Mol', [object], { } 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) { var temp = last_key.strip ().py_split ('_'); var resname = temp [0]; 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__ ('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.'); - print (''); + self.warn_bad_atom_name ('N', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('C', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CA', last_key); } - if (real_resname == 'GLU' || real_resname == 'GLH' || real_resname == 'GLX') { + if (__in__ (real_resname, ['GLU', 'GLH', 'GLX'])) { 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.'); - print (''); + self.warn_bad_atom_name ('OE1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('OE2', last_key); } } - if (real_resname == 'ASP' || real_resname == 'ASH' || real_resname == 'ASX') { + if (__in__ (real_resname, ['ASP', 'ASH', 'ASX'])) { 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.'); - print (''); + self.warn_bad_atom_name ('OD1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('OD2', last_key); } } - if (real_resname == 'LYS' || real_resname == 'LYN') { - if (!__in__ ('NZ', residue)) { - 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 (__in__ (real_resname, ['LYS', 'LYN']) && !__in__ ('NZ', residue)) { + self.warn_bad_atom_name ('NZ', last_key); } if (real_resname == 'ARG') { 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.'); - print (''); + self.warn_bad_atom_name ('NH1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('NH2', last_key); } } - 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)) { - 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.'); - print (''); + self.warn_bad_atom_name ('NE2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('ND1', last_key); } } if (real_resname == 'PHE') { 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.'); - print (''); + self.warn_bad_atom_name ('CG', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CZ', last_key); } } if (real_resname == 'TYR') { 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.'); - print (''); + self.warn_bad_atom_name ('CG', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CZ', last_key); } } if (real_resname == 'TRP') { 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.'); - print (''); + self.warn_bad_atom_name ('CG', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD2', last_key); } if (!__in__ ('NE1', residue)) { - self.printout (('Warning: There is no atom named "NE1" 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.'); - print (''); + self.warn_bad_atom_name ('NE1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE2', last_key); } if (!__in__ ('CE3', residue)) { - self.printout (('Warning: There is no atom named "CE3" 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.'); - print (''); + self.warn_bad_atom_name ('CE3', last_key); } if (!__in__ ('CZ2', residue)) { - self.printout (('Warning: There is no atom named "CZ2" 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.'); - print (''); + self.warn_bad_atom_name ('CZ2', last_key); } if (!__in__ ('CZ3', residue)) { - self.printout (('Warning: There is no atom named "CZ3" 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.'); - print (''); + self.warn_bad_atom_name ('CZ3', last_key); } if (!__in__ ('CH2', residue)) { - self.printout (('Warning: There is no atom named "CH2" 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.'); - print (''); + self.warn_bad_atom_name ('CH2', last_key); } } - if (real_resname == 'HIS' || real_resname == 'HID' || real_resname == 'HIE' || real_resname == 'HIP') { + if (__in__ (real_resname, ['HIS', 'HID', 'HIE', 'HIP'])) { 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.'); - print (''); + self.warn_bad_atom_name ('CG', last_key); } 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-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); - print (''); + self.warn_bad_atom_name ('ND1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE1', last_key); } 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-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); - print (''); + self.warn_bad_atom_name ('NE2', last_key); } } } @@ -430,7 +391,7 @@ export var Mol = __class__ ('Mol', [object], { for (var atom_index2 of self.non_protein_atoms.py_keys ()) { if (atom_index1 != atom_index2) { var atom2 = self.non_protein_atoms [atom_index2]; - if (!(__in__ (atom2.residue.__getslice__ (-(3), null, 1), self.protein_resnames))) { + if (!__in__ (atom2.residue.__getslice__ (-(3), null, 1), self.protein_resnames)) { var dist = distance (atom1.coordinates, atom2.coordinates); if (dist < self.bond_length (atom1.element, atom2.element) * 1.2) { atom1.add_neighbor_atom_index (atom_index2); @@ -442,251 +403,259 @@ export var Mol = __class__ ('Mol', [object], { } } });}, + get update_distance () {return __get__ (this, function (self, element1, element2, orig_distance, match) { + var __left0__ = match; + var match_element1 = __left0__ [0]; + var match_element2 = __left0__ [1]; + var match_dist = __left0__ [2]; + if (element1 == match_element1 && element2 == match_element2) { + return match_dist; + } + if (element1 == match_element2 && element2 == match_element1) { + return match_dist; + } + return orig_distance; + });}, get bond_length () {return __get__ (this, function (self, element1, element2) { var distance = 0.0; - if (element1 == 'C' && element2 == 'C') { - var distance = 1.53; - } - if (element1 == 'N' && element2 == 'N') { - var distance = 1.425; - } - if (element1 == 'O' && element2 == 'O') { - var distance = 1.469; - } - if (element1 == 'S' && element2 == 'S') { - var distance = 2.048; - } - if (element1 == 'C' && element2 == 'H' || element1 == 'H' && element2 == 'C') { - var distance = 1.059; - } - if (element1 == 'C' && element2 == 'N' || element1 == 'N' && element2 == 'C') { - var distance = 1.469; - } - if (element1 == 'C' && element2 == 'O' || element1 == 'O' && element2 == 'C') { - var distance = 1.413; - } - if (element1 == 'C' && element2 == 'S' || element1 == 'S' && element2 == 'C') { - var distance = 1.819; - } - if (element1 == 'N' && element2 == 'H' || element1 == 'H' && element2 == 'N') { - var distance = 1.009; - } - if (element1 == 'N' && element2 == 'O' || element1 == 'O' && element2 == 'N') { - var distance = 1.463; - } - if (element1 == 'O' && element2 == 'S' || element1 == 'S' && element2 == 'O') { - var distance = 1.577; - } - if (element1 == 'O' && element2 == 'H' || element1 == 'H' && element2 == 'O') { - var distance = 0.967; - } - if (element1 == 'S' && element2 == 'H' || element1 == 'H' && element2 == 'S') { - var distance = 2.025 / 1.5; - } - if (element1 == 'S' && element2 == 'N' || element1 == 'H' && element2 == 'N') { - var distance = 1.633; - } - if (element1 == 'C' && element2 == 'F' || element1 == 'F' && element2 == 'C') { - var distance = 1.399; - } - if (element1 == 'C' && element2 == 'CL' || element1 == 'CL' && element2 == 'C') { - var distance = 1.79; - } - if (element1 == 'C' && element2 == 'BR' || element1 == 'BR' && element2 == 'C') { - var distance = 1.91; - } - if (element1 == 'C' && element2 == 'I' || element1 == 'I' && element2 == 'C') { - var distance = 2.162; - } - if (element1 == 'S' && element2 == 'BR' || element1 == 'BR' && element2 == 'S') { - var distance = 2.321; - } - if (element1 == 'S' && element2 == 'CL' || element1 == 'CL' && element2 == 'S') { - var distance = 2.283; - } - if (element1 == 'S' && element2 == 'F' || element1 == 'F' && element2 == 'S') { - var distance = 1.64; - } - if (element1 == 'S' && element2 == 'I' || element1 == 'I' && element2 == 'S') { - var distance = 2.687; - } - if (element1 == 'P' && element2 == 'BR' || element1 == 'BR' && element2 == 'P') { - var distance = 2.366; + var distance = self.update_distance (element1, element2, distance, ['C', 'C', 1.53]); + var distance = self.update_distance (element1, element2, distance, ['N', 'N', 1.425]); + var distance = self.update_distance (element1, element2, distance, ['O', 'O', 1.469]); + var distance = self.update_distance (element1, element2, distance, ['S', 'S', 2.048]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'SI', 2.359]); + var distance = self.update_distance (element1, element2, distance, ['C', 'H', 1.059]); + var distance = self.update_distance (element1, element2, distance, ['C', 'N', 1.469]); + var distance = self.update_distance (element1, element2, distance, ['C', 'O', 1.413]); + var distance = self.update_distance (element1, element2, distance, ['C', 'S', 1.819]); + var distance = self.update_distance (element1, element2, distance, ['N', 'H', 1.009]); + var distance = self.update_distance (element1, element2, distance, ['N', 'O', 1.463]); + var distance = self.update_distance (element1, element2, distance, ['O', 'S', 1.577]); + var distance = self.update_distance (element1, element2, distance, ['O', 'H', 0.967]); + var distance = self.update_distance (element1, element2, distance, ['S', 'H', 2.025 / 1.5]); + var distance = self.update_distance (element1, element2, distance, ['S', 'N', 1.633]); + var distance = self.update_distance (element1, element2, distance, ['C', 'F', 1.399]); + var distance = self.update_distance (element1, element2, distance, ['C', 'CL', 1.79]); + var distance = self.update_distance (element1, element2, distance, ['C', 'BR', 1.91]); + var distance = self.update_distance (element1, element2, distance, ['C', 'I', 2.162]); + var distance = self.update_distance (element1, element2, distance, ['S', 'BR', 2.321]); + var distance = self.update_distance (element1, element2, distance, ['S', 'CL', 2.283]); + var distance = self.update_distance (element1, element2, distance, ['S', 'F', 1.64]); + var distance = self.update_distance (element1, element2, distance, ['S', 'I', 2.687]); + var distance = self.update_distance (element1, element2, distance, ['P', 'BR', 2.366]); + var distance = self.update_distance (element1, element2, distance, ['P', 'CL', 2.008]); + var distance = self.update_distance (element1, element2, distance, ['P', 'F', 1.495]); + var distance = self.update_distance (element1, element2, distance, ['P', 'I', 2.49]); + var distance = self.update_distance (element1, element2, distance, ['P', 'O', 1.6]); + var distance = self.update_distance (element1, element2, distance, ['N', 'BR', 1.843]); + var distance = self.update_distance (element1, element2, distance, ['N', 'CL', 1.743]); + var distance = self.update_distance (element1, element2, distance, ['N', 'F', 1.406]); + var distance = self.update_distance (element1, element2, distance, ['N', 'I', 2.2]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'BR', 2.284]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'CL', 2.072]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'F', 1.636]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'P', 2.264]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'S', 2.145]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'C', 1.888]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'N', 1.743]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'O', 1.631]); + return distance; + });}, + get _categorize_donor_acceptor_with_hydrogens () {return __get__ (this, function (self, atom, hydrogen_bond) { + if (typeof hydrogen_bond == 'undefined' || (hydrogen_bond != null && hydrogen_bond.hasOwnProperty ("__kwargtrans__"))) {; + var hydrogen_bond = true; + }; + var central_atom_names = (hydrogen_bond ? ['H'] : ['I', 'BR', 'Br', 'CL', 'Cl', 'F']); + var h_or_hals = []; + for (var atm_index of self.all_atoms.py_keys ()) { + var central_atom = self.all_atoms [atm_index]; + var element = central_atom.element; + if (__in__ (element, central_atom_names)) { + var dist = central_atom.coordinates.dist_to (atom.coordinates); + if (dist < _max_donor_X_dist [element]) { + h_or_hals.append (central_atom); + } + } } - if (element1 == 'P' && element2 == 'CL' || element1 == 'CL' && element2 == 'P') { - var distance = 2.008; + var charaterizations = [['ACCEPTOR', null]]; + for (var h_or_hal of h_or_hals) { + charaterizations.append (['DONOR', h_or_hal]); } - if (element1 == 'P' && element2 == 'F' || element1 == 'F' && element2 == 'P') { - var distance = 1.495; + return charaterizations; + });}, + get _categorize_donor_acceptor_without_hydrogens () {return __get__ (this, function (self, atom) { + var charaterizations = []; + var num_neighbors = atom.number_of_neighbors (); + if (atom.element == 'O') { + charaterizations.append (['ACCEPTOR', null]); + if (num_neighbors == 1) { + var neighbor_idx = atom.indecies_of_atoms_connecting [0]; + var neighbor = self.all_atoms [neighbor_idx]; + var neighbor_is_sp3 = neighbor.has_sp3_geometry (self); + if (neighbor.element == 'C' && neighbor_is_sp3) { + charaterizations.append (['DONOR', atom]); + } + } } - if (element1 == 'P' && element2 == 'I' || element1 == 'I' && element2 == 'P') { - var distance = 2.49; + else if (atom.element == 'N') { + charaterizations.append (['ACCEPTOR', null]); + var num_neighbors = len (atom.indecies_of_atoms_connecting); + var is_sp3 = (num_neighbors > 1 ? atom.has_sp3_geometry (self) : true); + if (is_sp3 && num_neighbors < 4 || !(is_sp3) && num_neighbors < 3) { + charaterizations.append (['DONOR', atom]); + } } - if (element1 == 'P' && element2 == 'O' || element1 == 'O' && element2 == 'P') { - var distance = 1.6; + return charaterizations; + });}, + get is_hbond_donor_acceptor () {return __get__ (this, function (self, atom, hydrogen_bond) { + if (typeof hydrogen_bond == 'undefined' || (hydrogen_bond != null && hydrogen_bond.hasOwnProperty ("__kwargtrans__"))) {; + var hydrogen_bond = true; + }; + if (!(hydrogen_bond) || self.has_hydrogens) { + return self._categorize_donor_acceptor_with_hydrogens (atom, hydrogen_bond); } - if (element1 == 'N' && element2 == 'BR' || element1 == 'BR' && element2 == 'N') { - var distance = 1.843; + else { + return self._categorize_donor_acceptor_without_hydrogens (atom); } - if (element1 == 'N' && element2 == 'CL' || element1 == 'CL' && element2 == 'N') { - var distance = 1.743; + });}, + get charges_metals () {return __get__ (this, function (self, atom_index, atom) { + if (__in__ (atom.element, ['MG', 'MN', 'RH', 'ZN', 'FE', 'BI', 'AS', 'AG'])) { + var chrg = self.Charged (atom.coordinates, [atom_index], true); + self.charges.append (chrg); } - if (element1 == 'N' && element2 == 'F' || element1 == 'F' && element2 == 'N') { - var distance = 1.406; + });}, + get charges_arginine_like () {return __get__ (this, function (self, atom_index, atom) { + if (atom.element != 'C' || atom.number_of_neighbors () != 3) { + return ; } - if (element1 == 'N' && element2 == 'I' || element1 == 'I' && element2 == 'N') { - var distance = 2.2; + var nitrogens = self.connected_atoms_of_element (atom_index, 'N'); + if (len (nitrogens) >= 2) { + var nitros_to_use = []; + var no_term_nitros = atom.indecies_of_atoms_connecting.__getslice__ (0, null, 1); + for (var atmindex of nitrogens) { + if (len (self.connected_heavy_atoms (atmindex)) == 1) { + nitros_to_use.append (atmindex); + no_term_nitros.remove (atmindex); + } + } + var no_term_nitro_idx = (len (no_term_nitros) > 0 ? no_term_nitros [0] : -(1)); + if (len (nitros_to_use) == 2 && no_term_nitro_idx != -(1)) { + var no_term_atm = self.all_atoms [no_term_nitro_idx]; + var no_term_elem = no_term_atm.element; + var no_term_neigh = no_term_atm.number_of_neighbors (); + if (!(self.has_hydrogens) || (no_term_elem == 'C' && no_term_neigh == 4 || no_term_elem == 'O' && no_term_neigh == 2 || __in__ (no_term_elem, ['N', 'S', 'P']))) { + var pt = self.all_atoms [nitros_to_use [0]].coordinates.copy_of (); + var coor_to_use2 = self.all_atoms [nitros_to_use [1]].coordinates; + pt.x = pt.x + coor_to_use2.x; + pt.y = pt.y + coor_to_use2.y; + pt.z = pt.z + coor_to_use2.z; + pt.x = pt.x / 2.0; + pt.y = pt.y / 2.0; + pt.z = pt.z / 2.0; + var indexes = [atom_index]; + indexes.extend (nitros_to_use); + indexes.extend (self.connected_atoms_of_element (nitros_to_use [0], 'H')); + indexes.extend (self.connected_atoms_of_element (nitros_to_use [1], 'H')); + var chrg = self.Charged (pt, indexes, true); + self.charges.append (chrg); + } + } } - if (element1 == 'SI' && element2 == 'BR' || element1 == 'BR' && element2 == 'SI') { - var distance = 2.284; + });}, + get charges_amines () {return __get__ (this, function (self, atom_index, atom) { + if (atom.element != 'N') { + return ; } - if (element1 == 'SI' && element2 == 'CL' || element1 == 'CL' && element2 == 'SI') { - var distance = 2.072; + var num_neighors = atom.number_of_neighbors (); + if (num_neighors == 4) { + var indexes = [atom_index]; + indexes.extend (atom.indecies_of_atoms_connecting); + var chrg = self.Charged (atom.coordinates, indexes, true); + self.charges.append (chrg); + } + if (self.has_hydrogens) { + if (num_neighors == 3 && atom.has_sp3_geometry (self)) { + var indexes = [atom_index]; + indexes.extend (atom.indecies_of_atoms_connecting); + var chrg = self.Charged (atom.coordinates, indexes, true); + self.charges.append (chrg); + } } - if (element1 == 'SI' && element2 == 'F' || element1 == 'F' && element2 == 'SI') { - var distance = 1.636; + else if (num_neighors == 1 || atom.has_sp3_geometry (self)) { + var chrg = self.Charged (atom.coordinates, [atom_index], true); + self.charges.append (chrg); } - if (element1 == 'SI' && element2 == 'P' || element1 == 'P' && element2 == 'SI') { - var distance = 2.264; + });}, + get charges_carboxylate () {return __get__ (this, function (self, atom_index, atom) { + if (atom.element != 'C') { + return ; } - if (element1 == 'SI' && element2 == 'S' || element1 == 'S' && element2 == 'SI') { - var distance = 2.145; + if (atom.number_of_neighbors () == 3) { + var oxygens = self.connected_atoms_of_element (atom_index, 'O'); + if (len (oxygens) == 2 && (len (self.connected_heavy_atoms (oxygens [0])) == 1 && len (self.connected_heavy_atoms (oxygens [1])) == 1)) { + var pt = self.all_atoms [oxygens [0]].coordinates.copy_of (); + var pt2 = self.all_atoms [oxygens [1]].coordinates; + pt.x = pt.x + pt2.x; + pt.y = pt.y + pt2.y; + pt.z = pt.z + pt2.z; + pt.x = pt.x / 2.0; + pt.y = pt.y / 2.0; + pt.z = pt.z / 2.0; + var chrg = self.Charged (pt, [oxygens [0], atom_index, oxygens [1]], false); + self.charges.append (chrg); + } } - if (element1 == 'SI' && element2 == 'SI' || element1 == 'SI' && element2 == 'SI') { - var distance = 2.359; + });}, + get charges_phosphrous_compounds () {return __get__ (this, function (self, atom_index, atom) { + if (atom.element != 'P') { + return ; } - if (element1 == 'SI' && element2 == 'C' || element1 == 'C' && element2 == 'SI') { - var distance = 1.888; + var oxygens = self.connected_atoms_of_element (atom_index, 'O'); + if (len (oxygens) >= 2) { + var count = sum ((function () { + var __accu0__ = []; + for (var oxygen_index of oxygens) { + __accu0__.append (len (self.connected_heavy_atoms (oxygen_index)) == 1); + } + return py_iter (__accu0__); + }) ()); + if (count >= 2) { + var indexes = [atom_index]; + indexes.extend (oxygens); + var chrg = self.Charged (atom.coordinates, indexes, false); + self.charges.append (chrg); + } } - if (element1 == 'SI' && element2 == 'N' || element1 == 'N' && element2 == 'SI') { - var distance = 1.743; + });}, + get charges_sulfur_compounds () {return __get__ (this, function (self, atom_index, atom) { + if (atom.element != 'S') { + return ; } - if (element1 == 'SI' && element2 == 'O' || element1 == 'O' && element2 == 'SI') { - var distance = 1.631; + var oxygens = self.connected_atoms_of_element (atom_index, 'O'); + if (len (oxygens) >= 3) { + var count = sum ((function () { + var __accu0__ = []; + for (var oxygen_index of oxygens) { + __accu0__.append (len (self.connected_heavy_atoms (oxygen_index)) == 1); + } + return py_iter (__accu0__); + }) ()); + if (count >= 3) { + var indexes = [atom_index]; + indexes.extend (oxygens); + var chrg = self.Charged (atom.coordinates, indexes, false); + self.charges.append (chrg); + } } - return distance; });}, get assign_charges () {return __get__ (this, function (self) { - var all_charged = []; for (var atom_index of self.non_protein_atoms.py_keys ()) { var atom = self.non_protein_atoms [atom_index]; - if (atom.element == 'MG' || atom.element == 'MN' || atom.element == 'RH' || atom.element == 'ZN' || atom.element == 'FE' || atom.element == 'BI' || atom.element == 'AS' || atom.element == 'AG') { - var chrg = self.Charged (atom.coordinates, [atom_index], true); - self.charges.append (chrg); - } - if (atom.element == 'N') { - if (atom.number_of_neighbors () == 4) { - var indexes = [atom_index]; - indexes.extend (atom.indecies_of_atoms_connecting); - var chrg = self.Charged (atom.coordinates, indexes, true); - self.charges.append (chrg); - } - else if (atom.number_of_neighbors () == 3) { - var nitrogen = atom; - var atom1 = self.all_atoms [atom.indecies_of_atoms_connecting [0]]; - var atom2 = self.all_atoms [atom.indecies_of_atoms_connecting [1]]; - var atom3 = self.all_atoms [atom.indecies_of_atoms_connecting [2]]; - var angle1 = (angle_between_three_points (atom1.coordinates, nitrogen.coordinates, atom2.coordinates) * 180.0) / math.pi; - var angle2 = (angle_between_three_points (atom1.coordinates, nitrogen.coordinates, atom3.coordinates) * 180.0) / math.pi; - var angle3 = (angle_between_three_points (atom2.coordinates, nitrogen.coordinates, atom3.coordinates) * 180.0) / math.pi; - var average_angle = ((angle1 + angle2) + angle3) / 3; - if (fabs (average_angle - 109.0) < 5.0) { - var indexes = [atom_index]; - indexes.extend (atom.indecies_of_atoms_connecting); - var chrg = self.Charged (nitrogen.coordinates, indexes, true); - self.charges.append (chrg); - } - } - } - if (atom.element == 'C') { - if (atom.number_of_neighbors () == 3) { - var nitrogens = self.connected_atoms_of_given_element (atom_index, 'N'); - if (len (nitrogens) >= 2) { - var nitrogens_to_use = []; - var all_connected = atom.indecies_of_atoms_connecting.__getslice__ (0, null, 1); - var not_isolated = -(1); - for (var atmindex of nitrogens) { - if (len (self.connected_heavy_atoms (atmindex)) == 1) { - nitrogens_to_use.append (atmindex); - all_connected.remove (atmindex); - } - } - if (len (all_connected) > 0) { - var not_isolated = all_connected [0]; - } - if (len (nitrogens_to_use) == 2 && not_isolated != -(1)) { - var not_isolated_atom = self.all_atoms [not_isolated]; - if (not_isolated_atom.element == 'C' && not_isolated_atom.number_of_neighbors () == 4 || not_isolated_atom.element == 'O' && not_isolated_atom.number_of_neighbors () == 2 || not_isolated_atom.element == 'N' || not_isolated_atom.element == 'S' || not_isolated_atom.element == 'P') { - var pt = self.all_atoms [nitrogens_to_use [0]].coordinates.copy_of (); - pt.x = pt.x + self.all_atoms [nitrogens_to_use [1]].coordinates.x; - pt.y = pt.y + self.all_atoms [nitrogens_to_use [1]].coordinates.y; - pt.z = pt.z + self.all_atoms [nitrogens_to_use [1]].coordinates.z; - pt.x = pt.x / 2.0; - pt.y = pt.y / 2.0; - pt.z = pt.z / 2.0; - var indexes = [atom_index]; - indexes.extend (nitrogens_to_use); - indexes.extend (self.connected_atoms_of_given_element (nitrogens_to_use [0], 'H')); - indexes.extend (self.connected_atoms_of_given_element (nitrogens_to_use [1], 'H')); - var chrg = self.Charged (pt, indexes, true); - self.charges.append (chrg); - } - } - } - } - } - if (atom.element == 'C') { - if (atom.number_of_neighbors () == 3) { - var oxygens = self.connected_atoms_of_given_element (atom_index, 'O'); - if (len (oxygens) == 2) { - if (len (self.connected_heavy_atoms (oxygens [0])) == 1 && len (self.connected_heavy_atoms (oxygens [1])) == 1) { - var pt = self.all_atoms [oxygens [0]].coordinates.copy_of (); - pt.x = pt.x + self.all_atoms [oxygens [1]].coordinates.x; - pt.y = pt.y + self.all_atoms [oxygens [1]].coordinates.y; - pt.z = pt.z + self.all_atoms [oxygens [1]].coordinates.z; - pt.x = pt.x / 2.0; - pt.y = pt.y / 2.0; - pt.z = pt.z / 2.0; - var chrg = self.Charged (pt, [oxygens [0], atom_index, oxygens [1]], false); - self.charges.append (chrg); - } - } - } - } - if (atom.element == 'P') { - var oxygens = self.connected_atoms_of_given_element (atom_index, 'O'); - if (len (oxygens) >= 2) { - var count = 0; - for (var oxygen_index of oxygens) { - if (len (self.connected_heavy_atoms (oxygen_index)) == 1) { - var count = count + 1; - } - } - if (count >= 2) { - var indexes = [atom_index]; - indexes.extend (oxygens); - var chrg = self.Charged (atom.coordinates, indexes, false); - self.charges.append (chrg); - } - } - } - if (atom.element == 'S') { - var oxygens = self.connected_atoms_of_given_element (atom_index, 'O'); - if (len (oxygens) >= 3) { - var count = 0; - for (var oxygen_index of oxygens) { - if (len (self.connected_heavy_atoms (oxygen_index)) == 1) { - var count = count + 1; - } - } - if (count >= 3) { - var indexes = [atom_index]; - indexes.extend (oxygens); - var chrg = self.Charged (atom.coordinates, indexes, false); - self.charges.append (chrg); - } - } - } + self.charges_metals (atom_index, atom); + self.charges_arginine_like (atom_index, atom); + self.charges_amines (atom_index, atom); + self.charges_carboxylate (atom_index, atom); + self.charges_phosphrous_compounds (atom_index, atom); + self.charges_sulfur_compounds (atom_index, atom); } var curr_res = ''; var first = true; @@ -695,40 +664,32 @@ export var Mol = __class__ ('Mol', [object], { for (var atom_index of self.all_atoms.py_keys ()) { var atom = self.all_atoms [atom_index]; var key = (((atom.residue + '_') + str (atom.resid)) + '_') + atom.chain; - if (first == true) { + if (first) { var curr_res = key; var first = false; } if (key != curr_res) { - self.assign_charged_from_protein_process_residue (residue, last_key); + self.assign_charged_from_protein_residue (residue, last_key); var residue = []; var curr_res = key; } residue.append (atom_index); var last_key = key; } - self.assign_charged_from_protein_process_residue (residue, last_key); + self.assign_charged_from_protein_residue (residue, last_key); });}, - get assign_charged_from_protein_process_residue () {return __get__ (this, function (self, residue, last_key) { + get assign_charged_from_protein_residue () {return __get__ (this, function (self, residue, last_key) { var temp = last_key.strip ().py_split ('_'); var resname = temp [0]; var real_resname = resname.__getslice__ (-(3), null, 1); - var resid = temp [1]; - var chain = temp [2]; - if (real_resname == 'LYS' || real_resname == 'LYN') { + if (__in__ (real_resname, ['LYS', 'LYN'])) { for (var index of residue) { var atom = self.all_atoms [index]; if (atom.atom_name.strip () == 'NZ') { var indexes = [index]; for (var index2 of residue) { var atom2 = self.all_atoms [index2]; - if (atom2.atom_name.strip () == 'HZ1') { - indexes.append (index2); - } - if (atom2.atom_name.strip () == 'HZ2') { - indexes.append (index2); - } - if (atom2.atom_name.strip () == 'HZ3') { + if (__in__ (atom2.atom_name.strip (), ['HZ1', 'HZ2', 'HZ3'])) { indexes.append (index2); } } @@ -744,33 +705,15 @@ export var Mol = __class__ ('Mol', [object], { var indices = []; for (var index of residue) { var atom = self.all_atoms [index]; - if (atom.atom_name.strip () == 'NH1') { + var atm_name = atom.atom_name.strip (); + if (__in__ (atm_name, ['NH1', 'NH2'])) { charge_pt.x = charge_pt.x + atom.coordinates.x; charge_pt.y = charge_pt.y + atom.coordinates.y; charge_pt.z = charge_pt.z + atom.coordinates.z; indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == 'NH2') { - charge_pt.x = charge_pt.x + atom.coordinates.x; - charge_pt.y = charge_pt.y + atom.coordinates.y; - charge_pt.z = charge_pt.z + atom.coordinates.z; - indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == '2HH2') { - indices.append (index); - } - if (atom.atom_name.strip () == '1HH2') { - indices.append (index); - } - if (atom.atom_name.strip () == 'CZ') { - indices.append (index); - } - if (atom.atom_name.strip () == '2HH1') { - indices.append (index); + count++; } - if (atom.atom_name.strip () == '1HH1') { + if (__in__ (atm_name, ['2HH2', '1HH2', 'CZ', '2HH1', '1HH1'])) { indices.append (index); } } @@ -790,33 +733,15 @@ export var Mol = __class__ ('Mol', [object], { var indices = []; for (var index of residue) { var atom = self.all_atoms [index]; - if (atom.atom_name.strip () == 'NE2') { + var atm_name = atom.atom_name.strip (); + if (__in__ (atm_name, ['NE2', 'ND1'])) { charge_pt.x = charge_pt.x + atom.coordinates.x; charge_pt.y = charge_pt.y + atom.coordinates.y; charge_pt.z = charge_pt.z + atom.coordinates.z; indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == 'ND1') { - charge_pt.x = charge_pt.x + atom.coordinates.x; - charge_pt.y = charge_pt.y + atom.coordinates.y; - charge_pt.z = charge_pt.z + atom.coordinates.z; - indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == 'HE2') { - indices.append (index); - } - if (atom.atom_name.strip () == 'HD1') { - indices.append (index); + count++; } - if (atom.atom_name.strip () == 'CE1') { - indices.append (index); - } - if (atom.atom_name.strip () == 'CD2') { - indices.append (index); - } - if (atom.atom_name.strip () == 'CG') { + if (__in__ (atm_name, ['HE2', 'HD1', 'CE1', 'CD2', 'CG'])) { indices.append (index); } } @@ -836,21 +761,15 @@ export var Mol = __class__ ('Mol', [object], { var indices = []; for (var index of residue) { var atom = self.all_atoms [index]; - if (atom.atom_name.strip () == 'OE1') { + var atm_name = atom.atom_name.strip (); + if (__in__ (atm_name, ['OE1', 'OE2'])) { charge_pt.x = charge_pt.x + atom.coordinates.x; charge_pt.y = charge_pt.y + atom.coordinates.y; charge_pt.z = charge_pt.z + atom.coordinates.z; indices.append (index); - var count = count + 1.0; + count++; } - if (atom.atom_name.strip () == 'OE2') { - charge_pt.x = charge_pt.x + atom.coordinates.x; - charge_pt.y = charge_pt.y + atom.coordinates.y; - charge_pt.z = charge_pt.z + atom.coordinates.z; - indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == 'CD') { + if (atm_name == 'CD') { indices.append (index); } } @@ -870,21 +789,15 @@ export var Mol = __class__ ('Mol', [object], { var indices = []; for (var index of residue) { var atom = self.all_atoms [index]; - if (atom.atom_name.strip () == 'OD1') { + var atm_name = atom.atom_name.strip (); + if (__in__ (atm_name, ['OD1', 'OD2'])) { charge_pt.x = charge_pt.x + atom.coordinates.x; charge_pt.y = charge_pt.y + atom.coordinates.y; charge_pt.z = charge_pt.z + atom.coordinates.z; indices.append (index); - var count = count + 1.0; + count++; } - if (atom.atom_name.strip () == 'OD2') { - charge_pt.x = charge_pt.x + atom.coordinates.x; - charge_pt.y = charge_pt.y + atom.coordinates.y; - charge_pt.z = charge_pt.z + atom.coordinates.z; - indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == 'CG') { + if (atm_name == 'CG') { indices.append (index); } } @@ -1066,8 +979,6 @@ export var Mol = __class__ ('Mol', [object], { var temp = last_key.strip ().py_split ('_'); var resname = temp [0]; var real_resname = resname.__getslice__ (-(3), null, 1); - var resid = temp [1]; - var chain = temp [2]; if (real_resname == 'PHE') { var indicies_of_ring = []; for (var index of residue) { @@ -1148,7 +1059,7 @@ export var Mol = __class__ ('Mol', [object], { } self.add_aromatic_marker (indicies_of_ring); } - if (real_resname == 'HIS' || real_resname == 'HID' || real_resname == 'HIE' || real_resname == 'HIP') { + if (__in__ (real_resname, ['HIS', 'HID', 'HIE', 'HIP'])) { var indicies_of_ring = []; for (var index of residue) { var atom = self.all_atoms [index]; @@ -1319,35 +1230,35 @@ export var Mol = __class__ ('Mol', [object], { var resid2 = atoms [7].resid; for (var atom of atoms) { if (atom.resid == resid1 && atom.atom_name.strip () == 'N') { - var first_N = atom; + var first_n = atom; } if (atom.resid == resid1 && atom.atom_name.strip () == 'C') { - var first_C = atom; + var first_c = atom; } if (atom.resid == resid1 && atom.atom_name.strip () == 'CA') { - var first_CA = atom; + var first_ca = atom; } if (atom.resid == resid2 && atom.atom_name.strip () == 'N') { - var second_N = atom; + var second_n = atom; } if (atom.resid == resid2 && atom.atom_name.strip () == 'C') { - var second_C = atom; + var second_c = atom; } if (atom.resid == resid2 && atom.atom_name.strip () == 'CA') { - var second_CA = atom; + var second_ca = atom; } } - var phi = (dihedral (first_C.coordinates, second_N.coordinates, second_CA.coordinates, second_C.coordinates) * 180.0) / math.pi; - var psi = (dihedral (first_N.coordinates, first_CA.coordinates, first_C.coordinates, second_N.coordinates) * 180.0) / math.pi; + var phi = (dihedral (first_c.coordinates, second_n.coordinates, second_ca.coordinates, second_c.coordinates) * 180.0) / math.pi; + var psi = (dihedral (first_n.coordinates, first_ca.coordinates, first_c.coordinates, second_n.coordinates) * 180.0) / math.pi; if (phi > -(145) && phi < -(35) && psi > -(70) && psi < 50) { - var key1 = (str (first_C.resid) + '_') + first_C.chain; - var key2 = (str (second_C.resid) + '_') + second_C.chain; + var key1 = (str (first_c.resid) + '_') + first_c.chain; + var key2 = (str (second_c.resid) + '_') + second_c.chain; structure [key1] = 'ALPHA'; structure [key2] = 'ALPHA'; } if (phi >= -(180) && phi < -(40) && psi <= 180 && psi > 90 || phi >= -(180) && phi < -(70) && psi <= -(165)) { - var key1 = (str (first_C.resid) + '_') + first_C.chain; - var key2 = (str (second_C.resid) + '_') + second_C.chain; + var key1 = (str (first_c.resid) + '_') + first_c.chain; + var key2 = (str (second_c.resid) + '_') + second_c.chain; structure [key1] = 'BETA'; structure [key2] = 'BETA'; } @@ -1360,21 +1271,21 @@ export var Mol = __class__ ('Mol', [object], { var key = (str (atom.resid) + '_') + atom.chain; atom.structure = structure [key]; } - var CA_list = []; + var ca_list = []; for (var atom_index of self.all_atoms.py_keys ()) { var atom = self.all_atoms [atom_index]; if (__in__ (atom.residue.strip (), self.protein_resnames) && atom.atom_name.strip () == 'CA') { - CA_list.append (atom_index); + ca_list.append (atom_index); } } var change = true; while (change == true) { var change = false; - for (var CA_atom_index of CA_list) { + for (var CA_atom_index of ca_list) { var CA_atom = self.all_atoms [CA_atom_index]; if (CA_atom.structure == 'ALPHA') { var another_alpha_is_close = false; - for (var other_CA_atom_index of CA_list) { + for (var other_CA_atom_index of ca_list) { var other_CA_atom = self.all_atoms [other_CA_atom_index]; if (other_CA_atom.structure == 'ALPHA') { if (other_CA_atom.resid - 3 == CA_atom.resid || other_CA_atom.resid + 3 == CA_atom.resid) { @@ -1391,13 +1302,13 @@ export var Mol = __class__ ('Mol', [object], { } } } - for (var index_in_list = 0; index_in_list < len (CA_list) - 5; index_in_list++) { - var index_in_pdb1 = CA_list [index_in_list]; - var index_in_pdb2 = CA_list [index_in_list + 1]; - var index_in_pdb3 = CA_list [index_in_list + 2]; - var index_in_pdb4 = CA_list [index_in_list + 3]; - var index_in_pdb5 = CA_list [index_in_list + 4]; - var index_in_pdb6 = CA_list [index_in_list + 5]; + for (var index_in_list = 0; index_in_list < len (ca_list) - 5; index_in_list++) { + var index_in_pdb1 = ca_list [index_in_list]; + var index_in_pdb2 = ca_list [index_in_list + 1]; + var index_in_pdb3 = ca_list [index_in_list + 2]; + var index_in_pdb4 = ca_list [index_in_list + 3]; + var index_in_pdb5 = ca_list [index_in_list + 4]; + var index_in_pdb6 = ca_list [index_in_list + 5]; var atom1 = self.all_atoms [index_in_pdb1]; var atom2 = self.all_atoms [index_in_pdb2]; var atom3 = self.all_atoms [index_in_pdb3]; @@ -1457,11 +1368,11 @@ export var Mol = __class__ ('Mol', [object], { } } } - for (var CA_atom_index of CA_list) { + for (var CA_atom_index of ca_list) { var CA_atom = self.all_atoms [CA_atom_index]; if (CA_atom.structure == 'BETA') { var another_beta_is_close = false; - for (var other_CA_atom_index of CA_list) { + for (var other_CA_atom_index of ca_list) { if (other_CA_atom_index != CA_atom_index) { var other_CA_atom = self.all_atoms [other_CA_atom_index]; if (other_CA_atom.structure == 'BETA') { @@ -1482,11 +1393,11 @@ export var Mol = __class__ ('Mol', [object], { } } } - for (var index_in_list = 0; index_in_list < len (CA_list) - 3; index_in_list++) { - var index_in_pdb1 = CA_list [index_in_list]; - var index_in_pdb2 = CA_list [index_in_list + 1]; - var index_in_pdb3 = CA_list [index_in_list + 2]; - var index_in_pdb4 = CA_list [index_in_list + 3]; + for (var index_in_list = 0; index_in_list < len (ca_list) - 3; index_in_list++) { + var index_in_pdb1 = ca_list [index_in_list]; + var index_in_pdb2 = ca_list [index_in_list + 1]; + var index_in_pdb3 = ca_list [index_in_list + 2]; + var index_in_pdb4 = ca_list [index_in_list + 3]; var atom1 = self.all_atoms [index_in_pdb1]; var atom2 = self.all_atoms [index_in_pdb2]; var atom3 = self.all_atoms [index_in_pdb3]; diff --git a/javascript/lib/binana._structure.point.js b/javascript/lib/binana._structure.point.js index 5e517da..6e68487 100644 --- a/javascript/lib/binana._structure.point.js +++ b/javascript/lib/binana._structure.point.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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'; diff --git a/javascript/lib/binana._utils._math_functions.js b/javascript/lib/binana._utils._math_functions.js index 3be74b8..fbea90e 100644 --- a/javascript/lib/binana._utils._math_functions.js +++ b/javascript/lib/binana._utils._math_functions.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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'; @@ -84,8 +84,7 @@ export var dihedral = function (point1, point2, point3, point4) { var b2Xb3 = cross_product (b2, b3); var b1Xb2 = cross_product (b1, b2); var b1XMagb2 = vector_scalar_multiply (b1, b2.magnitude ()); - var radians = math.atan2 (dot_product (b1XMagb2, b2Xb3), dot_product (b1Xb2, b2Xb3)); - return radians; + return math.atan2 (dot_product (b1XMagb2, b2Xb3), dot_product (b1Xb2, b2Xb3)); }; export var angle_between_three_points = function (point1, point2, point3) { var vector1 = vector_subtraction (point1, point2); @@ -96,12 +95,8 @@ export var angle_between_points = function (point1, point2) { var new_point1 = return_normalized_vector (point1); var new_point2 = return_normalized_vector (point2); var dot_prod = dot_product (new_point1, new_point2); - if (dot_prod > 1.0) { - var dot_prod = 1.0; - } - if (dot_prod < -(1.0)) { - var dot_prod = -(1.0); - } + var dot_prod = min (dot_prod, 1.0); + var dot_prod = max (dot_prod, -(1.0)); return math.acos (dot_prod); }; export var return_normalized_vector = function (vector) { diff --git a/javascript/lib/binana._utils.js b/javascript/lib/binana._utils.js index 522bb79..ba8bb5d 100644 --- a/javascript/lib/binana._utils.js +++ b/javascript/lib/binana._utils.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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__ = 'binana._utils'; diff --git a/javascript/lib/binana._utils.shim.js b/javascript/lib/binana._utils.shim.js index 41258cd..eb2b52d 100644 --- a/javascript/lib/binana._utils.shim.js +++ b/javascript/lib/binana._utils.shim.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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__ = 'binana._utils.shim'; export var fake_fs = dict ({}); diff --git a/javascript/lib/binana._utils.utils.js b/javascript/lib/binana._utils.utils.js index 8003c02..965614f 100644 --- a/javascript/lib/binana._utils.utils.js +++ b/javascript/lib/binana._utils.utils.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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 {_set_default} from './binana._utils.shim.js'; var __name__ = 'binana._utils.utils'; diff --git a/javascript/lib/binana.fs.js b/javascript/lib/binana.fs.js index d8b7df9..1085572 100644 --- a/javascript/lib/binana.fs.js +++ b/javascript/lib/binana.fs.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // details. Copyright 2020 Jacob D. Durrant. -// Transcrypt'ed from Python, 2021-11-05 16:24:10 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 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 {OpenFile} from './binana._utils.shim.js'; @@ -10,7 +10,7 @@ import * as shim from './binana._utils.shim.js'; import * as _utils from './binana._utils.js'; import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); -export {OpenFile, _utils, shim}; +export {_utils, shim, OpenFile}; var __name__ = 'binana.fs'; export var save_file = function (filename, text) { var f = OpenFile (filename, 'w'); diff --git a/javascript/lib/binana.interactions._cat_pi.js b/javascript/lib/binana.interactions._cat_pi.js index 32e3a58..eec7812 100644 --- a/javascript/lib/binana.interactions._cat_pi.js +++ b/javascript/lib/binana.interactions._cat_pi.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {project_point_onto_plane} from './binana._utils._math_functions.js'; @@ -40,14 +40,14 @@ export var _detect_pi_cat = function (mol_with_aromatic, mol_with_pos_charge, cu for (var index of charged.indices) { __accu0__.append (mol_with_pos_charge.all_atoms [index].string_id ()); } - return __accu0__; + return py_iter (__accu0__); }) ())) + ']'; var aromatic_mol_lbls = ('[' + ' / '.join ((function () { var __accu0__ = []; for (var index of aromatic.indices) { __accu0__.append (mol_with_aromatic.all_atoms [index].string_id ()); } - return __accu0__; + return py_iter (__accu0__); }) ())) + ']'; if (name_of_charged == 'LIGAND') { cat_pi_labels.append (tuple ([charged_mol_lbls, aromatic_mol_lbls])); diff --git a/javascript/lib/binana.interactions._close.js b/javascript/lib/binana.interactions._close.js index cf8df7b..b25b424 100644 --- a/javascript/lib/binana.interactions._close.js +++ b/javascript/lib/binana.interactions._close.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {Mol} from './binana._structure.mol.js'; diff --git a/javascript/lib/binana.interactions._closest.js b/javascript/lib/binana.interactions._closest.js index 6ee9fc8..5c9d2f6 100644 --- a/javascript/lib/binana.interactions._closest.js +++ b/javascript/lib/binana.interactions._closest.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {Mol} from './binana._structure.mol.js'; diff --git a/javascript/lib/binana.interactions._electrostatic_energies.js b/javascript/lib/binana.interactions._electrostatic_energies.js index 363327c..ee0e60b 100644 --- a/javascript/lib/binana.interactions._electrostatic_energies.js +++ b/javascript/lib/binana.interactions._electrostatic_energies.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {hashtable_entry_add_one, list_alphebetize_and_combine} from './binana._utils.utils.js'; diff --git a/javascript/lib/binana.interactions._flexibility.js b/javascript/lib/binana.interactions._flexibility.js index 6c9218c..460f1a5 100644 --- a/javascript/lib/binana.interactions._flexibility.js +++ b/javascript/lib/binana.interactions._flexibility.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {Mol} from './binana._structure.mol.js'; diff --git a/javascript/lib/binana.interactions._hydrogen_halogen_bonds.js b/javascript/lib/binana.interactions._hydrogen_halogen_bonds.js index 25bbe75..de37851 100644 --- a/javascript/lib/binana.interactions._hydrogen_halogen_bonds.js +++ b/javascript/lib/binana.interactions._hydrogen_halogen_bonds.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 __future__ = {}; var binana = {}; var math = {}; @@ -21,7 +21,20 @@ __nest__ (binana, '', __module_binana__); import {HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF} from './binana.interactions.default_params.js'; import {_set_default} from './binana._utils.shim.js'; var __name__ = 'binana.interactions._hydrogen_halogen_bonds'; -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 _mimic_set_minus = function (set1, set2) { + for (var s2 of set2) { + var set1 = (function () { + var __accu0__ = []; + for (var s of set1) { + if (s [0] != s2 [0]) { + __accu0__.append (s); + } + } + return __accu0__; + }) (); + } + return set1; +}; export var get_hydrogen_or_halogen_bonds = function (ligand, receptor, dist_cutoff, angle_cutoff, hydrogen_bond) { if (typeof dist_cutoff == 'undefined' || (dist_cutoff != null && dist_cutoff.hasOwnProperty ("__kwargtrans__"))) {; var dist_cutoff = null; @@ -32,45 +45,56 @@ export var get_hydrogen_or_halogen_bonds = function (ligand, receptor, dist_cuto if (typeof hydrogen_bond == 'undefined' || (hydrogen_bond != null && hydrogen_bond.hasOwnProperty ("__kwargtrans__"))) {; var hydrogen_bond = true; }; - var central_atoms = (hydrogen_bond ? ['H'] : ['I', 'BR', 'Br', 'CL', 'Cl', 'F']); - var dist_cutoff = _set_default (dist_cutoff, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF); - var angle_cutoff = _set_default (angle_cutoff, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF); var hbonds = dict ({}); var pdb_hbonds = Mol (); var hbonds_labels = []; + var dist_cutoff = _set_default (dist_cutoff, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF); + var angle_cutoff = _set_default (angle_cutoff, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF); + var lig_and_recep_have_hydrogens = ligand.has_hydrogens && receptor.has_hydrogens; var ligand_receptor_dists = _get_ligand_receptor_dists (ligand, receptor); - for (var [ligand_atom, receptor_atom, dist] of ligand_receptor_dists) { - if (dist < dist_cutoff && __in__ (ligand_atom.element, ['O', 'N']) && __in__ (receptor_atom.element, ['O', 'N'])) { - var hydrogens = []; - for (var atm_index of ligand.all_atoms.py_keys ()) { - var element = ligand.all_atoms [atm_index].element; - if (__in__ (element, central_atoms)) { - var dist = ligand.all_atoms [atm_index].coordinates.dist_to (ligand_atom.coordinates); - if (dist < max_donor_X_dist [element]) { - ligand.all_atoms [atm_index].comment = 'LIGAND'; - hydrogens.append (ligand.all_atoms [atm_index]); - } - } + var close_donors_acceptors = (function () { + var __accu0__ = []; + for (var [ligand_atom, receptor_atom, dist] of ligand_receptor_dists) { + if (dist < dist_cutoff && __in__ (ligand_atom.element, ['O', 'N']) && __in__ (receptor_atom.element, ['O', 'N'])) { + __accu0__.append ([ligand_atom, receptor_atom]); } - for (var atm_index of receptor.all_atoms.py_keys ()) { - var element = receptor.all_atoms [atm_index].element; - if (__in__ (element, central_atoms)) { - var dist = receptor.all_atoms [atm_index].coordinates.dist_to (receptor_atom.coordinates); - if (dist < max_donor_X_dist [element]) { - receptor.all_atoms [atm_index].comment = 'RECEPTOR'; - hydrogens.append (receptor.all_atoms [atm_index]); - } - } + } + return __accu0__; + }) (); + for (var [ligand_atom, receptor_atom] of close_donors_acceptors) { + var hbond_detected = false; + var lig_atm_hbond_infs = ligand.is_hbond_donor_acceptor (ligand_atom, hydrogen_bond); + var recep_atm_hbond_infs = receptor.is_hbond_donor_acceptor (receptor_atom, hydrogen_bond); + for (var lig_atm_hbond_inf of lig_atm_hbond_infs) { + if (hbond_detected) { + break; } - for (var hydrogen of hydrogens) { - if (fabs (180 - (angle_between_three_points (ligand_atom.coordinates, hydrogen.coordinates, receptor_atom.coordinates) * 180.0) / math.pi) <= angle_cutoff) { - var hbonds_key = (((('HDONOR_' + hydrogen.comment) + '_') + receptor_atom.side_chain_or_backbone ()) + '_') + receptor_atom.structure; - pdb_hbonds.add_new_atom (ligand_atom.copy_of ()); - pdb_hbonds.add_new_atom (hydrogen.copy_of ()); - pdb_hbonds.add_new_atom (receptor_atom.copy_of ()); - hashtable_entry_add_one (hbonds, hbonds_key); - hbonds_labels.append (tuple ([ligand_atom.string_id (), hydrogen.string_id (), receptor_atom.string_id (), hydrogen.comment])); + var __left0__ = lig_atm_hbond_inf; + var lig_donor_or_accept = __left0__ [0]; + var lig_center_atom = __left0__ [1]; + for (var recep_atm_hbond_inf of recep_atm_hbond_infs) { + var __left0__ = recep_atm_hbond_inf; + var accept_donor_or_accept = __left0__ [0]; + var accept_center_atom = __left0__ [1]; + if (lig_donor_or_accept == accept_donor_or_accept) { + continue; + } + var center_atom = (lig_donor_or_accept == 'DONOR' ? lig_center_atom : accept_center_atom); + if (lig_and_recep_have_hydrogens && hydrogen_bond) { + var angle = angle_between_three_points (ligand_atom.coordinates, center_atom.coordinates, receptor_atom.coordinates); + if (fabs (180 - (angle * 180.0) / math.pi) > angle_cutoff) { + continue; + } } + var comment = (lig_donor_or_accept == 'ACCEPTOR' ? 'RECEPTOR' : 'LIGAND'); + var hbonds_key = (((('HDONOR_' + comment) + '_') + receptor_atom.side_chain_or_backbone ()) + '_') + receptor_atom.structure; + pdb_hbonds.add_new_atom (ligand_atom.copy_of ()); + pdb_hbonds.add_new_atom (center_atom.copy_of ()); + pdb_hbonds.add_new_atom (receptor_atom.copy_of ()); + hashtable_entry_add_one (hbonds, hbonds_key); + hbonds_labels.append (tuple ([ligand_atom.string_id (), center_atom.string_id (), receptor_atom.string_id (), comment])); + var hbond_detected = true; + break; } } } diff --git a/javascript/lib/binana.interactions._hydrophobics.js b/javascript/lib/binana.interactions._hydrophobics.js index e32097e..d5b40ca 100644 --- a/javascript/lib/binana.interactions._hydrophobics.js +++ b/javascript/lib/binana.interactions._hydrophobics.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {Mol} from './binana._structure.mol.js'; diff --git a/javascript/lib/binana.interactions._ligand_atom_types.js b/javascript/lib/binana.interactions._ligand_atom_types.js index eab2dae..6a66c1c 100644 --- a/javascript/lib/binana.interactions._ligand_atom_types.js +++ b/javascript/lib/binana.interactions._ligand_atom_types.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {hashtable_entry_add_one, list_alphebetize_and_combine} from './binana._utils.utils.js'; diff --git a/javascript/lib/binana.interactions._pi_pi.js b/javascript/lib/binana.interactions._pi_pi.js index c992cc9..7fb386f 100644 --- a/javascript/lib/binana.interactions._pi_pi.js +++ b/javascript/lib/binana.interactions._pi_pi.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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'; diff --git a/javascript/lib/binana.interactions._salt_bridges.js b/javascript/lib/binana.interactions._salt_bridges.js index f0450b2..89fa1d9 100644 --- a/javascript/lib/binana.interactions._salt_bridges.js +++ b/javascript/lib/binana.interactions._salt_bridges.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {Mol} from './binana._structure.mol.js'; @@ -30,24 +30,28 @@ export var get_salt_bridges = function (ligand, receptor, cutoff) { } var key = 'SALT-BRIDGE_' + structure; for (var index of receptor_charge.indices) { - pdb_salt_bridges.add_new_atom (receptor.all_atoms [index].copy_of ()); + var idx = int (index); + var atom = receptor.all_atoms [idx]; + pdb_salt_bridges.add_new_atom (atom.copy_of ()); } for (var index of ligand_charge.indices) { - pdb_salt_bridges.add_new_atom (ligand.all_atoms [index].copy_of ()); + var idx = int (index); + var atom = ligand.all_atoms [idx]; + pdb_salt_bridges.add_new_atom (atom.copy_of ()); } hashtable_entry_add_one (salt_bridges, key); salt_bridge_labels.append (tuple ([('[' + ' / '.join ((function () { var __accu0__ = []; for (var index of ligand_charge.indices) { - __accu0__.append (ligand.all_atoms [index].string_id ()); + __accu0__.append (ligand.all_atoms [int (index)].string_id ()); } - return __accu0__; + return py_iter (__accu0__); }) ())) + ']', ('[' + ' / '.join ((function () { var __accu0__ = []; for (var index of receptor_charge.indices) { - __accu0__.append (receptor.all_atoms [index].string_id ()); + __accu0__.append (receptor.all_atoms [int (index)].string_id ()); } - return __accu0__; + return py_iter (__accu0__); }) ())) + ']'])); } } diff --git a/javascript/lib/binana.interactions.default_params.js b/javascript/lib/binana.interactions.default_params.js index f813767..4df3125 100644 --- a/javascript/lib/binana.interactions.default_params.js +++ b/javascript/lib/binana.interactions.default_params.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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__ = 'binana.interactions.default_params'; export var CLOSE_CONTACTS_DIST1_CUTOFF = 2.5; diff --git a/javascript/lib/binana.interactions.js b/javascript/lib/binana.interactions.js index 0db1552..63ed182 100644 --- a/javascript/lib/binana.interactions.js +++ b/javascript/lib/binana.interactions.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 _closest from './binana.interactions._closest.js'; @@ -22,7 +22,7 @@ __nest__ (binana, '', __module_binana__); import {ACTIVE_SITE_FLEXIBILITY_DIST_CUTOFF, CATION_PI_DIST_CUTOFF, CLOSE_CONTACTS_DIST1_CUTOFF, CLOSE_CONTACTS_DIST2_CUTOFF, ELECTROSTATIC_DIST_CUTOFF, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF, HYDROPHOBIC_DIST_CUTOFF, PI_PADDING_DIST, PI_PI_INTERACTING_DIST_CUTOFF, PI_STACKING_ANGLE_TOLERANCE, SALT_BRIDGE_DIST_CUTOFF, T_STACKING_ANGLE_TOLERANCE, T_STACKING_CLOSEST_DIST_CUTOFF} from './binana.interactions.default_params.js'; import {_set_default} from './binana._utils.shim.js'; import * as default_params from './binana.interactions.default_params.js'; -export {CLOSE_CONTACTS_DIST2_CUTOFF, _cat_pi, PI_PADDING_DIST, _flexibility, CATION_PI_DIST_CUTOFF, _closest, _electrostatic_energies, default_params, HYDROPHOBIC_DIST_CUTOFF, CLOSE_CONTACTS_DIST1_CUTOFF, SALT_BRIDGE_DIST_CUTOFF, _hydrophobics, T_STACKING_ANGLE_TOLERANCE, _close, _ligand_atom_types, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF, ACTIVE_SITE_FLEXIBILITY_DIST_CUTOFF, ELECTROSTATIC_DIST_CUTOFF, _set_default, PI_PI_INTERACTING_DIST_CUTOFF, _salt_bridges, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF, T_STACKING_CLOSEST_DIST_CUTOFF, PI_STACKING_ANGLE_TOLERANCE, _hydrogen_halogen_bonds, _pi_pi}; +export {HYDROPHOBIC_DIST_CUTOFF, default_params, T_STACKING_ANGLE_TOLERANCE, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF, PI_PADDING_DIST, _pi_pi, _salt_bridges, PI_STACKING_ANGLE_TOLERANCE, ACTIVE_SITE_FLEXIBILITY_DIST_CUTOFF, _hydrophobics, _electrostatic_energies, _flexibility, _hydrogen_halogen_bonds, T_STACKING_CLOSEST_DIST_CUTOFF, CLOSE_CONTACTS_DIST1_CUTOFF, CLOSE_CONTACTS_DIST2_CUTOFF, SALT_BRIDGE_DIST_CUTOFF, _ligand_atom_types, _closest, _close, CATION_PI_DIST_CUTOFF, PI_PI_INTERACTING_DIST_CUTOFF, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF, _set_default, _cat_pi, ELECTROSTATIC_DIST_CUTOFF}; var __name__ = 'binana.interactions'; export var get_cation_pi = function (ligand, receptor, cutoff, pi_padding) { if (typeof cutoff == 'undefined' || (cutoff != null && cutoff.hasOwnProperty ("__kwargtrans__"))) {; diff --git a/javascript/lib/binana.js b/javascript/lib/binana.js index 85981e5..1a1c194 100644 --- a/javascript/lib/binana.js +++ b/javascript/lib/binana.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 _get_params from './binana._cli_params._get_params.js'; @@ -13,7 +13,7 @@ import * as load_ligand_receptor from './binana.load_ligand_receptor.js'; import * as fs from './binana.fs.js'; import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); -export {fs, output, _get_params, interactions, load_ligand_receptor, _start}; +export {fs, _get_params, _start, output, interactions, load_ligand_receptor}; var __name__ = '__main__'; export var _sys = binana.sys; export var run = function (args) { diff --git a/javascript/lib/binana.load_ligand_receptor.js b/javascript/lib/binana.load_ligand_receptor.js index aa9331d..b2c771c 100644 --- a/javascript/lib/binana.load_ligand_receptor.js +++ b/javascript/lib/binana.load_ligand_receptor.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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'; @@ -13,7 +13,7 @@ import * as __module_math__ from './math.js'; __nest__ (math, '', __module_math__); import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); -export {_Point, _Mol, _math_functions}; +export {_math_functions, _Point, _Mol}; var __name__ = 'binana.load_ligand_receptor'; export var _ligand_receptor_dists = null; export var _ligand_receptor_aromatic_dists = null; diff --git a/javascript/lib/binana.output._directory.js b/javascript/lib/binana.output._directory.js index 58e8669..8068b9e 100644 --- a/javascript/lib/binana.output._directory.js +++ b/javascript/lib/binana.output._directory.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // details. Copyright 2020 Jacob D. Durrant. -// Transcrypt'ed from Python, 2021-11-05 16:24:10 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 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 * as shim from './binana._utils.shim.js'; @@ -10,7 +10,7 @@ import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); import * as vmd_state from './binana.output._directory.vmd_state.js'; import * as pdbs from './binana.output._directory.pdbs.js'; -export {vmd_state, pdbs, shim}; +export {pdbs, vmd_state, shim}; var __name__ = 'binana.output._directory'; export var os = shim; export var make_directory_output = function (parameters, closest, close, active_site_flexibility, hydrophobics, hydrogen_bonds, halogen_bonds, pi_pi, cat_pi, salt_bridges, ligand, receptor) { diff --git a/javascript/lib/binana.output._directory.pdbs.js b/javascript/lib/binana.output._directory.pdbs.js index edee545..b8a74e4 100644 --- a/javascript/lib/binana.output._directory.pdbs.js +++ b/javascript/lib/binana.output._directory.pdbs.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // details. Copyright 2020 Jacob D. Durrant. -// Transcrypt'ed from Python, 2021-11-05 16:24:10 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 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__ = 'binana.output._directory.pdbs'; export var output_dir_pdbs = function (pdb_closest_contacts, parameters, pdb_close_contacts, pdb_contacts_alpha_helix, pdb_contacts_beta_sheet, pdb_contacts_other_2nd_structure, pdb_back_bone, pdb_side_chain, pdb_hydrophobic, pdb_hbonds, pdb_halbonds, pdb_pistack, pdb_pi_T, pdb_pi_cat, pdb_salt_bridges, ligand, receptor) { diff --git a/javascript/lib/binana.output._directory.vmd_state.js b/javascript/lib/binana.output._directory.vmd_state.js index 36c3f25..dfeebb0 100644 --- a/javascript/lib/binana.output._directory.vmd_state.js +++ b/javascript/lib/binana.output._directory.vmd_state.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // details. Copyright 2020 Jacob D. Durrant. -// Transcrypt'ed from Python, 2021-11-05 16:24:10 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 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 {OpenFile} from './binana._utils.shim.js'; diff --git a/javascript/lib/binana.output._log.js b/javascript/lib/binana.output._log.js index 1213e6e..e41fe75 100644 --- a/javascript/lib/binana.output._log.js +++ b/javascript/lib/binana.output._log.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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:34 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 * as json from './binana._utils.shim.js'; diff --git a/javascript/lib/binana.output.dictionary.js b/javascript/lib/binana.output.dictionary.js index f4fbaa2..4d3c1b9 100644 --- a/javascript/lib/binana.output.dictionary.js +++ b/javascript/lib/binana.output.dictionary.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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:34 var binana = {}; var re = {}; 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'; diff --git a/javascript/lib/binana.output.js b/javascript/lib/binana.output.js index a593230..3d3cddc 100644 --- a/javascript/lib/binana.output.js +++ b/javascript/lib/binana.output.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {OpenFile as _openFile} from './binana._utils.shim.js'; @@ -13,7 +13,7 @@ import * as pdb_file from './binana.output.pdb_file.js'; import * as _log from './binana.output._log.js'; import * as dictionary from './binana.output.dictionary.js'; import * as _directory from './binana.output._directory.js'; -export {_directory, _openFile, dictionary, _json, pdb_file, _log}; +export {_openFile, _directory, _json, dictionary, pdb_file, _log}; var __name__ = 'binana.output'; export var _write_main = function (parameters, ligand, receptor, closest, close, hydrophobics, hydrogen_bonds, halogen_bonds, salt_bridges, pi_pi, cat_pi, electrostatic_energies, active_site_flexibility, ligand_atom_types) { var json_output = binana.output.dictionary.collect (closest, close, hydrophobics, hydrogen_bonds, halogen_bonds, salt_bridges, pi_pi, cat_pi, electrostatic_energies, active_site_flexibility, ligand_atom_types, __kwargtrans__ ({ligand_rotatable_bonds: ligand.rotatable_bonds_count})); diff --git a/javascript/lib/binana.output.pdb_file.js b/javascript/lib/binana.output.pdb_file.js index 0377bcb..3d634ed 100644 --- a/javascript/lib/binana.output.pdb_file.js +++ b/javascript/lib/binana.output.pdb_file.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {OpenFile} from './binana._utils.shim.js'; diff --git a/javascript/lib/math.js b/javascript/lib/math.js index 4976c47..f9b7f89 100644 --- a/javascript/lib/math.js +++ b/javascript/lib/math.js @@ -1,4 +1,4 @@ -// Transcrypt'ed from Python, 2021-11-05 16:24:08 +// Transcrypt'ed from Python, 2021-11-09 00:25:32 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, 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__ = 'math'; export var pi = Math.PI; diff --git a/javascript/lib/org.transcrypt.__runtime__.js b/javascript/lib/org.transcrypt.__runtime__.js index 15eca37..650e004 100644 --- a/javascript/lib/org.transcrypt.__runtime__.js +++ b/javascript/lib/org.transcrypt.__runtime__.js @@ -1,4 +1,4 @@ -// Transcrypt'ed from Python, 2021-11-05 16:24:08 +// Transcrypt'ed from Python, 2021-11-09 00:25:32 var __name__ = 'org.transcrypt.__runtime__'; export var __envir__ = {}; __envir__.interpreter_name = 'python'; diff --git a/javascript/lib/re.js b/javascript/lib/re.js index dc63cda..1e55cc9 100644 --- a/javascript/lib/re.js +++ b/javascript/lib/re.js @@ -1,4 +1,4 @@ -// Transcrypt'ed from Python, 2021-11-05 16:24:09 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 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 {translate} from './re.translate.js'; export {translate}; diff --git a/javascript/lib/re.translate.js b/javascript/lib/re.translate.js index 00bda7b..9b8fb11 100644 --- a/javascript/lib/re.translate.js +++ b/javascript/lib/re.translate.js @@ -1,4 +1,4 @@ -// Transcrypt'ed from Python, 2021-11-05 16:24:10 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 var re = {}; 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_re__ from './re.js'; diff --git a/python/binana/_structure/atom.py b/python/binana/_structure/atom.py index 8f77fb2..48c6f69 100644 --- a/python/binana/_structure/atom.py +++ b/python/binana/_structure/atom.py @@ -4,9 +4,25 @@ # this file contains the Atom class for binana.py +import math import binana from binana._structure.point import Point from binana._utils.shim import r_just, round_to_thousandths_to_str +from binana._utils._math_functions import angle_between_three_points + +# __pragma__ ('skip') +# Python +from math import fabs + +# __pragma__ ('noskip') + + +"""? +# Transcrypt +import binana._utils +from binana._utils import shim +from binana._utils.shim import fabs +?""" """ Class Atom defines an atom @@ -81,10 +97,10 @@ def create_pdb_line(self, index): + r_just(self.residue, 4) ) - output = output + r_just(round_to_thousandths_to_str(self.coordinates.x), 18) - output = output + r_just(round_to_thousandths_to_str(self.coordinates.y), 8) - output = output + r_just(round_to_thousandths_to_str(self.coordinates.z), 8) - output = output + r_just(self.element, 24) + output += r_just(round_to_thousandths_to_str(self.coordinates.x), 18) + output += r_just(round_to_thousandths_to_str(self.coordinates.y), 8) + output += r_just(round_to_thousandths_to_str(self.coordinates.z), 8) + output += r_just(self.element, 24) return output # Returns the number of an atom's nearest neighbors @@ -96,19 +112,14 @@ def number_of_neighbors(self): # Param self (Atom) # Param index (float): index of atom to be added def add_neighbor_atom_index(self, index): - if not (index in self.indecies_of_atoms_connecting): + if index not in self.indecies_of_atoms_connecting: self.indecies_of_atoms_connecting.append(index) # Returns whether the atom is part of the backbone or a sidechain # Only really applies to proteins, assuming standard atom names # Param self (Atom) def side_chain_or_backbone(self): - if ( - self.atom_name.strip() == "CA" - or self.atom_name.strip() == "C" - or self.atom_name.strip() == "O" - or self.atom_name.strip() == "N" - ): + if self.atom_name.strip() in ["CA", "C", "O", "N"]: return "BACKBONE" else: return "SIDECHAIN" @@ -205,3 +216,25 @@ def read_pdb_line(self, line): if self.residue.strip() == "": self.residue = " MOL" + + # TODO: Might make more sense to put this in mol. + def has_sp3_geometry(self, parent_mol): + ncrs = [ + parent_mol.all_atoms[i].coordinates + for i in self.indecies_of_atoms_connecting + ] + ccr = self.coordinates + to_deg = 180.0 / math.pi + 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) + + average_angle = sum(angles) / float(len(angles)) + + return fabs(average_angle - 109.0) < 5.0 diff --git a/python/binana/_structure/mol.py b/python/binana/_structure/mol.py index b47b7ce..139743b 100644 --- a/python/binana/_structure/mol.py +++ b/python/binana/_structure/mol.py @@ -10,7 +10,6 @@ from binana._structure.atom import Atom from binana._utils._math_functions import ( distance, - angle_between_three_points, vector_subtraction, cross_product, dihedral, @@ -39,6 +38,18 @@ Class Mol handles PDB filing """ +# O-H distance is 0.96 A, N-H is 1.01 A. See +# http://www.science.uwaterloo.ca/~cchieh/cact/c120/bondel.html +_max_donor_X_dist = { + "H": 1.3, + "I": 2.04 * 1.4, # O-I: 2.04 per avogadro + "BR": 1.86 * 1.4, # O-Br: 1.86 + "Br": 1.86 * 1.4, + "CL": 1.71 * 1.4, # O-Cl: 1.71 + "Cl": 1.71 * 1.4, + "F": 1.33 * 1.4, # O-F: 1.33 +} + class Mol: @@ -87,6 +98,7 @@ def __init__(self): ] self.aromatic_rings = [] self.charges = [] # a list of points + self.has_hydrogens = False def load_pdb_from_text( self, @@ -124,7 +136,7 @@ def load_pdb_from_text( # aren't loaded This basically gets rid of rotamers, I think. atom_already_loaded = [] - for t in range(0, len(lines)): + for t in range(len(lines)): line = lines[t] if line[:3] == "END" and line[:7] != "ENDROOT" and line[:9] != "ENDBRANCH": @@ -152,6 +164,9 @@ def load_pdb_from_text( temp_atom = Atom() temp_atom.read_pdb_line(line) + if temp_atom.element == "H": + self.has_hydrogens = True + if ( temp_atom.coordinates.x > min_x and temp_atom.coordinates.x < max_x @@ -161,20 +176,12 @@ def load_pdb_from_text( and temp_atom.coordinates.z < max_z ): - if self.max_x < temp_atom.coordinates.x: - self.max_x = temp_atom.coordinates.x - if self.max_y < temp_atom.coordinates.y: - self.max_y = temp_atom.coordinates.y - 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 - + self.max_x = max(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) + self.min_x = min(self.min_x, temp_atom.coordinates.x) + self.min_y = min(self.min_y, temp_atom.coordinates.y) + self.min_z = min(self.min_z, temp_atom.coordinates.z) # this string uniquely identifies each atom key = ( temp_atom.atom_name.strip() @@ -201,23 +208,24 @@ def load_pdb_from_text( if ( key not in atom_already_loaded - or not temp_atom.residue.strip() in self.protein_resnames + or temp_atom.residue.strip() not in self.protein_resnames ): # So either the atom hasn't been loaded, or else # it's a non-protein atom So note that non-protein # atoms can have redundant names, but protein # atoms cannot. This is because protein residues # often contain rotamers - atom_already_loaded.append( - key - ) # So each atom can only be loaded once. No rotamers. - self.all_atoms[ - autoindex - ] = temp_atom # So you're actually reindexing everything here. + + # So each atom can only be loaded once. No rotamers. + atom_already_loaded.append(key) + + # So you're actually reindexing everything here. + self.all_atoms[autoindex] = temp_atom + if temp_atom.residue[-3:] not in self.protein_resnames: self.non_protein_atoms[autoindex] = temp_atom - autoindex = autoindex + 1 + autoindex += 1 self.check_protein_format() @@ -228,6 +236,12 @@ def load_pdb_from_text( self.assign_aromatic_rings() self.assign_charges() + if not 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("") + # Load PDB file # Param file_name (string) # Param min_x (float): minimum x coordinate @@ -293,13 +307,10 @@ def save_pdb(self, file_name): # Returns a new PDB line # Param self (Mol) def save_pdb_string(self): - to_output = "" - - # Write coordinates of all atoms - for atom_index in self.all_atoms.keys(): - to_output += self.all_atoms[atom_index].create_pdb_line(atom_index) + "\n" - - return to_output + return "".join( + self.all_atoms[atom_index].create_pdb_line(atom_index) + "\n" + for atom_index in self.all_atoms.keys() + ) # Adds a new atom to this Mol # Param self (Mol) @@ -308,11 +319,11 @@ def add_new_atom(self, atom): # first get available index t = 1 all_atom_keys = list(self.all_atoms.keys()) - + """? all_atom_keys = [int(k) for k in all_atom_keys] ?""" - + while t in all_atom_keys: t += 1 @@ -330,7 +341,7 @@ def set_resname(self, resname): # Param self (Mol) # Param index (integer): index of atom # Param connected_atom_element (string): element in question - def connected_atoms_of_given_element(self, index, connected_atom_element): + def connected_atoms_of_element(self, index, connected_atom_element): atom = self.all_atoms[index] connected_atoms = [] for index2 in atom.indecies_of_atoms_connecting: @@ -380,6 +391,16 @@ def check_protein_format(self): self.check_protein_format_process_residue(residue, last_key) + def warn_bad_atom_name(self, name, residue): + self.printout( + 'Warning: There is no atom named "' + + 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("") + # Correct format of the protein and residues # Param self (Mol) # Param residue () @@ -388,304 +409,103 @@ def check_protein_format_process_residue(self, residue, last_key): temp = last_key.strip().split("_") resname = temp[0] real_resname = resname[-3:] - resid = temp[1] - chain = temp[2] + # resid = temp[1] + # chain = temp[2] if real_resname in self.protein_resnames: # so it's a protein residue if "N" not in 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." - ) - print("") + self.warn_bad_atom_name("N", last_key) if "C" not in 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." - ) - print("") + self.warn_bad_atom_name("C", last_key) if "CA" not in 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." - ) - print("") + self.warn_bad_atom_name("CA", last_key) - if real_resname == "GLU" or real_resname == "GLH" or real_resname == "GLX": + if real_resname in ["GLU", "GLH", "GLX"]: if "OE1" not in 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." - ) - print("") + self.warn_bad_atom_name("OE1", last_key) if "OE2" not in 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." - ) - print("") + self.warn_bad_atom_name("OE2", last_key) - if real_resname == "ASP" or real_resname == "ASH" or real_resname == "ASX": + if real_resname in ["ASP", "ASH", "ASX"]: if "OD1" not in 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." - ) - print("") + self.warn_bad_atom_name("OD1", last_key) if "OD2" not in 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." - ) - print("") - - if real_resname == "LYS" or real_resname == "LYN": - if "NZ" not in residue: - 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("") + self.warn_bad_atom_name("OD2", last_key) + + if real_resname in ["LYS", "LYN"] and "NZ" not in residue: + self.warn_bad_atom_name("NZ", last_key) if real_resname == "ARG": if "NH1" not in 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." - ) - print("") + self.warn_bad_atom_name("NH1", last_key) if "NH2" not in 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." - ) - print("") + self.warn_bad_atom_name("NH2", last_key) - if ( - real_resname == "HIS" - or real_resname == "HID" - or real_resname == "HIE" - or real_resname == "HIP" - ): + if real_resname in ["HIS", "HID", "HIE", "HIP"]: if "NE2" not in 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." - ) - print("") + self.warn_bad_atom_name("NE2", last_key) if "ND1" not in 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." - ) - print("") + self.warn_bad_atom_name("ND1", last_key) if real_resname == "PHE": if "CG" not in 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." - ) - print("") + self.warn_bad_atom_name("CG", last_key) if "CD1" not in 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." - ) - print("") + self.warn_bad_atom_name("CD1", last_key) if "CD2" not in 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." - ) - print("") + self.warn_bad_atom_name("CD2", last_key) if "CE1" not in 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." - ) - print("") + self.warn_bad_atom_name("CE1", last_key) if "CE2" not in 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." - ) - print("") + self.warn_bad_atom_name("CE2", last_key) if "CZ" not in 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." - ) - print("") + self.warn_bad_atom_name("CZ", last_key) if real_resname == "TYR": if "CG" not in 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." - ) - print("") + self.warn_bad_atom_name("CG", last_key) if "CD1" not in 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." - ) - print("") + self.warn_bad_atom_name("CD1", last_key) if "CD2" not in 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." - ) - print("") + self.warn_bad_atom_name("CD2", last_key) if "CE1" not in 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." - ) - print("") + self.warn_bad_atom_name("CE1", last_key) if "CE2" not in 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." - ) - print("") + self.warn_bad_atom_name("CE2", last_key) if "CZ" not in 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." - ) - print("") + self.warn_bad_atom_name("CZ", last_key) if real_resname == "TRP": if "CG" not in 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." - ) - print("") + self.warn_bad_atom_name("CG", last_key) if "CD1" not in 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." - ) - print("") + self.warn_bad_atom_name("CD1", last_key) if "CD2" not in 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." - ) - print("") + self.warn_bad_atom_name("CD2", last_key) if "NE1" not in residue: - self.printout( - 'Warning: There is no atom named "NE1" 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." - ) - print("") + self.warn_bad_atom_name("NE1", last_key) if "CE2" not in 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." - ) - print("") + self.warn_bad_atom_name("CE2", last_key) if "CE3" not in residue: - self.printout( - 'Warning: There is no atom named "CE3" 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." - ) - print("") + self.warn_bad_atom_name("CE3", last_key) if "CZ2" not in residue: - self.printout( - 'Warning: There is no atom named "CZ2" 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." - ) - print("") + self.warn_bad_atom_name("CZ2", last_key) if "CZ3" not in residue: - self.printout( - 'Warning: There is no atom named "CZ3" 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." - ) - print("") + self.warn_bad_atom_name("CZ3", last_key) if "CH2" not in residue: - self.printout( - 'Warning: There is no atom named "CH2" 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." - ) - print("") + self.warn_bad_atom_name("CH2", last_key) - if ( - real_resname == "HIS" - or real_resname == "HID" - or real_resname == "HIE" - or real_resname == "HIP" - ): + if real_resname in ["HIS", "HID", "HIE", "HIP"]: if "CG" not in 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." - ) - print("") + self.warn_bad_atom_name("CG", last_key) if "ND1" not in 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-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore." - ) - print("") + self.warn_bad_atom_name("ND1", last_key) if "CD2" not in 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." - ) - print("") + self.warn_bad_atom_name("CD2", last_key) if "CE1" not in 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." - ) - print("") + self.warn_bad_atom_name("CE1", last_key) if "NE2" not in 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-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore." - ) - print("") + self.warn_bad_atom_name("NE2", last_key) # Functions to determine the bond connectivity based on distance # ============================================================== @@ -700,7 +520,7 @@ def create_bonds_by_distance(self): for atom_index2 in self.non_protein_atoms.keys(): if atom_index1 != atom_index2: atom2 = self.non_protein_atoms[atom_index2] - if not atom2.residue[-3:] in self.protein_resnames: + if atom2.residue[-3:] not in self.protein_resnames: # so it's not a protein residue dist = distance(atom1.coordinates, atom2.coordinates) @@ -711,6 +531,14 @@ def create_bonds_by_distance(self): atom1.add_neighbor_atom_index(atom_index2) atom2.add_neighbor_atom_index(atom_index1) + def update_distance(self, element1, element2, orig_distance, match): + match_element1, match_element2, match_dist = match + if element1 == match_element1 and element2 == match_element2: + return match_dist + if element1 == match_element2 and element2 == match_element1: + return match_dist + return orig_distance + # Retuns bond length between two elements # Param self (Mol) # Param element1 (string): symbol of first element @@ -722,376 +550,397 @@ def bond_length(self, element1, element2): lengths would be incorrect, probably slight errors (<0.06) in the hundreds.""" distance = 0.0 - if element1 == "C" and element2 == "C": - distance = 1.53 - if element1 == "N" and element2 == "N": - distance = 1.425 - if element1 == "O" and element2 == "O": - distance = 1.469 - if element1 == "S" and element2 == "S": - distance = 2.048 - if (element1 == "C" and element2 == "H") or ( - element1 == "H" and element2 == "C" - ): - distance = 1.059 - if (element1 == "C" and element2 == "N") or ( - element1 == "N" and element2 == "C" - ): - distance = 1.469 - if (element1 == "C" and element2 == "O") or ( - element1 == "O" and element2 == "C" - ): - distance = 1.413 - if (element1 == "C" and element2 == "S") or ( - element1 == "S" and element2 == "C" - ): - distance = 1.819 - if (element1 == "N" and element2 == "H") or ( - element1 == "H" and element2 == "N" - ): - distance = 1.009 - if (element1 == "N" and element2 == "O") or ( - element1 == "O" and element2 == "N" - ): - distance = 1.463 - if (element1 == "O" and element2 == "S") or ( - element1 == "S" and element2 == "O" - ): - distance = 1.577 - if (element1 == "O" and element2 == "H") or ( - element1 == "H" and element2 == "O" - ): - distance = 0.967 - if (element1 == "S" and element2 == "H") or ( - element1 == "H" and element2 == "S" - ): - # This one not from source sited above. Not sure where it's from, - # but it wouldn't ever be used in the current context ("AutoGrow") - distance = 2.025 / 1.5 - if (element1 == "S" and element2 == "N") or ( - element1 == "H" and element2 == "N" - ): - distance = 1.633 - - if (element1 == "C" and element2 == "F") or ( - element1 == "F" and element2 == "C" - ): - distance = 1.399 - if (element1 == "C" and element2 == "CL") or ( - element1 == "CL" and element2 == "C" - ): - distance = 1.790 - if (element1 == "C" and element2 == "BR") or ( - element1 == "BR" and element2 == "C" - ): - distance = 1.910 - if (element1 == "C" and element2 == "I") or ( - element1 == "I" and element2 == "C" - ): - distance = 2.162 - - if (element1 == "S" and element2 == "BR") or ( - element1 == "BR" and element2 == "S" - ): - distance = 2.321 - if (element1 == "S" and element2 == "CL") or ( - element1 == "CL" and element2 == "S" - ): - distance = 2.283 - if (element1 == "S" and element2 == "F") or ( - element1 == "F" and element2 == "S" - ): - distance = 1.640 - if (element1 == "S" and element2 == "I") or ( - element1 == "I" and element2 == "S" - ): - distance = 2.687 - - if (element1 == "P" and element2 == "BR") or ( - element1 == "BR" and element2 == "P" - ): - distance = 2.366 - if (element1 == "P" and element2 == "CL") or ( - element1 == "CL" and element2 == "P" - ): - distance = 2.008 - if (element1 == "P" and element2 == "F") or ( - element1 == "F" and element2 == "P" - ): - distance = 1.495 - if (element1 == "P" and element2 == "I") or ( - element1 == "I" and element2 == "P" - ): - distance = 2.490 - if (element1 == "P" and element2 == "O") or ( - element1 == "O" and element2 == "P" - ): - # estimate based on eye balling Handbook of Chemistry and Physics - distance = 1.6 - - if (element1 == "N" and element2 == "BR") or ( - element1 == "BR" and element2 == "N" - ): - distance = 1.843 - if (element1 == "N" and element2 == "CL") or ( - element1 == "CL" and element2 == "N" - ): - distance = 1.743 - if (element1 == "N" and element2 == "F") or ( - element1 == "F" and element2 == "N" - ): - distance = 1.406 - if (element1 == "N" and element2 == "I") or ( - element1 == "I" and element2 == "N" - ): - distance = 2.2 - - if (element1 == "SI" and element2 == "BR") or ( - element1 == "BR" and element2 == "SI" - ): - distance = 2.284 - if (element1 == "SI" and element2 == "CL") or ( - element1 == "CL" and element2 == "SI" - ): - distance = 2.072 - if (element1 == "SI" and element2 == "F") or ( - element1 == "F" and element2 == "SI" - ): - distance = 1.636 - if (element1 == "SI" and element2 == "P") or ( - element1 == "P" and element2 == "SI" - ): - distance = 2.264 - if (element1 == "SI" and element2 == "S") or ( - element1 == "S" and element2 == "SI" - ): - distance = 2.145 - if (element1 == "SI" and element2 == "SI") or ( - element1 == "SI" and element2 == "SI" - ): - distance = 2.359 - if (element1 == "SI" and element2 == "C") or ( - element1 == "C" and element2 == "SI" - ): - distance = 1.888 - if (element1 == "SI" and element2 == "N") or ( - element1 == "N" and element2 == "SI" - ): - distance = 1.743 - if (element1 == "SI" and element2 == "O") or ( - element1 == "O" and element2 == "SI" - ): - distance = 1.631 + distance = self.update_distance(element1, element2, distance, ["C", "C", 1.53]) + distance = self.update_distance(element1, element2, distance, ["N", "N", 1.425]) + distance = self.update_distance(element1, element2, distance, ["O", "O", 1.469]) + distance = self.update_distance(element1, element2, distance, ["S", "S", 2.048]) + distance = self.update_distance( + element1, element2, distance, ["SI", "SI", 2.359] + ) + + distance = self.update_distance(element1, element2, distance, ["C", "H", 1.059]) + distance = self.update_distance(element1, element2, distance, ["C", "N", 1.469]) + distance = self.update_distance(element1, element2, distance, ["C", "O", 1.413]) + distance = self.update_distance(element1, element2, distance, ["C", "S", 1.819]) + distance = self.update_distance(element1, element2, distance, ["N", "H", 1.009]) + distance = self.update_distance(element1, element2, distance, ["N", "O", 1.463]) + distance = self.update_distance(element1, element2, distance, ["O", "S", 1.577]) + distance = self.update_distance(element1, element2, distance, ["O", "H", 0.967]) + + # This one not from source sited above. Not sure where it's from, + # but it wouldn't ever be used in the current context ("AutoGrow") + distance = self.update_distance( + element1, element2, distance, ["S", "H", 2.025 / 1.5] + ) + + distance = self.update_distance(element1, element2, distance, ["S", "N", 1.633]) + + distance = self.update_distance(element1, element2, distance, ["C", "F", 1.399]) + distance = self.update_distance( + element1, element2, distance, ["C", "CL", 1.790] + ) + distance = self.update_distance( + element1, element2, distance, ["C", "BR", 1.910] + ) + distance = self.update_distance(element1, element2, distance, ["C", "I", 2.162]) + + distance = self.update_distance( + element1, element2, distance, ["S", "BR", 2.321] + ) + distance = self.update_distance( + element1, element2, distance, ["S", "CL", 2.283] + ) + distance = self.update_distance(element1, element2, distance, ["S", "F", 1.640]) + distance = self.update_distance(element1, element2, distance, ["S", "I", 2.687]) + + distance = self.update_distance( + element1, element2, distance, ["P", "BR", 2.366] + ) + distance = self.update_distance( + element1, element2, distance, ["P", "CL", 2.008] + ) + distance = self.update_distance(element1, element2, distance, ["P", "F", 1.495]) + distance = self.update_distance(element1, element2, distance, ["P", "I", 2.490]) + + # estimate based on eye balling Handbook of Chemistry and Physics + distance = self.update_distance(element1, element2, distance, ["P", "O", 1.6]) + + distance = self.update_distance( + element1, element2, distance, ["N", "BR", 1.843] + ) + distance = self.update_distance( + element1, element2, distance, ["N", "CL", 1.743] + ) + distance = self.update_distance(element1, element2, distance, ["N", "F", 1.406]) + distance = self.update_distance(element1, element2, distance, ["N", "I", 2.2]) + + distance = self.update_distance( + element1, element2, distance, ["SI", "BR", 2.284] + ) + distance = self.update_distance( + element1, element2, distance, ["SI", "CL", 2.072] + ) + distance = self.update_distance( + element1, element2, distance, ["SI", "F", 1.636] + ) + distance = self.update_distance( + element1, element2, distance, ["SI", "P", 2.264] + ) + distance = self.update_distance( + element1, element2, distance, ["SI", "S", 2.145] + ) + distance = self.update_distance( + element1, element2, distance, ["SI", "C", 1.888] + ) + distance = self.update_distance( + element1, element2, distance, ["SI", "N", 1.743] + ) + distance = self.update_distance( + element1, element2, distance, ["SI", "O", 1.631] + ) return distance - # Functions to identify positive charges - # ====================================== - def regardless_of_hydrogens(self): - # Charged groups that can be assigned regardless of whether the - # molecules includes hydrogen atoms. - for atom_index in self.non_protein_atoms.keys(): - atom = self.non_protein_atoms[atom_index] - if atom.element in ["MG", "MN", "RH", "ZN", "FE", "BI", "AS", "AG"]: - chrg = self.Charged(atom.coordinates, [atom_index], True) - self.charges.append(chrg) - if atom.element == "N" and atom.number_of_neighbors() == 4: - # a quartinary amine, so it's easy - indexes = [atom_index] - indexes.extend(atom.indecies_of_atoms_connecting) + # Functions to identify hydrogen bond donors and acceptors + # ======================================================== - # so the indicies stored is just the index of the nitrogen - # and any attached atoms - chrg = self.Charged(atom.coordinates, indexes, True) - self.charges.append(chrg) + def _categorize_donor_acceptor_with_hydrogens(self, atom, hydrogen_bond=True): + # Also good for halides even when no hydrogens. - # Assign Charges to atoms in protein - # Param self (Mol) - def assign_charges(self): - # Get all the quartinary amines on non-protein residues (these are the - # only non-protein groups that will be identified as positively - # charged) - for atom_index in self.non_protein_atoms.keys(): - atom = self.non_protein_atoms[atom_index] + central_atom_names = ( + ["H"] if hydrogen_bond else ["I", "BR", "Br", "CL", "Cl", "F"] + ) + h_or_hals = [] - if atom.element == "N" and atom.number_of_neighbors() == 3: - # maybe you only have two hydrogen's added, by they're sp3 - # hybridized. Just count this as a quartinary amine, since - # I think the positive charge would be stabalized. - nitrogen = atom - atom1 = self.all_atoms[atom.indecies_of_atoms_connecting[0]] - atom2 = self.all_atoms[atom.indecies_of_atoms_connecting[1]] - atom3 = self.all_atoms[atom.indecies_of_atoms_connecting[2]] - angle1 = ( - angle_between_three_points( - atom1.coordinates, nitrogen.coordinates, atom2.coordinates - ) - * 180.0 - / math.pi - ) - angle2 = ( - angle_between_three_points( - atom1.coordinates, nitrogen.coordinates, atom3.coordinates - ) - * 180.0 - / math.pi - ) - angle3 = ( - angle_between_three_points( - atom2.coordinates, nitrogen.coordinates, atom3.coordinates - ) - * 180.0 - / math.pi - ) - average_angle = (angle1 + angle2 + angle3) / 3 - if fabs(average_angle - 109.0) < 5.0: - indexes = [atom_index] - indexes.extend(atom.indecies_of_atoms_connecting) - # so indexes added are the nitrogen and any attached - # atoms. - chrg = self.Charged(nitrogen.coordinates, indexes, True) - self.charges.append(chrg) + for atm_index in self.all_atoms.keys(): + central_atom = self.all_atoms[atm_index] + element = central_atom.element + if element in central_atom_names: + # so it's a hydrogen (or halogen) + dist = central_atom.coordinates.dist_to(atom.coordinates) + if dist < _max_donor_X_dist[element]: # 1.3 for H + # central_atom.comment = lbl + h_or_hals.append(central_atom) - if atom.element == "C" and atom.number_of_neighbors() == 3: - # the carbon has only three atoms connected to it - nitrogens = self.connected_atoms_of_given_element(atom_index, "N") - if len(nitrogens) >= 2: - # so carbon is connected to at least two nitrogens. - # now we need to count the number of nitrogens that - # are only connected to one heavy atom (the carbon). - nitrogens_to_use = [] - all_connected = atom.indecies_of_atoms_connecting[:] - for atmindex in nitrogens: - if len(self.connected_heavy_atoms(atmindex)) == 1: - nitrogens_to_use.append(atmindex) - all_connected.remove(atmindex) - - not_isolated = all_connected[0] if len(all_connected) > 0 else -1 - if len(nitrogens_to_use) == 2 and not_isolated != -1: - # so there are at two nitrogens that are only - # connected to the carbon (and probably some - # hydrogens) - - # now you need to make sure not_isolated atom is - # sp3 hybridized - not_isolated_atom = self.all_atoms[not_isolated] - if ( - ( - not_isolated_atom.element == "C" - and not_isolated_atom.number_of_neighbors() == 4 - ) - or ( - not_isolated_atom.element == "O" - and not_isolated_atom.number_of_neighbors() == 2 - ) - or not_isolated_atom.element == "N" - or not_isolated_atom.element == "S" - or not_isolated_atom.element == "P" - ): + # N and O can always be acceptors. + charaterizations = [["ACCEPTOR", None]] - pt = self.all_atoms[ - nitrogens_to_use[0] - ].coordinates.copy_of() - pt.x = ( - pt.x - + self.all_atoms[nitrogens_to_use[1]].coordinates.x - ) - pt.y = ( - pt.y - + self.all_atoms[nitrogens_to_use[1]].coordinates.y - ) - pt.z = ( - pt.z - + self.all_atoms[nitrogens_to_use[1]].coordinates.z - ) - pt.x = pt.x / 2.0 - pt.y = pt.y / 2.0 - pt.z = pt.z / 2.0 - - indexes = [atom_index, *nitrogens_to_use] - indexes.extend( - self.connected_atoms_of_given_element( - nitrogens_to_use[0], "H" - ) - ) - indexes.extend( - self.connected_atoms_of_given_element( - nitrogens_to_use[1], "H" - ) - ) + # Might also be donors + for h_or_hal in h_or_hals: + charaterizations.append(["DONOR", h_or_hal]) - chrg = self.Charged( - pt, indexes, True # True because it's positive - ) - self.charges.append(chrg) - - if atom.element == "C" and atom.number_of_neighbors() == 3: - # a carboxylate carbon will have three items connected to - # it. - oxygens = self.connected_atoms_of_given_element(atom_index, "O") - if len(oxygens) == 2 and ( - len(self.connected_heavy_atoms(oxygens[0])) == 1 - and len(self.connected_heavy_atoms(oxygens[1])) == 1 + return charaterizations + + def _categorize_donor_acceptor_without_hydrogens(self, atom): + charaterizations = [] + + num_neighbors = atom.number_of_neighbors() + + if atom.element == "O": + # If it's an oxygen atom, it's always an acceptor. True of OH, COC, =O, + # nitro, etc. + charaterizations.append(["ACCEPTOR", None]) + + if num_neighbors == 1: + neighbor_idx = atom.indecies_of_atoms_connecting[0] + neighbor = self.all_atoms[neighbor_idx] + neighbor_is_sp3 = neighbor.has_sp3_geometry(self) + + if neighbor.element == "C" and neighbor_is_sp3: + # If its single neighbor is SP3 hybridized, assume COH => + # donor. + charaterizations.append(["DONOR", atom]) + + # So otherwise, carboxylate, ketone, amide, etc. Assume not donor. + + # Note that phosphates, sulfonates, etc., always considered + # deprotonated (not donors). + + elif atom.element == "N": + # Assume all nitrogens can be acceptors + charaterizations.append(["ACCEPTOR", None]) + + num_neighbors = len(atom.indecies_of_atoms_connecting) + + # Note that if bound to only one atom, assuming sp3. + is_sp3 = atom.has_sp3_geometry(self) if num_neighbors > 1 else True + + if (is_sp3 and num_neighbors < 4) or (not is_sp3 and num_neighbors < 3): + # If sp3 but not a quartinary amine, assume it's a donor. Also, + # always assume sp2 hybridized nitrogens can be protonated + # unless connected to three heteroatoms. Some almost certainly + # aren't. But hard to distinguish without calculating pKa. + charaterizations.append(["DONOR", atom]) + + return charaterizations + + def is_hbond_donor_acceptor(self, atom, hydrogen_bond=True): + # hydrogen_bond == False means halogen bond + + if not hydrogen_bond or self.has_hydrogens: + # Halide bond or hydrogen bond with hydrogens specified. + return self._categorize_donor_acceptor_with_hydrogens(atom, hydrogen_bond) + else: + # Hydrogen bond and hydrogens not specified (so guess). + return self._categorize_donor_acceptor_without_hydrogens(atom) + + # Functions to identify charged groups + # ==================================== + + def charges_metals(self, atom_index, atom): + # Works regardless of added hydrogens + if atom.element in ["MG", "MN", "RH", "ZN", "FE", "BI", "AS", "AG"]: + chrg = self.Charged(atom.coordinates, [atom_index], True) + self.charges.append(chrg) + + def charges_arginine_like(self, atom_index, atom): + # e.g., arginine-like, but note that charges on protein residues are + # determined based on residue and atom names. The works regardless of + # hydrogens atoms, though might give slightly different answers. + + if atom.element != "C" or atom.number_of_neighbors() != 3: + return + + # the carbon has only three atoms connected to it + nitrogens = self.connected_atoms_of_element(atom_index, "N") + if len(nitrogens) >= 2: + # so carbon is connected to at least two nitrogens. now we need + # to count the number of nitrogens that are only connected to + # one heavy atom (the carbon, so terminal nitrogens). + # not_term_nitros will contain all the atoms connected to the + # carbon that are not terminal nitrogens. + nitros_to_use = [] + no_term_nitros = atom.indecies_of_atoms_connecting[:] + for atmindex in nitrogens: + if len(self.connected_heavy_atoms(atmindex)) == 1: + # It's a terminal nitrogen + nitros_to_use.append(atmindex) + no_term_nitros.remove(atmindex) + + no_term_nitro_idx = no_term_nitros[0] if len(no_term_nitros) > 0 else -1 + if len(nitros_to_use) == 2 and no_term_nitro_idx != -1: + # so there are at two terminal nitrogens that are only + # connected to the carbon (and probably some hydrogens) + + # now you need to make sure not_term_nitro_index atom is + # sp3 hybridized. For example, NC(N)=C is not charged, + # not is NC(N)=O. If there are no hydrogens added, just + # pass this step automatically (less accurate). + no_term_atm = self.all_atoms[no_term_nitro_idx] + no_term_elem = no_term_atm.element + no_term_neigh = no_term_atm.number_of_neighbors() + + # TODO: You could use has_sp3_geometry instead of making + # exception if not self.has_hydrogens. Not sure if that would + # lead to better or worse accuracy. It's hard without the + # hydrogens added. + if not self.has_hydrogens or ( + (no_term_elem == "C" and no_term_neigh == 4) + or (no_term_elem == "O" and no_term_neigh == 2) + or no_term_elem in ["N", "S", "P"] ): - # so it's a carboxylate! Add a negative charge. - pt = self.all_atoms[oxygens[0]].coordinates.copy_of() - pt.x = pt.x + self.all_atoms[oxygens[1]].coordinates.x - pt.y = pt.y + self.all_atoms[oxygens[1]].coordinates.y - pt.z = pt.z + self.all_atoms[oxygens[1]].coordinates.z + pt = self.all_atoms[nitros_to_use[0]].coordinates.copy_of() + + coor_to_use2 = self.all_atoms[nitros_to_use[1]].coordinates + + pt.x = pt.x + coor_to_use2.x + pt.y = pt.y + coor_to_use2.y + pt.z = pt.z + coor_to_use2.z pt.x = pt.x / 2.0 pt.y = pt.y / 2.0 pt.z = pt.z / 2.0 - chrg = self.Charged( - pt, [oxygens[0], atom_index, oxygens[1]], False + + indexes = [atom_index] + + # Note that * notation doesn't work in transcrypt! Keep + # extend below rather than merge. + indexes.extend(nitros_to_use) + + indexes.extend( + self.connected_atoms_of_element(nitros_to_use[0], "H") + ) + indexes.extend( + self.connected_atoms_of_element(nitros_to_use[1], "H") ) + + # True because it's positive + chrg = self.Charged(pt, indexes, True) self.charges.append(chrg) - if atom.element == "P": - # let's check for a phosphate or anything where a phosphorus - # is bound to two oxygens where both oxygens are bound to only - # one heavy atom (the phosphorus). I think this will get - # several phosphorus substances. - oxygens = self.connected_atoms_of_given_element(atom_index, "O") - if len(oxygens) >= 2: - # the phosphorus is bound to at least two oxygens now - # count the number of oxygens that are only bound to the - # phosphorus - count = sum( - len(self.connected_heavy_atoms(oxygen_index)) == 1 - for oxygen_index in oxygens - ) + def charges_amines(self, atom_index, atom): + if atom.element != "N": + return - if count >= 2: - # so there are at least two oxygens that are only - # bound to the phosphorus - indexes = [atom_index] - indexes.extend(oxygens) - chrg = self.Charged(atom.coordinates, indexes, False) - self.charges.append(chrg) - - if atom.element == "S": - # let's check for a sulfonate or anything where a sulfur is - # bound to at least three oxygens and at least three are bound - # to only the sulfur (or the sulfur and a hydrogen). - oxygens = self.connected_atoms_of_given_element(atom_index, "O") - if len(oxygens) >= 3: - # the sulfur is bound to at least three oxygens. now count - # the number of oxygens that are only bound to the sulfur - count = sum( - len(self.connected_heavy_atoms(oxygen_index)) == 1 - for oxygen_index in oxygens - ) + # If a nitrogen has 4 neighbors, regardless of added hydrogens, it's + # positively charged. + + num_neighors = atom.number_of_neighbors() + + if num_neighors == 4: + # a quartinary amine, so it's easy + indexes = [atom_index] + indexes.extend(atom.indecies_of_atoms_connecting) + + # so the indicies stored is just the index of the nitrogen and any + # attached atoms + chrg = self.Charged(atom.coordinates, indexes, True) + self.charges.append(chrg) + + if self.has_hydrogens: + # maybe you only have two hydrogen's added, but they're sp3 + # hybridized. Just count this as a quartinary amine, since I think + # the positive charge would be stabalized. + if num_neighors == 3 and atom.has_sp3_geometry(self): + indexes = [atom_index] + indexes.extend(atom.indecies_of_atoms_connecting) - if count >= 3: - # so there are at least three oxygens that are only - # bound to the sulfur - indexes = [atom_index] - indexes.extend(oxygens) - chrg = self.Charged(atom.coordinates, indexes, False) - self.charges.append(chrg) + # indexes added are the nitrogen and any attached atoms. + chrg = self.Charged(atom.coordinates, indexes, True) + self.charges.append(chrg) + + elif num_neighors == 1 or atom.has_sp3_geometry(self): + # Hydrogens have not been added. Assume nitrogens bonded to only one + # atom or ones that could be SP3 hybridized are charged. Case of + # quartinary amine covered above. + + chrg = self.Charged(atom.coordinates, [atom_index], True) + self.charges.append(chrg) + + def charges_carboxylate(self, atom_index, atom): + if atom.element != "C": + return + + # Works regardless of whether hydrogens added. - # Now that you've found all the positive charges in non-protein - # residues, it's time to look for aromatic rings in protein residues + if atom.number_of_neighbors() == 3: + # a carboxylate carbon will have three items connected to it. + oxygens = self.connected_atoms_of_element(atom_index, "O") + if len(oxygens) == 2 and ( + len(self.connected_heavy_atoms(oxygens[0])) == 1 + and len(self.connected_heavy_atoms(oxygens[1])) == 1 + ): + # so it's a carboxylate! Add a negative charge. + pt = self.all_atoms[oxygens[0]].coordinates.copy_of() + pt2 = self.all_atoms[oxygens[1]].coordinates + pt.x = pt.x + pt2.x + pt.y = pt.y + pt2.y + pt.z = pt.z + pt2.z + pt.x = pt.x / 2.0 + pt.y = pt.y / 2.0 + pt.z = pt.z / 2.0 + chrg = self.Charged(pt, [oxygens[0], atom_index, oxygens[1]], False) + self.charges.append(chrg) + + def charges_phosphrous_compounds(self, atom_index, atom): + if atom.element != "P": + return + + # Doesn't matter whether hydrogens have been added. + + # let's check for a phosphate or anything where a phosphorus is bound to + # two oxygens where both oxygens are bound to only one heavy atom (the + # phosphorus). I think this will get several phosphorus substances. + oxygens = self.connected_atoms_of_element(atom_index, "O") + if len(oxygens) >= 2: + # the phosphorus is bound to at least two oxygens now count the + # number of oxygens that are only bound to the phosphorus + count = sum( + len(self.connected_heavy_atoms(oxygen_index)) == 1 + for oxygen_index in oxygens + ) + + if count >= 2: + # so there are at least two oxygens that are only + # bound to the phosphorus + indexes = [atom_index] + indexes.extend(oxygens) + chrg = self.Charged(atom.coordinates, indexes, False) + self.charges.append(chrg) + + def charges_sulfur_compounds(self, atom_index, atom): + if atom.element != "S": + return + + # Doesn't matter whether hydrogens added. + + # let's check for a sulfonate or anything where a sulfur is bound to at + # least three oxygens and at least three are bound to only the sulfur + # (or the sulfur and a hydrogen). + oxygens = self.connected_atoms_of_element(atom_index, "O") + if len(oxygens) >= 3: + # the sulfur is bound to at least three oxygens. now count the + # number of oxygens that are only bound to the sulfur + count = sum( + len(self.connected_heavy_atoms(oxygen_index)) == 1 + for oxygen_index in oxygens + ) + + if count >= 3: + # so there are at least three oxygens that are only bound to the + # sulfur + indexes = [atom_index] + indexes.extend(oxygens) + chrg = self.Charged(atom.coordinates, indexes, False) + self.charges.append(chrg) + + # Assign Charges to atoms in protein + # Param self (Mol) + def assign_charges(self): + # Get all the charged groups on non-protein residues (these are the + # only non-protein groups that will be identified as positively + # charged) + + for atom_index in self.non_protein_atoms.keys(): + atom = self.non_protein_atoms[atom_index] + self.charges_metals(atom_index, atom) + self.charges_arginine_like(atom_index, atom) + self.charges_amines(atom_index, atom) + self.charges_carboxylate(atom_index, atom) + self.charges_phosphrous_compounds(atom_index, atom) + self.charges_sulfur_compounds(atom_index, atom) + + # Now that you've found all the charges in non-protein residues, it's + # time to look for charges in protein residues curr_res = "" first = True residue = [] @@ -1108,7 +957,7 @@ def assign_charges(self): if key != curr_res: - self.assign_charged_from_protein_process_residue(residue, last_key) + self.assign_charged_from_protein_residue(residue, last_key) residue = [] curr_res = key @@ -1116,20 +965,20 @@ def assign_charges(self): residue.append(atom_index) last_key = key - self.assign_charged_from_protein_process_residue(residue, last_key) + self.assign_charged_from_protein_residue(residue, last_key) # Assign charges but with protein residue # Param self (Mol) # Param residue () # Param last_key () - def assign_charged_from_protein_process_residue(self, residue, last_key): + def assign_charged_from_protein_residue(self, residue, last_key): temp = last_key.strip().split("_") resname = temp[0] real_resname = resname[-3:] # resid = temp[1] # chain = temp[2] - if real_resname == "LYS" or real_resname == "LYN": + if real_resname in ["LYS", "LYN"]: # regardless of protonation state, assume it's charged. for index in residue: atom = self.all_atoms[index] @@ -1140,11 +989,7 @@ def assign_charged_from_protein_process_residue(self, residue, last_key): indexes = [index] for index2 in residue: atom2 = self.all_atoms[index2] - if atom2.atom_name.strip() == "HZ1": - indexes.append(index2) - if atom2.atom_name.strip() == "HZ2": - indexes.append(index2) - if atom2.atom_name.strip() == "HZ3": + if atom2.atom_name.strip() in ["HZ1", "HZ2", "HZ3"]: indexes.append(index2) chrg = self.Charged(atom.coordinates, indexes, True) @@ -1157,27 +1002,14 @@ def assign_charged_from_protein_process_residue(self, residue, last_key): indices = [] for index in residue: atom = self.all_atoms[index] - if atom.atom_name.strip() == "NH1": + atm_name = atom.atom_name.strip() + if atm_name in ["NH1", "NH2"]: charge_pt.x = charge_pt.x + atom.coordinates.x charge_pt.y = charge_pt.y + atom.coordinates.y charge_pt.z = charge_pt.z + atom.coordinates.z indices.append(index) - count = count + 1.0 - if atom.atom_name.strip() == "NH2": - charge_pt.x = charge_pt.x + atom.coordinates.x - charge_pt.y = charge_pt.y + atom.coordinates.y - charge_pt.z = charge_pt.z + atom.coordinates.z - indices.append(index) - count = count + 1.0 - if atom.atom_name.strip() == "2HH2": - indices.append(index) - if atom.atom_name.strip() == "1HH2": - indices.append(index) - if atom.atom_name.strip() == "CZ": - indices.append(index) - if atom.atom_name.strip() == "2HH1": - indices.append(index) - if atom.atom_name.strip() == "1HH1": + count += 1.0 + if atm_name in ["2HH2", "1HH2", "CZ", "2HH1", "1HH1"]: indices.append(index) if count != 0.0: @@ -1199,27 +1031,14 @@ def assign_charged_from_protein_process_residue(self, residue, last_key): indices = [] for index in residue: atom = self.all_atoms[index] - if atom.atom_name.strip() == "NE2": - charge_pt.x = charge_pt.x + atom.coordinates.x - charge_pt.y = charge_pt.y + atom.coordinates.y - charge_pt.z = charge_pt.z + atom.coordinates.z - indices.append(index) - count = count + 1.0 - if atom.atom_name.strip() == "ND1": + atm_name = atom.atom_name.strip() + if atm_name in ["NE2", "ND1"]: charge_pt.x = charge_pt.x + atom.coordinates.x charge_pt.y = charge_pt.y + atom.coordinates.y charge_pt.z = charge_pt.z + atom.coordinates.z indices.append(index) - count = count + 1.0 - if atom.atom_name.strip() == "HE2": - indices.append(index) - if atom.atom_name.strip() == "HD1": - indices.append(index) - if atom.atom_name.strip() == "CE1": - indices.append(index) - if atom.atom_name.strip() == "CD2": - indices.append(index) - if atom.atom_name.strip() == "CG": + count += 1.0 + if atm_name in ["HE2", "HD1", "CE1", "CD2", "CG"]: indices.append(index) if count != 0.0: @@ -1239,19 +1058,15 @@ def assign_charged_from_protein_process_residue(self, residue, last_key): indices = [] for index in residue: atom = self.all_atoms[index] - if atom.atom_name.strip() == "OE1": - charge_pt.x = charge_pt.x + atom.coordinates.x - charge_pt.y = charge_pt.y + atom.coordinates.y - charge_pt.z = charge_pt.z + atom.coordinates.z - indices.append(index) - count = count + 1.0 - if atom.atom_name.strip() == "OE2": + atm_name = atom.atom_name.strip() + if atm_name in ["OE1", "OE2"]: charge_pt.x = charge_pt.x + atom.coordinates.x charge_pt.y = charge_pt.y + atom.coordinates.y charge_pt.z = charge_pt.z + atom.coordinates.z indices.append(index) - count = count + 1.0 - if atom.atom_name.strip() == "CD": + count += 1.0 + + if atm_name == "CD": indices.append(index) if count != 0.0: @@ -1259,11 +1074,8 @@ def assign_charged_from_protein_process_residue(self, residue, last_key): charge_pt.y = charge_pt.y / count charge_pt.z = charge_pt.z / count if charge_pt.x != 0.0 or charge_pt.y != 0.0 or charge_pt.z != 0.0: - chrg = self.Charged( - charge_pt, - indices, - False, # False because it's a negative charge - ) + # False because it's a negative charge + chrg = self.Charged(charge_pt, indices, False) self.charges.append(chrg) if real_resname in ["ASP", "ASH", "ASX"]: @@ -1275,19 +1087,14 @@ def assign_charged_from_protein_process_residue(self, residue, last_key): indices = [] for index in residue: atom = self.all_atoms[index] - if atom.atom_name.strip() == "OD1": - charge_pt.x = charge_pt.x + atom.coordinates.x - charge_pt.y = charge_pt.y + atom.coordinates.y - charge_pt.z = charge_pt.z + atom.coordinates.z - indices.append(index) - count = count + 1.0 - if atom.atom_name.strip() == "OD2": + atm_name = atom.atom_name.strip() + if atm_name in ["OD1", "OD2"]: charge_pt.x = charge_pt.x + atom.coordinates.x charge_pt.y = charge_pt.y + atom.coordinates.y charge_pt.z = charge_pt.z + atom.coordinates.z indices.append(index) - count = count + 1.0 - if atom.atom_name.strip() == "CG": + count += 1.0 + if atm_name == "CG": indices.append(index) if count != 0.0: @@ -1521,8 +1328,8 @@ def assign_aromatic_rings_from_protein_process_residue(self, residue, last_key): temp = last_key.strip().split("_") resname = temp[0] real_resname = resname[-3:] - resid = temp[1] - chain = temp[2] + # resid = temp[1] + # chain = temp[2] if real_resname == "PHE": indicies_of_ring = [] @@ -1584,12 +1391,7 @@ def assign_aromatic_rings_from_protein_process_residue(self, residue, last_key): self.add_aromatic_marker(indicies_of_ring) - if ( - real_resname == "HIS" - or real_resname == "HID" - or real_resname == "HIE" - or real_resname == "HIP" - ): + if real_resname in ["HIS", "HID", "HIE", "HIP"]: indicies_of_ring = [] for index in residue: # written this way because order is important @@ -1761,36 +1563,36 @@ def assign_secondary_structure(self): # Now give easier to use names to the atoms for atom in atoms: if atom.resid == resid1 and atom.atom_name.strip() == "N": - first_N = atom + first_n = atom if atom.resid == resid1 and atom.atom_name.strip() == "C": - first_C = atom + first_c = atom if atom.resid == resid1 and atom.atom_name.strip() == "CA": - first_CA = atom + first_ca = atom if atom.resid == resid2 and atom.atom_name.strip() == "N": - second_N = atom + second_n = atom if atom.resid == resid2 and atom.atom_name.strip() == "C": - second_C = atom + second_c = atom if atom.resid == resid2 and atom.atom_name.strip() == "CA": - second_CA = atom + second_ca = atom # Now compute the phi and psi dihedral angles phi = ( dihedral( - first_C.coordinates, - second_N.coordinates, - second_CA.coordinates, - second_C.coordinates, + first_c.coordinates, + second_n.coordinates, + second_ca.coordinates, + second_c.coordinates, ) * 180.0 / math.pi ) psi = ( dihedral( - first_N.coordinates, - first_CA.coordinates, - first_C.coordinates, - second_N.coordinates, + first_n.coordinates, + first_ca.coordinates, + first_c.coordinates, + second_n.coordinates, ) * 180.0 / math.pi @@ -1799,8 +1601,8 @@ def assign_secondary_structure(self): # Now use those angles to determine if it's alpha or # beta if phi > -145 and phi < -35 and psi > -70 and psi < 50: - key1 = str(first_C.resid) + "_" + first_C.chain - key2 = str(second_C.resid) + "_" + second_C.chain + key1 = str(first_c.resid) + "_" + first_c.chain + key2 = str(second_c.resid) + "_" + second_c.chain structure[key1] = "ALPHA" structure[key2] = "ALPHA" if (phi >= -180 and phi < -40 and psi <= 180 and psi > 90) or ( @@ -1808,8 +1610,8 @@ def assign_secondary_structure(self): ): # beta. This gets some loops (by my eye), but it's # the best I could do. - key1 = str(first_C.resid) + "_" + first_C.chain - key2 = str(second_C.resid) + "_" + second_C.chain + key1 = str(first_c.resid) + "_" + first_c.chain + key2 = str(second_c.resid) + "_" + second_c.chain structure[key1] = "BETA" structure[key2] = "BETA" @@ -1820,14 +1622,14 @@ def assign_secondary_structure(self): atom.structure = structure[key] # Some more post processing. - CA_list = [] # first build a list of the indices of all the alpha carbons + ca_list = [] # first build a list of the indices of all the alpha carbons for atom_index in self.all_atoms.keys(): atom = self.all_atoms[atom_index] if ( atom.residue.strip() in self.protein_resnames and atom.atom_name.strip() == "CA" ): - CA_list.append(atom_index) + ca_list.append(atom_index) # some more post processing. change = True @@ -1836,13 +1638,13 @@ def assign_secondary_structure(self): # A residue of index i is only going to be in an alpha helix its # CA is within 6 A of the CA of the residue i + 3 - for CA_atom_index in CA_list: + for CA_atom_index in ca_list: CA_atom = self.all_atoms[CA_atom_index] if CA_atom.structure == "ALPHA": # so it's in an alpha helix another_alpha_is_close = False for ( other_CA_atom_index - ) in CA_list: # so now compare that CA to all the other CA's + ) in ca_list: # so now compare that CA to all the other CA's other_CA_atom = self.all_atoms[other_CA_atom_index] if other_CA_atom.structure == "ALPHA": # so it's also in an alpha helix @@ -1868,14 +1670,14 @@ def assign_secondary_structure(self): # residues (to wrap around and hydrogen bond). I'm going to # require them to span at least 5 residues, based on examination # of many structures. - for index_in_list in range(len(CA_list) - 5): + for index_in_list in range(len(ca_list) - 5): - index_in_pdb1 = CA_list[index_in_list] - index_in_pdb2 = CA_list[index_in_list + 1] - index_in_pdb3 = CA_list[index_in_list + 2] - index_in_pdb4 = CA_list[index_in_list + 3] - index_in_pdb5 = CA_list[index_in_list + 4] - index_in_pdb6 = CA_list[index_in_list + 5] + index_in_pdb1 = ca_list[index_in_list] + index_in_pdb2 = ca_list[index_in_list + 1] + index_in_pdb3 = ca_list[index_in_list + 2] + index_in_pdb4 = ca_list[index_in_list + 3] + index_in_pdb5 = ca_list[index_in_list + 4] + index_in_pdb6 = ca_list[index_in_list + 5] atom1 = self.all_atoms[index_in_pdb1] atom2 = self.all_atoms[index_in_pdb2] @@ -1995,11 +1797,11 @@ def assign_secondary_structure(self): # now go through each of the BETA CA atoms. A residue is only # going to be called a beta sheet if CA atom is within 6.0 A of # another CA beta, same chain, but index difference > 2. - for CA_atom_index in CA_list: + for CA_atom_index in ca_list: CA_atom = self.all_atoms[CA_atom_index] if CA_atom.structure == "BETA": # so it's in a beta sheet another_beta_is_close = False - for other_CA_atom_index in CA_list: + for other_CA_atom_index in ca_list: if other_CA_atom_index != CA_atom_index: # so not comparing an atom to itself other_CA_atom = self.all_atoms[other_CA_atom_index] @@ -2035,12 +1837,12 @@ def assign_secondary_structure(self): # beta strand, for example) Beta sheets are usually at least 3 # residues long - for index_in_list in range(len(CA_list) - 3): + for index_in_list in range(len(ca_list) - 3): - index_in_pdb1 = CA_list[index_in_list] - index_in_pdb2 = CA_list[index_in_list + 1] - index_in_pdb3 = CA_list[index_in_list + 2] - index_in_pdb4 = CA_list[index_in_list + 3] + index_in_pdb1 = ca_list[index_in_list] + index_in_pdb2 = ca_list[index_in_list + 1] + index_in_pdb3 = ca_list[index_in_list + 2] + index_in_pdb4 = ca_list[index_in_list + 3] atom1 = self.all_atoms[index_in_pdb1] atom2 = self.all_atoms[index_in_pdb2] diff --git a/python/binana/_test/expected_output/output.pdb b/python/binana/_test/expected_output/output.pdb index 1127f87..933db58 100644 --- a/python/binana/_test/expected_output/output.pdb +++ b/python/binana/_test/expected_output/output.pdb @@ -8,17 +8,17 @@ REMARK cation_pi_dist_cutoff | 6.0 REMARK close_contacts_dist1_cutoff | 2.5 REMARK close_contacts_dist2_cutoff | 4.0 REMARK electrostatic_dist_cutoff | 4.0 -REMARK hydrogen_halogen_bond_angle_cutoff | 40.0 -REMARK hydrogen_halogen_bond_dist_cutoff | 4.0 +REMARK hydrogen_halogen_bond_angle_cutoff | 40.0 +REMARK hydrogen_halogen_bond_dist_cutoff | 4.0 REMARK hydrophobic_dist_cutoff | 4.0 -REMARK ligand | /Users/jdurrant/Documents/Work/durrant_git/binana/binana/test/input/ligand.pdbqt -REMARK output_dir | /Users/jdurrant/Documents/Work/durrant_git/binana/binana/test/output/ -REMARK output_file | /Users/jdurrant/Documents/Work/durrant_git/binana/binana/test/output/output.pdb -REMARK output_json | /Users/jdurrant/Documents/Work/durrant_git/binana/binana/test/output/output.json +REMARK ligand | /Users/jdurrant/Documents/Work/durrant_git/binana/python/binana/_test/input/ligand.pdbqt +REMARK output_dir | /Users/jdurrant/Documents/Work/durrant_git/binana/python/binana/_test/output/ +REMARK output_file | /Users/jdurrant/Documents/Work/durrant_git/binana/python/binana/_test/output/output.pdb +REMARK output_json | /Users/jdurrant/Documents/Work/durrant_git/binana/python/binana/_test/output/output.json REMARK pi_padding_dist | 0.75 REMARK pi_pi_interacting_dist_cutoff | 7.5 REMARK pi_stacking_angle_tolerance | 30.0 -REMARK receptor | /Users/jdurrant/Documents/Work/durrant_git/binana/binana/test/input/receptor.pdbqt +REMARK receptor | /Users/jdurrant/Documents/Work/durrant_git/binana/python/binana/_test/input/receptor.pdbqt REMARK salt_bridge_dist_cutoff | 5.5 REMARK test | False REMARK @@ -8328,11 +8328,11 @@ REMARK "OTH" indicate receptor contacts whose respective protein residues have REMARK the alpha-helix, beta-sheet, or "other" secondary structure. "BAC" and REMARK "SID" indicate receptor contacts that are part of the protein backbone REMARK and sidechain, respectively. "HYD" indicates hydrophobic contacts -REMARK between the protein and ligand. "HBN" indicates hydrogen bonds. "SAL" -REMARK indicates salt bridges. "PIS" indicates pi-pi stacking interactions, -REMARK "PIT" indicates T-stacking interactions, and "PIC" indicates cation-pi -REMARK interactions. Protein residue names are unchanged, but the ligand -REMARK residue is now named "LIG". +REMARK between the protein and ligand. "HBN" indicates hydrogen bonds. "HAL" +REMARK indicates halogen bonds. "SAL" indicates salt bridges. "PIS" indicates +REMARK pi-pi stacking interactions, "PIT" indicates T-stacking interactions, +REMARK and "PIC" indicates cation-pi interactions. Protein residue names are +REMARK unchanged, but the ligand residue is now named "LIG". REMARK ATOM 1 N ASP 23.366 -3.399 14.662 N ATOM 2 CA ASP 22.530 -2.226 14.843 C diff --git a/python/binana/_utils/_math_functions.py b/python/binana/_utils/_math_functions.py index b0298b5..e782166 100644 --- a/python/binana/_utils/_math_functions.py +++ b/python/binana/_utils/_math_functions.py @@ -137,8 +137,7 @@ def dihedral(point1, point2, point3, point4): # never tested b1Xb2 = cross_product(b1, b2) b1XMagb2 = vector_scalar_multiply(b1, b2.magnitude()) - radians = math.atan2(dot_product(b1XMagb2, b2Xb3), dot_product(b1Xb2, b2Xb3)) - return radians + return math.atan2(dot_product(b1XMagb2, b2Xb3), dot_product(b1Xb2, b2Xb3)) def angle_between_three_points(point1, point2, point3): # As in three connected atoms @@ -151,10 +150,8 @@ def angle_between_points(point1, point2): new_point1 = return_normalized_vector(point1) new_point2 = return_normalized_vector(point2) dot_prod = dot_product(new_point1, new_point2) - if dot_prod > 1.0: - dot_prod = 1.0 # to prevent errors that can rarely occur - if dot_prod < -1.0: - dot_prod = -1.0 + dot_prod = min(dot_prod, 1.0) + dot_prod = max(dot_prod, -1.0) return math.acos(dot_prod) diff --git a/python/binana/interactions/_hydrogen_halogen_bonds.py b/python/binana/interactions/_hydrogen_halogen_bonds.py index 04bbe6a..3e625f2 100644 --- a/python/binana/interactions/_hydrogen_halogen_bonds.py +++ b/python/binana/interactions/_hydrogen_halogen_bonds.py @@ -31,17 +31,181 @@ # Be sure to update the corresponding function in # binana.interactions.__init__.py as well! -# O-H distance is 0.96 A, N-H is 1.01 A. See -# http://www.science.uwaterloo.ca/~cchieh/cact/c120/bondel.html -max_donor_X_dist = { - "H": 1.3, - "I": 2.04 * 1.4, # O-I: 2.04 per avogadro - "BR": 1.86 * 1.4, # O-Br: 1.86 - "Br": 1.86 * 1.4, - "CL": 1.71 * 1.4, # O-Cl: 1.71 - "Cl": 1.71 * 1.4, - "F": 1.33 * 1.4, # O-F: 1.33 -} +# # O-H distance is 0.96 A, N-H is 1.01 A. See +# # http://www.science.uwaterloo.ca/~cchieh/cact/c120/bondel.html +# _max_donor_X_dist = { +# "H": 1.3, +# "I": 2.04 * 1.4, # O-I: 2.04 per avogadro +# "BR": 1.86 * 1.4, # O-Br: 1.86 +# "Br": 1.86 * 1.4, +# "CL": 1.71 * 1.4, # O-Cl: 1.71 +# "Cl": 1.71 * 1.4, +# "F": 1.33 * 1.4, # O-F: 1.33 +# } + + +# # def _mimic_set_minus(set1, set2): +# # for s1 in set1: +# # while s1 in set2: +# # set2.remove(s1) +# # return set2 + + +# def _detect_hydrogen_bonds_without_hydrogens(close_donors_acceptors, ligand, receptor): +# # In case the user has not added hydrogen bonds to their structures. Not as +# # accurate. + +# hbonds = {} +# pdb_hbonds = Mol() +# hbonds_labels = [] + +# for lig_atm, recep_atm in close_donors_acceptors: +# lig_categories = ligand._categorize_donor_acceptor_without_hydrogens(lig_atm) +# recep_categories = receptor._categorize_donor_acceptor_without_hydrogens( +# recep_atm +# ) + +# if len(lig_categories) < len(recep_categories): +# recep_categories = _mimic_set_minus(lig_categories, recep_categories) +# # Note that transcrypt doesn't support set subtraction. +# # recep_categories = recep_categories - lig_categories + +# if len(recep_categories) < len(lig_categories): +# lig_categories = _mimic_set_minus(recep_categories, lig_categories) +# # lig_categories = lig_categories - recep_categories + +# # If below occurs, there can't be donor-acceptor pair +# if len(lig_categories) == 0: +# continue +# if len(recep_categories) == 0: +# continue + +# if len(lig_categories) > 0 and len(recep_categories) > 0: +# # They could be complementary (donor-acceptor), but they could also +# # both be donor or both be acceptor. + +# # Pick first lig one (in case there are many) +# lig_category = list(lig_categories)[0] + +# # Remove that one from recep options. +# recep_categories = _mimic_set_minus([lig_category], recep_categories) + +# if len(recep_categories) == 0: +# # There are no complementary donor-acceptor pairs. +# continue + +# # Pick first of remaining receptor ones +# recep_category = list(recep_categories)[0] + +# # ***** + +# comment = "RECEPTOR" if lig_category == "ACCEPTOR" else "LIGAND" + +# hbonds_key = ( +# "HDONOR_" +# + comment +# + "_" +# + recep_atm.side_chain_or_backbone() +# + "_" +# + recep_atm.structure +# ) + +# pdb_hbonds.add_new_atom(lig_atm.copy_of()) +# pdb_hbonds.add_new_atom(recep_atm.copy_of()) +# hashtable_entry_add_one(hbonds, hbonds_key) + +# hbonds_labels.append( +# ( +# lig_atm.string_id(), +# # There is no middle hydrogen in this case, so just repeat +# # one of the heteroatoms. +# lig_atm.string_id() +# if comment == "LIGAND" +# else recep_atm.string_id(), +# recep_atm.string_id(), +# comment, +# ) +# ) + +# return hbonds, pdb_hbonds, hbonds_labels + + +# def _detect_hbonds_by_angle( +# close_donors_acceptors, ligand, receptor, angle_cutoff, hydrogen_bond +# ): +# # Use this function if detecting halogen bonds or hydrogen bonds when the +# # models both include hydrogen atoms. + +# hbonds = {} +# pdb_hbonds = Mol() +# hbonds_labels = [] + +# central_atom_names = ["H"] if hydrogen_bond else ["I", "BR", "Br", "CL", "Cl", "F"] + +# # Now see if there's some sort of hydrogen (or halogen) bond between these +# # two atoms. default distance cutoff = 4, angle cutoff = 40. Note that these +# # cutoffs are generous. +# for lig_atm, recep_atm in close_donors_acceptors: +# # now build a list of all the hydrogens (or halogens) close to these +# # atoms +# h_or_hal = [] + +# for mol, hetero_atom, lbl in [ +# [ligand, lig_atm, "LIGAND"], +# [receptor, recep_atm, "RECEPTOR"], +# ]: +# for atm_index in mol.all_atoms.keys(): +# central_atom = mol.all_atoms[atm_index] +# element = central_atom.element +# if element in central_atom_names: +# # so it's a hydrogen (or halogen) +# dist = central_atom.coordinates.dist_to(hetero_atom.coordinates) +# if dist < _max_donor_X_dist[element]: # 1.3 for H +# central_atom.comment = lbl +# h_or_hal.append(central_atom) + +# # now we need to check the angles +# for center_atm in h_or_hal: +# angle = angle_between_three_points( +# lig_atm.coordinates, +# center_atm.coordinates, +# recep_atm.coordinates, +# ) + +# if fabs(180 - angle * 180.0 / math.pi) > angle_cutoff: +# # Angle is too big. +# continue + +# # If you get here, angle is ok. +# hbonds_key = ( +# "HDONOR_" +# + center_atm.comment +# + "_" +# + recep_atm.side_chain_or_backbone() +# + "_" +# + recep_atm.structure +# ) +# pdb_hbonds.add_new_atom(lig_atm.copy_of()) +# pdb_hbonds.add_new_atom(center_atm.copy_of()) +# pdb_hbonds.add_new_atom(recep_atm.copy_of()) +# hashtable_entry_add_one(hbonds, hbonds_key) + +# hbonds_labels.append( +# ( +# lig_atm.string_id(), +# center_atm.string_id(), +# recep_atm.string_id(), +# center_atm.comment, +# ) +# ) + +# return hbonds, pdb_hbonds, hbonds_labels + + +def _mimic_set_minus(set1, set2): + for s2 in set2: + set1 = [s for s in set1 if s[0] != s2[0]] + return set1 def get_hydrogen_or_halogen_bonds( @@ -79,89 +243,206 @@ def get_hydrogen_or_halogen_bonds( the log file ("labels"). """ - central_atoms = ["H"] if hydrogen_bond else ["I", "BR", "Br", "CL", "Cl", "F"] + hbonds = {} + pdb_hbonds = Mol() + hbonds_labels = [] dist_cutoff = _set_default(dist_cutoff, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF) angle_cutoff = _set_default(angle_cutoff, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF) - hbonds = {} - pdb_hbonds = Mol() - hbonds_labels = [] + # Check if hydrogen atoms added. + lig_and_recep_have_hydrogens = ligand.has_hydrogens and receptor.has_hydrogens # Calculate the distances. ligand_receptor_dists = _get_ligand_receptor_dists(ligand, receptor) - # Now see if there's some sort of hydrogen (or halogen) bond between these - # two atoms. distance cutoff = 4, angle cutoff = 40. Note that these cutoffs - # are generous. - for ligand_atom, receptor_atom, dist in ligand_receptor_dists: + # Get all donor-acceptor pairs that are near each other. + close_donors_acceptors = [ + [ligand_atom, receptor_atom] + for ligand_atom, receptor_atom, dist in ligand_receptor_dists if ( dist < dist_cutoff and ligand_atom.element in ["O", "N"] and receptor_atom.element in ["O", "N"] - ): - # now build a list of all the hydrogens (or halogens) close to these - # atoms - hydrogens = [] - - for atm_index in ligand.all_atoms.keys(): - element = ligand.all_atoms[atm_index].element - if element in central_atoms: - dist = ligand.all_atoms[atm_index].coordinates.dist_to( - ligand_atom.coordinates - ) - if dist < max_donor_X_dist[element]: # 1.3 for H - # so it's a hydrogen (or halogen) - ligand.all_atoms[atm_index].comment = "LIGAND" - hydrogens.append(ligand.all_atoms[atm_index]) - - for atm_index in receptor.all_atoms.keys(): - element = receptor.all_atoms[atm_index].element - if element in central_atoms: - dist = receptor.all_atoms[atm_index].coordinates.dist_to( - receptor_atom.coordinates - ) - if dist < max_donor_X_dist[element]: # 1.3 for H - # so it's a hydrogen (or halogen) - receptor.all_atoms[atm_index].comment = "RECEPTOR" - hydrogens.append(receptor.all_atoms[atm_index]) - - # now we need to check the angles - for hydrogen in hydrogens: - if ( - fabs( - 180 - - angle_between_three_points( - ligand_atom.coordinates, - hydrogen.coordinates, - receptor_atom.coordinates, - ) - * 180.0 - / math.pi - ) - <= angle_cutoff - ): - hbonds_key = ( - "HDONOR_" - + hydrogen.comment - + "_" - + receptor_atom.side_chain_or_backbone() - + "_" - + receptor_atom.structure + ) + ] + + # Go through those pairs and find ones with complementary receptor/ligand + # labels. + for ligand_atom, receptor_atom in close_donors_acceptors: + hbond_detected = False + lig_atm_hbond_infs = ligand.is_hbond_donor_acceptor(ligand_atom, hydrogen_bond) + recep_atm_hbond_infs = receptor.is_hbond_donor_acceptor( + receptor_atom, hydrogen_bond + ) + + # print( + # "Note that above codewasworking before refactoring. Can always try restoring if you can't fix below." + # ) + + # print( + # "This whole process of winnowing down acceptable donor-acceptor pairs is falwed. You need to combinatorial check them all, especially since angles can be used to eliminate them in some cases." + # ) + + for lig_atm_hbond_inf in lig_atm_hbond_infs: + if hbond_detected: + break + + lig_donor_or_accept, lig_center_atom = lig_atm_hbond_inf + for recep_atm_hbond_inf in recep_atm_hbond_infs: + accept_donor_or_accept, accept_center_atom = recep_atm_hbond_inf + + if lig_donor_or_accept == accept_donor_or_accept: + # Both acceptors or both donors. Doesn't work. + continue + + center_atom = ( + lig_center_atom + if lig_donor_or_accept == "DONOR" + else accept_center_atom + ) + + # Now that you've got the atoms, check the angles if appropriate. + if lig_and_recep_have_hydrogens or not hydrogen_bond: + # Hydrogens present and you're detecting hydrogen bonds, or + # you're detecting halogen bonds (so hydrogens don't + # matter). + + angle = angle_between_three_points( + ligand_atom.coordinates, + center_atom.coordinates, + receptor_atom.coordinates, ) - pdb_hbonds.add_new_atom(ligand_atom.copy_of()) - pdb_hbonds.add_new_atom(hydrogen.copy_of()) - pdb_hbonds.add_new_atom(receptor_atom.copy_of()) - hashtable_entry_add_one(hbonds, hbonds_key) - - hbonds_labels.append( - ( - ligand_atom.string_id(), - hydrogen.string_id(), - receptor_atom.string_id(), - hydrogen.comment, - ) + + if fabs(180 - angle * 180.0 / math.pi) > angle_cutoff: + # Angle is too big. + continue + + # Now collect that data. + comment = "RECEPTOR" if lig_donor_or_accept == "ACCEPTOR" else "LIGAND" + + hbonds_key = ( + "HDONOR_" + + comment + + "_" + + receptor_atom.side_chain_or_backbone() + + "_" + + receptor_atom.structure + ) + + pdb_hbonds.add_new_atom(ligand_atom.copy_of()) + pdb_hbonds.add_new_atom(center_atom.copy_of()) + pdb_hbonds.add_new_atom(receptor_atom.copy_of()) + hashtable_entry_add_one(hbonds, hbonds_key) + + hbonds_labels.append( + ( + ligand_atom.string_id(), + center_atom.string_id(), + receptor_atom.string_id(), + comment, ) + ) + + # If you get here, it's identified a hydrogen bond. No need to + # keep checking for a hydrogen bond between these two atoms. + hbond_detected = True + break + + # if len(lig_atm_hbond_infs) < len(recep_atm_hbond_infs): + # recep_atm_hbond_infs = _mimic_set_minus( + # recep_atm_hbond_infs, lig_atm_hbond_infs + # ) + # # Note that transcrypt doesn't support set subtraction. + # # recep_atm_hbond_inf = recep_atm_hbond_inf - lig_atm_hbond_inf + + # if len(recep_atm_hbond_infs) < len(lig_atm_hbond_infs): + # lig_atm_hbond_infs = _mimic_set_minus( + # lig_atm_hbond_infs, recep_atm_hbond_infs + # ) + # # lig_atm_hbond_inf = lig_atm_hbond_inf - recep_atm_hbond_inf + + # # If below occurs, there can't be donor-acceptor pair + # if len(lig_atm_hbond_infs) == 0: + # continue + # if len(recep_atm_hbond_infs) == 0: + # continue + + # if len(lig_atm_hbond_infs) > 0 and len(recep_atm_hbond_infs) > 0: + # # They could be complementary (donor-acceptor), but they could also + # # both be donor or both be acceptor. + + # # Pick first lig one (in case there are many) + # lig_category = lig_atm_hbond_infs[0] + + # # Remove that one from recep options. + # recep_atm_hbond_infs = _mimic_set_minus( + # recep_atm_hbond_infs, [lig_category] + # ) + + # if len(recep_atm_hbond_infs) == 0: + # # There are no complementary donor-acceptor pairs. + # continue + + # # Pick first of remaining receptor ones + # recep_category = recep_atm_hbond_infs[0] + + # # print( + # # "Should therebe mutliple center atoms, and you need to pick between them?" + # # ) + + # center_atom = ( + # recep_category[1] if lig_category[0] == "ACCEPTOR" else lig_category[1] + # ) + + # # Now that you've got the atoms, check the angles if appropriate. + # # TODO: Conditional + # angle = angle_between_three_points( + # ligand_atom.coordinates, + # center_atom.coordinates, + # receptor_atom.coordinates, + # ) + + # if fabs(180 - angle * 180.0 / math.pi) > angle_cutoff: + # # Angle is too big. + # continue + + # # Now collect that data. + # comment = "RECEPTOR" if lig_category[0] == "ACCEPTOR" else "LIGAND" + + # hbonds_key = ( + # "HDONOR_" + # + comment + # + "_" + # + receptor_atom.side_chain_or_backbone() + # + "_" + # + receptor_atom.structure + # ) + + # pdb_hbonds.add_new_atom(ligand_atom.copy_of()) + # pdb_hbonds.add_new_atom(center_atom.copy_of()) + # pdb_hbonds.add_new_atom(receptor_atom.copy_of()) + # hashtable_entry_add_one(hbonds, hbonds_key) + + # # import pdb; pdb.set_trace() + + # hbonds_labels.append( + # ( + # ligand_atom.string_id(), + # center_atom.string_id(), + # receptor_atom.string_id(), + # comment, + # ) + # ) + + # if not hydrogen_bond or (ligand.has_hydrogens and receptor.has_hydrogens): + # hbonds, pdb_hbonds, hbonds_labels = _detect_hbonds_by_angle( + # close_donors_acceptors, ligand, receptor, angle_cutoff, hydrogen_bond + # ) + # else: + # hbonds, pdb_hbonds, hbonds_labels = _detect_hydrogen_bonds_without_hydrogens( + # close_donors_acceptors, ligand, receptor + # ) return { "counts": hbonds, diff --git a/python/binana/interactions/_salt_bridges.py b/python/binana/interactions/_salt_bridges.py index e75d680..57ad236 100644 --- a/python/binana/interactions/_salt_bridges.py +++ b/python/binana/interactions/_salt_bridges.py @@ -64,33 +64,43 @@ def get_salt_bridges(ligand, receptor, cutoff=None): key = "SALT-BRIDGE_" + structure for index in receptor_charge.indices: - pdb_salt_bridges.add_new_atom(receptor.all_atoms[index].copy_of()) + idx = int(index) + atom = receptor.all_atoms[idx] + pdb_salt_bridges.add_new_atom(atom.copy_of()) + for index in ligand_charge.indices: - pdb_salt_bridges.add_new_atom(ligand.all_atoms[index].copy_of()) + idx = int(index) + atom = ligand.all_atoms[idx] + pdb_salt_bridges.add_new_atom(atom.copy_of()) hashtable_entry_add_one(salt_bridges, key) salt_bridge_labels.append( ( - "[" - + " / ".join( - [ - ligand.all_atoms[index].string_id() - for index in ligand_charge.indices - ] - ) - + "]", - "[" - + " / ".join( - [ - receptor.all_atoms[index].string_id() - for index in receptor_charge.indices - ] - ) - + "]", + ( + ( + "[" + + " / ".join( + ligand.all_atoms[int(index)].string_id() + for index in ligand_charge.indices + ) + ) + + "]" + ), + ( + ( + "[" + + " / ".join( + receptor.all_atoms[int(index)].string_id() + for index in receptor_charge.indices + ) + ) + + "]" + ), ) ) + return { "counts": salt_bridges, "mol": pdb_salt_bridges, diff --git a/python/binana/output/_log.py b/python/binana/output/_log.py index eedc88a..918ed28 100644 --- a/python/binana/output/_log.py +++ b/python/binana/output/_log.py @@ -220,7 +220,7 @@ def _get_active_site_flexibility(active_site_flexibility, output): return output -def _get_hbonds(hbonds, output, hydrogen_bond = True): +def _get_hbonds(hbonds, output, hydrogen_bond=True): name = "Hydrogen" if hydrogen_bond else "Halogen" @@ -525,7 +525,7 @@ def collect( output = _get_active_site_flexibility(active_site_flexibility, output) output = _get_hbonds(hydrogen_bonds, output, True) # hydrogen bonds - output = _get_hbonds(hydrogen_bonds, output, False) # halogen bonds + output = _get_hbonds(halogen_bonds, output, False) # halogen bonds output = _get_hydrophobics(hydrophobics, output) diff --git a/web_app/src/BINANAInterface.ts b/web_app/src/BINANAInterface.ts index d038654..c681617 100644 --- a/web_app/src/BINANAInterface.ts +++ b/web_app/src/BINANAInterface.ts @@ -329,7 +329,6 @@ function drawCylinders(interactionType: any[], interactionName: string): void { return; } - // Get atoms. let interactionTypeAtoms = interactionType.map(i => [ i["ligandAtoms"].map(l => atomInfTo3DMolAtom(ligandMol, l)), diff --git a/web_app/src/binanajs/__future__.js b/web_app/src/binanajs/__future__.js index 9c4598f..0d9e931 100644 --- a/web_app/src/binanajs/__future__.js +++ b/web_app/src/binanajs/__future__.js @@ -1,4 +1,4 @@ -// 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'; var __name__ = '__future__'; export var all_feature_names = []; diff --git a/web_app/src/binanajs/binana._cli_params._get_params.js b/web_app/src/binanajs/binana._cli_params._get_params.js index bfd68b8..b8e511f 100644 --- a/web_app/src/binanajs/binana._cli_params._get_params.js +++ b/web_app/src/binanajs/binana._cli_params._get_params.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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'; diff --git a/web_app/src/binanajs/binana._start.js b/web_app/src/binanajs/binana._start.js index 9dc30fa..806cc64 100644 --- a/web_app/src/binanajs/binana._start.js +++ b/web_app/src/binanajs/binana._start.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 binana = {}; var math = {}; diff --git a/web_app/src/binanajs/binana._structure.atom.js b/web_app/src/binanajs/binana._structure.atom.js index 7c6f9ff..2f01d14 100644 --- a/web_app/src/binanajs/binana._structure.atom.js +++ b/web_app/src/binanajs/binana._structure.atom.js @@ -2,13 +2,21 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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 {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 {Point} from './binana._structure.point.js'; import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); +import * as __module_math__ from './math.js'; +__nest__ (math, '', __module_math__); var __name__ = 'binana._structure.atom'; export var Atom = __class__ ('Atom', [object], { __module__: __name__, @@ -55,22 +63,22 @@ export var Atom = __class__ ('Atom', [object], { get create_pdb_line () {return __get__ (this, function (self, index) { 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 (round_to_thousandths_to_str (self.coordinates.x), 18); - var output = 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); - var output = output + r_just (self.element, 24); + output += r_just (round_to_thousandths_to_str (self.coordinates.x), 18); + output += r_just (round_to_thousandths_to_str (self.coordinates.y), 8); + output += r_just (round_to_thousandths_to_str (self.coordinates.z), 8); + output += r_just (self.element, 24); return output; });}, get number_of_neighbors () {return __get__ (this, function (self) { return len (self.indecies_of_atoms_connecting); });}, 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); } });}, 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'; } else { @@ -164,6 +172,29 @@ export var Atom = __class__ ('Atom', [object], { if (self.residue.strip () == '') { 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; });} }); diff --git a/web_app/src/binanajs/binana._structure.mol.js b/web_app/src/binanajs/binana._structure.mol.js index 2eea976..5def03e 100644 --- a/web_app/src/binanajs/binana._structure.mol.js +++ b/web_app/src/binanajs/binana._structure.mol.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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'; @@ -12,7 +12,7 @@ import * as shim from './binana._utils.shim.js'; import * as __module_binana__utils__ from './binana._utils.js'; __nest__ (binana, '_utils', __module_binana__utils__); 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 {Point} from './binana._structure.point.js'; import * as __module_math__ from './math.js'; @@ -21,6 +21,7 @@ import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); var __name__ = 'binana._structure.mol'; 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], { __module__: __name__, get __init__ () {return __get__ (this, function (self) { @@ -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.aromatic_rings = []; 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) { 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], { if (len (line) >= 7 && (line.__getslice__ (0, 4, 1) == 'ATOM' || line.__getslice__ (0, 6, 1) == 'HETATM')) { var temp_atom = Atom (); 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 (self.max_x < temp_atom.coordinates.x) { - self.max_x = temp_atom.coordinates.x; - } - if (self.max_y < temp_atom.coordinates.y) { - self.max_y = temp_atom.coordinates.y; - } - 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; - } + self.max_x = max (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); + self.min_x = min (self.min_x, temp_atom.coordinates.x); + self.min_y = min (self.min_y, temp_atom.coordinates.y); + self.min_z = min (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 (); 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.'); 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); self.all_atoms [autoindex] = temp_atom; if (!__in__ (temp_atom.residue.__getslice__ (-(3), null, 1), self.protein_resnames)) { self.non_protein_atoms [autoindex] = temp_atom; } - var autoindex = autoindex + 1; + autoindex++; } } } @@ -127,6 +120,10 @@ export var Mol = __class__ ('Mol', [object], { self.create_bonds_by_distance (); self.assign_aromatic_rings (); 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) { if (typeof min_x == 'undefined' || (min_x != null && min_x.hasOwnProperty ("__kwargtrans__"))) {; @@ -174,11 +171,13 @@ export var Mol = __class__ ('Mol', [object], { f.close (); });}, get save_pdb_string () {return __get__ (this, function (self) { - var to_output = ''; - for (var atom_index of self.all_atoms.py_keys ()) { - to_output += self.all_atoms [atom_index].create_pdb_line (atom_index) + '\n'; - } - return to_output; + return ''.join ((function () { + var __accu0__ = []; + for (var atom_index of self.all_atoms.py_keys ()) { + __accu0__.append (self.all_atoms [atom_index].create_pdb_line (atom_index) + '\n'); + } + return py_iter (__accu0__); + }) ()); });}, get add_new_atom () {return __get__ (this, function (self, atom) { var t = 1; @@ -200,7 +199,7 @@ export var Mol = __class__ ('Mol', [object], { 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 connected_atoms = []; for (var index2 of atom.indecies_of_atoms_connecting) { @@ -230,7 +229,7 @@ export var Mol = __class__ ('Mol', [object], { for (var atom_index of self.all_atoms.py_keys ()) { var atom = self.all_atoms [atom_index]; var key = (((atom.residue + '_') + str (atom.resid)) + '_') + atom.chain; - if (first === true) { + if (first) { var curr_res = key; var first = false; } @@ -244,181 +243,143 @@ export var Mol = __class__ ('Mol', [object], { } 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) { var temp = last_key.strip ().py_split ('_'); var resname = temp [0]; 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__ ('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.'); - print (''); + self.warn_bad_atom_name ('N', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('C', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CA', last_key); } - if (real_resname == 'GLU' || real_resname == 'GLH' || real_resname == 'GLX') { + if (__in__ (real_resname, ['GLU', 'GLH', 'GLX'])) { 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.'); - print (''); + self.warn_bad_atom_name ('OE1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('OE2', last_key); } } - if (real_resname == 'ASP' || real_resname == 'ASH' || real_resname == 'ASX') { + if (__in__ (real_resname, ['ASP', 'ASH', 'ASX'])) { 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.'); - print (''); + self.warn_bad_atom_name ('OD1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('OD2', last_key); } } - if (real_resname == 'LYS' || real_resname == 'LYN') { - if (!__in__ ('NZ', residue)) { - 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 (__in__ (real_resname, ['LYS', 'LYN']) && !__in__ ('NZ', residue)) { + self.warn_bad_atom_name ('NZ', last_key); } if (real_resname == 'ARG') { 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.'); - print (''); + self.warn_bad_atom_name ('NH1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('NH2', last_key); } } - 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)) { - 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.'); - print (''); + self.warn_bad_atom_name ('NE2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('ND1', last_key); } } if (real_resname == 'PHE') { 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.'); - print (''); + self.warn_bad_atom_name ('CG', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CZ', last_key); } } if (real_resname == 'TYR') { 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.'); - print (''); + self.warn_bad_atom_name ('CG', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CZ', last_key); } } if (real_resname == 'TRP') { 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.'); - print (''); + self.warn_bad_atom_name ('CG', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD2', last_key); } if (!__in__ ('NE1', residue)) { - self.printout (('Warning: There is no atom named "NE1" 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.'); - print (''); + self.warn_bad_atom_name ('NE1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE2', last_key); } if (!__in__ ('CE3', residue)) { - self.printout (('Warning: There is no atom named "CE3" 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.'); - print (''); + self.warn_bad_atom_name ('CE3', last_key); } if (!__in__ ('CZ2', residue)) { - self.printout (('Warning: There is no atom named "CZ2" 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.'); - print (''); + self.warn_bad_atom_name ('CZ2', last_key); } if (!__in__ ('CZ3', residue)) { - self.printout (('Warning: There is no atom named "CZ3" 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.'); - print (''); + self.warn_bad_atom_name ('CZ3', last_key); } if (!__in__ ('CH2', residue)) { - self.printout (('Warning: There is no atom named "CH2" 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.'); - print (''); + self.warn_bad_atom_name ('CH2', last_key); } } - if (real_resname == 'HIS' || real_resname == 'HID' || real_resname == 'HIE' || real_resname == 'HIP') { + if (__in__ (real_resname, ['HIS', 'HID', 'HIE', 'HIP'])) { 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.'); - print (''); + self.warn_bad_atom_name ('CG', last_key); } 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-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); - print (''); + self.warn_bad_atom_name ('ND1', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CD2', last_key); } 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.'); - print (''); + self.warn_bad_atom_name ('CE1', last_key); } 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-pi and pi-cation interactions. If this residue is far from the active site, this warning may not affect the NNScore.'); - print (''); + self.warn_bad_atom_name ('NE2', last_key); } } } @@ -430,7 +391,7 @@ export var Mol = __class__ ('Mol', [object], { for (var atom_index2 of self.non_protein_atoms.py_keys ()) { if (atom_index1 != atom_index2) { var atom2 = self.non_protein_atoms [atom_index2]; - if (!(__in__ (atom2.residue.__getslice__ (-(3), null, 1), self.protein_resnames))) { + if (!__in__ (atom2.residue.__getslice__ (-(3), null, 1), self.protein_resnames)) { var dist = distance (atom1.coordinates, atom2.coordinates); if (dist < self.bond_length (atom1.element, atom2.element) * 1.2) { atom1.add_neighbor_atom_index (atom_index2); @@ -442,251 +403,259 @@ export var Mol = __class__ ('Mol', [object], { } } });}, + get update_distance () {return __get__ (this, function (self, element1, element2, orig_distance, match) { + var __left0__ = match; + var match_element1 = __left0__ [0]; + var match_element2 = __left0__ [1]; + var match_dist = __left0__ [2]; + if (element1 == match_element1 && element2 == match_element2) { + return match_dist; + } + if (element1 == match_element2 && element2 == match_element1) { + return match_dist; + } + return orig_distance; + });}, get bond_length () {return __get__ (this, function (self, element1, element2) { var distance = 0.0; - if (element1 == 'C' && element2 == 'C') { - var distance = 1.53; - } - if (element1 == 'N' && element2 == 'N') { - var distance = 1.425; - } - if (element1 == 'O' && element2 == 'O') { - var distance = 1.469; - } - if (element1 == 'S' && element2 == 'S') { - var distance = 2.048; - } - if (element1 == 'C' && element2 == 'H' || element1 == 'H' && element2 == 'C') { - var distance = 1.059; - } - if (element1 == 'C' && element2 == 'N' || element1 == 'N' && element2 == 'C') { - var distance = 1.469; - } - if (element1 == 'C' && element2 == 'O' || element1 == 'O' && element2 == 'C') { - var distance = 1.413; - } - if (element1 == 'C' && element2 == 'S' || element1 == 'S' && element2 == 'C') { - var distance = 1.819; - } - if (element1 == 'N' && element2 == 'H' || element1 == 'H' && element2 == 'N') { - var distance = 1.009; - } - if (element1 == 'N' && element2 == 'O' || element1 == 'O' && element2 == 'N') { - var distance = 1.463; - } - if (element1 == 'O' && element2 == 'S' || element1 == 'S' && element2 == 'O') { - var distance = 1.577; - } - if (element1 == 'O' && element2 == 'H' || element1 == 'H' && element2 == 'O') { - var distance = 0.967; - } - if (element1 == 'S' && element2 == 'H' || element1 == 'H' && element2 == 'S') { - var distance = 2.025 / 1.5; - } - if (element1 == 'S' && element2 == 'N' || element1 == 'H' && element2 == 'N') { - var distance = 1.633; - } - if (element1 == 'C' && element2 == 'F' || element1 == 'F' && element2 == 'C') { - var distance = 1.399; - } - if (element1 == 'C' && element2 == 'CL' || element1 == 'CL' && element2 == 'C') { - var distance = 1.79; - } - if (element1 == 'C' && element2 == 'BR' || element1 == 'BR' && element2 == 'C') { - var distance = 1.91; - } - if (element1 == 'C' && element2 == 'I' || element1 == 'I' && element2 == 'C') { - var distance = 2.162; - } - if (element1 == 'S' && element2 == 'BR' || element1 == 'BR' && element2 == 'S') { - var distance = 2.321; - } - if (element1 == 'S' && element2 == 'CL' || element1 == 'CL' && element2 == 'S') { - var distance = 2.283; - } - if (element1 == 'S' && element2 == 'F' || element1 == 'F' && element2 == 'S') { - var distance = 1.64; - } - if (element1 == 'S' && element2 == 'I' || element1 == 'I' && element2 == 'S') { - var distance = 2.687; - } - if (element1 == 'P' && element2 == 'BR' || element1 == 'BR' && element2 == 'P') { - var distance = 2.366; + var distance = self.update_distance (element1, element2, distance, ['C', 'C', 1.53]); + var distance = self.update_distance (element1, element2, distance, ['N', 'N', 1.425]); + var distance = self.update_distance (element1, element2, distance, ['O', 'O', 1.469]); + var distance = self.update_distance (element1, element2, distance, ['S', 'S', 2.048]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'SI', 2.359]); + var distance = self.update_distance (element1, element2, distance, ['C', 'H', 1.059]); + var distance = self.update_distance (element1, element2, distance, ['C', 'N', 1.469]); + var distance = self.update_distance (element1, element2, distance, ['C', 'O', 1.413]); + var distance = self.update_distance (element1, element2, distance, ['C', 'S', 1.819]); + var distance = self.update_distance (element1, element2, distance, ['N', 'H', 1.009]); + var distance = self.update_distance (element1, element2, distance, ['N', 'O', 1.463]); + var distance = self.update_distance (element1, element2, distance, ['O', 'S', 1.577]); + var distance = self.update_distance (element1, element2, distance, ['O', 'H', 0.967]); + var distance = self.update_distance (element1, element2, distance, ['S', 'H', 2.025 / 1.5]); + var distance = self.update_distance (element1, element2, distance, ['S', 'N', 1.633]); + var distance = self.update_distance (element1, element2, distance, ['C', 'F', 1.399]); + var distance = self.update_distance (element1, element2, distance, ['C', 'CL', 1.79]); + var distance = self.update_distance (element1, element2, distance, ['C', 'BR', 1.91]); + var distance = self.update_distance (element1, element2, distance, ['C', 'I', 2.162]); + var distance = self.update_distance (element1, element2, distance, ['S', 'BR', 2.321]); + var distance = self.update_distance (element1, element2, distance, ['S', 'CL', 2.283]); + var distance = self.update_distance (element1, element2, distance, ['S', 'F', 1.64]); + var distance = self.update_distance (element1, element2, distance, ['S', 'I', 2.687]); + var distance = self.update_distance (element1, element2, distance, ['P', 'BR', 2.366]); + var distance = self.update_distance (element1, element2, distance, ['P', 'CL', 2.008]); + var distance = self.update_distance (element1, element2, distance, ['P', 'F', 1.495]); + var distance = self.update_distance (element1, element2, distance, ['P', 'I', 2.49]); + var distance = self.update_distance (element1, element2, distance, ['P', 'O', 1.6]); + var distance = self.update_distance (element1, element2, distance, ['N', 'BR', 1.843]); + var distance = self.update_distance (element1, element2, distance, ['N', 'CL', 1.743]); + var distance = self.update_distance (element1, element2, distance, ['N', 'F', 1.406]); + var distance = self.update_distance (element1, element2, distance, ['N', 'I', 2.2]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'BR', 2.284]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'CL', 2.072]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'F', 1.636]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'P', 2.264]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'S', 2.145]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'C', 1.888]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'N', 1.743]); + var distance = self.update_distance (element1, element2, distance, ['SI', 'O', 1.631]); + return distance; + });}, + get _categorize_donor_acceptor_with_hydrogens () {return __get__ (this, function (self, atom, hydrogen_bond) { + if (typeof hydrogen_bond == 'undefined' || (hydrogen_bond != null && hydrogen_bond.hasOwnProperty ("__kwargtrans__"))) {; + var hydrogen_bond = true; + }; + var central_atom_names = (hydrogen_bond ? ['H'] : ['I', 'BR', 'Br', 'CL', 'Cl', 'F']); + var h_or_hals = []; + for (var atm_index of self.all_atoms.py_keys ()) { + var central_atom = self.all_atoms [atm_index]; + var element = central_atom.element; + if (__in__ (element, central_atom_names)) { + var dist = central_atom.coordinates.dist_to (atom.coordinates); + if (dist < _max_donor_X_dist [element]) { + h_or_hals.append (central_atom); + } + } } - if (element1 == 'P' && element2 == 'CL' || element1 == 'CL' && element2 == 'P') { - var distance = 2.008; + var charaterizations = [['ACCEPTOR', null]]; + for (var h_or_hal of h_or_hals) { + charaterizations.append (['DONOR', h_or_hal]); } - if (element1 == 'P' && element2 == 'F' || element1 == 'F' && element2 == 'P') { - var distance = 1.495; + return charaterizations; + });}, + get _categorize_donor_acceptor_without_hydrogens () {return __get__ (this, function (self, atom) { + var charaterizations = []; + var num_neighbors = atom.number_of_neighbors (); + if (atom.element == 'O') { + charaterizations.append (['ACCEPTOR', null]); + if (num_neighbors == 1) { + var neighbor_idx = atom.indecies_of_atoms_connecting [0]; + var neighbor = self.all_atoms [neighbor_idx]; + var neighbor_is_sp3 = neighbor.has_sp3_geometry (self); + if (neighbor.element == 'C' && neighbor_is_sp3) { + charaterizations.append (['DONOR', atom]); + } + } } - if (element1 == 'P' && element2 == 'I' || element1 == 'I' && element2 == 'P') { - var distance = 2.49; + else if (atom.element == 'N') { + charaterizations.append (['ACCEPTOR', null]); + var num_neighbors = len (atom.indecies_of_atoms_connecting); + var is_sp3 = (num_neighbors > 1 ? atom.has_sp3_geometry (self) : true); + if (is_sp3 && num_neighbors < 4 || !(is_sp3) && num_neighbors < 3) { + charaterizations.append (['DONOR', atom]); + } } - if (element1 == 'P' && element2 == 'O' || element1 == 'O' && element2 == 'P') { - var distance = 1.6; + return charaterizations; + });}, + get is_hbond_donor_acceptor () {return __get__ (this, function (self, atom, hydrogen_bond) { + if (typeof hydrogen_bond == 'undefined' || (hydrogen_bond != null && hydrogen_bond.hasOwnProperty ("__kwargtrans__"))) {; + var hydrogen_bond = true; + }; + if (!(hydrogen_bond) || self.has_hydrogens) { + return self._categorize_donor_acceptor_with_hydrogens (atom, hydrogen_bond); } - if (element1 == 'N' && element2 == 'BR' || element1 == 'BR' && element2 == 'N') { - var distance = 1.843; + else { + return self._categorize_donor_acceptor_without_hydrogens (atom); } - if (element1 == 'N' && element2 == 'CL' || element1 == 'CL' && element2 == 'N') { - var distance = 1.743; + });}, + get charges_metals () {return __get__ (this, function (self, atom_index, atom) { + if (__in__ (atom.element, ['MG', 'MN', 'RH', 'ZN', 'FE', 'BI', 'AS', 'AG'])) { + var chrg = self.Charged (atom.coordinates, [atom_index], true); + self.charges.append (chrg); } - if (element1 == 'N' && element2 == 'F' || element1 == 'F' && element2 == 'N') { - var distance = 1.406; + });}, + get charges_arginine_like () {return __get__ (this, function (self, atom_index, atom) { + if (atom.element != 'C' || atom.number_of_neighbors () != 3) { + return ; } - if (element1 == 'N' && element2 == 'I' || element1 == 'I' && element2 == 'N') { - var distance = 2.2; + var nitrogens = self.connected_atoms_of_element (atom_index, 'N'); + if (len (nitrogens) >= 2) { + var nitros_to_use = []; + var no_term_nitros = atom.indecies_of_atoms_connecting.__getslice__ (0, null, 1); + for (var atmindex of nitrogens) { + if (len (self.connected_heavy_atoms (atmindex)) == 1) { + nitros_to_use.append (atmindex); + no_term_nitros.remove (atmindex); + } + } + var no_term_nitro_idx = (len (no_term_nitros) > 0 ? no_term_nitros [0] : -(1)); + if (len (nitros_to_use) == 2 && no_term_nitro_idx != -(1)) { + var no_term_atm = self.all_atoms [no_term_nitro_idx]; + var no_term_elem = no_term_atm.element; + var no_term_neigh = no_term_atm.number_of_neighbors (); + if (!(self.has_hydrogens) || (no_term_elem == 'C' && no_term_neigh == 4 || no_term_elem == 'O' && no_term_neigh == 2 || __in__ (no_term_elem, ['N', 'S', 'P']))) { + var pt = self.all_atoms [nitros_to_use [0]].coordinates.copy_of (); + var coor_to_use2 = self.all_atoms [nitros_to_use [1]].coordinates; + pt.x = pt.x + coor_to_use2.x; + pt.y = pt.y + coor_to_use2.y; + pt.z = pt.z + coor_to_use2.z; + pt.x = pt.x / 2.0; + pt.y = pt.y / 2.0; + pt.z = pt.z / 2.0; + var indexes = [atom_index]; + indexes.extend (nitros_to_use); + indexes.extend (self.connected_atoms_of_element (nitros_to_use [0], 'H')); + indexes.extend (self.connected_atoms_of_element (nitros_to_use [1], 'H')); + var chrg = self.Charged (pt, indexes, true); + self.charges.append (chrg); + } + } } - if (element1 == 'SI' && element2 == 'BR' || element1 == 'BR' && element2 == 'SI') { - var distance = 2.284; + });}, + get charges_amines () {return __get__ (this, function (self, atom_index, atom) { + if (atom.element != 'N') { + return ; } - if (element1 == 'SI' && element2 == 'CL' || element1 == 'CL' && element2 == 'SI') { - var distance = 2.072; + var num_neighors = atom.number_of_neighbors (); + if (num_neighors == 4) { + var indexes = [atom_index]; + indexes.extend (atom.indecies_of_atoms_connecting); + var chrg = self.Charged (atom.coordinates, indexes, true); + self.charges.append (chrg); + } + if (self.has_hydrogens) { + if (num_neighors == 3 && atom.has_sp3_geometry (self)) { + var indexes = [atom_index]; + indexes.extend (atom.indecies_of_atoms_connecting); + var chrg = self.Charged (atom.coordinates, indexes, true); + self.charges.append (chrg); + } } - if (element1 == 'SI' && element2 == 'F' || element1 == 'F' && element2 == 'SI') { - var distance = 1.636; + else if (num_neighors == 1 || atom.has_sp3_geometry (self)) { + var chrg = self.Charged (atom.coordinates, [atom_index], true); + self.charges.append (chrg); } - if (element1 == 'SI' && element2 == 'P' || element1 == 'P' && element2 == 'SI') { - var distance = 2.264; + });}, + get charges_carboxylate () {return __get__ (this, function (self, atom_index, atom) { + if (atom.element != 'C') { + return ; } - if (element1 == 'SI' && element2 == 'S' || element1 == 'S' && element2 == 'SI') { - var distance = 2.145; + if (atom.number_of_neighbors () == 3) { + var oxygens = self.connected_atoms_of_element (atom_index, 'O'); + if (len (oxygens) == 2 && (len (self.connected_heavy_atoms (oxygens [0])) == 1 && len (self.connected_heavy_atoms (oxygens [1])) == 1)) { + var pt = self.all_atoms [oxygens [0]].coordinates.copy_of (); + var pt2 = self.all_atoms [oxygens [1]].coordinates; + pt.x = pt.x + pt2.x; + pt.y = pt.y + pt2.y; + pt.z = pt.z + pt2.z; + pt.x = pt.x / 2.0; + pt.y = pt.y / 2.0; + pt.z = pt.z / 2.0; + var chrg = self.Charged (pt, [oxygens [0], atom_index, oxygens [1]], false); + self.charges.append (chrg); + } } - if (element1 == 'SI' && element2 == 'SI' || element1 == 'SI' && element2 == 'SI') { - var distance = 2.359; + });}, + get charges_phosphrous_compounds () {return __get__ (this, function (self, atom_index, atom) { + if (atom.element != 'P') { + return ; } - if (element1 == 'SI' && element2 == 'C' || element1 == 'C' && element2 == 'SI') { - var distance = 1.888; + var oxygens = self.connected_atoms_of_element (atom_index, 'O'); + if (len (oxygens) >= 2) { + var count = sum ((function () { + var __accu0__ = []; + for (var oxygen_index of oxygens) { + __accu0__.append (len (self.connected_heavy_atoms (oxygen_index)) == 1); + } + return py_iter (__accu0__); + }) ()); + if (count >= 2) { + var indexes = [atom_index]; + indexes.extend (oxygens); + var chrg = self.Charged (atom.coordinates, indexes, false); + self.charges.append (chrg); + } } - if (element1 == 'SI' && element2 == 'N' || element1 == 'N' && element2 == 'SI') { - var distance = 1.743; + });}, + get charges_sulfur_compounds () {return __get__ (this, function (self, atom_index, atom) { + if (atom.element != 'S') { + return ; } - if (element1 == 'SI' && element2 == 'O' || element1 == 'O' && element2 == 'SI') { - var distance = 1.631; + var oxygens = self.connected_atoms_of_element (atom_index, 'O'); + if (len (oxygens) >= 3) { + var count = sum ((function () { + var __accu0__ = []; + for (var oxygen_index of oxygens) { + __accu0__.append (len (self.connected_heavy_atoms (oxygen_index)) == 1); + } + return py_iter (__accu0__); + }) ()); + if (count >= 3) { + var indexes = [atom_index]; + indexes.extend (oxygens); + var chrg = self.Charged (atom.coordinates, indexes, false); + self.charges.append (chrg); + } } - return distance; });}, get assign_charges () {return __get__ (this, function (self) { - var all_charged = []; for (var atom_index of self.non_protein_atoms.py_keys ()) { var atom = self.non_protein_atoms [atom_index]; - if (atom.element == 'MG' || atom.element == 'MN' || atom.element == 'RH' || atom.element == 'ZN' || atom.element == 'FE' || atom.element == 'BI' || atom.element == 'AS' || atom.element == 'AG') { - var chrg = self.Charged (atom.coordinates, [atom_index], true); - self.charges.append (chrg); - } - if (atom.element == 'N') { - if (atom.number_of_neighbors () == 4) { - var indexes = [atom_index]; - indexes.extend (atom.indecies_of_atoms_connecting); - var chrg = self.Charged (atom.coordinates, indexes, true); - self.charges.append (chrg); - } - else if (atom.number_of_neighbors () == 3) { - var nitrogen = atom; - var atom1 = self.all_atoms [atom.indecies_of_atoms_connecting [0]]; - var atom2 = self.all_atoms [atom.indecies_of_atoms_connecting [1]]; - var atom3 = self.all_atoms [atom.indecies_of_atoms_connecting [2]]; - var angle1 = (angle_between_three_points (atom1.coordinates, nitrogen.coordinates, atom2.coordinates) * 180.0) / math.pi; - var angle2 = (angle_between_three_points (atom1.coordinates, nitrogen.coordinates, atom3.coordinates) * 180.0) / math.pi; - var angle3 = (angle_between_three_points (atom2.coordinates, nitrogen.coordinates, atom3.coordinates) * 180.0) / math.pi; - var average_angle = ((angle1 + angle2) + angle3) / 3; - if (fabs (average_angle - 109.0) < 5.0) { - var indexes = [atom_index]; - indexes.extend (atom.indecies_of_atoms_connecting); - var chrg = self.Charged (nitrogen.coordinates, indexes, true); - self.charges.append (chrg); - } - } - } - if (atom.element == 'C') { - if (atom.number_of_neighbors () == 3) { - var nitrogens = self.connected_atoms_of_given_element (atom_index, 'N'); - if (len (nitrogens) >= 2) { - var nitrogens_to_use = []; - var all_connected = atom.indecies_of_atoms_connecting.__getslice__ (0, null, 1); - var not_isolated = -(1); - for (var atmindex of nitrogens) { - if (len (self.connected_heavy_atoms (atmindex)) == 1) { - nitrogens_to_use.append (atmindex); - all_connected.remove (atmindex); - } - } - if (len (all_connected) > 0) { - var not_isolated = all_connected [0]; - } - if (len (nitrogens_to_use) == 2 && not_isolated != -(1)) { - var not_isolated_atom = self.all_atoms [not_isolated]; - if (not_isolated_atom.element == 'C' && not_isolated_atom.number_of_neighbors () == 4 || not_isolated_atom.element == 'O' && not_isolated_atom.number_of_neighbors () == 2 || not_isolated_atom.element == 'N' || not_isolated_atom.element == 'S' || not_isolated_atom.element == 'P') { - var pt = self.all_atoms [nitrogens_to_use [0]].coordinates.copy_of (); - pt.x = pt.x + self.all_atoms [nitrogens_to_use [1]].coordinates.x; - pt.y = pt.y + self.all_atoms [nitrogens_to_use [1]].coordinates.y; - pt.z = pt.z + self.all_atoms [nitrogens_to_use [1]].coordinates.z; - pt.x = pt.x / 2.0; - pt.y = pt.y / 2.0; - pt.z = pt.z / 2.0; - var indexes = [atom_index]; - indexes.extend (nitrogens_to_use); - indexes.extend (self.connected_atoms_of_given_element (nitrogens_to_use [0], 'H')); - indexes.extend (self.connected_atoms_of_given_element (nitrogens_to_use [1], 'H')); - var chrg = self.Charged (pt, indexes, true); - self.charges.append (chrg); - } - } - } - } - } - if (atom.element == 'C') { - if (atom.number_of_neighbors () == 3) { - var oxygens = self.connected_atoms_of_given_element (atom_index, 'O'); - if (len (oxygens) == 2) { - if (len (self.connected_heavy_atoms (oxygens [0])) == 1 && len (self.connected_heavy_atoms (oxygens [1])) == 1) { - var pt = self.all_atoms [oxygens [0]].coordinates.copy_of (); - pt.x = pt.x + self.all_atoms [oxygens [1]].coordinates.x; - pt.y = pt.y + self.all_atoms [oxygens [1]].coordinates.y; - pt.z = pt.z + self.all_atoms [oxygens [1]].coordinates.z; - pt.x = pt.x / 2.0; - pt.y = pt.y / 2.0; - pt.z = pt.z / 2.0; - var chrg = self.Charged (pt, [oxygens [0], atom_index, oxygens [1]], false); - self.charges.append (chrg); - } - } - } - } - if (atom.element == 'P') { - var oxygens = self.connected_atoms_of_given_element (atom_index, 'O'); - if (len (oxygens) >= 2) { - var count = 0; - for (var oxygen_index of oxygens) { - if (len (self.connected_heavy_atoms (oxygen_index)) == 1) { - var count = count + 1; - } - } - if (count >= 2) { - var indexes = [atom_index]; - indexes.extend (oxygens); - var chrg = self.Charged (atom.coordinates, indexes, false); - self.charges.append (chrg); - } - } - } - if (atom.element == 'S') { - var oxygens = self.connected_atoms_of_given_element (atom_index, 'O'); - if (len (oxygens) >= 3) { - var count = 0; - for (var oxygen_index of oxygens) { - if (len (self.connected_heavy_atoms (oxygen_index)) == 1) { - var count = count + 1; - } - } - if (count >= 3) { - var indexes = [atom_index]; - indexes.extend (oxygens); - var chrg = self.Charged (atom.coordinates, indexes, false); - self.charges.append (chrg); - } - } - } + self.charges_metals (atom_index, atom); + self.charges_arginine_like (atom_index, atom); + self.charges_amines (atom_index, atom); + self.charges_carboxylate (atom_index, atom); + self.charges_phosphrous_compounds (atom_index, atom); + self.charges_sulfur_compounds (atom_index, atom); } var curr_res = ''; var first = true; @@ -695,40 +664,32 @@ export var Mol = __class__ ('Mol', [object], { for (var atom_index of self.all_atoms.py_keys ()) { var atom = self.all_atoms [atom_index]; var key = (((atom.residue + '_') + str (atom.resid)) + '_') + atom.chain; - if (first == true) { + if (first) { var curr_res = key; var first = false; } if (key != curr_res) { - self.assign_charged_from_protein_process_residue (residue, last_key); + self.assign_charged_from_protein_residue (residue, last_key); var residue = []; var curr_res = key; } residue.append (atom_index); var last_key = key; } - self.assign_charged_from_protein_process_residue (residue, last_key); + self.assign_charged_from_protein_residue (residue, last_key); });}, - get assign_charged_from_protein_process_residue () {return __get__ (this, function (self, residue, last_key) { + get assign_charged_from_protein_residue () {return __get__ (this, function (self, residue, last_key) { var temp = last_key.strip ().py_split ('_'); var resname = temp [0]; var real_resname = resname.__getslice__ (-(3), null, 1); - var resid = temp [1]; - var chain = temp [2]; - if (real_resname == 'LYS' || real_resname == 'LYN') { + if (__in__ (real_resname, ['LYS', 'LYN'])) { for (var index of residue) { var atom = self.all_atoms [index]; if (atom.atom_name.strip () == 'NZ') { var indexes = [index]; for (var index2 of residue) { var atom2 = self.all_atoms [index2]; - if (atom2.atom_name.strip () == 'HZ1') { - indexes.append (index2); - } - if (atom2.atom_name.strip () == 'HZ2') { - indexes.append (index2); - } - if (atom2.atom_name.strip () == 'HZ3') { + if (__in__ (atom2.atom_name.strip (), ['HZ1', 'HZ2', 'HZ3'])) { indexes.append (index2); } } @@ -744,33 +705,15 @@ export var Mol = __class__ ('Mol', [object], { var indices = []; for (var index of residue) { var atom = self.all_atoms [index]; - if (atom.atom_name.strip () == 'NH1') { + var atm_name = atom.atom_name.strip (); + if (__in__ (atm_name, ['NH1', 'NH2'])) { charge_pt.x = charge_pt.x + atom.coordinates.x; charge_pt.y = charge_pt.y + atom.coordinates.y; charge_pt.z = charge_pt.z + atom.coordinates.z; indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == 'NH2') { - charge_pt.x = charge_pt.x + atom.coordinates.x; - charge_pt.y = charge_pt.y + atom.coordinates.y; - charge_pt.z = charge_pt.z + atom.coordinates.z; - indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == '2HH2') { - indices.append (index); - } - if (atom.atom_name.strip () == '1HH2') { - indices.append (index); - } - if (atom.atom_name.strip () == 'CZ') { - indices.append (index); - } - if (atom.atom_name.strip () == '2HH1') { - indices.append (index); + count++; } - if (atom.atom_name.strip () == '1HH1') { + if (__in__ (atm_name, ['2HH2', '1HH2', 'CZ', '2HH1', '1HH1'])) { indices.append (index); } } @@ -790,33 +733,15 @@ export var Mol = __class__ ('Mol', [object], { var indices = []; for (var index of residue) { var atom = self.all_atoms [index]; - if (atom.atom_name.strip () == 'NE2') { + var atm_name = atom.atom_name.strip (); + if (__in__ (atm_name, ['NE2', 'ND1'])) { charge_pt.x = charge_pt.x + atom.coordinates.x; charge_pt.y = charge_pt.y + atom.coordinates.y; charge_pt.z = charge_pt.z + atom.coordinates.z; indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == 'ND1') { - charge_pt.x = charge_pt.x + atom.coordinates.x; - charge_pt.y = charge_pt.y + atom.coordinates.y; - charge_pt.z = charge_pt.z + atom.coordinates.z; - indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == 'HE2') { - indices.append (index); - } - if (atom.atom_name.strip () == 'HD1') { - indices.append (index); + count++; } - if (atom.atom_name.strip () == 'CE1') { - indices.append (index); - } - if (atom.atom_name.strip () == 'CD2') { - indices.append (index); - } - if (atom.atom_name.strip () == 'CG') { + if (__in__ (atm_name, ['HE2', 'HD1', 'CE1', 'CD2', 'CG'])) { indices.append (index); } } @@ -836,21 +761,15 @@ export var Mol = __class__ ('Mol', [object], { var indices = []; for (var index of residue) { var atom = self.all_atoms [index]; - if (atom.atom_name.strip () == 'OE1') { + var atm_name = atom.atom_name.strip (); + if (__in__ (atm_name, ['OE1', 'OE2'])) { charge_pt.x = charge_pt.x + atom.coordinates.x; charge_pt.y = charge_pt.y + atom.coordinates.y; charge_pt.z = charge_pt.z + atom.coordinates.z; indices.append (index); - var count = count + 1.0; + count++; } - if (atom.atom_name.strip () == 'OE2') { - charge_pt.x = charge_pt.x + atom.coordinates.x; - charge_pt.y = charge_pt.y + atom.coordinates.y; - charge_pt.z = charge_pt.z + atom.coordinates.z; - indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == 'CD') { + if (atm_name == 'CD') { indices.append (index); } } @@ -870,21 +789,15 @@ export var Mol = __class__ ('Mol', [object], { var indices = []; for (var index of residue) { var atom = self.all_atoms [index]; - if (atom.atom_name.strip () == 'OD1') { + var atm_name = atom.atom_name.strip (); + if (__in__ (atm_name, ['OD1', 'OD2'])) { charge_pt.x = charge_pt.x + atom.coordinates.x; charge_pt.y = charge_pt.y + atom.coordinates.y; charge_pt.z = charge_pt.z + atom.coordinates.z; indices.append (index); - var count = count + 1.0; + count++; } - if (atom.atom_name.strip () == 'OD2') { - charge_pt.x = charge_pt.x + atom.coordinates.x; - charge_pt.y = charge_pt.y + atom.coordinates.y; - charge_pt.z = charge_pt.z + atom.coordinates.z; - indices.append (index); - var count = count + 1.0; - } - if (atom.atom_name.strip () == 'CG') { + if (atm_name == 'CG') { indices.append (index); } } @@ -1066,8 +979,6 @@ export var Mol = __class__ ('Mol', [object], { var temp = last_key.strip ().py_split ('_'); var resname = temp [0]; var real_resname = resname.__getslice__ (-(3), null, 1); - var resid = temp [1]; - var chain = temp [2]; if (real_resname == 'PHE') { var indicies_of_ring = []; for (var index of residue) { @@ -1148,7 +1059,7 @@ export var Mol = __class__ ('Mol', [object], { } self.add_aromatic_marker (indicies_of_ring); } - if (real_resname == 'HIS' || real_resname == 'HID' || real_resname == 'HIE' || real_resname == 'HIP') { + if (__in__ (real_resname, ['HIS', 'HID', 'HIE', 'HIP'])) { var indicies_of_ring = []; for (var index of residue) { var atom = self.all_atoms [index]; @@ -1319,35 +1230,35 @@ export var Mol = __class__ ('Mol', [object], { var resid2 = atoms [7].resid; for (var atom of atoms) { if (atom.resid == resid1 && atom.atom_name.strip () == 'N') { - var first_N = atom; + var first_n = atom; } if (atom.resid == resid1 && atom.atom_name.strip () == 'C') { - var first_C = atom; + var first_c = atom; } if (atom.resid == resid1 && atom.atom_name.strip () == 'CA') { - var first_CA = atom; + var first_ca = atom; } if (atom.resid == resid2 && atom.atom_name.strip () == 'N') { - var second_N = atom; + var second_n = atom; } if (atom.resid == resid2 && atom.atom_name.strip () == 'C') { - var second_C = atom; + var second_c = atom; } if (atom.resid == resid2 && atom.atom_name.strip () == 'CA') { - var second_CA = atom; + var second_ca = atom; } } - var phi = (dihedral (first_C.coordinates, second_N.coordinates, second_CA.coordinates, second_C.coordinates) * 180.0) / math.pi; - var psi = (dihedral (first_N.coordinates, first_CA.coordinates, first_C.coordinates, second_N.coordinates) * 180.0) / math.pi; + var phi = (dihedral (first_c.coordinates, second_n.coordinates, second_ca.coordinates, second_c.coordinates) * 180.0) / math.pi; + var psi = (dihedral (first_n.coordinates, first_ca.coordinates, first_c.coordinates, second_n.coordinates) * 180.0) / math.pi; if (phi > -(145) && phi < -(35) && psi > -(70) && psi < 50) { - var key1 = (str (first_C.resid) + '_') + first_C.chain; - var key2 = (str (second_C.resid) + '_') + second_C.chain; + var key1 = (str (first_c.resid) + '_') + first_c.chain; + var key2 = (str (second_c.resid) + '_') + second_c.chain; structure [key1] = 'ALPHA'; structure [key2] = 'ALPHA'; } if (phi >= -(180) && phi < -(40) && psi <= 180 && psi > 90 || phi >= -(180) && phi < -(70) && psi <= -(165)) { - var key1 = (str (first_C.resid) + '_') + first_C.chain; - var key2 = (str (second_C.resid) + '_') + second_C.chain; + var key1 = (str (first_c.resid) + '_') + first_c.chain; + var key2 = (str (second_c.resid) + '_') + second_c.chain; structure [key1] = 'BETA'; structure [key2] = 'BETA'; } @@ -1360,21 +1271,21 @@ export var Mol = __class__ ('Mol', [object], { var key = (str (atom.resid) + '_') + atom.chain; atom.structure = structure [key]; } - var CA_list = []; + var ca_list = []; for (var atom_index of self.all_atoms.py_keys ()) { var atom = self.all_atoms [atom_index]; if (__in__ (atom.residue.strip (), self.protein_resnames) && atom.atom_name.strip () == 'CA') { - CA_list.append (atom_index); + ca_list.append (atom_index); } } var change = true; while (change == true) { var change = false; - for (var CA_atom_index of CA_list) { + for (var CA_atom_index of ca_list) { var CA_atom = self.all_atoms [CA_atom_index]; if (CA_atom.structure == 'ALPHA') { var another_alpha_is_close = false; - for (var other_CA_atom_index of CA_list) { + for (var other_CA_atom_index of ca_list) { var other_CA_atom = self.all_atoms [other_CA_atom_index]; if (other_CA_atom.structure == 'ALPHA') { if (other_CA_atom.resid - 3 == CA_atom.resid || other_CA_atom.resid + 3 == CA_atom.resid) { @@ -1391,13 +1302,13 @@ export var Mol = __class__ ('Mol', [object], { } } } - for (var index_in_list = 0; index_in_list < len (CA_list) - 5; index_in_list++) { - var index_in_pdb1 = CA_list [index_in_list]; - var index_in_pdb2 = CA_list [index_in_list + 1]; - var index_in_pdb3 = CA_list [index_in_list + 2]; - var index_in_pdb4 = CA_list [index_in_list + 3]; - var index_in_pdb5 = CA_list [index_in_list + 4]; - var index_in_pdb6 = CA_list [index_in_list + 5]; + for (var index_in_list = 0; index_in_list < len (ca_list) - 5; index_in_list++) { + var index_in_pdb1 = ca_list [index_in_list]; + var index_in_pdb2 = ca_list [index_in_list + 1]; + var index_in_pdb3 = ca_list [index_in_list + 2]; + var index_in_pdb4 = ca_list [index_in_list + 3]; + var index_in_pdb5 = ca_list [index_in_list + 4]; + var index_in_pdb6 = ca_list [index_in_list + 5]; var atom1 = self.all_atoms [index_in_pdb1]; var atom2 = self.all_atoms [index_in_pdb2]; var atom3 = self.all_atoms [index_in_pdb3]; @@ -1457,11 +1368,11 @@ export var Mol = __class__ ('Mol', [object], { } } } - for (var CA_atom_index of CA_list) { + for (var CA_atom_index of ca_list) { var CA_atom = self.all_atoms [CA_atom_index]; if (CA_atom.structure == 'BETA') { var another_beta_is_close = false; - for (var other_CA_atom_index of CA_list) { + for (var other_CA_atom_index of ca_list) { if (other_CA_atom_index != CA_atom_index) { var other_CA_atom = self.all_atoms [other_CA_atom_index]; if (other_CA_atom.structure == 'BETA') { @@ -1482,11 +1393,11 @@ export var Mol = __class__ ('Mol', [object], { } } } - for (var index_in_list = 0; index_in_list < len (CA_list) - 3; index_in_list++) { - var index_in_pdb1 = CA_list [index_in_list]; - var index_in_pdb2 = CA_list [index_in_list + 1]; - var index_in_pdb3 = CA_list [index_in_list + 2]; - var index_in_pdb4 = CA_list [index_in_list + 3]; + for (var index_in_list = 0; index_in_list < len (ca_list) - 3; index_in_list++) { + var index_in_pdb1 = ca_list [index_in_list]; + var index_in_pdb2 = ca_list [index_in_list + 1]; + var index_in_pdb3 = ca_list [index_in_list + 2]; + var index_in_pdb4 = ca_list [index_in_list + 3]; var atom1 = self.all_atoms [index_in_pdb1]; var atom2 = self.all_atoms [index_in_pdb2]; var atom3 = self.all_atoms [index_in_pdb3]; diff --git a/web_app/src/binanajs/binana._structure.point.js b/web_app/src/binanajs/binana._structure.point.js index 5e517da..6e68487 100644 --- a/web_app/src/binanajs/binana._structure.point.js +++ b/web_app/src/binanajs/binana._structure.point.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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'; diff --git a/web_app/src/binanajs/binana._utils._math_functions.js b/web_app/src/binanajs/binana._utils._math_functions.js index 3be74b8..fbea90e 100644 --- a/web_app/src/binanajs/binana._utils._math_functions.js +++ b/web_app/src/binanajs/binana._utils._math_functions.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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'; @@ -84,8 +84,7 @@ export var dihedral = function (point1, point2, point3, point4) { var b2Xb3 = cross_product (b2, b3); var b1Xb2 = cross_product (b1, b2); var b1XMagb2 = vector_scalar_multiply (b1, b2.magnitude ()); - var radians = math.atan2 (dot_product (b1XMagb2, b2Xb3), dot_product (b1Xb2, b2Xb3)); - return radians; + return math.atan2 (dot_product (b1XMagb2, b2Xb3), dot_product (b1Xb2, b2Xb3)); }; export var angle_between_three_points = function (point1, point2, point3) { var vector1 = vector_subtraction (point1, point2); @@ -96,12 +95,8 @@ export var angle_between_points = function (point1, point2) { var new_point1 = return_normalized_vector (point1); var new_point2 = return_normalized_vector (point2); var dot_prod = dot_product (new_point1, new_point2); - if (dot_prod > 1.0) { - var dot_prod = 1.0; - } - if (dot_prod < -(1.0)) { - var dot_prod = -(1.0); - } + var dot_prod = min (dot_prod, 1.0); + var dot_prod = max (dot_prod, -(1.0)); return math.acos (dot_prod); }; export var return_normalized_vector = function (vector) { diff --git a/web_app/src/binanajs/binana._utils.js b/web_app/src/binanajs/binana._utils.js index 522bb79..ba8bb5d 100644 --- a/web_app/src/binanajs/binana._utils.js +++ b/web_app/src/binanajs/binana._utils.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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__ = 'binana._utils'; diff --git a/web_app/src/binanajs/binana._utils.shim.js b/web_app/src/binanajs/binana._utils.shim.js index 41258cd..eb2b52d 100644 --- a/web_app/src/binanajs/binana._utils.shim.js +++ b/web_app/src/binanajs/binana._utils.shim.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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__ = 'binana._utils.shim'; export var fake_fs = dict ({}); diff --git a/web_app/src/binanajs/binana._utils.utils.js b/web_app/src/binanajs/binana._utils.utils.js index 8003c02..965614f 100644 --- a/web_app/src/binanajs/binana._utils.utils.js +++ b/web_app/src/binanajs/binana._utils.utils.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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 {_set_default} from './binana._utils.shim.js'; var __name__ = 'binana._utils.utils'; diff --git a/web_app/src/binanajs/binana.fs.js b/web_app/src/binanajs/binana.fs.js index d8b7df9..1085572 100644 --- a/web_app/src/binanajs/binana.fs.js +++ b/web_app/src/binanajs/binana.fs.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // details. Copyright 2020 Jacob D. Durrant. -// Transcrypt'ed from Python, 2021-11-05 16:24:10 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 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 {OpenFile} from './binana._utils.shim.js'; @@ -10,7 +10,7 @@ import * as shim from './binana._utils.shim.js'; import * as _utils from './binana._utils.js'; import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); -export {OpenFile, _utils, shim}; +export {_utils, shim, OpenFile}; var __name__ = 'binana.fs'; export var save_file = function (filename, text) { var f = OpenFile (filename, 'w'); diff --git a/web_app/src/binanajs/binana.interactions._cat_pi.js b/web_app/src/binanajs/binana.interactions._cat_pi.js index 32e3a58..eec7812 100644 --- a/web_app/src/binanajs/binana.interactions._cat_pi.js +++ b/web_app/src/binanajs/binana.interactions._cat_pi.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {project_point_onto_plane} from './binana._utils._math_functions.js'; @@ -40,14 +40,14 @@ export var _detect_pi_cat = function (mol_with_aromatic, mol_with_pos_charge, cu for (var index of charged.indices) { __accu0__.append (mol_with_pos_charge.all_atoms [index].string_id ()); } - return __accu0__; + return py_iter (__accu0__); }) ())) + ']'; var aromatic_mol_lbls = ('[' + ' / '.join ((function () { var __accu0__ = []; for (var index of aromatic.indices) { __accu0__.append (mol_with_aromatic.all_atoms [index].string_id ()); } - return __accu0__; + return py_iter (__accu0__); }) ())) + ']'; if (name_of_charged == 'LIGAND') { cat_pi_labels.append (tuple ([charged_mol_lbls, aromatic_mol_lbls])); diff --git a/web_app/src/binanajs/binana.interactions._close.js b/web_app/src/binanajs/binana.interactions._close.js index cf8df7b..b25b424 100644 --- a/web_app/src/binanajs/binana.interactions._close.js +++ b/web_app/src/binanajs/binana.interactions._close.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {Mol} from './binana._structure.mol.js'; diff --git a/web_app/src/binanajs/binana.interactions._closest.js b/web_app/src/binanajs/binana.interactions._closest.js index 6ee9fc8..5c9d2f6 100644 --- a/web_app/src/binanajs/binana.interactions._closest.js +++ b/web_app/src/binanajs/binana.interactions._closest.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {Mol} from './binana._structure.mol.js'; diff --git a/web_app/src/binanajs/binana.interactions._electrostatic_energies.js b/web_app/src/binanajs/binana.interactions._electrostatic_energies.js index 363327c..ee0e60b 100644 --- a/web_app/src/binanajs/binana.interactions._electrostatic_energies.js +++ b/web_app/src/binanajs/binana.interactions._electrostatic_energies.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {hashtable_entry_add_one, list_alphebetize_and_combine} from './binana._utils.utils.js'; diff --git a/web_app/src/binanajs/binana.interactions._flexibility.js b/web_app/src/binanajs/binana.interactions._flexibility.js index 6c9218c..460f1a5 100644 --- a/web_app/src/binanajs/binana.interactions._flexibility.js +++ b/web_app/src/binanajs/binana.interactions._flexibility.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {Mol} from './binana._structure.mol.js'; diff --git a/web_app/src/binanajs/binana.interactions._hydrogen_halogen_bonds.js b/web_app/src/binanajs/binana.interactions._hydrogen_halogen_bonds.js index 25bbe75..de37851 100644 --- a/web_app/src/binanajs/binana.interactions._hydrogen_halogen_bonds.js +++ b/web_app/src/binanajs/binana.interactions._hydrogen_halogen_bonds.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 __future__ = {}; var binana = {}; var math = {}; @@ -21,7 +21,20 @@ __nest__ (binana, '', __module_binana__); import {HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF} from './binana.interactions.default_params.js'; import {_set_default} from './binana._utils.shim.js'; var __name__ = 'binana.interactions._hydrogen_halogen_bonds'; -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 _mimic_set_minus = function (set1, set2) { + for (var s2 of set2) { + var set1 = (function () { + var __accu0__ = []; + for (var s of set1) { + if (s [0] != s2 [0]) { + __accu0__.append (s); + } + } + return __accu0__; + }) (); + } + return set1; +}; export var get_hydrogen_or_halogen_bonds = function (ligand, receptor, dist_cutoff, angle_cutoff, hydrogen_bond) { if (typeof dist_cutoff == 'undefined' || (dist_cutoff != null && dist_cutoff.hasOwnProperty ("__kwargtrans__"))) {; var dist_cutoff = null; @@ -32,45 +45,56 @@ export var get_hydrogen_or_halogen_bonds = function (ligand, receptor, dist_cuto if (typeof hydrogen_bond == 'undefined' || (hydrogen_bond != null && hydrogen_bond.hasOwnProperty ("__kwargtrans__"))) {; var hydrogen_bond = true; }; - var central_atoms = (hydrogen_bond ? ['H'] : ['I', 'BR', 'Br', 'CL', 'Cl', 'F']); - var dist_cutoff = _set_default (dist_cutoff, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF); - var angle_cutoff = _set_default (angle_cutoff, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF); var hbonds = dict ({}); var pdb_hbonds = Mol (); var hbonds_labels = []; + var dist_cutoff = _set_default (dist_cutoff, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF); + var angle_cutoff = _set_default (angle_cutoff, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF); + var lig_and_recep_have_hydrogens = ligand.has_hydrogens && receptor.has_hydrogens; var ligand_receptor_dists = _get_ligand_receptor_dists (ligand, receptor); - for (var [ligand_atom, receptor_atom, dist] of ligand_receptor_dists) { - if (dist < dist_cutoff && __in__ (ligand_atom.element, ['O', 'N']) && __in__ (receptor_atom.element, ['O', 'N'])) { - var hydrogens = []; - for (var atm_index of ligand.all_atoms.py_keys ()) { - var element = ligand.all_atoms [atm_index].element; - if (__in__ (element, central_atoms)) { - var dist = ligand.all_atoms [atm_index].coordinates.dist_to (ligand_atom.coordinates); - if (dist < max_donor_X_dist [element]) { - ligand.all_atoms [atm_index].comment = 'LIGAND'; - hydrogens.append (ligand.all_atoms [atm_index]); - } - } + var close_donors_acceptors = (function () { + var __accu0__ = []; + for (var [ligand_atom, receptor_atom, dist] of ligand_receptor_dists) { + if (dist < dist_cutoff && __in__ (ligand_atom.element, ['O', 'N']) && __in__ (receptor_atom.element, ['O', 'N'])) { + __accu0__.append ([ligand_atom, receptor_atom]); } - for (var atm_index of receptor.all_atoms.py_keys ()) { - var element = receptor.all_atoms [atm_index].element; - if (__in__ (element, central_atoms)) { - var dist = receptor.all_atoms [atm_index].coordinates.dist_to (receptor_atom.coordinates); - if (dist < max_donor_X_dist [element]) { - receptor.all_atoms [atm_index].comment = 'RECEPTOR'; - hydrogens.append (receptor.all_atoms [atm_index]); - } - } + } + return __accu0__; + }) (); + for (var [ligand_atom, receptor_atom] of close_donors_acceptors) { + var hbond_detected = false; + var lig_atm_hbond_infs = ligand.is_hbond_donor_acceptor (ligand_atom, hydrogen_bond); + var recep_atm_hbond_infs = receptor.is_hbond_donor_acceptor (receptor_atom, hydrogen_bond); + for (var lig_atm_hbond_inf of lig_atm_hbond_infs) { + if (hbond_detected) { + break; } - for (var hydrogen of hydrogens) { - if (fabs (180 - (angle_between_three_points (ligand_atom.coordinates, hydrogen.coordinates, receptor_atom.coordinates) * 180.0) / math.pi) <= angle_cutoff) { - var hbonds_key = (((('HDONOR_' + hydrogen.comment) + '_') + receptor_atom.side_chain_or_backbone ()) + '_') + receptor_atom.structure; - pdb_hbonds.add_new_atom (ligand_atom.copy_of ()); - pdb_hbonds.add_new_atom (hydrogen.copy_of ()); - pdb_hbonds.add_new_atom (receptor_atom.copy_of ()); - hashtable_entry_add_one (hbonds, hbonds_key); - hbonds_labels.append (tuple ([ligand_atom.string_id (), hydrogen.string_id (), receptor_atom.string_id (), hydrogen.comment])); + var __left0__ = lig_atm_hbond_inf; + var lig_donor_or_accept = __left0__ [0]; + var lig_center_atom = __left0__ [1]; + for (var recep_atm_hbond_inf of recep_atm_hbond_infs) { + var __left0__ = recep_atm_hbond_inf; + var accept_donor_or_accept = __left0__ [0]; + var accept_center_atom = __left0__ [1]; + if (lig_donor_or_accept == accept_donor_or_accept) { + continue; + } + var center_atom = (lig_donor_or_accept == 'DONOR' ? lig_center_atom : accept_center_atom); + if (lig_and_recep_have_hydrogens && hydrogen_bond) { + var angle = angle_between_three_points (ligand_atom.coordinates, center_atom.coordinates, receptor_atom.coordinates); + if (fabs (180 - (angle * 180.0) / math.pi) > angle_cutoff) { + continue; + } } + var comment = (lig_donor_or_accept == 'ACCEPTOR' ? 'RECEPTOR' : 'LIGAND'); + var hbonds_key = (((('HDONOR_' + comment) + '_') + receptor_atom.side_chain_or_backbone ()) + '_') + receptor_atom.structure; + pdb_hbonds.add_new_atom (ligand_atom.copy_of ()); + pdb_hbonds.add_new_atom (center_atom.copy_of ()); + pdb_hbonds.add_new_atom (receptor_atom.copy_of ()); + hashtable_entry_add_one (hbonds, hbonds_key); + hbonds_labels.append (tuple ([ligand_atom.string_id (), center_atom.string_id (), receptor_atom.string_id (), comment])); + var hbond_detected = true; + break; } } } diff --git a/web_app/src/binanajs/binana.interactions._hydrophobics.js b/web_app/src/binanajs/binana.interactions._hydrophobics.js index e32097e..d5b40ca 100644 --- a/web_app/src/binanajs/binana.interactions._hydrophobics.js +++ b/web_app/src/binanajs/binana.interactions._hydrophobics.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {Mol} from './binana._structure.mol.js'; diff --git a/web_app/src/binanajs/binana.interactions._ligand_atom_types.js b/web_app/src/binanajs/binana.interactions._ligand_atom_types.js index eab2dae..6a66c1c 100644 --- a/web_app/src/binanajs/binana.interactions._ligand_atom_types.js +++ b/web_app/src/binanajs/binana.interactions._ligand_atom_types.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {hashtable_entry_add_one, list_alphebetize_and_combine} from './binana._utils.utils.js'; diff --git a/web_app/src/binanajs/binana.interactions._pi_pi.js b/web_app/src/binanajs/binana.interactions._pi_pi.js index c992cc9..7fb386f 100644 --- a/web_app/src/binanajs/binana.interactions._pi_pi.js +++ b/web_app/src/binanajs/binana.interactions._pi_pi.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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'; diff --git a/web_app/src/binanajs/binana.interactions._salt_bridges.js b/web_app/src/binanajs/binana.interactions._salt_bridges.js index f0450b2..89fa1d9 100644 --- a/web_app/src/binanajs/binana.interactions._salt_bridges.js +++ b/web_app/src/binanajs/binana.interactions._salt_bridges.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {Mol} from './binana._structure.mol.js'; @@ -30,24 +30,28 @@ export var get_salt_bridges = function (ligand, receptor, cutoff) { } var key = 'SALT-BRIDGE_' + structure; for (var index of receptor_charge.indices) { - pdb_salt_bridges.add_new_atom (receptor.all_atoms [index].copy_of ()); + var idx = int (index); + var atom = receptor.all_atoms [idx]; + pdb_salt_bridges.add_new_atom (atom.copy_of ()); } for (var index of ligand_charge.indices) { - pdb_salt_bridges.add_new_atom (ligand.all_atoms [index].copy_of ()); + var idx = int (index); + var atom = ligand.all_atoms [idx]; + pdb_salt_bridges.add_new_atom (atom.copy_of ()); } hashtable_entry_add_one (salt_bridges, key); salt_bridge_labels.append (tuple ([('[' + ' / '.join ((function () { var __accu0__ = []; for (var index of ligand_charge.indices) { - __accu0__.append (ligand.all_atoms [index].string_id ()); + __accu0__.append (ligand.all_atoms [int (index)].string_id ()); } - return __accu0__; + return py_iter (__accu0__); }) ())) + ']', ('[' + ' / '.join ((function () { var __accu0__ = []; for (var index of receptor_charge.indices) { - __accu0__.append (receptor.all_atoms [index].string_id ()); + __accu0__.append (receptor.all_atoms [int (index)].string_id ()); } - return __accu0__; + return py_iter (__accu0__); }) ())) + ']'])); } } diff --git a/web_app/src/binanajs/binana.interactions.default_params.js b/web_app/src/binanajs/binana.interactions.default_params.js index f813767..4df3125 100644 --- a/web_app/src/binanajs/binana.interactions.default_params.js +++ b/web_app/src/binanajs/binana.interactions.default_params.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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__ = 'binana.interactions.default_params'; export var CLOSE_CONTACTS_DIST1_CUTOFF = 2.5; diff --git a/web_app/src/binanajs/binana.interactions.js b/web_app/src/binanajs/binana.interactions.js index 0db1552..63ed182 100644 --- a/web_app/src/binanajs/binana.interactions.js +++ b/web_app/src/binanajs/binana.interactions.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 _closest from './binana.interactions._closest.js'; @@ -22,7 +22,7 @@ __nest__ (binana, '', __module_binana__); import {ACTIVE_SITE_FLEXIBILITY_DIST_CUTOFF, CATION_PI_DIST_CUTOFF, CLOSE_CONTACTS_DIST1_CUTOFF, CLOSE_CONTACTS_DIST2_CUTOFF, ELECTROSTATIC_DIST_CUTOFF, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF, HYDROPHOBIC_DIST_CUTOFF, PI_PADDING_DIST, PI_PI_INTERACTING_DIST_CUTOFF, PI_STACKING_ANGLE_TOLERANCE, SALT_BRIDGE_DIST_CUTOFF, T_STACKING_ANGLE_TOLERANCE, T_STACKING_CLOSEST_DIST_CUTOFF} from './binana.interactions.default_params.js'; import {_set_default} from './binana._utils.shim.js'; import * as default_params from './binana.interactions.default_params.js'; -export {CLOSE_CONTACTS_DIST2_CUTOFF, _cat_pi, PI_PADDING_DIST, _flexibility, CATION_PI_DIST_CUTOFF, _closest, _electrostatic_energies, default_params, HYDROPHOBIC_DIST_CUTOFF, CLOSE_CONTACTS_DIST1_CUTOFF, SALT_BRIDGE_DIST_CUTOFF, _hydrophobics, T_STACKING_ANGLE_TOLERANCE, _close, _ligand_atom_types, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF, ACTIVE_SITE_FLEXIBILITY_DIST_CUTOFF, ELECTROSTATIC_DIST_CUTOFF, _set_default, PI_PI_INTERACTING_DIST_CUTOFF, _salt_bridges, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF, T_STACKING_CLOSEST_DIST_CUTOFF, PI_STACKING_ANGLE_TOLERANCE, _hydrogen_halogen_bonds, _pi_pi}; +export {HYDROPHOBIC_DIST_CUTOFF, default_params, T_STACKING_ANGLE_TOLERANCE, HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF, PI_PADDING_DIST, _pi_pi, _salt_bridges, PI_STACKING_ANGLE_TOLERANCE, ACTIVE_SITE_FLEXIBILITY_DIST_CUTOFF, _hydrophobics, _electrostatic_energies, _flexibility, _hydrogen_halogen_bonds, T_STACKING_CLOSEST_DIST_CUTOFF, CLOSE_CONTACTS_DIST1_CUTOFF, CLOSE_CONTACTS_DIST2_CUTOFF, SALT_BRIDGE_DIST_CUTOFF, _ligand_atom_types, _closest, _close, CATION_PI_DIST_CUTOFF, PI_PI_INTERACTING_DIST_CUTOFF, HYDROGEN_HALOGEN_BOND_DIST_CUTOFF, _set_default, _cat_pi, ELECTROSTATIC_DIST_CUTOFF}; var __name__ = 'binana.interactions'; export var get_cation_pi = function (ligand, receptor, cutoff, pi_padding) { if (typeof cutoff == 'undefined' || (cutoff != null && cutoff.hasOwnProperty ("__kwargtrans__"))) {; diff --git a/web_app/src/binanajs/binana.js b/web_app/src/binanajs/binana.js index 85981e5..1a1c194 100644 --- a/web_app/src/binanajs/binana.js +++ b/web_app/src/binanajs/binana.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 _get_params from './binana._cli_params._get_params.js'; @@ -13,7 +13,7 @@ import * as load_ligand_receptor from './binana.load_ligand_receptor.js'; import * as fs from './binana.fs.js'; import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); -export {fs, output, _get_params, interactions, load_ligand_receptor, _start}; +export {fs, _get_params, _start, output, interactions, load_ligand_receptor}; var __name__ = '__main__'; export var _sys = binana.sys; export var run = function (args) { diff --git a/web_app/src/binanajs/binana.load_ligand_receptor.js b/web_app/src/binanajs/binana.load_ligand_receptor.js index aa9331d..b2c771c 100644 --- a/web_app/src/binanajs/binana.load_ligand_receptor.js +++ b/web_app/src/binanajs/binana.load_ligand_receptor.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 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'; @@ -13,7 +13,7 @@ import * as __module_math__ from './math.js'; __nest__ (math, '', __module_math__); import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); -export {_Point, _Mol, _math_functions}; +export {_math_functions, _Point, _Mol}; var __name__ = 'binana.load_ligand_receptor'; export var _ligand_receptor_dists = null; export var _ligand_receptor_aromatic_dists = null; diff --git a/web_app/src/binanajs/binana.output._directory.js b/web_app/src/binanajs/binana.output._directory.js index 58e8669..8068b9e 100644 --- a/web_app/src/binanajs/binana.output._directory.js +++ b/web_app/src/binanajs/binana.output._directory.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // details. Copyright 2020 Jacob D. Durrant. -// Transcrypt'ed from Python, 2021-11-05 16:24:10 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 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 * as shim from './binana._utils.shim.js'; @@ -10,7 +10,7 @@ import * as __module_binana__ from './binana.js'; __nest__ (binana, '', __module_binana__); import * as vmd_state from './binana.output._directory.vmd_state.js'; import * as pdbs from './binana.output._directory.pdbs.js'; -export {vmd_state, pdbs, shim}; +export {pdbs, vmd_state, shim}; var __name__ = 'binana.output._directory'; export var os = shim; export var make_directory_output = function (parameters, closest, close, active_site_flexibility, hydrophobics, hydrogen_bonds, halogen_bonds, pi_pi, cat_pi, salt_bridges, ligand, receptor) { diff --git a/web_app/src/binanajs/binana.output._directory.pdbs.js b/web_app/src/binanajs/binana.output._directory.pdbs.js index edee545..b8a74e4 100644 --- a/web_app/src/binanajs/binana.output._directory.pdbs.js +++ b/web_app/src/binanajs/binana.output._directory.pdbs.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // details. Copyright 2020 Jacob D. Durrant. -// Transcrypt'ed from Python, 2021-11-05 16:24:10 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 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__ = 'binana.output._directory.pdbs'; export var output_dir_pdbs = function (pdb_closest_contacts, parameters, pdb_close_contacts, pdb_contacts_alpha_helix, pdb_contacts_beta_sheet, pdb_contacts_other_2nd_structure, pdb_back_bone, pdb_side_chain, pdb_hydrophobic, pdb_hbonds, pdb_halbonds, pdb_pistack, pdb_pi_T, pdb_pi_cat, pdb_salt_bridges, ligand, receptor) { diff --git a/web_app/src/binanajs/binana.output._directory.vmd_state.js b/web_app/src/binanajs/binana.output._directory.vmd_state.js index 36c3f25..dfeebb0 100644 --- a/web_app/src/binanajs/binana.output._directory.vmd_state.js +++ b/web_app/src/binanajs/binana.output._directory.vmd_state.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // details. Copyright 2020 Jacob D. Durrant. -// Transcrypt'ed from Python, 2021-11-05 16:24:10 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 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 {OpenFile} from './binana._utils.shim.js'; diff --git a/web_app/src/binanajs/binana.output._log.js b/web_app/src/binanajs/binana.output._log.js index 1213e6e..e41fe75 100644 --- a/web_app/src/binanajs/binana.output._log.js +++ b/web_app/src/binanajs/binana.output._log.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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:34 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 * as json from './binana._utils.shim.js'; diff --git a/web_app/src/binanajs/binana.output.dictionary.js b/web_app/src/binanajs/binana.output.dictionary.js index f4fbaa2..4d3c1b9 100644 --- a/web_app/src/binanajs/binana.output.dictionary.js +++ b/web_app/src/binanajs/binana.output.dictionary.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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:34 var binana = {}; var re = {}; 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'; diff --git a/web_app/src/binanajs/binana.output.js b/web_app/src/binanajs/binana.output.js index a593230..3d3cddc 100644 --- a/web_app/src/binanajs/binana.output.js +++ b/web_app/src/binanajs/binana.output.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {OpenFile as _openFile} from './binana._utils.shim.js'; @@ -13,7 +13,7 @@ import * as pdb_file from './binana.output.pdb_file.js'; import * as _log from './binana.output._log.js'; import * as dictionary from './binana.output.dictionary.js'; import * as _directory from './binana.output._directory.js'; -export {_directory, _openFile, dictionary, _json, pdb_file, _log}; +export {_openFile, _directory, _json, dictionary, pdb_file, _log}; var __name__ = 'binana.output'; export var _write_main = function (parameters, ligand, receptor, closest, close, hydrophobics, hydrogen_bonds, halogen_bonds, salt_bridges, pi_pi, cat_pi, electrostatic_energies, active_site_flexibility, ligand_atom_types) { var json_output = binana.output.dictionary.collect (closest, close, hydrophobics, hydrogen_bonds, halogen_bonds, salt_bridges, pi_pi, cat_pi, electrostatic_energies, active_site_flexibility, ligand_atom_types, __kwargtrans__ ({ligand_rotatable_bonds: ligand.rotatable_bonds_count})); diff --git a/web_app/src/binanajs/binana.output.pdb_file.js b/web_app/src/binanajs/binana.output.pdb_file.js index 0377bcb..3d634ed 100644 --- a/web_app/src/binanajs/binana.output.pdb_file.js +++ b/web_app/src/binanajs/binana.output.pdb_file.js @@ -2,7 +2,7 @@ // LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full // 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 = {}; 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 {OpenFile} from './binana._utils.shim.js'; diff --git a/web_app/src/binanajs/compile_and_copy_here.sh b/web_app/src/binanajs/compile_and_copy_here.sh index 482df1d..3312ffb 100755 --- a/web_app/src/binanajs/compile_and_copy_here.sh +++ b/web_app/src/binanajs/compile_and_copy_here.sh @@ -1,12 +1,12 @@ source activate Python36 -# Clean up old files. -ls | grep -v "compile_and_copy_here.sh" | awk '{print "rm " $1}' | bash - # Compile the python to javascript. Assumes transcrypt installed. cd ../../../javascript/ ./compile.sh cd - +# Clean up old files. +ls | grep -v "compile_and_copy_here.sh" | awk '{print "rm " $1}' | bash + # Copy over compiled files. cp ../../../javascript/lib/* ./ diff --git a/web_app/src/binanajs/math.js b/web_app/src/binanajs/math.js index 4976c47..f9b7f89 100644 --- a/web_app/src/binanajs/math.js +++ b/web_app/src/binanajs/math.js @@ -1,4 +1,4 @@ -// Transcrypt'ed from Python, 2021-11-05 16:24:08 +// Transcrypt'ed from Python, 2021-11-09 00:25:32 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, 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__ = 'math'; export var pi = Math.PI; diff --git a/web_app/src/binanajs/org.transcrypt.__runtime__.js b/web_app/src/binanajs/org.transcrypt.__runtime__.js index 15eca37..650e004 100644 --- a/web_app/src/binanajs/org.transcrypt.__runtime__.js +++ b/web_app/src/binanajs/org.transcrypt.__runtime__.js @@ -1,4 +1,4 @@ -// Transcrypt'ed from Python, 2021-11-05 16:24:08 +// Transcrypt'ed from Python, 2021-11-09 00:25:32 var __name__ = 'org.transcrypt.__runtime__'; export var __envir__ = {}; __envir__.interpreter_name = 'python'; diff --git a/web_app/src/binanajs/re.js b/web_app/src/binanajs/re.js index dc63cda..1e55cc9 100644 --- a/web_app/src/binanajs/re.js +++ b/web_app/src/binanajs/re.js @@ -1,4 +1,4 @@ -// Transcrypt'ed from Python, 2021-11-05 16:24:09 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 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 {translate} from './re.translate.js'; export {translate}; diff --git a/web_app/src/binanajs/re.translate.js b/web_app/src/binanajs/re.translate.js index 00bda7b..9b8fb11 100644 --- a/web_app/src/binanajs/re.translate.js +++ b/web_app/src/binanajs/re.translate.js @@ -1,4 +1,4 @@ -// Transcrypt'ed from Python, 2021-11-05 16:24:10 +// Transcrypt'ed from Python, 2021-11-09 00:25:34 var re = {}; 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_re__ from './re.js';