cocoatree 0.1.0rc0.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cocoatree/__init__.py +8 -0
- cocoatree/__params.py +80 -0
- cocoatree/_pipeline.py +144 -0
- cocoatree/_scraper.py +23 -0
- cocoatree/_version.py +1 -0
- cocoatree/datasets/__init__.py +3 -0
- cocoatree/datasets/_base.py +188 -0
- cocoatree/datasets/data/DHFR/3QL0.pdb +3507 -0
- cocoatree/datasets/data/DHFR/DHFR_sectors.npz +0 -0
- cocoatree/datasets/data/DHFR/alignment.faa.gz +0 -0
- cocoatree/datasets/data/S1A_serine_proteases/3tgi.pdb +2844 -0
- cocoatree/datasets/data/S1A_serine_proteases/halabi_alignment.fasta +20580 -0
- cocoatree/datasets/data/S1A_serine_proteases/halabi_metadata.csv +1471 -0
- cocoatree/datasets/data/S1A_serine_proteases/halabi_sectors.npz +0 -0
- cocoatree/datasets/data/S1A_serine_proteases/rivoire_alignment.fasta +19460 -0
- cocoatree/datasets/data/S1A_serine_proteases/rivoire_metadata.csv +1391 -0
- cocoatree/datasets/data/S1A_serine_proteases/rivoire_sectors.npz +0 -0
- cocoatree/datasets/data/rhomboid_proteases/2NRF.pdb +3300 -0
- cocoatree/datasets/data/rhomboid_proteases/Data_S1_Rhomboid_MSA_short_names.fasta +5534 -0
- cocoatree/datasets/data/rhomboid_proteases/rhomboid_metadata_clean.csv +2766 -0
- cocoatree/datasets/data/rhomboid_proteases/rhomboid_sectors.npz +0 -0
- cocoatree/datasets/tests/test_datasets.py +14 -0
- cocoatree/decomposition.py +263 -0
- cocoatree/io.py +185 -0
- cocoatree/msa.py +579 -0
- cocoatree/pysca.py +238 -0
- cocoatree/randomize.py +30 -0
- cocoatree/scripts/cocoatree-sca.py +6 -0
- cocoatree/statistics/__init__.py +58 -0
- cocoatree/statistics/pairwise.py +318 -0
- cocoatree/statistics/position.py +258 -0
- cocoatree/tests/test_init.py +24 -0
- cocoatree/tests/test_msa.py +14 -0
- cocoatree/visualization.py +440 -0
- cocoatree-0.1.0rc0.dev2.dist-info/METADATA +66 -0
- cocoatree-0.1.0rc0.dev2.dist-info/RECORD +39 -0
- cocoatree-0.1.0rc0.dev2.dist-info/WHEEL +5 -0
- cocoatree-0.1.0rc0.dev2.dist-info/licenses/LICENSE +28 -0
- cocoatree-0.1.0rc0.dev2.dist-info/top_level.txt +1 -0
cocoatree/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from . import msa # noqa: F401
|
|
2
|
+
from . import datasets # noqa: F401
|
|
3
|
+
from . import statistics # noqa: F401
|
|
4
|
+
from . import io # noqa: F401
|
|
5
|
+
from . import decomposition # noqa: F401
|
|
6
|
+
from ._pipeline import perform_sca # noqa: F401
|
|
7
|
+
from ._version import __version__ # noqa: F401
|
|
8
|
+
|
cocoatree/__params.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Parameters for COCOA-Tree
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
# in pySCA, the defautl value is 0.03 (default here)
|
|
6
|
+
# in mean-field DCA, the default value is 0.5
|
|
7
|
+
__freq_regularization_ref = 0.03
|
|
8
|
+
|
|
9
|
+
__freq0 = np.array(
|
|
10
|
+
[
|
|
11
|
+
0.073,
|
|
12
|
+
0.025,
|
|
13
|
+
0.050,
|
|
14
|
+
0.061,
|
|
15
|
+
0.042,
|
|
16
|
+
0.072,
|
|
17
|
+
0.023,
|
|
18
|
+
0.053,
|
|
19
|
+
0.064,
|
|
20
|
+
0.089,
|
|
21
|
+
0.023,
|
|
22
|
+
0.043,
|
|
23
|
+
0.052,
|
|
24
|
+
0.040,
|
|
25
|
+
0.052,
|
|
26
|
+
0.073,
|
|
27
|
+
0.056,
|
|
28
|
+
0.063,
|
|
29
|
+
0.013,
|
|
30
|
+
0.033
|
|
31
|
+
]
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
lett2num = {
|
|
35
|
+
'-': 0,
|
|
36
|
+
'A': 1,
|
|
37
|
+
'C': 2,
|
|
38
|
+
'D': 3,
|
|
39
|
+
'E': 4,
|
|
40
|
+
'F': 5,
|
|
41
|
+
'G': 6,
|
|
42
|
+
'H': 7,
|
|
43
|
+
'I': 8,
|
|
44
|
+
'K': 9,
|
|
45
|
+
'L': 10,
|
|
46
|
+
'M': 11,
|
|
47
|
+
'N': 12,
|
|
48
|
+
'P': 13,
|
|
49
|
+
'Q': 14,
|
|
50
|
+
'R': 15,
|
|
51
|
+
'S': 16,
|
|
52
|
+
'T': 17,
|
|
53
|
+
'V': 18,
|
|
54
|
+
'W': 19,
|
|
55
|
+
'Y': 20}
|
|
56
|
+
|
|
57
|
+
__aa_count = len(lett2num)
|
|
58
|
+
|
|
59
|
+
aatable = {
|
|
60
|
+
"ALA": "A",
|
|
61
|
+
"ARG": "R",
|
|
62
|
+
"ASN": "N",
|
|
63
|
+
"ASP": "D",
|
|
64
|
+
"CYS": "C",
|
|
65
|
+
"GLN": "Q",
|
|
66
|
+
"GLU": "E",
|
|
67
|
+
"GLY": "G",
|
|
68
|
+
"HIS": "H",
|
|
69
|
+
"ILE": "I",
|
|
70
|
+
"LEU": "L",
|
|
71
|
+
"LYS": "K",
|
|
72
|
+
"MET": "M",
|
|
73
|
+
"PHE": "F",
|
|
74
|
+
"PRO": "P",
|
|
75
|
+
"SER": "S",
|
|
76
|
+
"THR": "T",
|
|
77
|
+
"TRP": "W",
|
|
78
|
+
"TYR": "Y",
|
|
79
|
+
"VAL": "V",
|
|
80
|
+
}
|
cocoatree/_pipeline.py
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
from . import msa
|
|
2
|
+
from . import statistics
|
|
3
|
+
from . import decomposition
|
|
4
|
+
from . import __params
|
|
5
|
+
|
|
6
|
+
import pandas as pd
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def perform_sca(sequences_id, sequences,
|
|
11
|
+
n_components=4,
|
|
12
|
+
freq_regul=__params.__freq_regularization_ref,
|
|
13
|
+
gap_threshold=0.4, seq_threshold=0.2,
|
|
14
|
+
coevolution_metric="SCA", correction=None):
|
|
15
|
+
"""
|
|
16
|
+
Perform statistical coupling analysis (SCA)
|
|
17
|
+
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
sequences : list of MSA sequences to filter
|
|
21
|
+
|
|
22
|
+
sequences_id : list of the MSA's sequence identifiers
|
|
23
|
+
|
|
24
|
+
n_components : int, default: 4
|
|
25
|
+
|
|
26
|
+
gap_threshold : float [0, 1], default: 0.4
|
|
27
|
+
max proportion of gaps tolerated
|
|
28
|
+
|
|
29
|
+
seq_threshold : maximum fraction of gaps per sequence (default 0.2)
|
|
30
|
+
|
|
31
|
+
coevolution_metric : str or callable, optional, default: 'SCA'
|
|
32
|
+
which coevolution metric to use:
|
|
33
|
+
|
|
34
|
+
- SCA: the coevolution matrix from Rivoire et al
|
|
35
|
+
- MI: the mutual information
|
|
36
|
+
- NMI: the normalized mutual information
|
|
37
|
+
- callable: a function that takes as arguments (1) sequences, (2)
|
|
38
|
+
`seq_weights`, and `freq_regul`
|
|
39
|
+
|
|
40
|
+
correction : {None, 'APC', 'entropy'}, default: None
|
|
41
|
+
which correction to use
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
coevol_matrix : np.ndarray (n_filtered_pos, n_filtered_pos)
|
|
46
|
+
coevolution matrix
|
|
47
|
+
|
|
48
|
+
coevol_matrix_ngm : np.ndarray (n_filtered_pos, n_filtered_pos)
|
|
49
|
+
coevolution matrix without global mode (ngm = no global mode)
|
|
50
|
+
|
|
51
|
+
df : pd.DataFrame with the following columns
|
|
52
|
+
|
|
53
|
+
- original_msa_pos : the original MSA position
|
|
54
|
+
- filtered_msa_pos : the position in the filtered MSA
|
|
55
|
+
|
|
56
|
+
and for each component:
|
|
57
|
+
|
|
58
|
+
- PCk: the projection of the residue onto the kth principal component
|
|
59
|
+
- ICk: the projeciton of the residue onto the kth independent
|
|
60
|
+
component
|
|
61
|
+
- xcor_k: wherether the residue is found to be part of xcor k
|
|
62
|
+
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
# Start by filtering sequences
|
|
66
|
+
seq_kept, seq_kept_id, pos_kept = msa.filter_sequences(
|
|
67
|
+
sequences, sequences_id, gap_threshold=gap_threshold,
|
|
68
|
+
seq_threshold=seq_threshold)
|
|
69
|
+
|
|
70
|
+
# Compute sequence weights. This is mostly to avoid recomputing it at
|
|
71
|
+
# several step in the pipeline and thus speed things up a bit
|
|
72
|
+
seq_weights, _ = msa.compute_seq_weights(seq_kept)
|
|
73
|
+
|
|
74
|
+
# Compute co-evolution matrix
|
|
75
|
+
if coevolution_metric == "SCA":
|
|
76
|
+
coevol_matrix = statistics.pairwise.compute_sca_matrix(
|
|
77
|
+
seq_kept,
|
|
78
|
+
seq_weights=seq_weights,
|
|
79
|
+
freq_regul=freq_regul)
|
|
80
|
+
elif coevolution_metric == "MI":
|
|
81
|
+
coevol_matrix = statistics.pairwise.compute_mutual_information_matrix(
|
|
82
|
+
seq_kept, seq_weights=seq_weights, freq_regul=freq_regul,
|
|
83
|
+
normalize=False)
|
|
84
|
+
elif coevolution_metric == "NMI":
|
|
85
|
+
coevol_matrix = statistics.pairwise.compute_mutual_information_matrix(
|
|
86
|
+
seq_kept, seq_weights=seq_weights, freq_regul=freq_regul)
|
|
87
|
+
elif callable(coevolution_metric):
|
|
88
|
+
coevol_matrix = coevolution_metric(
|
|
89
|
+
seq_kept, seq_weights=seq_weights,
|
|
90
|
+
freq_regul=freq_regul)
|
|
91
|
+
else:
|
|
92
|
+
raise ValueError(
|
|
93
|
+
"Unknown 'coevol_metric' value. User provided"
|
|
94
|
+
f"{coevolution_metric}. Options are 'SCA', 'MI', 'NMI'")
|
|
95
|
+
|
|
96
|
+
# Compute correction on coevolution matrix
|
|
97
|
+
if correction is not None:
|
|
98
|
+
if correction == "APC":
|
|
99
|
+
_, coevol_matrix = statistics.pairwise.compute_apc(coevol_matrix)
|
|
100
|
+
elif correction == "entropy":
|
|
101
|
+
entropy_aa = statistics.position.compute_conservation(
|
|
102
|
+
seq_kept,
|
|
103
|
+
seq_weights=seq_weights)
|
|
104
|
+
coevol_matrix = statistics.pairwise.compute_entropy_correction(
|
|
105
|
+
coevol_matrix, entropy_aa)
|
|
106
|
+
else:
|
|
107
|
+
raise ValueError(
|
|
108
|
+
"Unknown 'correction' value. User provided"
|
|
109
|
+
f"{correction}. Options are 'APC', 'entropy'")
|
|
110
|
+
|
|
111
|
+
# Now, compute deconvolution
|
|
112
|
+
|
|
113
|
+
principal_components = decomposition.extract_principal_components(
|
|
114
|
+
coevol_matrix)
|
|
115
|
+
independent_components = decomposition.extract_independent_components(
|
|
116
|
+
coevol_matrix, n_components=n_components)
|
|
117
|
+
xcors = decomposition.extract_xcors_from_ICs(
|
|
118
|
+
independent_components, coevol_matrix)
|
|
119
|
+
|
|
120
|
+
# Now, map everything into a nice pandas DataFrame
|
|
121
|
+
pos_mapping, _ = msa.map_msa_positions(len(sequences[0]), pos_kept)
|
|
122
|
+
|
|
123
|
+
df = pd.DataFrame(
|
|
124
|
+
{"original_msa_pos": np.arange(len(sequences[0]), dtype=int),
|
|
125
|
+
"filtered_msa_pos": pos_mapping.values()})
|
|
126
|
+
# make filtered_msa_pos stay integer with NaN support
|
|
127
|
+
df["filtered_msa_pos"] = df["filtered_msa_pos"].astype("Int64")
|
|
128
|
+
|
|
129
|
+
# Add PCA and ICA results
|
|
130
|
+
for k in range(n_components):
|
|
131
|
+
df.loc[~df["filtered_msa_pos"].isna(),
|
|
132
|
+
"PC%d" % (k+1)] = principal_components[k]
|
|
133
|
+
df.loc[~df["filtered_msa_pos"].isna(),
|
|
134
|
+
"IC%d" % (k+1)] = independent_components[k]
|
|
135
|
+
df["xcor_%d" % (k+1)] = np.isin(
|
|
136
|
+
df["filtered_msa_pos"], xcors[k])
|
|
137
|
+
df.loc[~df["filtered_msa_pos"].isna(),
|
|
138
|
+
"xcor_%d" % (k+1)] = np.isin(
|
|
139
|
+
df.loc[~df["filtered_msa_pos"].isna(),
|
|
140
|
+
"filtered_msa_pos"], xcors[k])
|
|
141
|
+
|
|
142
|
+
coevol_matrix_ngm = decomposition.remove_global_correlations(coevol_matrix)
|
|
143
|
+
|
|
144
|
+
return coevol_matrix, coevol_matrix_ngm, df
|
cocoatree/_scraper.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from glob import glob
|
|
2
|
+
import shutil
|
|
3
|
+
import os
|
|
4
|
+
from sphinx_gallery.scrapers import figure_rst
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def png_scraper(block, block_vars, gallery_conf):
|
|
8
|
+
# Find all PNG files in the directory of this example.
|
|
9
|
+
path_current_example = os.path.dirname(block_vars['src_file'])
|
|
10
|
+
pngs = sorted(glob(os.path.join(path_current_example, '*.png')))
|
|
11
|
+
|
|
12
|
+
# Iterate through PNGs, copy them to the Sphinx-Gallery output directory
|
|
13
|
+
image_names = list()
|
|
14
|
+
image_path_iterator = block_vars['image_path_iterator']
|
|
15
|
+
seen = set()
|
|
16
|
+
for png in pngs:
|
|
17
|
+
if png not in seen:
|
|
18
|
+
seen |= set(png)
|
|
19
|
+
this_image_path = image_path_iterator.next()
|
|
20
|
+
image_names.append(this_image_path)
|
|
21
|
+
shutil.move(png, this_image_path)
|
|
22
|
+
# Use the `figure_rst` helper function to generate reST for image files
|
|
23
|
+
return figure_rst(image_names, gallery_conf['src_dir'])
|
cocoatree/_version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0.rc0.dev2"
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from ..io import load_MSA, load_pdb
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
import gzip
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def load_S1A_serine_proteases(paper='rivoire'):
|
|
9
|
+
"""
|
|
10
|
+
Load the S1A serine protease dataset
|
|
11
|
+
|
|
12
|
+
Halabi dataset: 1470 sequences of length 832; 3 sectors identified
|
|
13
|
+
Rivoire dataset : 1390 sequences of length 832 (snake sequences were
|
|
14
|
+
removed for the paper's analysis); 6 sectors identified (including the
|
|
15
|
+
3 from Halabi et al, 2008)
|
|
16
|
+
|
|
17
|
+
Parameters
|
|
18
|
+
----------
|
|
19
|
+
paper: str, either 'halabi' or 'rivoire'
|
|
20
|
+
whether to load the dataset from Halabi et al, Cell, 2008 or from
|
|
21
|
+
Rivoire et al, PLoS Comput Biol, 2016
|
|
22
|
+
|
|
23
|
+
Returns
|
|
24
|
+
-------
|
|
25
|
+
a dictionnary containing :
|
|
26
|
+
- `sequences_ids`: a list of strings corresponding to sequence names
|
|
27
|
+
- `alignment`: a list of strings corresponding to sequences. Because it
|
|
28
|
+
is an MSA, all the strings are of same length.
|
|
29
|
+
- `metadata`: a pandas dataframe containing the metadata associated
|
|
30
|
+
with the alignment.
|
|
31
|
+
- `sector_positions`: a dictionnary of arrays containing the residue
|
|
32
|
+
positions associated to each sector, either in Halabi et al, or in
|
|
33
|
+
Rivoire et al.
|
|
34
|
+
- `pdb_sequence`: sequence extracted from rat's trypsin PDB structure
|
|
35
|
+
- `pdb_positions`: positions extracted from rat's trypsin PDB structure
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
module_path = os.path.dirname(__file__)
|
|
39
|
+
|
|
40
|
+
if paper == 'halabi':
|
|
41
|
+
# Load the alignment used in Halabi et al, 2008
|
|
42
|
+
filename = os.path.join(
|
|
43
|
+
module_path,
|
|
44
|
+
"data/S1A_serine_proteases/halabi_alignment.fasta")
|
|
45
|
+
data = load_MSA(filename, format="fasta")
|
|
46
|
+
# Load the positions of the 3 sectors identified in Halabi et al, Cell,
|
|
47
|
+
# 2008
|
|
48
|
+
filename = os.path.join(
|
|
49
|
+
module_path,
|
|
50
|
+
"data/S1A_serine_proteases/halabi_sectors.npz")
|
|
51
|
+
sectors = np.load(filename)
|
|
52
|
+
# Load the metadata
|
|
53
|
+
filename = os.path.join(
|
|
54
|
+
module_path,
|
|
55
|
+
"data/S1A_serine_proteases/halabi_metadata.csv")
|
|
56
|
+
metadata = pd.read_csv(filename)
|
|
57
|
+
|
|
58
|
+
elif paper == 'rivoire':
|
|
59
|
+
# Load the alignment used in Rivoire et al, 2016
|
|
60
|
+
filename = os.path.join(
|
|
61
|
+
module_path,
|
|
62
|
+
"data/S1A_serine_proteases/rivoire_alignment.fasta")
|
|
63
|
+
data = load_MSA(filename, format="fasta")
|
|
64
|
+
# Load the positions of the 6 sectors identified in Rivoire et al, PLoS
|
|
65
|
+
# Comput Biol, 2016
|
|
66
|
+
filename = os.path.join(
|
|
67
|
+
module_path,
|
|
68
|
+
"data/S1A_serine_proteases/rivoire_sectors.npz")
|
|
69
|
+
sectors = np.load(filename)
|
|
70
|
+
# Load the metadata
|
|
71
|
+
filename = os.path.join(
|
|
72
|
+
module_path,
|
|
73
|
+
"data/S1A_serine_proteases/rivoire_metadata.csv")
|
|
74
|
+
metadata = pd.read_csv(filename)
|
|
75
|
+
|
|
76
|
+
else:
|
|
77
|
+
raise ValueError(f"invalid paper: {paper}. Options are 'halabi' or \
|
|
78
|
+
'rivoire'")
|
|
79
|
+
|
|
80
|
+
# Load the PDB structure
|
|
81
|
+
filename = os.path.join(
|
|
82
|
+
module_path,
|
|
83
|
+
"data/S1A_serine_proteases/3tgi.pdb")
|
|
84
|
+
pdb_sequence, pdb_positions = load_pdb(filename, '3TGI', 'E')
|
|
85
|
+
data["sector_positions"] = sectors
|
|
86
|
+
data["metadata"] = metadata
|
|
87
|
+
data["pdb_sequence"] = pdb_sequence,
|
|
88
|
+
data["pdb_positions"] = pdb_positions
|
|
89
|
+
|
|
90
|
+
return data
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def load_rhomboid_proteases():
|
|
94
|
+
"""
|
|
95
|
+
Load the rhomboid protease dataset
|
|
96
|
+
|
|
97
|
+
This dataset comes from Mihaljevic & Urban, Cell, 2020
|
|
98
|
+
(DOI: https://doi.org/10.1016/j.str.2020.07.015).
|
|
99
|
+
|
|
100
|
+
Returns
|
|
101
|
+
-------
|
|
102
|
+
a dictionnary containing :
|
|
103
|
+
- `sequence_ids`: a list of strings corresponding to sequence names
|
|
104
|
+
- `alignment`: a list of strings corresponding to sequences. Because it
|
|
105
|
+
is an MSA, all the strings are of same length.
|
|
106
|
+
- `sector_positions`: a dictionnary of arrays containing the residue
|
|
107
|
+
positions associated to each sector as published in the original
|
|
108
|
+
paper.
|
|
109
|
+
- `pdb_sequence`: sequence extracted from E. coli's PDB structure
|
|
110
|
+
- `pdb_positions`: positions extracted from E. coli's PDB structure
|
|
111
|
+
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
module_path = os.path.dirname(__file__)
|
|
115
|
+
filename = os.path.join(
|
|
116
|
+
module_path,
|
|
117
|
+
"data/rhomboid_proteases/Data_S1_Rhomboid_MSA_short_names.fasta")
|
|
118
|
+
data = load_MSA(filename, format="fasta")
|
|
119
|
+
|
|
120
|
+
filename = os.path.join(
|
|
121
|
+
module_path,
|
|
122
|
+
"data/rhomboid_proteases/rhomboid_sectors.npz")
|
|
123
|
+
sectors = np.load(filename)
|
|
124
|
+
|
|
125
|
+
# Load the metadata
|
|
126
|
+
filename = os.path.join(
|
|
127
|
+
module_path,
|
|
128
|
+
"data/rhomboid_proteases/rhomboid_metadata_clean.csv")
|
|
129
|
+
metadata = pd.read_csv(filename)
|
|
130
|
+
|
|
131
|
+
# Load the PDB structure
|
|
132
|
+
filename = os.path.join(
|
|
133
|
+
module_path,
|
|
134
|
+
"data/rhomboid_proteases/2NRF.pdb")
|
|
135
|
+
# Two chains: A or B
|
|
136
|
+
pdb_sequence, pdb_positions = load_pdb(filename, '2NRF', 'A')
|
|
137
|
+
|
|
138
|
+
data["sector_positions"] = sectors
|
|
139
|
+
data["metadata"] = metadata
|
|
140
|
+
data["pdb_sequence"] = pdb_sequence,
|
|
141
|
+
data["pdb_positions"] = pdb_positions
|
|
142
|
+
|
|
143
|
+
return data
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def load_DHFR():
|
|
147
|
+
"""
|
|
148
|
+
load the DHFR dataset
|
|
149
|
+
|
|
150
|
+
This dataset comes from Kalmer et al, The Journal of Physical Chemistry B,
|
|
151
|
+
2024 (https://pubs.acs.org/doi/10.1021/acs.jpcb.4c04195)
|
|
152
|
+
|
|
153
|
+
Returns
|
|
154
|
+
-------
|
|
155
|
+
a dictionnary containing :
|
|
156
|
+
- `sequence_ids`: a list of strings corresponding to sequence names
|
|
157
|
+
- `alignment`: a list of strings corresponding to sequences. Because it
|
|
158
|
+
is an MSA, all the strings are of same length.
|
|
159
|
+
- `sector_positions`: a dictionnary of arrays containing the residue
|
|
160
|
+
positions associated to each sector as published in the original
|
|
161
|
+
paper.
|
|
162
|
+
- `pdb_sequence`: sequence extracted from E. coli's PDB structure
|
|
163
|
+
- `pdb_positions`: positions extracted from E. coli's PDB structure
|
|
164
|
+
"""
|
|
165
|
+
module_path = os.path.dirname(__file__)
|
|
166
|
+
|
|
167
|
+
filename = os.path.join(
|
|
168
|
+
module_path,
|
|
169
|
+
"data/DHFR/alignment.faa.gz")
|
|
170
|
+
with gzip.open(filename, "rt") as f:
|
|
171
|
+
data = load_MSA(f, format="fasta")
|
|
172
|
+
|
|
173
|
+
filename = os.path.join(
|
|
174
|
+
module_path,
|
|
175
|
+
"data/DHFR/DHFR_sectors.npz")
|
|
176
|
+
sectors = np.load(filename)
|
|
177
|
+
|
|
178
|
+
# Load the PDB structure
|
|
179
|
+
filename = os.path.join(
|
|
180
|
+
module_path,
|
|
181
|
+
"data/DHFR/3QL0.pdb")
|
|
182
|
+
pdb_sequence, pdb_positions = load_pdb(filename, '3QL0', 'A')
|
|
183
|
+
|
|
184
|
+
data["sector_positions"] = sectors
|
|
185
|
+
data["pdb_sequence"] = pdb_sequence,
|
|
186
|
+
data["pdb_positions"] = pdb_positions
|
|
187
|
+
|
|
188
|
+
return data
|