Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/pip_installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ jobs:
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
install-script: pip_install.sh stable,tests alphabase ${{ matrix.python-version }} ${{ matrix.os }}
install-script: pip_install.sh stable,tests

loose_installation:
name: Test loose pip installation on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest, macos-latest-xlarge]
python-version: [3.9]
uses: ./.github/workflows/_run_tests.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
install-script: pip_install.sh tests alphabase ${{ matrix.python-version }} ${{ matrix.os }}
install-script: pip_install.sh tests
20 changes: 3 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,11 @@ be compatible with:
pip install "alphabase[stable]"
```

**NOTE**: You might need to run `pip install -U pip` before installing
NOTE: You might need to run `pip install -U pip` before installing
AlphaBase like this. Also note the double quotes `"`.
If you are using the `quant_reader` module, it is advisable to add the
`dask-stable` or `dask` extras to speed up processing large files.

**NOTE for macOS users**: Due to compilation issues with PyTables on macOS, you may encounter build errors when installing AlphaBase.
These may include

- `ERROR:: Could not find a local HDF5 installation`
- `ERROR: Failed building wheel for tables`

If this happens, install PyTables via conda/mamba first:
```bash
conda install -c conda-forge pytables
# or
mamba install -c conda-forge pytables
```
Then proceed with the pip installation of AlphaBase.

`dask-stable` or `dask` extras to speed up processing large files. You need to install the `hdf` option
Comment thread
lucas-diedrich marked this conversation as resolved.
Outdated
of the package to be able to read alphapept protein group matrices in hdf format.

For those who are really adventurous, it is also possible to directly
install any branch (e.g. `@main`) with any extras
Expand Down
3 changes: 3 additions & 0 deletions alphabase/pg_reader/alphapept_pg_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class AlphaPeptPGReader(PGReaderBase):
AlphaPept protein group matrices contain both raw intensities and LFQ-corrected intensities.
The LFQ-corrected intensities are marked by an `_LFQ` suffix.

In order to read alphapept `.hdf` output, please install the package with extra optional
dependencies `pip install alphabase[hdf]`.
Comment thread
lucas-diedrich marked this conversation as resolved.
Outdated

Example:
-------
Get example data
Expand Down
7 changes: 0 additions & 7 deletions misc/pip_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ set -e -u
INSTALL_TYPE=$1 # stable, loose, etc..
ENV_NAME=${2:-alphabase}
PYTHON_VERSION=${3:-3.9}
OS=${4:-nan}

conda create -n $ENV_NAME python=$PYTHON_VERSION -y

Expand All @@ -18,12 +17,6 @@ else
INSTALL_STRING="[${INSTALL_TYPE}]"
fi

# pytables has known issues on MacOS for pg-readers - install from conda
# https://github.com/PyTables/PyTables/issues/219#issuecomment-24117053
if [[ "$OS" = "macOS-latest" || "$OS" = "macos-latest-xlarge" ]]; then
conda install -n $ENV_NAME -c conda-forge pytables -y
fi

# print pip environment for reproducibility
conda run -n $ENV_NAME --no-capture-output pip freeze

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dependencies = {file = ["requirements/requirements_loose.txt"]}
optional-dependencies.stable = { file = ["requirements/requirements.txt" ] }
optional-dependencies.dask = { file = ["requirements/requirements_dask_loose.txt" ] }
optional-dependencies.dask-stable = { file = ["requirements/requirements_dask.txt" ] }
optional-dependencies.hdf = { file = ["requirements/requirements_hdf_loose.txt" ] }
Comment thread
lucas-diedrich marked this conversation as resolved.
optional-dependencies.tests = { file = ["requirements/requirements_tests.txt" ] }
optional-dependencies.development = { file = [
"requirements/requirements_development.txt",
Expand Down
1 change: 0 additions & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ pyteomics==4.7.5
pyyaml==6.0.2
lxml==5.3.0 # required by pyteomics
rdkit==2024.3.3
tables==3.9.2 # required to read HDF files, latest version compatible with 3.9
Comment thread
lucas-diedrich marked this conversation as resolved.
2 changes: 2 additions & 0 deletions requirements/requirements_hdf_loose.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Dependencies required for running the "loose" version of alphabase with hdf support for the alphapept PG reader.
tables
Comment thread
lucas-diedrich marked this conversation as resolved.
1 change: 0 additions & 1 deletion requirements/requirements_loose.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ pyteomics
pyyaml
lxml
rdkit
tables
10 changes: 10 additions & 0 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Shared logic for integration tests."""

import importlib.util
import os
from pathlib import Path

Expand All @@ -8,6 +9,14 @@

from alphabase.tools.data_downloader import DataShareDownloader

TABLES_PACKAGE_UNAVAILABLE = importlib.util.find_spec("tables") is None
Comment thread
lucas-diedrich marked this conversation as resolved.


pytest.mark.optional_pytables_dependency = pytest.mark.skipif(
TABLES_PACKAGE_UNAVAILABLE,
reason="pytables package not installed. Install with `pip install alphabase[hdf]`",
)


def get_remote_data_with_ref(
url: str, ref_url: str, directory: Path
Expand Down Expand Up @@ -132,6 +141,7 @@ def example_alphapept_csv(tmp_path) -> tuple[Path, pd.DataFrame]:
return file_path, reference


@pytest.mark.optional_pytables_dependency
@pytest.fixture(scope="function")
def example_alphapept_hdf(tmp_path) -> tuple[Path, pd.DataFrame]:
"""Get and parse real alphapept protein group report matrix."""
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/test_pg_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_import_csv_file_equivalent(

pd.testing.assert_frame_equal(result_df, reference)

@pytest.mark.optional_pytables_dependency
def test_import_hdf_file_equivalent(
self, example_alphapept_hdf: tuple[str, pd.DataFrame]
):
Expand Down Expand Up @@ -105,6 +106,7 @@ def test_import_csv_file(
PGCols.DECOY_INDICATOR,
]

@pytest.mark.optional_pytables_dependency
@pytest.mark.parametrize(
("measurement_regex", "expected_shape", "expected_colums"),
[
Expand Down
Loading