csa3d 0.2.1__tar.gz → 0.2.2__tar.gz
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.
- {csa3d-0.2.1 → csa3d-0.2.2}/PKG-INFO +27 -12
- {csa3d-0.2.1 → csa3d-0.2.2}/README.md +26 -11
- csa3d-0.2.2/csa3d/__init__.py +12 -0
- csa3d-0.2.2/csa3d/data_setup.py +224 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/csa3d.egg-info/PKG-INFO +27 -12
- {csa3d-0.2.1 → csa3d-0.2.2}/csa3d.egg-info/SOURCES.txt +2 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/pyproject.toml +1 -1
- {csa3d-0.2.1 → csa3d-0.2.2}/LICENSE +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/csa3d/_vendor/__init__.py +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/csa3d/_vendor/dendrogram_cut.py +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/csa3d/config/__init__.py +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/csa3d/config/loader.py +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/csa3d/config/settings.py +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/csa3d.egg-info/dependency_links.txt +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/csa3d.egg-info/requires.txt +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/csa3d.egg-info/top_level.txt +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/setup.cfg +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/tests/test_code_quality.py +0 -0
- {csa3d-0.2.1 → csa3d-0.2.2}/tests/test_config.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: csa3d
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Extract and analyze enzyme catalytic sites in 3D from the Mechanism and Catalytic Site Atlas (M-CSA)
|
|
5
5
|
Author-email: Ioannis Riziotis <riziotis@ebi.ac.uk>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -106,28 +106,43 @@ pip install -e ".[dev,docs]"
|
|
|
106
106
|
|
|
107
107
|
## Quick Start
|
|
108
108
|
|
|
109
|
-
### 1.
|
|
109
|
+
### 1. Automatic Data Setup (Recommended)
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
Download and setup M-CSA data automatically:
|
|
112
112
|
|
|
113
|
-
**Option A: Download automatically (recommended)**
|
|
114
113
|
```python
|
|
115
|
-
from csa3d import
|
|
116
|
-
|
|
114
|
+
from csa3d import setup_data
|
|
115
|
+
|
|
116
|
+
# Downloads ~50 GB of data to ~/.csa3d/data
|
|
117
|
+
# Set up specific location with:
|
|
118
|
+
# setup_data("/path/to/csa3d_data")
|
|
119
|
+
success = setup_data()
|
|
120
|
+
|
|
121
|
+
if success:
|
|
122
|
+
print("✓ Data setup complete!")
|
|
117
123
|
```
|
|
118
124
|
|
|
119
|
-
|
|
125
|
+
Or via command line:
|
|
126
|
+
```bash
|
|
127
|
+
python -m csa3d.data_setup /path/to/csa3d_data
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 2. Manual Data Configuration
|
|
131
|
+
|
|
132
|
+
If you prefer to download data manually:
|
|
133
|
+
|
|
134
|
+
**Option A: Environment variable**
|
|
120
135
|
```bash
|
|
121
136
|
export CSA3D_DATA_DIR="/path/to/csa3d_data"
|
|
122
137
|
```
|
|
123
138
|
|
|
124
|
-
**Option
|
|
139
|
+
**Option B: Set in code**
|
|
125
140
|
```python
|
|
126
|
-
from csa3d import
|
|
127
|
-
|
|
141
|
+
from csa3d import set_data_dir
|
|
142
|
+
set_data_dir("/path/to/csa3d_data")
|
|
128
143
|
```
|
|
129
144
|
|
|
130
|
-
###
|
|
145
|
+
### 3. Load and Inspect Active Sites
|
|
131
146
|
|
|
132
147
|
```python
|
|
133
148
|
from csa3d import Mcsa
|
|
@@ -152,7 +167,7 @@ for entry in db:
|
|
|
152
167
|
print(f" Resolution: {site.resolution} Å")
|
|
153
168
|
```
|
|
154
169
|
|
|
155
|
-
###
|
|
170
|
+
### 4. Clustering and Template Creation
|
|
156
171
|
|
|
157
172
|
```python
|
|
158
173
|
# Build multiple entries
|
|
@@ -51,28 +51,43 @@ pip install -e ".[dev,docs]"
|
|
|
51
51
|
|
|
52
52
|
## Quick Start
|
|
53
53
|
|
|
54
|
-
### 1.
|
|
54
|
+
### 1. Automatic Data Setup (Recommended)
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
Download and setup M-CSA data automatically:
|
|
57
57
|
|
|
58
|
-
**Option A: Download automatically (recommended)**
|
|
59
58
|
```python
|
|
60
|
-
from csa3d import
|
|
61
|
-
|
|
59
|
+
from csa3d import setup_data
|
|
60
|
+
|
|
61
|
+
# Downloads ~50 GB of data to ~/.csa3d/data
|
|
62
|
+
# Set up specific location with:
|
|
63
|
+
# setup_data("/path/to/csa3d_data")
|
|
64
|
+
success = setup_data()
|
|
65
|
+
|
|
66
|
+
if success:
|
|
67
|
+
print("✓ Data setup complete!")
|
|
62
68
|
```
|
|
63
69
|
|
|
64
|
-
|
|
70
|
+
Or via command line:
|
|
71
|
+
```bash
|
|
72
|
+
python -m csa3d.data_setup /path/to/csa3d_data
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 2. Manual Data Configuration
|
|
76
|
+
|
|
77
|
+
If you prefer to download data manually:
|
|
78
|
+
|
|
79
|
+
**Option A: Environment variable**
|
|
65
80
|
```bash
|
|
66
81
|
export CSA3D_DATA_DIR="/path/to/csa3d_data"
|
|
67
82
|
```
|
|
68
83
|
|
|
69
|
-
**Option
|
|
84
|
+
**Option B: Set in code**
|
|
70
85
|
```python
|
|
71
|
-
from csa3d import
|
|
72
|
-
|
|
86
|
+
from csa3d import set_data_dir
|
|
87
|
+
set_data_dir("/path/to/csa3d_data")
|
|
73
88
|
```
|
|
74
89
|
|
|
75
|
-
###
|
|
90
|
+
### 3. Load and Inspect Active Sites
|
|
76
91
|
|
|
77
92
|
```python
|
|
78
93
|
from csa3d import Mcsa
|
|
@@ -97,7 +112,7 @@ for entry in db:
|
|
|
97
112
|
print(f" Resolution: {site.resolution} Å")
|
|
98
113
|
```
|
|
99
114
|
|
|
100
|
-
###
|
|
115
|
+
### 4. Clustering and Template Creation
|
|
101
116
|
|
|
102
117
|
```python
|
|
103
118
|
# Build multiple entries
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""CSA-3D: Extract and analyze enzyme catalytic sites from M-CSA."""
|
|
2
|
+
|
|
3
|
+
from .data_setup import setup_data
|
|
4
|
+
from .config import set_data_dir, get_data_dir
|
|
5
|
+
|
|
6
|
+
__version__ = "0.2.2"
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"setup_data",
|
|
10
|
+
"set_data_dir",
|
|
11
|
+
"get_data_dir",
|
|
12
|
+
]
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"""Automatic data setup and download for CSA-3D.
|
|
2
|
+
|
|
3
|
+
Downloads and organizes required data files from official sources.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
import os
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Optional
|
|
10
|
+
import urllib.request
|
|
11
|
+
import urllib.error
|
|
12
|
+
from urllib.parse import urljoin
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DataDownloader:
|
|
18
|
+
"""Download and setup CSA-3D data files."""
|
|
19
|
+
|
|
20
|
+
# Data source URLs
|
|
21
|
+
SIFTS_URL = "https://www.ebi.ac.uk/pdbe/download/sifts/csv/"
|
|
22
|
+
KEGG_URL = "https://rest.kegg.jp/get/"
|
|
23
|
+
RHEA_URL = "https://www.rhea-db.org/download/rhea/"
|
|
24
|
+
PDBE_URL = "https://www.ebi.ac.uk/pdbe/download/"
|
|
25
|
+
MCSA_URL = "https://www.ebi.ac.uk/thornton-srv/m-csa/download/"
|
|
26
|
+
|
|
27
|
+
def __init__(self, data_dir: Path):
|
|
28
|
+
"""Initialize data downloader.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
data_dir: Root directory for CSA-3D data
|
|
32
|
+
"""
|
|
33
|
+
self.data_dir = Path(data_dir)
|
|
34
|
+
self.data_dir.mkdir(parents=True, exist_ok=True)
|
|
35
|
+
|
|
36
|
+
def download_file(self, url: str, output_path: Path) -> bool:
|
|
37
|
+
"""Download a file from URL.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
url: URL to download from
|
|
41
|
+
output_path: Path to save file
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
True if successful, False otherwise
|
|
45
|
+
"""
|
|
46
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
47
|
+
|
|
48
|
+
try:
|
|
49
|
+
logger.info(f"Downloading {url} → {output_path}")
|
|
50
|
+
urllib.request.urlretrieve(url, output_path)
|
|
51
|
+
logger.info(f"✓ Downloaded {output_path.name}")
|
|
52
|
+
return True
|
|
53
|
+
except urllib.error.URLError as e:
|
|
54
|
+
logger.warning(f"✗ Failed to download {url}: {e}")
|
|
55
|
+
return False
|
|
56
|
+
except Exception as e:
|
|
57
|
+
logger.error(f"Unexpected error downloading {url}: {e}")
|
|
58
|
+
return False
|
|
59
|
+
|
|
60
|
+
def setup_sifts(self) -> bool:
|
|
61
|
+
"""Setup SIFTS (PDB-UniProt mappings).
|
|
62
|
+
|
|
63
|
+
Downloads from EBI PDBe SIFTS data.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
True if successful
|
|
67
|
+
"""
|
|
68
|
+
logger.info("Setting up SIFTS data...")
|
|
69
|
+
sifts_dir = self.data_dir / "sifts"
|
|
70
|
+
sifts_dir.mkdir(parents=True, exist_ok=True)
|
|
71
|
+
|
|
72
|
+
files = {
|
|
73
|
+
"uniprot_pdb.csv": "uniprot_pdb.csv",
|
|
74
|
+
"pdb_chain_uniprot.csv": "pdb_chain_uniprot.csv",
|
|
75
|
+
"pdb_chain_enzyme.csv": "pdb_chain_enzyme.csv",
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
success = True
|
|
79
|
+
for filename, remote_name in files.items():
|
|
80
|
+
url = urljoin(self.SIFTS_URL, remote_name)
|
|
81
|
+
output = sifts_dir / filename
|
|
82
|
+
if not self.download_file(url, output):
|
|
83
|
+
success = False
|
|
84
|
+
|
|
85
|
+
return success
|
|
86
|
+
|
|
87
|
+
def setup_kegg(self) -> bool:
|
|
88
|
+
"""Setup KEGG reaction data.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
True if successful
|
|
92
|
+
"""
|
|
93
|
+
logger.info("Setting up KEGG data...")
|
|
94
|
+
kegg_dir = self.data_dir / "kegg"
|
|
95
|
+
kegg_dir.mkdir(parents=True, exist_ok=True)
|
|
96
|
+
|
|
97
|
+
# KEGG reactions endpoint
|
|
98
|
+
output = kegg_dir / "kegg_reaction_components.csv"
|
|
99
|
+
logger.info("Note: KEGG data requires special API handling")
|
|
100
|
+
logger.info("Please obtain KEGG reaction data from: https://www.kegg.jp/")
|
|
101
|
+
return False
|
|
102
|
+
|
|
103
|
+
def setup_rhea(self) -> bool:
|
|
104
|
+
"""Setup RHEA reaction data.
|
|
105
|
+
|
|
106
|
+
Downloads from RHEA database.
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
True if successful
|
|
110
|
+
"""
|
|
111
|
+
logger.info("Setting up RHEA data...")
|
|
112
|
+
rhea_dir = self.data_dir / "rhea"
|
|
113
|
+
rhea_dir.mkdir(parents=True, exist_ok=True)
|
|
114
|
+
|
|
115
|
+
url = urljoin(self.RHEA_URL, "rhea_reaction_components.csv")
|
|
116
|
+
output = rhea_dir / "rhea_reaction_components.csv"
|
|
117
|
+
return self.download_file(url, output)
|
|
118
|
+
|
|
119
|
+
def setup_pdbe(self) -> bool:
|
|
120
|
+
"""Setup PDBe data (ions, cofactors, resolution).
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
True if successful
|
|
124
|
+
"""
|
|
125
|
+
logger.info("Setting up PDBe data...")
|
|
126
|
+
pdbe_dir = self.data_dir / "pdbe"
|
|
127
|
+
pdbe_dir.mkdir(parents=True, exist_ok=True)
|
|
128
|
+
|
|
129
|
+
files = {
|
|
130
|
+
"pdb_ions.csv": "pdb_ions.csv",
|
|
131
|
+
"pdb_cofactors.csv": "pdb_cofactors.csv",
|
|
132
|
+
"resolu.idx": "resolu.idx",
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
success = True
|
|
136
|
+
for filename, remote_name in files.items():
|
|
137
|
+
url = urljoin(self.PDBE_URL, remote_name)
|
|
138
|
+
output = pdbe_dir / filename
|
|
139
|
+
if not self.download_file(url, output):
|
|
140
|
+
success = False
|
|
141
|
+
|
|
142
|
+
return success
|
|
143
|
+
|
|
144
|
+
def setup_mcsa(self) -> bool:
|
|
145
|
+
"""Setup M-CSA catalytic site data.
|
|
146
|
+
|
|
147
|
+
Downloads from M-CSA database.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
True if successful
|
|
151
|
+
"""
|
|
152
|
+
logger.info("Setting up M-CSA data...")
|
|
153
|
+
mcsa_dir = self.data_dir / "mcsa"
|
|
154
|
+
mcsa_dir.mkdir(parents=True, exist_ok=True)
|
|
155
|
+
|
|
156
|
+
url = urljoin(self.MCSA_URL, "mcsa_cofactors.csv")
|
|
157
|
+
output = mcsa_dir / "mcsa_cofactors.csv"
|
|
158
|
+
return self.download_file(url, output)
|
|
159
|
+
|
|
160
|
+
def setup_all(self, skip_optional: bool = False) -> dict:
|
|
161
|
+
"""Setup all data files.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
skip_optional: Skip optional data sources (KEGG)
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
Dictionary with setup status for each source
|
|
168
|
+
"""
|
|
169
|
+
logger.info(f"Starting automatic CSA-3D data setup to {self.data_dir}")
|
|
170
|
+
|
|
171
|
+
results = {}
|
|
172
|
+
results["sifts"] = self.setup_sifts()
|
|
173
|
+
results["rhea"] = self.setup_rhea()
|
|
174
|
+
results["pdbe"] = self.setup_pdbe()
|
|
175
|
+
results["mcsa"] = self.setup_mcsa()
|
|
176
|
+
|
|
177
|
+
if not skip_optional:
|
|
178
|
+
results["kegg"] = self.setup_kegg()
|
|
179
|
+
|
|
180
|
+
# Summary
|
|
181
|
+
logger.info("\n" + "=" * 60)
|
|
182
|
+
logger.info("Data Setup Summary:")
|
|
183
|
+
for source, success in results.items():
|
|
184
|
+
status = "✓ Complete" if success else "✗ Failed/Skipped"
|
|
185
|
+
logger.info(f" {source.upper()}: {status}")
|
|
186
|
+
logger.info("=" * 60)
|
|
187
|
+
|
|
188
|
+
return results
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def setup_data(data_dir: Optional[str] = None) -> bool:
|
|
192
|
+
"""Setup CSA-3D data automatically.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
data_dir: Directory for data files. Defaults to ~/.csa3d/data
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
True if setup successful
|
|
199
|
+
"""
|
|
200
|
+
if data_dir is None:
|
|
201
|
+
data_dir = str(Path.home() / ".csa3d" / "data")
|
|
202
|
+
|
|
203
|
+
logger.info(f"Setting up CSA-3D data in: {data_dir}")
|
|
204
|
+
|
|
205
|
+
downloader = DataDownloader(Path(data_dir))
|
|
206
|
+
results = downloader.setup_all()
|
|
207
|
+
|
|
208
|
+
success = all(results.values())
|
|
209
|
+
if success:
|
|
210
|
+
logger.info(f"\n✓ Data setup complete!")
|
|
211
|
+
logger.info(f"Set environment variable: export CSA3D_DATA_DIR={data_dir}")
|
|
212
|
+
else:
|
|
213
|
+
logger.warning("\n⚠ Some data sources failed to download")
|
|
214
|
+
logger.info("Please check logs above and retry")
|
|
215
|
+
|
|
216
|
+
return success
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
if __name__ == "__main__":
|
|
220
|
+
logging.basicConfig(
|
|
221
|
+
level=logging.INFO,
|
|
222
|
+
format="%(levelname)s: %(message)s"
|
|
223
|
+
)
|
|
224
|
+
setup_data()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: csa3d
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Extract and analyze enzyme catalytic sites in 3D from the Mechanism and Catalytic Site Atlas (M-CSA)
|
|
5
5
|
Author-email: Ioannis Riziotis <riziotis@ebi.ac.uk>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -106,28 +106,43 @@ pip install -e ".[dev,docs]"
|
|
|
106
106
|
|
|
107
107
|
## Quick Start
|
|
108
108
|
|
|
109
|
-
### 1.
|
|
109
|
+
### 1. Automatic Data Setup (Recommended)
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
Download and setup M-CSA data automatically:
|
|
112
112
|
|
|
113
|
-
**Option A: Download automatically (recommended)**
|
|
114
113
|
```python
|
|
115
|
-
from csa3d import
|
|
116
|
-
|
|
114
|
+
from csa3d import setup_data
|
|
115
|
+
|
|
116
|
+
# Downloads ~50 GB of data to ~/.csa3d/data
|
|
117
|
+
# Set up specific location with:
|
|
118
|
+
# setup_data("/path/to/csa3d_data")
|
|
119
|
+
success = setup_data()
|
|
120
|
+
|
|
121
|
+
if success:
|
|
122
|
+
print("✓ Data setup complete!")
|
|
117
123
|
```
|
|
118
124
|
|
|
119
|
-
|
|
125
|
+
Or via command line:
|
|
126
|
+
```bash
|
|
127
|
+
python -m csa3d.data_setup /path/to/csa3d_data
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 2. Manual Data Configuration
|
|
131
|
+
|
|
132
|
+
If you prefer to download data manually:
|
|
133
|
+
|
|
134
|
+
**Option A: Environment variable**
|
|
120
135
|
```bash
|
|
121
136
|
export CSA3D_DATA_DIR="/path/to/csa3d_data"
|
|
122
137
|
```
|
|
123
138
|
|
|
124
|
-
**Option
|
|
139
|
+
**Option B: Set in code**
|
|
125
140
|
```python
|
|
126
|
-
from csa3d import
|
|
127
|
-
|
|
141
|
+
from csa3d import set_data_dir
|
|
142
|
+
set_data_dir("/path/to/csa3d_data")
|
|
128
143
|
```
|
|
129
144
|
|
|
130
|
-
###
|
|
145
|
+
### 3. Load and Inspect Active Sites
|
|
131
146
|
|
|
132
147
|
```python
|
|
133
148
|
from csa3d import Mcsa
|
|
@@ -152,7 +167,7 @@ for entry in db:
|
|
|
152
167
|
print(f" Resolution: {site.resolution} Å")
|
|
153
168
|
```
|
|
154
169
|
|
|
155
|
-
###
|
|
170
|
+
### 4. Clustering and Template Creation
|
|
156
171
|
|
|
157
172
|
```python
|
|
158
173
|
# Build multiple entries
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "csa3d"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.2"
|
|
8
8
|
description = "Extract and analyze enzyme catalytic sites in 3D from the Mechanism and Catalytic Site Atlas (M-CSA)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "Apache-2.0"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|