Skip to content

Commit 283af51

Browse files
committed
make dask optional and update documentation for installation
1 parent 8c938c7 commit 283af51

7 files changed

Lines changed: 31 additions & 3 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,18 @@ For those who are really adventurous, it is also possible to directly install an
102102
pip install "git+https://github.com/MannLabs/alphaquant.git@development#egg=alphaquant[stable,development-stable]"
103103
```
104104

105+
#### Optional extras
106+
107+
For processing very large PTM files that don't fit in memory, install the optional dask extra:
108+
109+
```bash
110+
pip install "alphaquant[dask]"
111+
```
112+
or the version with a pinned dependency (recommended)
113+
```bash
114+
pip install "alphaquant[dask-stable]"
115+
```
116+
105117
### Developer installation
106118

107119
AlphaQuant can also be installed in editable (i.e. developer) mode with a few `bash` commands. This allows to fully customize the software and even modify the source code to your specific needs. When an editable Python package is installed, its source code is stored in a transparent location of your choice. While optional, it is advised to first (create and) navigate to e.g. a general software folder:

alphaquant/ptm/ptmsite_mapping.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@
1818
# Cell
1919

2020
import pandas as pd
21-
import dask.dataframe as dd
21+
import warnings
2222

23+
try:
24+
import dask.dataframe as dd
25+
HAS_DASK = True
26+
except ModuleNotFoundError:
27+
HAS_DASK = False
28+
warnings.warn(
29+
"Dependency 'dask' not installed. If you want to use its functionality, install alphaquant with the 'dask' extra. Falling back to non-dask based processing."
30+
)
2331

2432

2533
def assign_dataset_chunkwise(input_file, results_dir, samplemap_df , modification_type = "[Phospho (STY)]", id_thresh = 0.6, excl_thresh =0.2 ,swissprot_file = None,
@@ -46,6 +54,12 @@ def assign_dataset_chunkwise(input_file, results_dir, samplemap_df , modificatio
4654
input_type (str): Type of input data ("Spectronaut" or "DIANN")
4755
organism (str): Organism name
4856
"""
57+
if not HAS_DASK:
58+
raise ImportError(
59+
"Dask is required for out-of-memory PTM site mapping. "
60+
"Install it with: pip install \"alphaquant[dask]\""
61+
)
62+
4963
clean_up_previous_processings(results_dir)
5064

5165
if input_type == 'Spectronaut':

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ optional-dependencies = { stable = { file = ["requirements/requirements.txt",
5353
] }, gui-stable = { file = [ "requirements/requirements_gui.txt",
5454
] }, tests = { file = [ "requirements/requirements_tests.txt",
5555
] }, development = { file = ["requirements/requirements_development.txt", "requirements/requirements_tests.txt",
56+
] }, dask = { file = [ "requirements/requirements_dask_loose.txt",
57+
] }, dask-stable = { file = [ "requirements/requirements_dask.txt",
5658
] }}
5759

5860
version = {attr = "alphaquant.__version__"}

requirements/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ anytree==2.12.1
99
graphviz==0.20.3
1010
click==8.1.8
1111
lmfit==1.3.2
12-
dask==2025.1.0
1312
multiprocess==0.70.17
1413
pyfasta==0.5.2
1514
openpyxl==3.1.5

requirements/requirements_dask.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dask==2025.1.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dask

requirements/requirements_loose.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ anytree
99
graphviz
1010
click
1111
lmfit
12-
dask
1312
multiprocess
1413
pyfasta
1514
openpyxl

0 commit comments

Comments
 (0)