Skip to content

Commit 6ae41a7

Browse files
committed
init snakemake workflow project
1 parent 5d598ca commit 6ae41a7

File tree

16 files changed

+335
-0
lines changed

16 files changed

+335
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint PR
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
- reopened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: read
12+
13+
jobs:
14+
main:
15+
name: Validate PR title
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@v5
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy Apptainer
2+
3+
on:
4+
workflow_run:
5+
workflows: ["release-please"]
6+
types:
7+
- completed
8+
workflow_dispatch:
9+
10+
jobs:
11+
build_and_push:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
17+
steps:
18+
- name: checkout repo
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: add apptainer source
24+
shell: bash
25+
run: |
26+
sudo add-apt-repository -y ppa:apptainer/ppa
27+
sudo apt-get update
28+
29+
- name: create dockerfile
30+
uses: snakemake/snakemake-github-action@v2
31+
with:
32+
directory: .
33+
snakefile: workflow/Snakefile
34+
install-apptainer: true
35+
args: "--cores 1"
36+
task: containerize
37+
38+
- name: create apptainer recipe
39+
shell: bash
40+
run: |
41+
pip install spython
42+
sed -i "2i RUN apt-get update && apt-get install -y curl" Dockerfile
43+
spython recipe Dockerfile > apptainer.def
44+
sed -i 's/\/environment.yaml\/environment.yaml$/\/environment.yaml/' apptainer.def
45+
46+
- name: create apptainer image
47+
shell: bash
48+
run: |
49+
sudo apt-get install -y uidmap
50+
apptainer build --fakeroot apptainer.sif apptainer.def
51+
52+
- name: authenticate to GHCR
53+
run: |
54+
echo ${{ secrets.GITHUB_TOKEN }} | apptainer registry login -u ${{ github.actor }} --password-stdin oras://ghcr.io
55+
56+
- name: push apptainer to GHCR
57+
run: |
58+
REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
59+
echo "Pushing apptainer to: oras://ghcr.io/${REPO}:latest"
60+
apptainer push apptainer.sif "oras://ghcr.io/${REPO}:latest"

