Skip to content

Commit 8580d04

Browse files
committed
New tests added
1 parent 9d7d5c1 commit 8580d04

File tree

11 files changed

+338
-16
lines changed

11 files changed

+338
-16
lines changed

docs/contents/user/tools/physchem/get_atomic_radius.ipynb

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,75 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": null,
19+
"execution_count": 1,
2020
"id": "c3c463fe-1210-480d-92f5-8f1ea78368c2",
2121
"metadata": {},
22+
"outputs": [
23+
{
24+
"data": {
25+
"application/vnd.jupyter.widget-view+json": {
26+
"model_id": "e45fb964025844c4a41d57cb608a80aa",
27+
"version_major": 2,
28+
"version_minor": 0
29+
},
30+
"text/plain": []
31+
},
32+
"metadata": {},
33+
"output_type": "display_data"
34+
}
35+
],
36+
"source": [
37+
"import molsysmt as msm"
38+
]
39+
},
40+
{
41+
"cell_type": "code",
42+
"execution_count": 2,
43+
"id": "42ea1bbe-a39c-4bce-87f4-a380d37c0f02",
44+
"metadata": {},
2245
"outputs": [],
23-
"source": []
46+
"source": [
47+
"molecular_system = msm.convert(msm.systems['Trp-Cage']['1l2y.h5msm'])"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": 3,
53+
"id": "620f7cd4-16c5-49ba-a209-48b296d9e8d6",
54+
"metadata": {},
55+
"outputs": [],
56+
"source": [
57+
"radius_atom = msm.physchem.get_atomic_radius(molecular_system, element='atom', selection='group_id==4',\n",
58+
" definition='vdw')"
59+
]
60+
},
61+
{
62+
"cell_type": "code",
63+
"execution_count": 4,
64+
"id": "d0d6dc48-94a5-4b13-afef-1d9f2b3f70a8",
65+
"metadata": {},
66+
"outputs": [
67+
{
68+
"data": {
69+
"text/html": [
70+
"<table><tbody><tr><th>Magnitude</th><td style='text-align:left;'><pre>[0.155 0.17 0.17 0.152 0.17 0.17 0.17 0.17 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11]</pre></td></tr><tr><th>Units</th><td style='text-align:left;'>nanometer</td></tr></tbody></table>"
71+
],
72+
"text/latex": [
73+
"$\\begin{pmatrix} & & & & & & & & & & & & & & & & & & \\end{pmatrix}\\ \\mathrm{nanometer}$"
74+
],
75+
"text/plain": [
76+
"<Quantity([0.155 0.17 0.17 0.152 0.17 0.17 0.17 0.17 0.11 0.11 0.11 0.11\n",
77+
" 0.11 0.11 0.11 0.11 0.11 0.11 0.11 ], 'nanometer')>"
78+
]
79+
},
80+
"execution_count": 4,
81+
"metadata": {},
82+
"output_type": "execute_result"
83+
}
84+
],
85+
"source": [
86+
"radius_atom"
87+
]
2488
}
2589
],
2690
"metadata": {
@@ -39,7 +103,7 @@
39103
"name": "python",
40104
"nbconvert_exporter": "python",
41105
"pygments_lexer": "ipython3",
42-
"version": "3.10.14"
106+
"version": "3.12.8"
43107
}
44108
},
45109
"nbformat": 4,
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "1daf6537-58f0-496f-acb0-e771d4735b7d",
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": []
12+
},
13+
"source": [
14+
"# Get degrees of freedom"
15+
]
16+
},
17+
{
18+
"cell_type": "code",
19+
"execution_count": 1,
20+
"id": "c3c463fe-1210-480d-92f5-8f1ea78368c2",
21+
"metadata": {},
22+
"outputs": [
23+
{
24+
"data": {
25+
"application/vnd.jupyter.widget-view+json": {
26+
"model_id": "0284911ac0384dedab7df90691974d44",
27+
"version_major": 2,
28+
"version_minor": 0
29+
},
30+
"text/plain": []
31+
},
32+
"metadata": {},
33+
"output_type": "display_data"
34+
}
35+
],
36+
"source": [
37+
"import molsysmt as msm"
38+
]
39+
},
40+
{
41+
"cell_type": "code",
42+
"execution_count": 2,
43+
"id": "e7556259-8097-42ae-98b6-498fc1fc7499",
44+
"metadata": {},
45+
"outputs": [],
46+
"source": [
47+
"molecular_system = msm.convert(msm.systems['T4 lysozyme L99A']['181l.h5msm'],\n",
48+
" selection='molecule_type==\"protein\"')"
49+
]
50+
},
51+
{
52+
"cell_type": "code",
53+
"execution_count": 3,
54+
"id": "0deba7c2-1f88-4d7b-94fa-d9c598f00cb4",
55+
"metadata": {},
56+
"outputs": [],
57+
"source": [
58+
"tt_groups = msm.physchem.get_transmembrane_tendency(molecular_system, element='group',\n",
59+
" definition='zhao')"
60+
]
61+
},
62+
{
63+
"cell_type": "code",
64+
"execution_count": 8,
65+
"id": "3a4ea51e-4fb4-4e05-80b8-dc0de2dca5a8",
66+
"metadata": {},
67+
"outputs": [],
68+
"source": [
69+
"view = msm.view(molecular_system)\n",
70+
"msm.thirds.nglview.set_color_by_value(view, values=tt_groups, mid_value=0.0)"
71+
]
72+
},
73+
{
74+
"cell_type": "code",
75+
"execution_count": 9,
76+
"id": "7226e658-3abc-430d-9b5d-fbf2bdbec625",
77+
"metadata": {},
78+
"outputs": [
79+
{
80+
"data": {
81+
"application/vnd.jupyter.widget-view+json": {
82+
"model_id": "e647cca337d346f1b9d9ad122fc00568",
83+
"version_major": 2,
84+
"version_minor": 0
85+
},
86+
"text/plain": [
87+
"NGLWidget()"
88+
]
89+
},
90+
"metadata": {},
91+
"output_type": "display_data"
92+
}
93+
],
94+
"source": [
95+
"view"
96+
]
97+
},
98+
{
99+
"cell_type": "code",
100+
"execution_count": null,
101+
"id": "c7add9be-10a1-4e9d-abad-0da19da10bdb",
102+
"metadata": {},
103+
"outputs": [],
104+
"source": []
105+
}
106+
],
107+
"metadata": {
108+
"kernelspec": {
109+
"display_name": "Python 3 (ipykernel)",
110+
"language": "python",
111+
"name": "python3"
112+
},
113+
"language_info": {
114+
"codemirror_mode": {
115+
"name": "ipython",
116+
"version": 3
117+
},
118+
"file_extension": ".py",
119+
"mimetype": "text/x-python",
120+
"name": "python",
121+
"nbconvert_exporter": "python",
122+
"pygments_lexer": "ipython3",
123+
"version": "3.12.8"
124+
}
125+
},
126+
"nbformat": 4,
127+
"nbformat_minor": 5
128+
}

