Skip to content

Commit bf00533

Browse files
committed
add ppix folding data example
1 parent be685a2 commit bf00533

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

templates/01a_load_ppix_data.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Load a HDX-MS dataset with both a FD and ND control"""
2+
3+
from pathlib import Path
4+
5+
import numpy as np
6+
7+
from pyhdx import read_dynamx
8+
from pyhdx.process import apply_control, filter_peptides
9+
10+
# %%
11+
12+
root_dir = Path(__file__).parent.parent
13+
np.random.seed(43)
14+
15+
fpath = root_dir / "tests" / "test_data" / "input" / "PpiA_folding.csv"
16+
17+
# Load the full .csv file
18+
df = read_dynamx(fpath)
19+
df
20+
# %%
21+
22+
fd_spec = {"state": "Native", "exposure": {"value": 86400, "unit": "s"}}
23+
nd_spec = {"state": "FD", "exposure": {"value": 0.6, "unit": "s"}}
24+
25+
# Filter out peptides for the full deuteration control
26+
fd_df = filter_peptides(df, **fd_spec)
27+
28+
# Filter out peptides for the non-deuterated control
29+
nd_df = filter_peptides(df, **nd_spec)
30+
31+
# Filter out peptides for the experiment with state "Folding"
32+
peptides = filter_peptides(df, state="Folding")
33+
34+
# %%
35+
# Apply the FD and ND controls. This adds the columns 'rfu' and 'rfu_sd' (Relative Fractional Uptake)
36+
# as well as 'fd_uptake' and 'nd_uptake', and their standard deviations.
37+
peptides_control = apply_control(peptides, fd_control=fd_df, nd_control=nd_df)
38+
peptides_control.columns
39+
40+
# %%

0 commit comments

Comments
 (0)