.github/workflows/main.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
pull_request:
7+
branches: [main, dev]
8+
9+
jobs:
10+
Formatting:
11+
runs-on: ubuntu-latest
12+
if: ${{ github.actor != 'github-actions[bot]' }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
- name: Test formatting
18+
uses: super-linter/super-linter@v7
19+
env:
20+
VALIDATE_ALL_CODEBASE: false
21+
DEFAULT_BRANCH: main
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
VALIDATE_SNAKEMAKE_SNAKEFMT: true
24+
VALIDATE_YAML_PRETTIER: true
25+
26+
Linting:
27+
runs-on: ubuntu-latest
28+
if: ${{ github.actor != 'github-actions[bot]' }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Test linting workflow
32+
uses: snakemake/[email protected]
33+
with:
34+
directory: .
35+
snakefile: workflow/Snakefile
36+
args: "--lint"
37+
38+
Testing:
39+
runs-on: ubuntu-latest
40+
if: ${{ github.actor != 'github-actions[bot]' }}
41+
needs:
42+
- Formatting
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Test run workflow
46+
uses: snakemake/[email protected]
47+
with:
48+
directory: .test
49+
snakefile: workflow/Snakefile
50+
args: "--sdm conda --show-failed-logs --cores 3 --conda-cleanup-pkgs cache -n"
51+
52+
- name: Test report
53+
uses: snakemake/[email protected]
54+
with:
55+
directory: .test
56+
snakefile: workflow/Snakefile
57+
args: "--cores 3 --report report.zip -n"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
issues: write
10+
11+
name: release-please
12+
13+
jobs:
14+
release-please:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: googleapis/release-please-action@v4
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
release-type: simple

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
results/**
2+
resources/**
3+
logs/**
4+
.snakemake
5+
.snakemake/**
6+
.test/results/*

.snakemake-workflow-catalog.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
usage:
2+
mandatory-flags:
3+
desc: # describe your flags here in a few sentences
4+
flags: # put your flags here
5+
software-stack-deployment:
6+
conda: true # whether pipeline works with '--sdm conda'
7+
apptainer: false # whether pipeline works with '--sdm apptainer/singularity'
8+
apptainer+conda: true # whether pipeline works with '--sdm conda apptainer/singularity'
9+
report: true # whether creation of reports using 'snakemake --report report.zip' is supported

.test/config/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
samplesheet: "config/samples.tsv"

.test/config/samples.tsv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sample,species,strain,id_prefix,file

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# snakemake-assembly-postprocessing
2+
3+
[![Snakemake](https://img.shields.io/badge/snakemake-≥8.24.1-brightgreen.svg)](https://snakemake.github.io)
4+
[![GitHub actions status](https://github.com/MPUSP/snakemake-assembly-postprocessing/actions/workflows/main.yml/badge.svg)](https://github.com/MPUSP/snakemake-assembly-postprocessing/actions/workflows/main.yml)
5+
[![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/en/latest/)
6+
[![run with apptainer](https://img.shields.io/badge/run%20with-apptainer-1D355C.svg?labelColor=000000)](https://apptainer.org/)
7+
8+
A Snakemake workflow for the post-processing of microbial genome assemblies.
9+
10+
## Usage
11+
12+
The usage of this workflow is described in the [Snakemake Workflow Catalog](https://snakemake.github.io/snakemake-workflow-catalog/docs/workflows/MPUSP/snakemake-assembly-postprocessing).
13+
14+
If you use this workflow in a paper, don't forget to give credits to the authors by citing the URL of this repository.
15+
16+
## Authors
17+
18+
- Dr. Rina Ahmed-Begrich
19+
- Affiliation: [Max-Planck-Unit for the Science of Pathogens](https://www.mpusp.mpg.de/) (MPUSP), Berlin, Germany
20+
- ORCID profile: https://orcid.org/0000-0002-0656-1795
21+
- Dr. Michael Jahn
22+
- Affiliation: [Max-Planck-Unit for the Science of Pathogens](https://www.mpusp.mpg.de/) (MPUSP), Berlin, Germany
23+
- ORCID profile: https://orcid.org/0000-0002-3913-153X
24+
- github page: https://github.com/m-jahn
25+
26+
## References
27+
28+
> Köster, J., Mölder, F., Jablonski, K. P., Letcher, B., Hall, M. B., Tomkins-Tinch, C. H., Sochat, V., Forster, J., Lee, S., Twardziok, S. O., Kanitz, A., Wilm, A., Holtgrewe, M., Rahmann, S., & Nahnsen, S. _Sustainable data analysis with Snakemake_. F1000Research, 10:33, 10, 33, **2021**. https://doi.org/10.12688/f1000research.29032.2.

config/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Running the workflow
2+
3+
### Input data
4+
5+
This workflow requires `fasta` input data.
6+
The samplesheet table has the following layout:
7+
8+
| sample | species | strain | id_prefix | file |
9+
| ----------- | ------------ | ---------------------------------- | ------------- | ------------- |
10+
| EC2224 | "Streptococcus pyogenes" | SF370 | Spy | assembly.fasta |
11+
12+
### Execution
13+
14+
To run the workflow from command line, change to the working directory and activate the conda environment.
15+
16+
```bash
17+
cd snakemake-assembly-postprocessing
18+
conda activate snakemake-assembly-postprocessing
19+
```
20+
21+
Adjust options in the default config file `config/config.yml`.
22+
Before running the entire workflow, perform a dry run using:
23+
24+
```bash
25+
snakemake --cores 3 --sdm conda --directory .test --dry-run
26+
```
27+
28+
To run the workflow with test files using **conda**:
29+
30+
```bash
31+
snakemake --cores 3 --sdm conda --directory .test
32+
```

0 commit comments

Comments
 (0)