Skip to content

Commit

Permalink
fix: use virtool-workflow^6.0.0-alpha11
Browse files Browse the repository at this point in the history
* Overhaul workflow to use `virtool-workflow^6.0.0`.
* Cleanup tests and example data.
* Source some tools from `workflow-tools`.
* Improve SPAdes logging.
  • Loading branch information
igboyes authored Jan 22, 2024
1 parent e551612 commit 2f14e66
Show file tree
Hide file tree
Showing 47 changed files with 1,456,770 additions and 3,864 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: commitlint
Expand All @@ -22,22 +22,33 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Docker
uses: docker/setup-buildx-action@v3
- name: Build
id: build
uses: docker/build-push-action@v5
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
load: true
target: test
- name: Test
run: docker build -t nuvs-test --target test . && docker run nuvs-test
run: docker run --rm -t ${{ steps.build.outputs.imageid }} pytest
release:
runs-on: ubuntu-22.04
needs: [test, commitlint]
if: github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- name: Install semantic-release
run: npm i semantic-release@v18.0.0 conventional-changelog-conventionalcommits@4.6.1
run: npm i semantic-release@v23.0.0 conventional-changelog-conventionalcommits@7.0.2
- name: Release
env:
GITHUB_USERNAME: ${{ secrets.GH_USERNAME }}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ jobs:
if: github.repository_owner == 'Virtool'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Write VERSION file
run: echo ${{ github.event.release.tag_name }} > VERSION
- name: Update pyproject.toml version
run: sed -i 's/0\.0\.0/${{ github.event.release.tag_name }}/' pyproject.toml
- name: Login to Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.GH_USERNAME }}
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__pycache__
.idea
.pytest_cache
/target/
.vscode
.vscode
target
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
repos:
- repo: https://github.com/psf/black
rev: 23.1.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
hooks:
- id: black
- id: ruff
args: [ --fix ]
- id: ruff-format
9 changes: 0 additions & 9 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
{
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
],
"plugins": [
["@semantic-release/commit-analyzer", {
Expand Down
7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

81 changes: 35 additions & 46 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
FROM debian:buster as prep
WORKDIR /build
RUN apt-get update && apt-get install -y cmake gcc g++ make unzip wget zlib1g-dev
RUN wget https://zlib.net/pigz/pigz-2.8.tar.gz
RUN tar -xvf pigz-2.8.tar.gz
WORKDIR /build/pigz-2.8
RUN make
WORKDIR /build
RUN wget https://www.bioinformatics.babraham.ac.uk/projects/fastqc/fastqc_v0.11.9.zip
RUN unzip fastqc_v0.11.9.zip
RUN wget https://github.com/BenLangmead/bowtie2/releases/download/v2.3.2/bowtie2-2.3.2-legacy-linux-x86_64.zip
RUN unzip bowtie2-2.3.2-legacy-linux-x86_64.zip
RUN mkdir bowtie2
Expand All @@ -17,52 +10,48 @@ RUN tar -xvf SPAdes-3.11.0-Linux.tar.gz
RUN mv SPAdes-3.11.0-Linux spades
RUN sed -i 's/import collections/import collections\nimport collections.abc/g' spades/share/spades/pyyaml3/constructor.py
RUN sed -i 's/key, collections.Hashable/key, collections.abc.Hashable/g' spades/share/spades/pyyaml3/constructor.py
RUN wget http://eddylab.org/software/hmmer/hmmer-3.2.1.tar.gz
RUN tar -xf hmmer-3.2.1.tar.gz
WORKDIR /build/hmmer-3.2.1
RUN ./configure --prefix /build/hmmer
RUN make
RUN make install
WORKDIR /build
RUN wget https://github.com/relipmoc/skewer/archive/0.2.2.tar.gz
RUN tar -xf 0.2.2.tar.gz
WORKDIR /build/skewer-0.2.2
RUN make
RUN mv skewer /build

FROM python:3.10-buster as base
FROM python:3.10-bullseye as build
WORKDIR /app
COPY --from=prep /build/bowtie2/* /usr/local/bin/
COPY --from=prep /build/FastQC /opt/fastqc
COPY --from=prep /build/hmmer /opt/hmmer
COPY --from=prep /build/pigz-2.8/pigz /usr/local/bin/pigz
COPY --from=prep /build/skewer /usr/local/bin/
COPY --from=prep /build/spades /opt/spades
RUN chmod ugo+x /opt/fastqc/fastqc && \
ln -fs /opt/fastqc/fastqc /usr/local/bin/fastqc && \
for file in `ls /opt/hmmer/bin`; do ln -fs /opt/hmmer/bin/${file} /usr/local/bin/${file}; done
RUN apt-get update && \
apt-get install -y --no-install-recommends curl build-essential default-jre && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
RUN apt-get update && apt-get install -y curl build-essential
COPY --from=ghcr.io/virtool/workflow-tools:2.0.1 /opt/hmmer /opt/hmmer
COPY --from=ghcr.io/virtool/workflow-tools:2.0.1 /usr/local/bin/skewer /usr/local/bin/
COPY --from=ghcr.io/virtool/workflow-tools:2.0.1 /usr/local/bin/pigz /usr/local/bin/
RUN apt-get update && apt-get install -y --no-install-recommends curl build-essential default-jre
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN curl -sSL https://install.python-poetry.org | python -
ENV PATH="/root/.cargo/bin:/root/.local/bin:/opt/spades/bin:${PATH}"
RUN pip install --upgrade pip
RUN pip install maturin==0.14.12
ENV PATH="/root/.cargo/bin:/root/.local/bin:/opt/spades/bin:/opt/hmmer/bin/:${PATH}" \
POETRY_CACHE_DIR='/tmp/poetry_cache' \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1
COPY src src
COPY Cargo.toml Cargo.lock poetry.lock pyproject.toml workflow.py ./
RUN maturin build --release
RUN poetry export > requirements.txt
RUN pip install -r requirements.txt
RUN pip install /app/target/wheels/nuvs_rust*.whl
COPY Cargo.toml Cargo.lock poetry.lock pyproject.toml ./
RUN poetry install --only rust
RUN poetry run maturin build --release
RUN poetry remove nuvs-rust && poetry add target/wheels/*.whl && poetry install
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR

FROM build as test
ENV PATH="/root/.cargo/bin:/root/.local/bin:/opt/spades/bin:${PATH}" \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1
RUN poetry install --with dev
COPY example ./example
COPY tests ./tests
COPY workflow.py ./
ENTRYPOINT ["poetry", "run"]

FROM base as test
FROM python:3.10-bullseye as base
WORKDIR /app
ENV PATH="/opt/spades/bin:${PATH}"
RUN poetry export --with dev > requirements.txt
RUN pip install -r requirements.txt
COPY --from=prep /build/bowtie2/* /usr/local/bin/
COPY --from=prep /build/spades /opt/spades
COPY --from=ghcr.io/virtool/workflow-tools:2.0.1 /opt/hmmer /opt/hmmer
COPY --from=ghcr.io/virtool/workflow-tools:2.0.1 /usr/local/bin/skewer /usr/local/bin/
COPY --from=ghcr.io/virtool/workflow-tools:2.0.1 /usr/local/bin/pigz /usr/local/bin/
ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:/opt/spades/bin:/opt/hmmer/bin:${PATH}"
COPY --from=build /app/.venv /app/.venv
COPY workflow.py ./
COPY tests ./tests
RUN pytest
125 changes: 0 additions & 125 deletions docker-compose.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions example/orfs.fa
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
>sequence_0.0
MVAVRAPRRKRASATDLYKTCKAAGTCPPDVIPKIEGSTLADKILQWSGLGIFLGGLGIGTGTGSGGRTGYIPLGGGGRPSVVDIGPT
RPPIIIEPVGPTEPSIVTLVEESSIIQSGAPIPTFSGGNGFELTTSSATTPAVLDITPSAGTVHVTSTNIQNPLYIEPPIDIPQAGEA
SGHIFTTTSTAGTHSYEEIPMEVFASTNGTGLEPISSTPIPGIQRVSAPRLYSKAYQQVKVTDPNFIGNPSTFVTFDNPAYEPIDETL
TYASSSTVAPDPDFLDIIALHRPALTSRKGTVRYSRLGQKATMKTRSGKQIGATVHYYHDISPIQSFAEHEEIELQPLHTSTHSSAPL
FDIYADPDTVPSIHTPRMSYSPTTLPVPRYASNVFSSINTSTTNVTVPLSTSFELPVYSGSDIYTPTSSPTWPSLPPPPTTNLPAIVV
HGDNYYLWPYIYLIHKRRKRMPYFFSDGFVAY
>sequence_2.0
MSSLVSETSNSEVGSQMESPGRGGQSIDAPSSSCFKVRARNLFLTYSKCNLTAVFLLEYISSLLKKYCPTYIYVAQEAHKDGSHHLHC
IIQCSKYVRTTSAKFFDIKEFHPNVQNPRMPKKALSYCKKSPISEAEYGVFQEIKRPRKKKADAPSTKDAKMAEIIKSSTNKEDYLSM
VRKSFPFDWATRLQQFQFSAESLFPSTPPPYVDPFGMPSQDTHPVIGAWLRDELYTDRSPTERRRSLYICGPTRTGKTSWARSLGSHN
YWQHSVDFLHVIQNARYNVIDDIPFKFVPCWKGLVGSQKDITVNPKYGKKRLLSNGIPCIILVNEDEDWLQQMQPSQADWFNANAVVH
YMYSGESFFEAL
Binary file added example/sample/paired_1.fq.gz
Binary file not shown.
Binary file added example/sample/paired_2.fq.gz
Binary file not shown.
Binary file added example/sample/reads_1.fq.gz
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 2f14e66

Please sign in to comment.