docs/contents/user/tools/physchem/get_transmembrane_tendency.ipynb

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,90 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": null,
19+
"execution_count": 1,
2020
"id": "c3c463fe-1210-480d-92f5-8f1ea78368c2",
2121
"metadata": {},
22+
"outputs": [
23+
{
24+
"data": {
25+
"application/vnd.jupyter.widget-view+json": {
26+
"model_id": "0284911ac0384dedab7df90691974d44",
27+
"version_major": 2,
28+
"version_minor": 0
29+
},
30+
"text/plain": []
31+
},
32+
"metadata": {},
33+
"output_type": "display_data"
34+
}
35+
],
36+
"source": [
37+
"import molsysmt as msm"
38+
]
39+
},
40+
{
41+
"cell_type": "code",
42+
"execution_count": 2,
43+
"id": "e7556259-8097-42ae-98b6-498fc1fc7499",
44+
"metadata": {},
45+
"outputs": [],
46+
"source": [
47+
"molecular_system = msm.convert(msm.systems['T4 lysozyme L99A']['181l.h5msm'],\n",
48+
" selection='molecule_type==\"protein\"')"
49+
]
50+
},
51+
{
52+
"cell_type": "code",
53+
"execution_count": 3,
54+
"id": "0deba7c2-1f88-4d7b-94fa-d9c598f00cb4",
55+
"metadata": {},
56+
"outputs": [],
57+
"source": [
58+
"tt_groups = msm.physchem.get_transmembrane_tendency(molecular_system, element='group',\n",
59+
" definition='zhao')"
60+
]
61+
},
62+
{
63+
"cell_type": "code",
64+
"execution_count": 8,
65+
"id": "3a4ea51e-4fb4-4e05-80b8-dc0de2dca5a8",
66+
"metadata": {},
67+
"outputs": [],
68+
"source": [
69+
"view = msm.view(molecular_system)\n",
70+
"msm.thirds.nglview.set_color_by_value(view, values=tt_groups, mid_value=0.0)"
71+
]
72+
},
73+
{
74+
"cell_type": "code",
75+
"execution_count": 9,
76+
"id": "7226e658-3abc-430d-9b5d-fbf2bdbec625",
77+
"metadata": {},
78+
"outputs": [
79+
{
80+
"data": {
81+
"application/vnd.jupyter.widget-view+json": {
82+
"model_id": "e647cca337d346f1b9d9ad122fc00568",
83+
"version_major": 2,
84+
"version_minor": 0
85+
},
86+
"text/plain": [
87+
"NGLWidget()"
88+
]
89+
},
90+
"metadata": {},
91+
"output_type": "display_data"
92+
}
93+
],
94+
"source": [
95+
"view"
96+
]
97+
},
98+
{
99+
"cell_type": "code",
100+
"execution_count": null,
101+
"id": "c7add9be-10a1-4e9d-abad-0da19da10bdb",
102+
"metadata": {},
22103
"outputs": [],
23104
"source": []
24105
}
@@ -39,7 +120,7 @@
39120
"name": "python",
40121
"nbconvert_exporter": "python",
41122
"pygments_lexer": "ipython3",
42-
"version": "3.10.14"
123+
"version": "3.12.8"
43124
}
44125
},
45126
"nbformat": 4,

