Skip to content

Commit 038935d

Browse files
authored
incorrect peak predictions in dq sq experiment (#76)
* linting * update catalog * remove dead code * remove 0.0 shifts * update tests * cleaning * bump version
1 parent 6cafc2d commit 038935d

File tree

8 files changed

+192
-59
lines changed

8 files changed

+192
-59
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name="FANDAS",
55
license="Apache License 2.0",
6-
version="2.2.7",
6+
version="2.2.8",
77
author="Siddarth Narasimhan, Rodrigo Honorato",
88
description="Fast Analysis of multidimensional NMR DAta Sets",
99
author_email="",

src/fandas/data/catalog.toml

Lines changed: 180 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,78 @@ ref = ""
3838
# This relationship is too complex to be represented by a single list,
3939
# instead treat it as a relation (nested list)
4040
atom_relation = [
41-
["CA", "HA"],
42-
["CA", "HA2"],
43-
["CA", "HA3"],
44-
["CB", "HB"],
45-
["CB", "HB2"],
46-
["CB", "HB3"],
47-
["CG", "HG"],
48-
["CG", "HG1"],
49-
["CG", "HG2"],
50-
["CG", "HG3"],
51-
["CD", "HD"],
52-
["CD", "HD1"],
53-
["CD", "HD2"],
54-
["CD", "HD3"],
55-
["CE", "HE"],
56-
["CE", "HE1"],
57-
["CE", "HE2"],
58-
["CE", "HE3"]
41+
[
42+
"CA",
43+
"HA",
44+
],
45+
[
46+
"CA",
47+
"HA2",
48+
],
49+
[
50+
"CA",
51+
"HA3",
52+
],
53+
[
54+
"CB",
55+
"HB",
56+
],
57+
[
58+
"CB",
59+
"HB2",
60+
],
61+
[
62+
"CB",
63+
"HB3",
64+
],
65+
[
66+
"CG",
67+
"HG",
68+
],
69+
[
70+
"CG",
71+
"HG1",
72+
],
73+
[
74+
"CG",
75+
"HG2",
76+
],
77+
[
78+
"CG",
79+
"HG3",
80+
],
81+
[
82+
"CD",
83+
"HD",
84+
],
85+
[
86+
"CD",
87+
"HD1",
88+
],
89+
[
90+
"CD",
91+
"HD2",
92+
],
93+
[
94+
"CD",
95+
"HD3",
96+
],
97+
[
98+
"CE",
99+
"HE",
100+
],
101+
[
102+
"CE",
103+
"HE1",
104+
],
105+
[
106+
"CE",
107+
"HE2",
108+
],
109+
[
110+
"CE",
111+
"HE3",
112+
],
59113
]
60114

61115

@@ -119,10 +173,22 @@ atom_relation = [
119173
"CB+CG",
120174
"CB",
121175
],
176+
[
177+
"CB+CG1",
178+
"CB",
179+
],
180+
[
181+
"CB+CG2",
182+
"CB",
183+
],
122184
[
123185
"CG+CB",
124186
"CG",
125187
],
188+
[
189+
"CG+CD",
190+
"CG",
191+
],
126192
[
127193
"CG+CD1",
128194
"CG",
@@ -131,22 +197,68 @@ atom_relation = [
131197
"CG+CD2",
132198
"CG",
133199
],
200+
[
201+
"CG1+CB",
202+
"CG1",
203+
],
204+
[
205+
"CG1+CD",
206+
"CG1",
207+
],
208+
[
209+
"CG1+CD1",
210+
"CG1",
211+
],
212+
[
213+
"CG1+CD2",
214+
"CG1",
215+
],
216+
[
217+
"CG2+CB",
218+
"CG2",
219+
],
220+
[
221+
"CG2+CD",
222+
"CG2",
223+
],
224+
[
225+
"CG2+CD1",
226+
"CG2",
227+
],
228+
[
229+
"CG2+CD2",
230+
"CG2",
231+
],
232+
[
233+
"CD+CG",
234+
"CD",
235+
],
236+
[
237+
"CD+CE",
238+
"CD",
239+
],
134240
[
135241
"CD1+CG",
136242
"CD1",
137243
],
138244
[
139-
"CD1+CE1",
245+
"CD1+CG1",
140246
"CD1",
141247
],
142248
[
143-
"CD1+CE2",
249+
"CD1+CG2",
250+
"CD1",
251+
],
252+
253+
[
254+
"CD1+CE1",
144255
"CD1",
145256
],
146257
[
147258
"CD2+CG",
148259
"CD2",
149260
],
261+
150262
[
151263
"CD2+CE1",
152264
"CD2",
@@ -155,6 +267,16 @@ atom_relation = [
155267
"CD2+CE2",
156268
"CD2",
157269
],
270+
[
271+
"CD2+CE3",
272+
"CD2",
273+
],
274+
[
275+
"CE+CD",
276+
"CE",
277+
],
278+
279+
158280
[
159281
"CE1+CD1",
160282
"CE1",
@@ -168,17 +290,25 @@ atom_relation = [
168290
"CE1",
169291
],
170292
[
171-
"CE2+CD1",
293+
"CE2+CD2",
172294
"CE2",
173295
],
174296
[
175-
"CE2+CD2",
297+
"CE2+CZ",
176298
"CE2",
177299
],
178300
[
179-
"CE2+CZ",
301+
"CE2+CZ2",
180302
"CE2",
181303
],
304+
[
305+
"CE3+CD2",
306+
"CE3",
307+
],
308+
[
309+
"CE3+CZ3",
310+
"CE3",
311+
],
182312
[
183313
"CZ+CE1",
184314
"CZ",
@@ -187,6 +317,33 @@ atom_relation = [
187317
"CZ+CE2",
188318
"CZ",
189319
],
320+
321+
[
322+
"CZ2+CE2",
323+
"CZ2",
324+
],
325+
[
326+
"CZ2+CH2",
327+
"CZ2",
328+
],
329+
330+
[
331+
"CZ3+CE3",
332+
"CZ3",
333+
],
334+
[
335+
"CZ3+CH2",
336+
"CZ3",
337+
],
338+
[
339+
"CH2+CZ2",
340+
"CH2",
341+
],
342+
343+
[
344+
"CH2+CZ3",
345+
"CH2",
346+
],
190347
]
191348
direction = [[0], [0]]
192349
example = """

src/fandas/modules/chemical.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,6 @@
1616
"HX": [atom for atom in ATOM_LIST if "H" in atom],
1717
}
1818

19-
QUANTUM_RELATIONSHIP = [
20-
("C+CA", "C"),
21-
("CA+C", "CA"),
22-
("CA+CB", "CA"),
23-
("CB+CA", "CB"),
24-
("CB+CG", "CB"),
25-
# FIXME: should be CG*, CE*, CD*, etc.
26-
("CG+CB", "CG"),
27-
("CG+CD1", "CG"),
28-
("CG+CD2", "CG"),
29-
("CD1+CG", "CD1"),
30-
("CD1+CE1", "CD1"),
31-
("CD1+CE2", "CD1"),
32-
("CD2+CG", "CD2"),
33-
("CD2+CE1", "CD2"),
34-
("CD2+CE2", "CD2"),
35-
("CE1+CD1", "CE1"),
36-
("CE1+CD2", "CE1"),
37-
("CE1+CZ", "CE1"),
38-
("CE2+CD1", "CE2"),
39-
("CE2+CD2", "CE2"),
40-
("CE2+CZ", "CE2"),
41-
("CZ+CE1", "CZ"),
42-
("CZ+CE2", "CZ"),
43-
]
44-
4519
EXPERIMENT_CATALOG = toml.load(Path(Path(__file__).parents[1], "data/catalog.toml"))
4620

4721
# This tells the position of each atom in the chemical shift:

src/fandas/modules/chemical_shift.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ def assign(self, data=STANDARD_DATA):
5252
for e, v in zip(df.columns[2:], sub_values.iloc[0].values[2:])
5353
)
5454

55+
# remove values that are equal to 0.0
56+
# this will make sure the `Residue` only contains the correct atoms
57+
# for example it will remove CD1 from Met
58+
atom_shift_dic = {
59+
e: atom_shift_dic[e] for e in atom_shift_dic if atom_shift_dic[e] != 0.0
60+
}
61+
5562
self.residues[resnum] = Residue(resnum, resname, ss, atom_shift_dic)
5663

5764
def replace_with_bmrb(

src/fandas/modules/experiment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _make_line(self, data_t):
121121
else:
122122
notes += f"{i.resname}{i.resnum}{atom_name}-"
123123
value = self.get_value(i.shifts, atom_name)
124-
if value:
124+
if value != 0.0:
125125
values.append(value)
126126

127127
if all(values) and len(values) == len(data_t[0]):

src/fandas/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VERSION = "2.2.7"
1+
VERSION = "2.2.8"
22
v_major, v_minor, v_patch = VERSION.split(".")

tests/modules/test_chemical.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""Test the chemical module."""
2+
23
from fandas.modules.chemical import (
34
STANDARD_DATA,
45
ATOM_LIST,
5-
QUANTUM_RELATIONSHIP,
66
EXPERIMENT_CATALOG,
77
ATOM_INDEX_DIC,
88
N_ATOMS,
@@ -25,11 +25,6 @@ def test_atom_list():
2525
assert ATOM_LIST is not None
2626

2727

28-
def test_quantum_relationship():
29-
"""Test if the quantum relationship is defined."""
30-
assert QUANTUM_RELATIONSHIP is not None
31-
32-
3328
def test_experiment_catalog():
3429
"""Test if the experiment catalog is defined."""
3530
assert EXPERIMENT_CATALOG is not None

tests/modules/test_chemical_shift.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test the chemical shift module."""
2+
23
import copy
34

45
import pytest
@@ -125,7 +126,6 @@ def test_consider_deuteration(chemshift_class):
125126

126127
assert chemshift_class.residues[1].shifts["HA"] == 0.0
127128
assert chemshift_class.residues[2].shifts["HA"] == 0.0
128-
assert chemshift_class.residues[2].shifts["HB"] == 0.0
129129
assert chemshift_class.residues[3].shifts["HB"] == 0.0
130130
assert chemshift_class.residues[3].shifts["HB"] == 0.0
131131

0 commit comments

Comments
 (0)