Skip to content

Commit

Permalink
ci,fix: fixed confidence out and ci migration
Browse files Browse the repository at this point in the history
  • Loading branch information
jspaezp committed Dec 5, 2024
1 parent 1d7475f commit 0074f88
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 885 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,24 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel build
- name: Set up Python
run: uv python install

- name: Build and publish
run: |
python -m build --wheel .
- name: Install the project
run: uv sync --all-extras --dev

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Test-build the Docker image
run: make build-docker

- name: Login to the GitHub Container Registry
uses: docker/login-action@v3
with:
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine build
enable-cache: true

- name: Set up Python
run: uv python install

- name: Install the project
run: uv sync --all-extras --dev

- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build --sdist --wheel .
make build-sdist
make build-wheel
twine upload dist/*
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -40,3 +42,6 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

- name: Check Build
run: make build
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ unit-test:
check: ruff-lint format pre-commit
@echo "All checks passed"

build: build-wheel build-docker
build: build-wheel build-sdist build-docker
@echo "Build completed"

build-wheel:
uv run --with build python -m build --wheel .

build-sdist:
uv run --with build python -m build --sdist .

build-docker:
uv run --with build python -m build --wheel --outdir dist .
docker build -t $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) .
docker run --rm -it $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) mokapot --help

pre-commit:
pre-commit run --all-files
Expand Down
14 changes: 10 additions & 4 deletions mokapot/confidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def assign_confidence(
qvalue_algorithm="tdc",
sqlite_path=None,
stream_confidence=False,
):
) -> list[Confidence]:
"""Assign confidence to PSMs peptides, and optionally, proteins.
Parameters
Expand Down Expand Up @@ -283,8 +283,11 @@ def assign_confidence(
Returns
-------
None
list[Confidence]
"""

# Note: I am really not a big fan of how large this function is ...
# JSPP 2024-12-05
is_sqlite = sqlite_path is not None

if dest_dir is None:
Expand Down Expand Up @@ -368,6 +371,8 @@ def create_output_writer(path: Path, level: str, initialize: bool):
if prefixes is None:
prefixes = [None] * len(datasets)

out = []

for dataset, score, prefix in zip(datasets, scores_list, prefixes):
# todo: nice to have: move this column renaming stuff into the
# column defs module, and further, have standardized columns
Expand Down Expand Up @@ -507,7 +512,7 @@ def hash_data_row(data_row):
else:
LOGGER.info(f"\t- Found {count} unique {level}.")

out = Confidence(
con = Confidence(
dataset=dataset,
levels=levels_or_proteins,
level_paths=level_data_path,
Expand All @@ -523,10 +528,11 @@ def hash_data_row(data_row):
stream_confidence=stream_confidence,
score_stats=score_stats,
)
out.append(con)
if not prefix:
append_to_output_file = True

return out
return out


@contextmanager
Expand Down
Loading

0 comments on commit 0074f88

Please sign in to comment.