Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

49 changes: 9 additions & 40 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,20 @@ on:
types: [created]

jobs:
build-sdist:
name: Build source distribution
build:
runs-on: ubuntu-latest
steps:
- 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
path: dist

build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-15, macos-15-intel]
steps:
- uses: actions/checkout@v4
with:
lfs: "true"
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.0
with:
output-dir: dist
- uses: astral-sh/setup-uv@v6
- name: Build sdist and wheel
run: uv build --out-dir dist
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
name: dist
path: dist

publish-to-pypi:
needs: [build-sdist, build-wheels]
needs: [build]
runs-on: ubuntu-latest
environment:
name: pypi
Expand All @@ -56,10 +27,8 @@ jobs:
id-token: write
steps:
- uses: actions/download-artifact@v4
- name: Move wheels to dist
run: |
mkdir dist/
mv dist-*/*.whl dist/
mv dist-*/*.tar.gz dist/
with:
name: dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
52 changes: 24 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,36 @@ on:
workflow_dispatch:

jobs:
build:
lint:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
- run: uvx ruff check --output-format=github ./ms2pip

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
lfs: "true"
enable-cache: true
- run: uv run --all-extras --group dev --python 3.13 ty check ms2pip/

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
enable-cache: true
- name: Install and test
run: |
python -m pip install --upgrade pip
pip install ruff

- name: Check with Ruff
run: ruff check --output-format=github ./ms2pip

- name: Build and install ms2pip
run: |
pip install .[dev]

- name: Test with pytest
run: |
pytest

- name: Test installation
uv run --python ${{ matrix.python-version }} pytest
- name: Test CLI
run: |
ms2pip --help
uv run --python ${{ matrix.python-version }} ms2pip --help
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
.pytest_cache/

# Custom MS2PIP stuff
# Custom
data/
*_pyx.c
*_pyx_*.c
ms2pip/models_xgboost/*.xgboost

# Pytest
.pytest_cache/
Expand Down Expand Up @@ -98,6 +93,7 @@ celerybeat-schedule
.venv/
venv/
ENV/
.venv-*/

# Spyder project settings
.spyderproject
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ peptide fragmentation spectrum that accurately resembles its observed equivalent
can be used to validate peptide identifications, generate proteome-wide spectral libraries, or to
select discriminative transitions for targeted proteomics. MS²PIP employs the
`XGBoost <https://xgboost.readthedocs.io/en/stable/>`_ machine learning algorithm and is written in
Python and C.
Python, with helper functions in Rust
(`ms2rescore-rs <https://github.com/compomics/ms2rescore-rs>`_).

.. figure:: https://raw.githubusercontent.com/compomics/ms2pip/v4.0.0/img/mirror-DVAQIFNNILR-2.png

Expand Down
1 change: 1 addition & 0 deletions docs/source/api/ms2pip.result.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ ms2pip.result
*************

.. automodule:: ms2pip.result
:members:
1 change: 1 addition & 0 deletions docs/source/api/ms2pip.spectrum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ ms2pip.spectrum
***************

.. automodule:: ms2pip.spectrum
:members:
7 changes: 1 addition & 6 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@ Pip package
.. image:: https://flat.badgen.net/badge/install%20with/pip/green
:target: https://pypi.org/project/ms2pip/

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

.. code-block:: bash

pip install ms2pip

Compiled wheels are available for various Python versions on 64bit Linux,
Windows, and macOS. This should install MS²PIP in a few seconds. For other
platforms, MS²PIP can be built from source, although it can take a while
to compile the large prediction models.

We recommend using a `venv <https://docs.python.org/3/library/venv.html>`__ or
`conda <https://docs.conda.io/en/latest/>`__ virtual environment.

Expand Down
4 changes: 3 additions & 1 deletion ms2pip/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# isort: skip_file
"""MS2PIP: Accurate and versatile peptide fragmentation spectrum prediction."""

__version__ = "4.2.0-alpha.2"
__version__ = "4.2.0-alpha.3"
__all__ = [
"predict_single",
"predict_batch",
"predict_library",
"correlate",
"correlate_preloaded",
"correlate_single",
"get_training_data",
"annotate_spectra",
"download_models",
Expand All @@ -26,6 +27,7 @@
predict_library,
correlate,
correlate_preloaded,
correlate_single,
get_training_data,
annotate_spectra,
download_models,
Expand Down
22 changes: 14 additions & 8 deletions ms2pip/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging
import sys
from pathlib import Path
from typing import Optional

import click
import rich
Expand Down Expand Up @@ -32,7 +31,7 @@

def _infer_output_name(
input_filename: str,
output_name: Optional[str] = None,
output_name: str | None = None,
) -> Path:
"""Infer output filename from input filename if output_filename was not defined."""
if output_name:
Expand All @@ -50,9 +49,7 @@ def cli(*args, **kwargs):
format="%(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
level=LOGGING_LEVELS[kwargs["logging_level"]],
handlers=[
RichHandler(rich_tracebacks=True, show_level=True, show_path=False)
],
handlers=[RichHandler(rich_tracebacks=True, show_level=True, show_path=False)],
)
rich.print(build_credits())

Expand All @@ -79,7 +76,7 @@ def predict_single(*args, **kwargs):
# Write output
rich.print(build_prediction_table(predicted_spectrum))
write_spectra(output_name, [result], output_format)
if plot:
if plot and predicted_spectrum:
spectrum_to_png(predicted_spectrum, output_name)


Expand Down Expand Up @@ -142,6 +139,9 @@ def predict_library(*args, **kwargs):
@click.option("--model", type=click.Choice(MODELS), default="HCD")
@click.option("--model-dir")
@click.option("--ms2-tolerance", type=float, default=0.02)
@click.option(
"--ms2-tolerance-mode", type=click.Choice(["Da", "ppm"], case_sensitive=False), default="Da"
)
@click.option("--processes", "-n", type=int)
def correlate(*args, **kwargs):
# Parse arguments
Expand Down Expand Up @@ -171,6 +171,9 @@ def correlate(*args, **kwargs):
@click.option("--spectrum-id-pattern", "-p")
@click.option("--model", type=click.Choice(MODELS), default="HCD")
@click.option("--ms2-tolerance", type=float, default=0.02)
@click.option(
"--ms2-tolerance-mode", type=click.Choice(["Da", "ppm"], case_sensitive=False), default="Da"
)
@click.option("--processes", "-n", type=int)
def get_training_data(*args, **kwargs):
# Parse arguments
Expand All @@ -193,6 +196,9 @@ def get_training_data(*args, **kwargs):
@click.option("--spectrum-id-pattern", "-p")
@click.option("--model", type=click.Choice(MODELS), default="HCD")
@click.option("--ms2-tolerance", type=float, default=0.02)
@click.option(
"--ms2-tolerance-mode", type=click.Choice(["Da", "ppm"], case_sensitive=False), default="Da"
)
@click.option("--processes", "-n", type=int)
def annotate_spectra(*args, **kwargs):
# Parse arguments
Expand All @@ -203,8 +209,8 @@ def annotate_spectra(*args, **kwargs):
results = ms2pip.core.annotate_spectra(*args, **kwargs)

# Write intensities
output_name_int = output_name.with_name(output_name.stem + "_observations").with_suffix()
logger.info(f"Writing intensities to {output_name_int.with_suffix('.tsv')}")
output_name = output_name.with_name(output_name.stem + "_observations")
logger.info(f"Writing intensities to {output_name.with_suffix('.tsv')}")
write_spectra(output_name, results, "tsv")


Expand Down
Empty file removed ms2pip/_cython_modules/__init__.py
Empty file.
Loading
Loading