diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index e352fab..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Bug report -about: Report an issue with this extension -title: '' -labels: bug - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**Output/logs/screenshots** -Please include any relevant output. - -**Sunbeam version** -Get version by activating sunbeam environment and running `sunbeam --version`. - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bba4070..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this extension -title: '' -labels: enhancement - ---- - -**What's the feature?** - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/other.md b/.github/ISSUE_TEMPLATE/other.md deleted file mode 100644 index fee03e7..0000000 --- a/.github/ISSUE_TEMPLATE/other.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -name: Other -about: Not a bug report or feature request -title: '' -labels: '' - ---- - - diff --git a/.github/workflows/condabot.yml b/.github/workflows/condabot.yml new file mode 100644 index 0000000..bf044aa --- /dev/null +++ b/.github/workflows/condabot.yml @@ -0,0 +1,16 @@ +name: Condabot + +on: + schedule: + - cron: '0 2 * * 1' + workflow_dispatch: + +jobs: + run-condabot: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: sunbeam-labs/condabot@v1 \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index d9dd671..0000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Tests - -on: - pull_request: - branches: - - main - push: - branches: - - main - -jobs: - run-tests: - uses: ./.github/workflows/tests.yml - secrets: inherit \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2975c61..dd7b5e5 100755 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,74 +1,31 @@ name: Tests on: + workflow_dispatch: + pull_request: - branches: [ master, main ] + branches: [ main, master ] push: - branches: [ master, main ] - workflow_call: - workflow_dispatch: - schedule: - - cron: "0 13 * * 1" + branches: [ main, master ] jobs: - lint: - name: Lint Code - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: Install Dependencies - run: pip install black snakefmt - - - name: Run Linter - run: | - black --check . - snakefmt --check *.smk - - test-unit: - name: Run Extension Unit Tests + test: + name: Test runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: Install Dependencies - run: pip install pytest pandas - - - name: Run Unit Tests - run: pytest .tests/unit/ - - test-e2e: - name: Test Extension with Sunbeam - runs-on: ubuntu-latest - needs: - - test-unit - - lint - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - name: Test with Sunbeam + - name: Sunbeam tests uses: sunbeam-labs/sbx_test_action@v1 - name: Dump Logs shell: bash if: always() - run: tail -n +1 logs/* + run: tail -n +1 logs/* || true - name: Dump Stats shell: bash if: always() - run: cat stats/* \ No newline at end of file + run: cat stats/* || true diff --git a/.tests/e2e/test_dry_run.py b/.tests/e2e/test_dry_run.py index 95d2798..a170524 100755 --- a/.tests/e2e/test_dry_run.py +++ b/.tests/e2e/test_dry_run.py @@ -1,3 +1,4 @@ +import os import pytest import shutil import subprocess as sp @@ -6,14 +7,8 @@ @pytest.fixture -def setup(monkeypatch): +def setup(): temp_dir = Path(tempfile.mkdtemp()) - monkeypatch.setenv( - "SUNBEAM_EXTENSIONS", str(Path(__file__).parent.parent.parent.parent.resolve()) - ) - print( - "SUNBEAM_EXTENSIONS:", str(Path(__file__).parent.parent.parent.parent.resolve()) - ) reads_fp = Path(".tests/data/reads/").resolve() @@ -22,8 +17,6 @@ def setup(monkeypatch): sp.check_output(["sunbeam", "init", "--data_fp", reads_fp, project_dir]) config_fp = project_dir / "sunbeam_config.yml" - with open(config_fp, "r") as f: - print("Initial config file content:", f.read()) config_str = f"sbx_sga: {{mash_ref: '{temp_dir}/dummy.msh'}}" Path(temp_dir / "dummy.msh").touch() @@ -94,15 +87,12 @@ def run_sunbeam(setup): print("STDOUT: ", sbx_proc.stdout) print("STDERR: ", sbx_proc.stderr) - try: - shutil.copytree(log_fp, "logs/") - shutil.copytree(stats_fp, "stats/") - except FileNotFoundError: - print("No logs or stats directory found.") - Path("logs/").mkdir(parents=True, exist_ok=True) - Path("stats/").mkdir(parents=True, exist_ok=True) - Path("logs/file").touch() - Path("stats/file").touch() + if os.getenv("GITHUB_ACTIONS") == "true": + try: + shutil.copytree(log_fp, "logs/") + shutil.copytree(stats_fp, "stats/") + except FileNotFoundError: + print("No logs or stats directory found.") output_fp = project_dir / "sunbeam_output" benchmarks_fp = project_dir / "stats/" diff --git a/README.md b/README.md index 0617218..488ff61 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Tests](https://github.com/sunbeam-labs/sbx_sga/actions/workflows/tests.yml/badge.svg)](https://github.com/sunbeam-labs/sbx_sga/actions/workflows/tests.yml) +![Condabot](https://img.shields.io/badge/condabot-active-purple) [![DockerHub](https://img.shields.io/docker/pulls/sunbeamlabs/sbx_sga)](https://hub.docker.com/repository/docker/sunbeamlabs/sbx_sga/) @@ -11,37 +12,12 @@ sbx_sga (Single Genome Assembly) is a [sunbeam](https://github.com/sunbeam-labs/sunbeam) extension for isolate QC, assembly, and classification. This pipeline uses [Mash](https://github.com/marbl/mash) for quality control, [Shovill](https://github.com/tseemann/shovill) for bacterial isolate assembly, [CheckM2](https://github.com/chklovski/CheckM2) and [QUAST](https://github.com/ablab/quast) for assembly QC, [MLST](https://github.com/tseemann/mlst) for typing, [Bakta](https://github.com/oschwengers/bakta) for annotation, [abriTAMR](https://github.com/MDU-PHL/abritamr) for AMR profiling, and [Sylph](https://github.com/bluenote-1577/sylph) for taxonomic classification. -## Installation - -Extension install is as simple as passing the extension's URL on GitHub to `sunbeam extend`: - - sunbeam extend https://github.com/sunbeam-labs/sbx_sga - -Any user-modifiable parameters specified in `config.yml` are automatically added on `sunbeam init`. If you're installing an extension in a project where you already have a config file, run the following to add the options for your newly added extension to your config (the `-i` flag means in-place config file modification; remove the `-i` flag to see the new config in stdout): - - sunbeam config update -i /path/to/project/sunbeam_config.yml - -Installation instructions for older versions of Sunbeam are included at the end of this README. - -## Running - -To run an extension, simply run Sunbeam as usual with your extension's target rule specified: - - sunbeam run --profile /path/to/project/ example_rule - -### Options for config.yml +## Config - mash_ref: the reference file for running Mash (should be a file ending in `.msh`) - checkm_ref: the diamond database for running CheckM2 (should be a file ending in `.dmnd`) - bakta_ref: the bakta reference database (should be a directory similar to `.../bakta_db/db/`) -## Installing an extension (legacy instructions for sunbeam <3.0) - -Installing an extension is as simple as cloning (or moving) your extension directory into the sunbeam/extensions/ folder, installing requirements through Conda, and adding the new options to your existing configuration file: - - git clone https://github.com/sunbeam-labs/sbx_sga/ sunbeam/extensions/sbx_sga - cat sunbeam/extensions/sbx_sga/config.yml >> sunbeam_config.yml - -## Issues with pipeline +## Docs -Please post any issues with this extension [here](https://github.com/sunbeam-labs/sbx_sga/issues). +More [docs](https://sunbeam.readthedocs.io/en/stable/extensions.html). \ No newline at end of file diff --git a/envs/abritamr.yml b/envs/abritamr.yml index 59fbe47..5d11f44 100644 --- a/envs/abritamr.yml +++ b/envs/abritamr.yml @@ -2,91 +2,5 @@ name: sga_abritamr channels: - conda-forge - bioconda - - defaults - - r dependencies: - - _libgcc_mutex=0.1 - - _openmp_mutex=4.5 - - abritamr=1.0.11 - - blast=2.15.0 - - bzip2=1.0.8 - - c-ares=1.28.1 - - ca-certificates=2024.2.2 - - curl=7.88.1 - - entrez-direct=21.6 - - gettext=0.22.5 - - gettext-tools=0.22.5 - - hmmer=3.4 - - keyutils=1.6.1 - - krb5=1.20.1 - - ld_impl_linux-64=2.40 - - libasprintf=0.22.5 - - libasprintf-devel=0.22.5 - - libblas=3.9.0 - - libcblas=3.9.0 - - libcurl=7.88.1 - - libedit=3.1.20191231 - - libev=4.33 - - libffi=3.4.2 - - libgcc-ng=13.2.0 - - libgettextpo=0.22.5 - - libgettextpo-devel=0.22.5 - - libgfortran-ng=13.2.0 - - libgfortran5=13.2.0 - - libgomp=13.2.0 - - libidn2=2.3.7 - - liblapack=3.9.0 - - libnghttp2=1.58.0 - - libnsl=2.0.1 - - libopenblas=0.3.27 - - libsqlite=3.45.3 - - libssh2=1.11.0 - - libstdcxx-ng=13.2.0 - - libunistring=0.9.10 - - libxcrypt=4.4.36 - - libzlib=1.2.13 - - ncbi-amrfinderplus=3.10.16 - - ncbi-vdb=3.1.1 - - ncurses=6.5 - - numpy=1.21.6 - - openssl=3.3.0 - - pandas=1.3.5 - - pcre=8.45 - - perl=5.32.1 - - perl-archive-tar=2.40 - - perl-carp=1.50 - - perl-common-sense=3.75 - - perl-compress-raw-bzip2=2.201 - - perl-compress-raw-zlib=2.202 - - perl-encode=3.21 - - perl-exporter=5.74 - - perl-exporter-tiny=1.002002 - - perl-extutils-makemaker=7.70 - - perl-io-compress=2.201 - - perl-io-zlib=1.14 - - perl-json=4.10 - - perl-json-xs=2.34 - - perl-list-moreutils=0.430 - - perl-list-moreutils-xs=0.430 - - perl-parent=0.241 - - perl-pathtools=3.75 - - perl-scalar-list-utils=1.63 - - perl-storable=3.15 - - perl-types-serialiser=1.01 - - pip=24.0 - - python=3.7.12 - - python-dateutil=2.9.0 - - python_abi=3.7 - - pytz=2024.1 - - readline=8.2 - - setuptools=59.8.0 - - six=1.16.0 - - sqlite=3.45.3 - - tk=8.6.13 - - wget=1.21.4 - - wheel=0.34.2 - - xlsxwriter=3.1.9 - - xz=5.2.6 - - zlib=1.2.13 - - zstd=1.5.6 - + - abritamr \ No newline at end of file diff --git a/envs/bakta.yml b/envs/bakta.yml index fd530a4..4028f93 100644 --- a/envs/bakta.yml +++ b/envs/bakta.yml @@ -2,161 +2,5 @@ name: sga_bakta channels: - conda-forge - bioconda - - defaults - - r dependencies: - - _libgcc_mutex=0.1 - - _openmp_mutex=4.5 - - alive-progress=1.6.2 - - aragorn=1.2.41 - - bakta=1.7.0 - - biopython=1.83 - - blast=2.15.0 - - brotli-python=1.1.0 - - bzip2=1.0.8 - - c-ares=1.28.1 - - ca-certificates=2024.6.2 - - certifi=2024.2.2 - - charset-normalizer=3.3.2 - - circos=0.69.9 - - curl=8.8.0 - - diamond=2.1.8 - - entrez-direct=21.6 - - expat=2.6.2 - - font-ttf-dejavu-sans-mono=2.37 - - font-ttf-inconsolata=3.000 - - font-ttf-source-code-pro=2.038 - - font-ttf-ubuntu=0.83 - - fontconfig=2.14.2 - - fonts-conda-ecosystem=1 - - fonts-conda-forge=1 - - freetype=2.12.1 - - gettext=0.22.5 - - gettext-tools=0.22.5 - - giflib=5.2.2 - - hmmer=3.4 - - icu=73.2 - - idna=3.7 - - infernal=1.1.5 - - isa-l=2.31.0 - - keyutils=1.6.1 - - krb5=1.21.2 - - ld_impl_linux-64=2.40 - - lerc=4.0.0 - - libasprintf=0.22.5 - - libasprintf-devel=0.22.5 - - libblas=3.9.0 - - libcblas=3.9.0 - - libcurl=8.8.0 - - libdeflate=1.20 - - libedit=3.1.20191231 - - libev=4.33 - - libexpat=2.6.2 - - libffi=3.4.2 - - libgcc-ng=13.2.0 - - libgd=2.3.3 - - libgettextpo=0.22.5 - - libgettextpo-devel=0.22.5 - - libgfortran-ng=13.2.0 - - libgfortran5=13.2.0 - - libgomp=13.2.0 - - libidn2=2.3.7 - - libjpeg-turbo=3.0.0 - - liblapack=3.9.0 - - libnghttp2=1.58.0 - - libnsl=2.0.1 - - libopenblas=0.3.27 - - libpng=1.6.43 - - libsqlite=3.45.3 - - libssh2=1.11.0 - - libstdcxx-ng=13.2.0 - - libtiff=4.6.0 - - libunistring=0.9.10 - - libuuid=2.38.1 - - libwebp=1.4.0 - - libwebp-base=1.4.0 - - libxcrypt=4.4.36 - - libzlib=1.2.13 - - ncbi-amrfinderplus=3.11.26 - - ncbi-vdb=3.1.1 - - ncurses=6.5 - - numpy=1.26.4 - - openssl=3.3.1 - - pbzip2=1.1.13 - - pcre=8.45 - - perl=5.32.1 - - perl-archive-tar=2.40 - - perl-b-cow=0.007 - - perl-carp=1.50 - - perl-clone=0.46 - - perl-common-sense=3.75 - - perl-compress-raw-bzip2=2.201 - - perl-compress-raw-zlib=2.202 - - perl-config-general=2.65 - - perl-digest-perl-md5=1.9 - - perl-encode=3.21 - - perl-exporter=5.74 - - perl-exporter-tiny=1.002002 - - perl-extutils-config=0.008 - - perl-extutils-helpers=0.026 - - perl-extutils-installpaths=0.012 - - perl-extutils-makemaker=7.70 - - perl-extutils-pl2bat=0.005 - - perl-font-ttf=1.06 - - perl-gd=2.76 - - perl-inc-latest=0.500 - - perl-io-compress=2.201 - - perl-io-string=1.08 - - perl-io-zlib=1.14 - - perl-json=4.10 - - perl-json-xs=2.34 - - perl-list-moreutils=0.430 - - perl-list-moreutils-xs=0.430 - - perl-math-bezier=0.01 - - perl-math-round=0.07 - - perl-math-vecstat=0.08 - - perl-module-build=0.4232 - - perl-module-build-tiny=0.039 - - perl-module-implementation=0.09 - - perl-module-runtime=0.016 - - perl-number-format=1.76 - - perl-params-validate=1.31 - - perl-parent=0.241 - - perl-pathtools=3.75 - - perl-readonly=2.05 - - perl-regexp-common=2017060201 - - perl-scalar-list-utils=1.63 - - perl-set-intspan=1.19 - - perl-statistics-basic=1.6611 - - perl-storable=3.15 - - perl-svg=2.87 - - perl-test-fatal=0.016 - - perl-text-format=0.62 - - perl-time-hires=1.9764 - - perl-try-tiny=0.31 - - perl-types-serialiser=1.01 - - perl-xml-parser=2.44_01 - - pigz=2.8 - - piler-cr=1.06 - - pip=24.0 - - pyrodigal=2.1.0 - - pysocks=1.7.1 - - python=3.10.14 - - python-isal=1.6.1 - - python_abi=3.10 - - pyyaml=6.0.1 - - readline=8.2 - - requests=2.32.3 - - setuptools=70.0.0 - - tk=8.6.13 - - trnascan-se=2.0.11 - - tzdata=2024a - - urllib3=2.2.1 - - wget=1.21.4 - - wheel=0.43.0 - - xopen=1.6.0 - - xz=5.2.6 - - yaml=0.2.5 - - zlib=1.2.13 - - zstd=1.5.6 - + - bakta \ No newline at end of file diff --git a/envs/checkm2.yml b/envs/checkm2.yml index e33b508..47b66a3 100644 --- a/envs/checkm2.yml +++ b/envs/checkm2.yml @@ -2,126 +2,5 @@ name: sga_checkm2 channels: - conda-forge - bioconda - - defaults - - r dependencies: - - _libgcc_mutex=0.1 - - _openmp_mutex=4.5 - - abseil-cpp=20200923.3 - - aiohttp=3.9.5 - - aiosignal=1.3.1 - - astor=0.8.1 - - astunparse=1.6.3 - - async-timeout=4.0.3 - - attrs=23.2.0 - - blinker=1.8.2 - - boost-cpp=1.70.0 - - brotli-python=1.1.0 - - bzip2=1.0.8 - - c-ares=1.28.1 - - ca-certificates=2024.6.2 - - cachetools=4.2.4 - - certifi=2024.2.2 - - cffi=1.16.0 - - charset-normalizer=3.3.2 - - click=8.1.7 - - colorama=0.4.6 - - cryptography=39.0.0 - - diamond=2.0.4 - - frozenlist=1.4.1 - - gast=0.3.3 - - giflib=5.2.2 - - google-auth=1.35.0 - - google-auth-oauthlib=0.4.6 - - google-pasta=0.2.0 - - grpc-cpp=1.36.4 - - grpcio=1.36.1 - - h5py=2.10.0 - - hdf5=1.10.6 - - icu=64.2 - - idna=3.7 - - importlib-metadata=7.1.0 - - joblib=1.4.2 - - jpeg=9e - - keras-preprocessing=1.1.2 - - keyutils=1.6.1 - - krb5=1.20.1 - - ld_impl_linux-64=2.40 - - libblas=3.9.0 - - libcblas=3.9.0 - - libcurl=7.87.0 - - libedit=3.1.20191231 - - libev=4.33 - - libffi=3.4.2 - - libgcc-ng=13.2.0 - - libgfortran-ng=13.2.0 - - libgfortran5=13.2.0 - - libgomp=13.2.0 - - liblapack=3.9.0 - - libnghttp2=1.51.0 - - libnsl=2.0.1 - - libopenblas=0.3.25 - - libpng=1.6.43 - - libprotobuf=3.15.8 - - libsqlite=3.45.3 - - libssh2=1.10.0 - - libstdcxx-ng=13.2.0 - - libuuid=2.38.1 - - libzlib=1.2.13 - - lightgbm=3.2.1 - - markdown=3.6 - - markupsafe=2.1.5 - - multidict=6.0.5 - - ncurses=6.5 - - oauthlib=3.2.2 - - openssl=1.1.1w - - opt_einsum=3.3.0 - - packaging=24.0 - - pandas=1.4.0 - - pip=24.0 - - prodigal=2.6.3 - - protobuf=3.15.8 - - pyasn1=0.6.0 - - pyasn1-modules=0.4.0 - - pycparser=2.22 - - pyjwt=2.8.0 - - pyopenssl=23.2.0 - - pysocks=1.7.1 - - python=3.8.15 - - python-dateutil=2.9.0 - - python-flatbuffers=1.12 - - python_abi=3.8 - - pytz=2024.1 - - pyu2f=0.1.5 - - re2=2021.04.01 - - readline=8.2 - - requests=2.32.3 - - requests-oauthlib=2.0.0 - - rsa=4.9 - - scikit-learn=0.23.2 - - scipy=1.8.0 - - setuptools=70.0.0 - - snappy=1.1.10 - - tensorboard=2.4.1 - - tensorboard-plugin-wit=1.8.1 - - tensorflow=2.4.0 - - tensorflow-base=2.4.0 - - tensorflow-estimator=2.4.0 - - threadpoolctl=3.5.0 - - tk=8.6.13 - - tqdm=4.66.4 - - urllib3=2.2.1 - - werkzeug=3.0.3 - - wheel=0.43.0 - - xz=5.2.6 - - yarl=1.9.4 - - zipp=3.17.0 - - zlib=1.2.13 - - pip: - - absl-py==0.15.0 - - checkm2==1.0.1 - - numpy==1.23.5 - - six==1.15.0 - - termcolor==1.1.0 - - typing-extensions==3.7.4.3 - - wrapt==1.12.1 + - checkm2 \ No newline at end of file diff --git a/sbx_sga.smk b/sbx_sga.smk index 1188ad4..b021699 100644 --- a/sbx_sga.smk +++ b/sbx_sga.smk @@ -1,25 +1,10 @@ -def get_sga_path() -> Path: - for fp in sys.path: - if fp.split("/")[-1] == "sbx_sga": - return Path(fp) - raise Error( - "Filepath for sbx_sga not found, are you sure it's installed under extensions/sbx_sga?" - ) - - ISOLATE_FP = Cfg["all"]["output_fp"] / "isolate" -SBX_SBA_VERSION = open(get_sga_path() / "VERSION").read().strip() TOOLS = ["shovill", "mlst", "checkm", "amr", "bakta", "mash"] - - try: - BENCHMARK_FP + SBX_SBA_VERSION = get_ext_version("sbx_sga") except NameError: - BENCHMARK_FP = output_subdir(Cfg, "benchmarks") -try: - LOG_FP -except NameError: - LOG_FP = output_subdir(Cfg, "logs") + # For backwards compatibility with older versions of Sunbeam + SBX_SBA_VERSION = "unknown" localrules: @@ -70,7 +55,7 @@ rule sga_mash: zcat {input.reads} > {output.agg} mash screen -w -p 8 {params.ref} {output.agg} > {output.win} 2> {log} sort -gr {output.win} > {output.sort} 2>> {log} - """ + """ rule sga_shovill: