Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
jdurrant
binana
Commits
d93c4e09
Commit
d93c4e09
authored
Nov 27, 2021
by
jdurrant
Browse files
Updated license notices, etc.
parent
9b0ebf69
Changes
176
Expand all
Hide whitespace changes
Inline
Side-by-side
CHANGES.md
View file @
d93c4e09
Changes
=======
WIP
---
2.
1
WIP
---
----
1.
Can select multiple interactions at once.
2.
PNG file included in download from "Save" button. Also, log.txt file, for
...
...
@@ -31,41 +31,20 @@ WIP
19.
output_csv option now also prints csv file containing same information as json.
20.
Possible to toggle ribbon on and off.
21.
Updated documentation.
22.
chain and resid now included in output PDB files.
23.
Throws a warning when using Python 2. Only Python 3 now offically supported.
TODO:
Hydrogen bonds w/o hydrogens added. Need to be more judicious. Remove certain
bonds per this heuristic:
*
For oxygen and sulfur, sum of actual neighbors and hydrogen bonds cannot be >
two. Remember to account for water molecules. Pick based on distance, dihedral
angle. =O not marked as donor, so don't need to worry about that.
*
Nitrogen cannot donate to more than actual neighbors + hydrogen bonds > 4, as
above.
*
chain and resid now included in output PDB files.
Tests on all operating systems (including mobile).
Be sure to compress javascript
MAke sure not javascript is external.
Clean up examples directory
Tests both python2 and python3
Test should also test version of protein without hydrogens, and make sure you
get all interactions tested. Metal, halogen, hydrogen with S.
finish README.md on file loading component.
PDBQT in webapp looks strange?
**
*
Makesure can loadin multipleligands. Probably need to rewritecodethat
triggersbinana run. Also, can run if restart.
And you need a message explaining the difference between delete/extract.
Push updated documentation somewhere.
2.
0
---
...
...
javascript/compile.sh
View file @
d93c4e09
# This file is part of BINANA, released under the Apache 2.0 License. See
# LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
# details. Copyright 2021 Jacob D. Durrant.
# This script only works if transcrypt is installed.
# pip install transcrypt
...
...
@@ -7,7 +11,7 @@ rm -rf ../python/__target__/ ./lib/
# Compile the python file.
cd
../python/
# --nomin
transcrypt
--build
--nomin
--ecom
--verbose
binana.py
transcrypt
--build
--ecom
--verbose
binana.py
cd
-
# Move the javascript library to the lib directory.
...
...
javascript/lib/__future__.js
View file @
d93c4e09
// Transcrypt'ed from Python, 2021-11-27 01:23: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__
=
'
__future__
'
;
export
var
all_feature_names
=
[];
'
use strict
'
;
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
=
[];
//# sourceMappingURL=__future__.map
\ No newline at end of file
javascript/lib/binana._cli_params._get_params.js
View file @
d93c4e09
...
...
@@ -2,86 +2,15 @@
// 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-27 01:23:31
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
'
;
__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
,
HALOGEN_BOND_DIST_CUTOFF
,
HYDROGEN_BOND_DIST_CUTOFF
,
HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF
,
HYDROPHOBIC_DIST_CUTOFF
,
LIGAND
,
METAL_COORDINATION_CUTOFF
,
OUTPUT_CSV
,
OUTPUT_DIR
,
OUTPUT_FILE
,
OUTPUT_JSON
,
PI_PADDING_DIST
,
PI_PI_INTERACTING_DIST_CUTOFF
,
PI_STACKING_ANGLE_TOLERANCE
,
RECEPTOR
,
SALT_BRIDGE_DIST_CUTOFF
,
TEST
,
T_STACKING_ANGLE_TOLERANCE
,
T_STACKING_CLOSEST_DIST_CUTOFF
}
from
'
./binana.interactions.default_params.js
'
;
var
__name__
=
'
binana._cli_params._get_params
'
;
export
var
sep
=
'
/
'
;
export
var
CommandLineParameters
=
__class__
(
'
CommandLineParameters
'
,
[
object
],
{
__module__
:
__name__
,
params
:
dict
({}),
get
is_num
()
{
return
__get__
(
this
,
function
(
self
,
num
)
{
try
{
return
float
(
num
);
}
catch
(
__except0__
)
{
if
(
isinstance
(
__except0__
,
ValueError
))
{
return
num
;
}
else
{
throw
__except0__
;
}
}
});},
get
__init__
()
{
return
__get__
(
this
,
function
(
self
,
parameters
)
{
self
.
params
[
'
close_contacts_dist1_cutoff
'
]
=
CLOSE_CONTACTS_DIST1_CUTOFF
;
self
.
params
[
'
close_contacts_dist2_cutoff
'
]
=
CLOSE_CONTACTS_DIST2_CUTOFF
;
self
.
params
[
'
electrostatic_dist_cutoff
'
]
=
ELECTROSTATIC_DIST_CUTOFF
;
self
.
params
[
'
active_site_flexibility_dist_cutoff
'
]
=
ACTIVE_SITE_FLEXIBILITY_DIST_CUTOFF
;
self
.
params
[
'
hydrophobic_dist_cutoff
'
]
=
HYDROPHOBIC_DIST_CUTOFF
;
self
.
params
[
'
hydrogen_bond_dist_cutoff
'
]
=
HYDROGEN_BOND_DIST_CUTOFF
;
self
.
params
[
'
hydrogen_halogen_bond_angle_cutoff
'
]
=
HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF
;
self
.
params
[
'
halogen_bond_dist_cutoff
'
]
=
HALOGEN_BOND_DIST_CUTOFF
;
self
.
params
[
'
pi_padding_dist
'
]
=
PI_PADDING_DIST
;
self
.
params
[
'
pi_pi_interacting_dist_cutoff
'
]
=
PI_PI_INTERACTING_DIST_CUTOFF
;
self
.
params
[
'
pi_stacking_angle_tolerance
'
]
=
PI_STACKING_ANGLE_TOLERANCE
;
self
.
params
[
'
T_stacking_angle_tolerance
'
]
=
T_STACKING_ANGLE_TOLERANCE
;
self
.
params
[
'
T_stacking_closest_dist_cutoff
'
]
=
T_STACKING_CLOSEST_DIST_CUTOFF
;
self
.
params
[
'
cation_pi_dist_cutoff
'
]
=
CATION_PI_DIST_CUTOFF
;
self
.
params
[
'
salt_bridge_dist_cutoff
'
]
=
SALT_BRIDGE_DIST_CUTOFF
;
self
.
params
[
'
metal_coordination_dist_cutoff
'
]
=
METAL_COORDINATION_CUTOFF
;
self
.
params
[
'
receptor
'
]
=
RECEPTOR
;
self
.
params
[
'
ligand
'
]
=
LIGAND
;
self
.
params
[
'
output_dir
'
]
=
OUTPUT_DIR
;
self
.
params
[
'
output_file
'
]
=
OUTPUT_FILE
;
self
.
params
[
'
output_json
'
]
=
OUTPUT_JSON
;
self
.
params
[
'
output_csv
'
]
=
OUTPUT_CSV
;
self
.
params
[
'
test
'
]
=
TEST
;
for
(
var
index
=
0
;
index
<
len
(
parameters
);
index
++
)
{
var
item
=
parameters
[
index
];
if
(
len
(
item
)
>
0
&&
item
[
0
]
==
'
-
'
)
{
var
key
=
item
.
py_replace
(
'
-
'
,
''
);
var
value
=
self
.
is_num
(
parameters
[
index
+
1
]);
if
(
__in__
(
key
,
list
(
self
.
params
.
py_keys
())))
{
self
.
params
[
key
]
=
value
;
parameters
[
index
]
=
''
;
parameters
[
index
+
1
]
=
''
;
}
}
}
self
.
error
=
''
;
for
(
var
index
=
1
;
index
<
len
(
parameters
);
index
++
)
{
var
item
=
parameters
[
index
];
if
(
item
!=
''
)
{
self
.
error
=
(
self
.
error
+
item
)
+
'
'
;
}
}
if
(
self
.
params
[
'
output_dir
'
]
!=
''
&&
self
.
params
[
'
output_dir
'
].
__getslice__
(
-
(
1
),
null
,
1
)
!=
sep
)
{
self
.
params
[
'
output_dir
'
]
=
self
.
params
[
'
output_dir
'
]
+
sep
;
}
var
single_output_files
=
[
tuple
([
'
output_file
'
,
'
pdb
'
]),
tuple
([
'
output_json
'
,
'
json
'
]),
tuple
([
'
output_csv
'
,
'
csv
'
])];
for
(
var
[
single_output_file
,
ext
]
of
single_output_files
)
{
if
(
self
.
params
[
'
output_dir
'
]
!=
''
&&
self
.
params
[
single_output_file
]
==
''
)
{
self
.
params
[
single_output_file
]
=
(
self
.
params
[
'
output_dir
'
]
+
'
output.
'
)
+
ext
;
}
}
});},
get
okay_to_proceed
()
{
return
__get__
(
this
,
function
(
self
)
{
return
self
.
params
[
'
receptor
'
]
!=
''
&&
self
.
params
[
'
ligand
'
]
!=
''
;
});}
});
'
use strict
'
;
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
"
;
__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
,
HALOGEN_BOND_DIST_CUTOFF
,
HYDROGEN_BOND_DIST_CUTOFF
,
HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF
,
HYDROPHOBIC_DIST_CUTOFF
,
LIGAND
,
METAL_COORDINATION_CUTOFF
,
OUTPUT_CSV
,
OUTPUT_DIR
,
OUTPUT_FILE
,
OUTPUT_JSON
,
PI_PADDING_DIST
,
PI_PI_INTERACTING_DIST_CUTOFF
,
PI_STACKING_ANGLE_TOLERANCE
,
RECEPTOR
,
SALT_BRIDGE_DIST_CUTOFF
,
TEST
,
T_STACKING_ANGLE_TOLERANCE
,
T_STACKING_CLOSEST_DIST_CUTOFF
}
from
"
./binana.interactions.default_params.js
"
;
var
__name__
=
"
binana._cli_params._get_params
"
;
export
var
sep
=
"
/
"
;
export
var
CommandLineParameters
=
__class__
(
"
CommandLineParameters
"
,
[
object
],{
__module__
:
__name__
,
params
:
dict
({}),
get
is_num
(){
return
__get__
(
this
,
function
(
self
,
num
){
try
{
return
float
(
num
)}
catch
(
__except0__
){
if
(
isinstance
(
__except0__
,
ValueError
))
return
num
;
else
throw
__except0__
;}})},
get
__init__
(){
return
__get__
(
this
,
function
(
self
,
parameters
){
self
.
params
[
"
close_contacts_dist1_cutoff
"
]
=
CLOSE_CONTACTS_DIST1_CUTOFF
;
self
.
params
[
"
close_contacts_dist2_cutoff
"
]
=
CLOSE_CONTACTS_DIST2_CUTOFF
;
self
.
params
[
"
electrostatic_dist_cutoff
"
]
=
ELECTROSTATIC_DIST_CUTOFF
;
self
.
params
[
"
active_site_flexibility_dist_cutoff
"
]
=
ACTIVE_SITE_FLEXIBILITY_DIST_CUTOFF
;
self
.
params
[
"
hydrophobic_dist_cutoff
"
]
=
HYDROPHOBIC_DIST_CUTOFF
;
self
.
params
[
"
hydrogen_bond_dist_cutoff
"
]
=
HYDROGEN_BOND_DIST_CUTOFF
;
self
.
params
[
"
hydrogen_halogen_bond_angle_cutoff
"
]
=
HYDROGEN_HALOGEN_BOND_ANGLE_CUTOFF
;
self
.
params
[
"
halogen_bond_dist_cutoff
"
]
=
HALOGEN_BOND_DIST_CUTOFF
;
self
.
params
[
"
pi_padding_dist
"
]
=
PI_PADDING_DIST
;
self
.
params
[
"
pi_pi_interacting_dist_cutoff
"
]
=
PI_PI_INTERACTING_DIST_CUTOFF
;
self
.
params
[
"
pi_stacking_angle_tolerance
"
]
=
PI_STACKING_ANGLE_TOLERANCE
;
self
.
params
[
"
T_stacking_angle_tolerance
"
]
=
T_STACKING_ANGLE_TOLERANCE
;
self
.
params
[
"
T_stacking_closest_dist_cutoff
"
]
=
T_STACKING_CLOSEST_DIST_CUTOFF
;
self
.
params
[
"
cation_pi_dist_cutoff
"
]
=
CATION_PI_DIST_CUTOFF
;
self
.
params
[
"
salt_bridge_dist_cutoff
"
]
=
SALT_BRIDGE_DIST_CUTOFF
;
self
.
params
[
"
metal_coordination_dist_cutoff
"
]
=
METAL_COORDINATION_CUTOFF
;
self
.
params
[
"
receptor
"
]
=
RECEPTOR
;
self
.
params
[
"
ligand
"
]
=
LIGAND
;
self
.
params
[
"
output_dir
"
]
=
OUTPUT_DIR
;
self
.
params
[
"
output_file
"
]
=
OUTPUT_FILE
;
self
.
params
[
"
output_json
"
]
=
OUTPUT_JSON
;
self
.
params
[
"
output_csv
"
]
=
OUTPUT_CSV
;
self
.
params
[
"
test
"
]
=
TEST
;
for
(
var
index
=
0
;
index
<
len
(
parameters
);
index
++
){
var
item
=
parameters
[
index
];
if
(
len
(
item
)
>
0
&&
item
[
0
]
==
"
-
"
){
var
key
=
item
.
py_replace
(
"
-
"
,
""
);
var
value
=
self
.
is_num
(
parameters
[
index
+
1
]);
if
(
__in__
(
key
,
list
(
self
.
params
.
py_keys
()))){
self
.
params
[
key
]
=
value
;
parameters
[
index
]
=
""
;
parameters
[
index
+
1
]
=
""
}}}
self
.
error
=
""
;
for
(
var
index
=
1
;
index
<
len
(
parameters
);
index
++
){
var
item
=
parameters
[
index
];
if
(
item
!=
""
)
self
.
error
=
self
.
error
+
item
+
"
"
}
if
(
self
.
params
[
"
output_dir
"
]
!=
""
&&
self
.
params
[
"
output_dir
"
].
__getslice__
(
-
1
,
null
,
1
)
!=
sep
)
self
.
params
[
"
output_dir
"
]
=
self
.
params
[
"
output_dir
"
]
+
sep
;
var
single_output_files
=
[
tuple
([
"
output_file
"
,
"
pdb
"
]),
tuple
([
"
output_json
"
,
"
json
"
]),
tuple
([
"
output_csv
"
,
"
csv
"
])];
for
(
var
[
single_output_file
,
ext
]
of
single_output_files
)
if
(
self
.
params
[
"
output_dir
"
]
!=
""
&&
self
.
params
[
single_output_file
]
==
""
)
self
.
params
[
single_output_file
]
=
self
.
params
[
"
output_dir
"
]
+
"
output.
"
+
ext
})},
get
okay_to_proceed
(){
return
__get__
(
this
,
function
(
self
){
return
self
.
params
[
"
receptor
"
]
!=
""
&&
self
.
params
[
"
ligand
"
]
!=
""
})}});
//# sourceMappingURL=binana._cli_params._get_params.map
\ No newline at end of file
javascript/lib/binana._start.js
View file @
d93c4e09
...
...
@@ -2,47 +2,13 @@
// 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-27 01:23:31
var
__future__
=
{};
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__
from
'
./binana.js
'
;
__nest__
(
binana
,
''
,
__module_binana__
);
import
*
as
__module_math__
from
'
./math.js
'
;
__nest__
(
math
,
''
,
__module_math__
);
import
{
from_files
}
from
'
./binana.load_ligand_receptor.js
'
;
import
{
get_all_interactions
}
from
'
./binana.interactions.js
'
;
import
{
_write_main
}
from
'
./binana.output.js
'
;
import
*
as
__module___future____
from
'
./__future__.js
'
;
__nest__
(
__future__
,
''
,
__module___future____
);
var
__name__
=
'
binana._start
'
;
export
var
textwrap
=
shim
;
export
var
VERSION
=
'
2.0
'
;
export
var
_get_all_interactions
=
function
(
parameters
)
{
var
max_cutoff
=
max
((
function
()
{
var
__accu0__
=
[];
for
(
var
i
of
parameters
.
params
.
py_items
())
{
if
(
__in__
(
'
dist
'
,
i
[
0
])
&&
__in__
(
'
cutoff
'
,
i
[
0
]))
{
__accu0__
.
append
(
i
[
1
]);
}
}
return
py_iter
(
__accu0__
);
})
())
+
15
;
var
__left0__
=
from_files
(
parameters
.
params
[
'
ligand
'
],
parameters
.
params
[
'
receptor
'
],
max_cutoff
);
var
ligand
=
__left0__
[
0
];
var
receptor
=
__left0__
[
1
];
var
pi_padding
=
parameters
.
params
[
'
pi_padding_dist
'
];
var
all_interacts
=
get_all_interactions
(
ligand
,
receptor
,
parameters
.
params
[
'
close_contacts_dist1_cutoff
'
],
parameters
.
params
[
'
close_contacts_dist2_cutoff
'
],
parameters
.
params
[
'
electrostatic_dist_cutoff
'
],
parameters
.
params
[
'
active_site_flexibility_dist_cutoff
'
],
parameters
.
params
[
'
hydrophobic_dist_cutoff
'
],
parameters
.
params
[
'
hydrogen_bond_dist_cutoff
'
],
parameters
.
params
[
'
hydrogen_halogen_bond_angle_cutoff
'
],
parameters
.
params
[
'
halogen_bond_dist_cutoff
'
],
parameters
.
params
[
'
pi_pi_interacting_dist_cutoff
'
],
parameters
.
params
[
'
pi_stacking_angle_tolerance
'
],
parameters
.
params
[
'
T_stacking_angle_tolerance
'
],
parameters
.
params
[
'
T_stacking_closest_dist_cutoff
'
],
parameters
.
params
[
'
cation_pi_dist_cutoff
'
],
parameters
.
params
[
'
salt_bridge_dist_cutoff
'
],
parameters
.
params
[
'
metal_coordination_dist_cutoff
'
],
pi_padding
);
for
(
var
key
of
all_interacts
[
'
cat_pi
'
]
[
'
counts
'
].
py_keys
())
{
all_interacts
[
'
pi_pi
'
]
[
'
counts
'
]
[
key
]
=
all_interacts
[
'
cat_pi
'
]
[
'
counts
'
]
[
key
];
}
_write_main
(
parameters
,
ligand
,
receptor
,
all_interacts
[
'
closest
'
],
all_interacts
[
'
close
'
],
all_interacts
[
'
hydrophobics
'
],
all_interacts
[
'
hydrogen_bonds
'
],
all_interacts
[
'
halogen_bonds
'
],
all_interacts
[
'
salt_bridges
'
],
all_interacts
[
'
metal_coordinations
'
],
all_interacts
[
'
pi_pi
'
],
all_interacts
[
'
cat_pi
'
],
all_interacts
[
'
electrostatic_energies
'
],
all_interacts
[
'
active_site_flexibility
'
],
all_interacts
[
'
ligand_atom_types
'
]);
};
export
var
_intro
=
function
()
{
print
(
'
\n
[- END INTRO -]
\n
'
);
};
'
use strict
'
;
var
__future__
=
{};
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__
from
"
./binana.js
"
;
__nest__
(
binana
,
""
,
__module_binana__
);
import
*
as
__module_math__
from
"
./math.js
"
;
__nest__
(
math
,
""
,
__module_math__
);
import
{
from_files
}
from
"
./binana.load_ligand_receptor.js
"
;
import
{
get_all_interactions
}
from
"
./binana.interactions.js
"
;
import
{
_write_main
}
from
"
./binana.output.js
"
;
import
*
as
__module___future____
from
"
./__future__.js
"
;
__nest__
(
__future__
,
""
,
__module___future____
);
var
__name__
=
"
binana._start
"
;
export
var
textwrap
=
shim
;
export
var
VERSION
=
"
2.1
"
;
export
var
_get_all_interactions
=
function
(
parameters
){
var
max_cutoff
=
max
(
function
(){
var
__accu0__
=
[];
for
(
var
i
of
parameters
.
params
.
py_items
())
if
(
__in__
(
"
dist
"
,
i
[
0
])
&&
__in__
(
"
cutoff
"
,
i
[
0
]))
__accu0__
.
append
(
i
[
1
]);
return
py_iter
(
__accu0__
)}())
+
15
;
var
__left0__
=
from_files
(
parameters
.
params
[
"
ligand
"
],
parameters
.
params
[
"
receptor
"
],
max_cutoff
);
var
ligand
=
__left0__
[
0
];
var
receptor
=
__left0__
[
1
];
var
pi_padding
=
parameters
.
params
[
"
pi_padding_dist
"
];
var
all_interacts
=
get_all_interactions
(
ligand
,
receptor
,
parameters
.
params
[
"
close_contacts_dist1_cutoff
"
],
parameters
.
params
[
"
close_contacts_dist2_cutoff
"
],
parameters
.
params
[
"
electrostatic_dist_cutoff
"
],
parameters
.
params
[
"
active_site_flexibility_dist_cutoff
"
],
parameters
.
params
[
"
hydrophobic_dist_cutoff
"
],
parameters
.
params
[
"
hydrogen_bond_dist_cutoff
"
],
parameters
.
params
[
"
hydrogen_halogen_bond_angle_cutoff
"
],
parameters
.
params
[
"
halogen_bond_dist_cutoff
"
],
parameters
.
params
[
"
pi_pi_interacting_dist_cutoff
"
],
parameters
.
params
[
"
pi_stacking_angle_tolerance
"
],
parameters
.
params
[
"
T_stacking_angle_tolerance
"
],
parameters
.
params
[
"
T_stacking_closest_dist_cutoff
"
],
parameters
.
params
[
"
cation_pi_dist_cutoff
"
],
parameters
.
params
[
"
salt_bridge_dist_cutoff
"
],
parameters
.
params
[
"
metal_coordination_dist_cutoff
"
],
pi_padding
);
for
(
var
key
of
all_interacts
[
"
cat_pi
"
][
"
counts
"
].
py_keys
())
all_interacts
[
"
pi_pi
"
][
"
counts
"
][
key
]
=
all_interacts
[
"
cat_pi
"
][
"
counts
"
][
key
];
_write_main
(
parameters
,
ligand
,
receptor
,
all_interacts
[
"
closest
"
],
all_interacts
[
"
close
"
],
all_interacts
[
"
hydrophobics
"
],
all_interacts
[
"
hydrogen_bonds
"
],
all_interacts
[
"
halogen_bonds
"
],
all_interacts
[
"
salt_bridges
"
],
all_interacts
[
"
metal_coordinations
"
],
all_interacts
[
"
pi_pi
"
],
all_interacts
[
"
cat_pi
"
],
all_interacts
[
"
electrostatic_energies
"
],
all_interacts
[
"
active_site_flexibility
"
],
all_interacts
[
"
ligand_atom_types
"
])};
export
var
_intro
=
function
(){
print
(
"
\n
[- END INTRO -]
\n
"
)};
//# sourceMappingURL=binana._start.map
\ No newline at end of file
javascript/lib/binana._structure.atom.js
View file @
d93c4e09
...
...
@@ -2,231 +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-27 01:23:32
var
binana
=
{};
var
math
=
{};
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
{
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
*
as
__module_re__
from
'
./re.js
'
;
__nest__
(
re
,
''
,
__module_re__
);
import
{
protein_resnames
,
to_deg
,
two_leter_atom_names
}
from
'
./binana._structure.consts.js
'
;
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__
,
get
__init__
()
{
return
__get__
(
this
,
function
(
self
)
{
self
.
atom_name
=
''
;
self
.
residue
=
''
;
self
.
coordinates
=
Point
(
99999
,
99999
,
99999
);
self
.
element
=
''
;
self
.
pdb_index
=
''
;
self
.
all_atoms_index
=
-
(
1
);
self
.
line
=
''
;
self
.
atom_type
=
''
;
self
.
indecies_of_atoms_connecting
=
[];
self
.
charge
=
0
;
self
.
resid
=
0
;
self
.
chain
=
''
;
self
.
structure
=
''
;
self
.
comment
=
''
;
});},
get
copy_of
()
{
return
__get__
(
this
,
function
(
self
)
{
var
theatom
=
Atom
();
theatom
.
atom_name
=
self
.
atom_name
;
theatom
.
residue
=
self
.
residue
;
theatom
.
coordinates
=
self
.
coordinates
.
copy_of
();
theatom
.
element
=
self
.
element
;
theatom
.
pdb_index
=
self
.
pdb_index
;
theatom
.
line
=
self
.
line
;
theatom
.
atom_type
=
self
.
atom_type
;
theatom
.
indecies_of_atoms_connecting
=
self
.
indecies_of_atoms_connecting
.
__getslice__
(
0
,
null
,
1
);
theatom
.
charge
=
self
.
charge
;
theatom
.
resid
=
self
.
resid
;
theatom
.
chain
=
self
.
chain
;
theatom
.
structure
=
self
.
structure
;
theatom
.
comment
=
self
.
comment
;
theatom
.
all_atoms_index
=
self
.
all_atoms_index
;
return
theatom
;
});},
get
string_id
()
{
return
__get__
(
this
,
function
(
self
)
{
var
to_return
=
''
;
if
(
self
.
chain
.
strip
()
!=
''
)
{
var
to_return
=
(
to_return
+
self
.
chain
.
strip
())
+
'
:
'
;
}
var
to_return
=
(((((((
to_return
+
self
.
residue
.
strip
())
+
'
(
'
)
+
str
(
self
.
resid
))
+
'
):
'
)
+
self
.
atom_name
.
strip
())
+
'
(
'
)
+
str
(
self
.
pdb_index
))
+
'
)
'
;
return
to_return
;
});},
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
))
+
r_just
(
self
.
chain
,
2
))
+
r_just
(
str
(
self
.
resid
),
4
);
output
+=
r_just
(
round_to_thousandths_to_str
(
self
.
coordinates
.
x
),
12
);
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
))
{
self
.
indecies_of_atoms_connecting
.
append
(
index
);
}
});},
get
side_chain_or_backbone
()
{
return
__get__
(
this
,
function
(
self
)
{
if
(
__in__
(
self
.
atom_name
.
strip
(),
[
'
CA
'
,
'
C
'
,
'
O
'
,
'
N
'
]))
{
return
'
BACKBONE
'
;
}
else
{
return
'
SIDECHAIN
'
;
}
});},
get
read_pdb_line
()
{
return
__get__
(
this
,
function
(
self
,
line
)
{
self
.
line
=
line
;
self
.
atom_name
=
line
.
__getslice__
(
11
,
16
,
1
).
strip
();
if
(
len
(
self
.
atom_name
)
==
1
)
{
self
.
atom_name
=
self
.
atom_name
+
'
'
;
}
else
if
(
__in__
(
len
(
self
.
atom_name
),
[
2
,
3
]))
{
self
.
atom_name
=
self
.
atom_name
+
'
'
;
}
self
.
coordinates
=
Point
(
float
(
line
.
__getslice__
(
30
,
38
,
1
)),
float
(
line
.
__getslice__
(
38
,
46
,
1
)),
float
(
line
.
__getslice__
(
46
,
54
,
1
)));
self
.
atom_type
=
line
.
__getslice__
(
76
,
79
,
1
).
strip
().
upper
();
self
.
charge
=
(
line
.
__getslice__
(
69
,
76
,
1
).
strip
()
!=
''
?
float
(
line
.
__getslice__
(
69
,
76
,
1
))
:
0.0
);
self
.
residue
=
line
.
__getslice__
(
16
,
20
,
1
);
self
.
residue
=
'
'
+
self
.
residue
.
__getslice__
(
-
(
3
),
null
,
1
);
if
(
self
.
element
==
''
)
{
var
element
=
line
.
__getslice__
(
76
,
null
,
1
).
strip
().
upper
();
if
(
element
!=
''
)
{
var
two_letters
=
re
.
sub
(
'
[^A-Z]
'
,
''
,
element
).
__getslice__
(
0
,
2
,
1
);
}
else
{
var
two_letters
=
self
.
atom_name
.
__getslice__
(
0
,
2
,
1
).
strip
().
upper
();
}
if
(
__in__
(
two_letters
,
two_leter_atom_names
)
&&
!
__in__
(
self
.
residue
.
__getslice__
(
-
(
3
),
null
,
1
),
protein_resnames
))
{
self
.
element
=
two_letters
;
}
else
{
self
.
element
=
self
.
atom_name
;
self
.
element
=
self
.
element
.
py_replace
(
'
0
'
,
''
);
self
.
element
=
self
.
element
.
py_replace
(
'
1
'
,
''
);
self
.
element
=
self
.
element
.
py_replace
(
'
2
'
,
''
);
self
.
element
=
self
.
element
.
py_replace
(
'
3
'
,
''
);
self
.
element
=
self
.
element
.
py_replace
(
'
4
'
,
''
);
self
.
element
=
self
.
element
.
py_replace
(
'
5
'
,
''
);
self
.
element
=
self
.
element
.
py_replace
(
'
6
'
,
''
);
self
.
element
=
self
.
element
.
py_replace
(
'
7
'
,
''
);
self
.
element
=
self
.
element
.
py_replace
(
'
8
'
,
''
);
self
.
element
=
self
.
element
.
py_replace
(
'
9
'
,
''
);
self
.
element
=
self
.
element
.
py_replace
(
'
@
'
,
''
);
self
.
element
=
self
.
element
.
__getslice__
(
0
,
1
,
1
).
strip
().
upper
();
}
}
self
.
pdb_index
=
line
.
__getslice__
(
6
,
12
,
1
).
strip
();
try
{
self
.
resid
=
int
(
line
.
__getslice__
(
23
,
26
,
1
));
}
catch
(
__except0__
)
{
// pass;
}
self
.
chain
=
line
.
__getslice__
(
21
,
22
,
1
);
if
(
self
.
chain
==
'
'
)
{
self
.
chain
=
'
X
'
;
}
if
(
self
.
residue
.
strip
()
==
''
)
{
self
.
residue
=
'
MOL
'
;
}
});},
get
_has_sp3_geometry_if_protein
()
{
return
__get__
(
this
,
function
(
self
,
resname
)
{
var
atomname
=
self
.
atom_name
.
strip
();
if
(
__in__
(
atomname
,
[
'
C
'
,
'
O
'
,
'
N
'
]))
{
return
false
;
}
if
(
resname
==
'
ARG
'
)
{
if
(
__in__
(
atomname
,
[
'
NE
'
,
'
NH1
'
,
'
NH2
'
]))
{
return
false
;
}
}
else
if
(
resname
==
'
ASN
'
)
{
if
(
__in__
(
atomname
,
[
'
CG
'
,
'
OD1
'
,
'
ND2
'
]))
{
return
false
;
}
}
else
if
(
resname
==
'
ASP
'
)
{
if
(
__in__
(
atomname
,
[
'
CG
'
,
'
OD1
'
]))
{
return
false
;
}
}
else
if
(
resname
==
'
GLN
'
)
{
if
(
__in__
(
atomname
,
[
'
CD
'
,
'
OE1
'
,
'
NE2
'
]))
{
return
false
;
}
}
else
if
(
resname
==
'
GLU
'
)
{
if
(
__in__
(
atomname
,
[
'
CD
'
,
'
OE1
'
]))
{
return
false
;
}
}
else
if
(
resname
==
'
HIS
'
)
{
if
(
__in__
(
atomname
,
[
'
CG
'
,
'
CD2
'
,
'
NE2
'
,
'
CE1
'
,
'
ND1
'
]))
{
return
false
;
}
}
else
if
(
__in__
(
resname
,
[
'
PHE
'
,
'
TYR
'
]))
{
if
(
__in__
(
atomname
,
[
'
CE1
'
,
'
CZ
'
,
'
CE2
'
,
'
CD2
'
,
'
CG
'
,
'
CD1
'
]))
{
return
false
;
}
}
else
if
(
resname
==
'
TRP
'
)
{
if
(
__in__
(
atomname
,
[
'
CG
'
,
'
CD1
'
,
'
NE1
'
,
'
CE2
'
,
'
CD2
'
,
'
CE3
'
,
'
CZ2
'
,
'
CZ3
'
,
'
CH2
'
]))
{
return
false
;
}
}
return
true
;
});},
get
has_sp3_geometry
()
{
return
__get__
(
this
,
function
(
self
,
parent_mol
)
{
var
resname
=
self
.
residue
.
__getslice__
(
-
(
3
),
null
,
1
);
if
(
__in__
(
resname
,
protein_resnames
))
{
return
self
.
_has_sp3_geometry_if_protein
(
resname
);
}
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
ncrs_len
=
len
(
ncrs
);
if
(
ncrs_len
<=
1
)
{
return
true
;
}
var
ccr
=
self
.
coordinates
;
var
angles
=
[
angle_between_three_points
(
ncrs
[
0
],
ccr
,
ncrs
[
1
])
*
to_deg
];
if
(
ncrs_len
>
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
(
ncrs_len
>
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
;
});},
get
belongs_to_protein
()
{
return
__get__
(
this
,
function
(
self
)
{
return
__in__
(
self
.
residue
.
__getslice__
(
-
(
3
),
null
,
1
),
protein_resnames
);
});}
});
'
use strict
'
;
var
binana
=
{};
var
math
=
{};
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
{
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
*
as
__module_re__
from
"
./re.js
"
;
__nest__
(
re
,
""
,
__module_re__
);
import
{
protein_resnames
,
to_deg
,
two_leter_atom_names
}
from
"
./binana._structure.consts.js
"
;
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__
,
get
__init__
(){
return
__get__
(
this
,
function
(
self
){
self
.
atom_name
=
""
;
self
.
residue
=
""
;
self
.
coordinates
=
Point
(
99999
,
99999
,
99999
);
self
.
element
=
""
;
self
.
pdb_index
=
""
;
self
.
all_atoms_index
=-
1
;
self
.
line
=
""
;
self
.
atom_type
=
""
;
self
.
indecies_of_atoms_connecting
=
[];
self
.
charge
=
0
;
self
.
resid
=
0
;
self
.
chain
=
""
;
self
.
structure
=
""
;
self
.
comment
=
""
})},
get
copy_of
(){
return
__get__
(
this
,
function
(
self
){
var
theatom
=
Atom
();
theatom
.
atom_name
=
self
.
atom_name
;
theatom
.
residue
=
self
.
residue
;
theatom
.
coordinates
=
self
.
coordinates
.
copy_of
();
theatom
.
element
=
self
.
element
;
theatom
.
pdb_index
=
self
.
pdb_index
;
theatom
.
line
=
self
.
line
;
theatom
.
atom_type
=
self
.
atom_type
;
theatom
.
indecies_of_atoms_connecting
=
self
.
indecies_of_atoms_connecting
.
__getslice__
(
0
,
null
,
1
);
theatom
.
charge
=
self
.
charge
;
theatom
.
resid
=
self
.
resid
;
theatom
.
chain
=
self
.
chain
;
theatom
.
structure
=
self
.
structure
;
theatom
.
comment
=
self
.
comment
;
theatom
.
all_atoms_index
=
self
.
all_atoms_index
;
return
theatom
})},
get
string_id
(){
return
__get__
(
this
,
function
(
self
){
var
to_return
=
""
;
if
(
self
.
chain
.
strip
()
!=
""
)
var
to_return
=
to_return
+
self
.
chain
.
strip
()
+
"
:
"
;
var
to_return
=
to_return
+
self
.
residue
.
strip
()
+
"
(
"
+
str
(
self
.
resid
)
+
"
):
"
+
self
.
atom_name
.
strip
()
+
"
(
"
+
str
(
self
.
pdb_index
)
+
"
)
"
;
return
to_return
})},
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
)
+
r_just
(
self
.
chain
,
2
)
+
r_just
(
str
(
self
.
resid
),
4
);
output
+=
r_just
(
round_to_thousandths_to_str
(
self
.
coordinates
.
x
),
12
);
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
))
self
.
indecies_of_atoms_connecting
.
append
(
index
)})},
get
side_chain_or_backbone
(){
return
__get__
(
this
,
function
(
self
){
if
(
__in__
(
self
.
atom_name
.
strip
(),[
"
CA
"
,
"
C
"
,
"
O
"
,
"
N
"
]))
return
"
BACKBONE
"
;
else
return
"
SIDECHAIN
"
})},
get
read_pdb_line
(){
return
__get__
(
this
,
function
(
self
,
line
){
self
.
line
=
line
;
self
.
atom_name
=
line
.
__getslice__
(
11
,
16
,
1
).
strip
();
if
(
len
(
self
.
atom_name
)
==
1
)
self
.
atom_name
=
self
.
atom_name
+
"
"
;
else
if
(
__in__
(
len
(
self
.
atom_name
),[
2
,
3
]))
self
.
atom_name
=
self
.
atom_name
+
"
"
;
self
.
coordinates
=
Point
(
float
(
line
.
__getslice__
(
30
,
38
,
1
)),
float
(
line
.
__getslice__
(
38
,
46
,
1
)),
float
(
line
.
__getslice__
(
46
,
54
,
1
)));
self
.
atom_type
=
line
.
__getslice__
(
76
,
79
,
1
).
strip
().
upper
();
self
.
charge
=
line
.
__getslice__
(
69
,
76
,
1
).
strip
()
!=
""
?
float
(
line
.
__getslice__
(
69
,
76
,
1
)):
0
;
self
.
residue
=
line
.
__getslice__
(
16
,
20
,
1
);
self
.
residue
=
"
"
+
self
.
residue
.
__getslice__
(
-
3
,
null
,
1
);
if
(
self
.
element
==
""
){
var
element
=
line
.
__getslice__
(
76
,
null
,
1
).
strip
().
upper
();
if
(
element
!=
""
)
var
two_letters
=
re
.
sub
(
"
[^A-Z]
"
,
""
,
element
).
__getslice__
(
0
,
2
,
1
);
else
var
two_letters
=
self
.
atom_name
.
__getslice__
(
0
,
2
,
1
).
strip
().
upper
();
if
(
__in__
(
two_letters
,
two_leter_atom_names
)
&&!
__in__
(
self
.
residue
.
__getslice__
(
-
3
,
null
,
1
),
protein_resnames
))
self
.
element
=
two_letters
;
else
{
self
.
element
=
self
.
atom_name
;
self
.
element
=
self
.
element
.
py_replace
(
"
0
"
,
""
);
self
.
element
=
self
.
element
.
py_replace
(
"
1
"
,
""
);
self
.
element
=
self
.
element
.
py_replace
(
"
2
"
,
""
);
self
.
element
=
self
.
element
.
py_replace
(
"
3
"
,
""
);
self
.
element
=
self
.
element
.
py_replace
(
"
4
"
,
""
);
self
.
element
=
self
.
element
.
py_replace
(
"
5
"
,
""
);
self
.
element
=
self
.
element
.
py_replace
(
"
6
"
,
""
);
self
.
element
=
self
.
element
.
py_replace
(
"
7
"
,
""
);
self
.
element
=
self
.
element
.
py_replace
(
"
8
"
,
""
);
self
.
element
=
self
.
element
.
py_replace
(
"
9
"
,
""
);
self
.
element
=
self
.
element
.
py_replace
(
"
@
"
,
""
);
self
.
element
=
self
.
element
.
__getslice__
(
0
,
1
,
1
).
strip
().
upper
()}}
self
.
pdb_index
=
line
.
__getslice__
(
6
,
12
,
1
).
strip
();
try
{
self
.
resid
=
int
(
line
.
__getslice__
(
23
,
26
,
1
))}
catch
(
__except0__
){}
self
.
chain
=
line
.
__getslice__
(
21
,
22
,
1
);
if
(
self
.
chain
==
"
"
)
self
.
chain
=
"
X
"
;
if
(
self
.
residue
.
strip
()
==
""
)
self
.
residue
=
"
MOL
"
})},
get
_has_sp3_geometry_if_protein
(){
return
__get__
(
this
,
function
(
self
,
resname
){
var
atomname
=
self
.
atom_name
.
strip
();
if
(
__in__
(
atomname
,
[
"
C
"
,
"
O
"
,
"
N
"
]))
return
false
;
if
(
resname
==
"
ARG
"
){
if
(
__in__
(
atomname
,[
"
NE
"
,
"
NH1
"
,
"
NH2
"
]))
return
false
}
else
if
(
resname
==
"
ASN
"
){
if
(
__in__
(
atomname
,[
"
CG
"
,
"
OD1
"
,
"
ND2
"
]))
return
false
}
else
if
(
resname
==
"
ASP
"
){
if
(
__in__
(
atomname
,[
"
CG
"
,
"
OD1
"
]))
return
false
}
else
if
(
resname
==
"
GLN
"
){
if
(
__in__
(
atomname
,[
"
CD
"
,
"
OE1
"
,
"
NE2
"
]))
return
false
}
else
if
(
resname
==
"
GLU
"
){
if
(
__in__
(
atomname
,[
"
CD
"
,
"
OE1
"
]))
return
false
}
else
if
(
resname
==
"
HIS
"
){
if
(
__in__
(
atomname
,[
"
CG
"
,
"
CD2
"
,
"
NE2
"
,
"
CE1
"
,
"
ND1
"
]))
return
false
}
else
if
(
__in__
(
resname
,
[
"
PHE
"
,
"
TYR
"
])){
if
(
__in__
(
atomname
,[
"
CE1
"
,
"
CZ
"
,
"
CE2
"
,
"
CD2
"
,
"
CG
"
,
"
CD1
"
]))
return
false
}
else
if
(
resname
==
"
TRP
"
)
if
(
__in__
(
atomname
,[
"
CG
"
,
"
CD1
"
,
"
NE1
"
,
"
CE2
"
,
"
CD2
"
,
"
CE3
"
,
"
CZ2
"
,
"
CZ3
"
,
"
CH2
"
]))
return
false
;
return
true
})},
get
has_sp3_geometry
(){
return
__get__
(
this
,
function
(
self
,
parent_mol
){
var
resname
=
self
.
residue
.
__getslice__
(
-
3
,
null
,
1
);
if
(
__in__
(
resname
,
protein_resnames
))
return
self
.
_has_sp3_geometry_if_protein
(
resname
);
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
ncrs_len
=
len
(
ncrs
);
if
(
ncrs_len
<=
1
)
return
true
;
var
ccr
=
self
.
coordinates
;
var
angles
=
[
angle_between_three_points
(
ncrs
[
0
],
ccr
,
ncrs
[
1
])
*
to_deg
];
if
(
ncrs_len
>
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
(
ncrs_len
>
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
)
<
5
})},
get
belongs_to_protein
(){
return
__get__
(
this
,
function
(
self
){
return
__in__
(
self
.
residue
.
__getslice__
(
-
3
,
null
,
1
),
protein_resnames
)})}});