molsysmt/_private/digestion/argument/definition.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
'get_polarity': ['grantham', 'zimmerman'],
1212
'get_area_buried': ['rose'],
1313
'get_buried_fraction': ['janin'],
14+
'get_atomic_radius': ['vdw'],
15+
'get_transmembrane_tendency': ['zhao', 'senes'],
1416
}
1517

1618
def digest_definition(definition, caller=None):
@@ -60,5 +62,15 @@ def digest_definition(definition, caller=None):
6062
if definition in definitions['get_buried_fraction']:
6163
return definition
6264

65+
elif caller=='molsysmt.physchem.get_atomic_radius.get_atomic_radius':
66+
if isinstance(definition, str):
67+
if definition in definitions['get_atomic_radius']:
68+
return definition
69+
70+
elif caller=='molsysmt.physchem.get_transmembrane_tendency.get_transmembrane_tendency':
71+
if isinstance(definition, str):
72+
if definition in definitions['get_transmembrane_tendency']:
73+
return definition
74+
6375
return ArgumentError('definition', value=definition, caller=caller, message=None)
6476

molsysmt/physchem/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@
99
from .get_sasa import get_sasa
1010
from .get_surface_area import get_surface_area
1111
from .get_volume import get_volume
12-
from .get_degrees_of_freedom import get_degrees_of_freedom

molsysmt/physchem/get_atomic_radius.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
import numpy as np
55

66
@digest()
7-
def get_atomic_radius(molecular_system, selection='all', definition='vdw'):
7+
def get_atomic_radius(molecular_system, element='atom', selection='all', definition='vdw', syntax='MolSysMT',
8+
skip_digestion=False):
89
"""
910
To be written soon...
1011
"""
1112

1213
from molsysmt.basic import get
13-
from molsysmt.physico_chemical_properties.atoms.radius import units
14-
from molsysmt._private._digestion import digest_element
14+
from molsysmt.physchem.atoms.radius import units
1515

1616
if definition=='vdw':
17-
from molsysmt.physico_chemical_properties.atoms.radius import vdw as values
17+
from molsysmt.physchem.atoms.radius import vdw as values
1818
else:
1919
raise NotImplementedError()
2020

2121

22-
atom_types = get(molecular_system, element='atom', selection=selection, type=True)
22+
atom_types = get(molecular_system, element='atom', selection=selection, atom_type=True)
2323

2424
output = []
2525

0 commit comments

Comments
 (0)