Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #228

Merged
merged 13 commits into from
Nov 20, 2024
18 changes: 3 additions & 15 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@ jobs:
- uses: actions/checkout@v4
with:
lfs: "true"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build

- name: Build sdist
run: python -m build --sdist --outdir dist

- uses: actions/upload-artifact@v4
with:
name: dist-source
Expand All @@ -41,18 +37,10 @@ jobs:
- uses: actions/checkout@v4
with:
lfs: "true"

- uses: actions/setup-python@v5
name: Set up Python
with:
python-version: "3.11"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel>=2

- name: Build wheels
run: python -m cibuildwheel --output-dir dist

uses: pypa/[email protected]
with:
output-dir: dist
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: "ubuntu-20.04"
tools:
python: "3.8"
python: "3.11"
jobs:
post_checkout:
# Download and uncompress the binary
Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Pip package
.. image:: https://flat.badgen.net/badge/install%20with/pip/green
:target: https://pypi.org/project/ms2pip/

With Python 3.8 or higher, run:
With Python 3.9 or higher, run:

.. code-block:: bash

Expand Down
4 changes: 2 additions & 2 deletions ms2pip/search_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class ProteomeSearchSpace(BaseModel):
min_length: int = 8
max_length: int = 30
min_precursor_mz: Optional[float] = 0
max_precursor_mz: Optional[float] = np.Inf
max_precursor_mz: Optional[float] = np.inf
cleavage_rule: str = "trypsin"
missed_cleavages: int = 2
semi_specific: bool = False
Expand All @@ -184,7 +184,7 @@ def __init__(self, **data: Any):
min_precursor_mz
Minimum precursor m/z for peptides. Default is 0.
max_precursor_mz
Maximum precursor m/z for peptides. Default is np.Inf.
Maximum precursor m/z for peptides. Default is np.inf.
cleavage_rule
Cleavage rule for peptide digestion. Default is "trypsin".
missed_cleavages
Expand Down
20 changes: 9 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ classifiers = [
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Development Status :: 5 - Production/Stable",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
"numpy>=1.16,<2",
"pandas>=1,<2",
"numpy>=1.25,<3",
"pandas>=1,<3",
"pyarrow",
"pyteomics>=3.5,<5",
"tomlkit>=0.5,<1",
"sqlalchemy>=1.3,<2",
"click>=7,<9",
"xgboost>=1.3,<2",
"xgboost>=1.3",
"lxml>=4",
"rich>=13",
"pydantic>=2",
Expand Down Expand Up @@ -75,25 +75,23 @@ publication = "https://doi.org/10.1093/nar/gkad335/"
ms2pip = "ms2pip.__main__:main"

[build-system]
requires = ["setuptools", "cython", "oldest-supported-numpy"]
requires = ["setuptools", "cython", "numpy>=2.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
include = ["ms2pip*"]

[tool.black]
line-length = 99
target-version = ['py38']
target-version = ['py39']

[tool.ruff]
line-length = 99
target-version = 'py38'
target-version = 'py39'

[tool.cibuildwheel]
build = "cp3*-manylinux_x86_64 cp3*-win_amd64 cp3*-macosx_x86_64 cp3*-macosx_arm64"
skip = "cp36-* cp37-* cp312-*" # EOL / no Numpy wheels available yet for Python 3.12
manylinux-x86_64-image = "manylinux2014"
# test-command = "pytest {package}/tests"
build = "cp3*-manylinux_x86_64 cp3*-musllinux_x86_64 cp3*-win_amd64 cp3*-macosx_x86_64 cp3*-macosx_arm64"
skip = "cp36-* cp37-* cp38-* cp313-*" # No ms2rescore-rs for 3.13
test-command = "ms2pip --help"

[tool.cibuildwheel.macos]
Expand Down
35 changes: 34 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import numpy as np
from psm_utils import PSM, Peptidoform
import pandas as pd

from ms2pip.core import get_training_data
from ms2pip.core import get_training_data, predict_single
from ms2pip.result import ProcessingResult


def _test_get_training_data():
Expand All @@ -13,3 +16,33 @@ def _test_get_training_data():
processes=1
)
pd.testing.assert_frame_equal(expected_df, output_df)

def test_predict_single():
pep = Peptidoform("ACDE/2")
result = predict_single(pep)

expected = ProcessingResult(
psm_index=0,
psm=PSM(peptidoform=pep, spectrum_id=0),
theoretical_mz={
"b": np.array([72.04435, 175.05354, 290.08047], dtype=np.float32),
"y": np.array([148.0604, 263.0873, 366.0965], dtype=np.float32),
},
predicted_intensity={
"b": np.array([-9.14031, -7.6102686, -7.746709], dtype=np.float32),
"y": np.array([-5.8988147, -5.811797, -7.069088], dtype=np.float32),
},
observed_intensity=None,
correlation=None,
feature_vectors=None,
)

assert result.psm_index == expected.psm_index
assert result.psm == expected.psm
np.testing.assert_array_almost_equal(result.theoretical_mz["b"], expected.theoretical_mz["b"])
np.testing.assert_array_almost_equal(result.theoretical_mz["y"], expected.theoretical_mz["y"])
np.testing.assert_array_almost_equal(result.predicted_intensity["b"], expected.predicted_intensity["b"])
np.testing.assert_array_almost_equal(result.predicted_intensity["y"], expected.predicted_intensity["y"])
assert result.observed_intensity == expected.observed_intensity
assert result.correlation == expected.correlation
assert result.feature_vectors == expected.feature_vectors