diff --git a/.github/workflows/conventional-prs.yml b/.github/workflows/conventional-prs.yml new file mode 100644 index 0000000..2a5b86f --- /dev/null +++ b/.github/workflows/conventional-prs.yml @@ -0,0 +1,18 @@ +name: PR +on: + pull_request_target: + types: + - opened + - reopened + - edited + - synchronize + +jobs: + title-format: + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v3.4.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + validateSingleCommit: true \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..cf2dd75 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,54 @@ +name: Tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + + +jobs: + Formatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Formatting + uses: github/super-linter@v4 + env: + VALIDATE_ALL_CODEBASE: false + DEFAULT_BRANCH: master + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VALIDATE_SNAKEMAKE_SNAKEFMT: true + + Linting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Lint workflow + uses: snakemake/snakemake-github-action@v1.24.0 + with: + directory: . + snakefile: workflow/Snakefile + args: "--lint" + + Testing: + runs-on: ubuntu-latest + needs: + - Linting + - Formatting + steps: + - uses: actions/checkout@v2 + + - name: Test workflow + uses: snakemake/snakemake-github-action@v1.24.0 + with: + directory: .test + snakefile: workflow/Snakefile + args: "--use-conda --show-failed-logs --cores 3 --conda-cleanup-pkgs cache --all-temp" + + - name: Test report + uses: snakemake/snakemake-github-action@v1.24.0 + with: + directory: .test + snakefile: workflow/Snakefile + args: "--report report.zip" \ No newline at end of file diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..a003abf --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,50 @@ +on: + push: + branches: + - main + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + + - uses: GoogleCloudPlatform/release-please-action@v2 + id: release + with: + release-type: python + package-name: snakemake + + - uses: actions/checkout@v2 + if: ${{ steps.release.outputs.release_created }} + with: + fetch-depth: 0 + + - name: Set up Python + if: ${{ steps.release.outputs.release_created }} + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Build package + if: ${{ steps.release.outputs.release_created }} + run: | + python -m pip install --upgrade pip + python setup.py sdist + + - name: Publish to PyPI + if: ${{ steps.release.outputs.release_created }} + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + + - name: Publish to Registry + if: ${{ steps.release.outputs.release_created }} + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: snakemake/snakemake + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + tags: "v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }},stable" \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e3789f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +results/** +resources/** +.snakemake +.snakemake/** diff --git a/.snakemake-workflow-catalog.yml b/.snakemake-workflow-catalog.yml new file mode 100644 index 0000000..e1c89ad --- /dev/null +++ b/.snakemake-workflow-catalog.yml @@ -0,0 +1,4 @@ +usage: + software-stack-deployment: + conda: true + report: true \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..50bac39 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019, Felix Mölder, Johannes Köster + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index f17a925..ff8dc0c 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,15 @@ -# A best practice template for Snakemake workflows +# Snakemake workflow: dna-seq-varlociraptor -To generate a new structure using this template, run +[![Snakemake](https://img.shields.io/badge/snakemake-≥6.3.0-brightgreen.svg)](https://snakemake.github.io) +[![GitHub actions status](https://github.com/snakemake-workflows/dna-seq-varlociraptor/workflows/Tests/badge.svg?branch=main)](https://github.com/snakemake-workflows/dna-seq-varlociraptor/actions?query=branch%3Amain+workflow%3ATests) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4675661.svg)](https://doi.org/10.5281/zenodo.4675661) - copier gh:snakemake-workflows/snakemake-workflow-template -with path pointing to the desired output directory. +A Snakemake workflow for calling small and structural variants under any kind of scenario (tumor/normal, tumor/normal/relapse, germline, pedigree, populations) via the unified statistical model of [Varlociraptor](https://varlociraptor.github.io). -You will get the following structure: - ├── copier.yml - ├── README.md - ├── .template - │   ├── config - │   │   └── config.yaml.tmpl - │   └── workflow - │   └── Snakefile.tmpl - └── workflow - ├── rules - │   └── common.smk - └── Snakefile +## Usage -The `workflow` folder contains the structure to put the actual workflow in. -Make sure to follow the [best practices](https://snakemake.readthedocs.io/en/stable/snakefiles/deployment.html#distribution-and-reproducibility). +The usage of this workflow is described in the [Snakemake Workflow Catalog](https://snakemake.github.io/snakemake-workflow-catalog/?usage=snakemake-workflows%2Fdna-seq-varlociraptor). -The `.template` folder contains an automatically generated template for deploying the workflow using Snakemake's [module system](https://snakemake.readthedocs.io/en/stable/snakefiles/modularization.html#snakefiles-modules). -Here, you should edit the `config.yaml.tmpl` to contain the config settings you would like to initialize in the deployment of the user. -It is possible to add further files needed for the configuration to the `.template` folder, e.g. sample sheets. \ No newline at end of file +If you use this workflow in a paper, don't forget to give credits to the authors by citing the URL of this (original) repository and its DOI (see above). diff --git a/README.md.tmpl b/README.md.tmpl deleted file mode 100644 index 39d62f1..0000000 --- a/README.md.tmpl +++ /dev/null @@ -1,83 +0,0 @@ -# Snakemake workflow: [[ repo ]] - -[![Snakemake](https://img.shields.io/badge/snakemake-≥6.1.0-brightgreen.svg)](https://snakemake.github.io) -[![GitHub actions status](https://github.com/[[ owner ]]/[[ repo ]]/workflows/Tests/badge.svg?branch=main)](https://github.com/[[ owner ]]/[[ repo ]]/actions?query=branch%3Amain+workflow%3ATests) - -**Add pipeline description here.** - -## Usage - -In any case, if you use this workflow in a paper, don't forget to give credits to the authors by citing the URL of this (original) repository and its DOI (see above). - -### Requirements - -* [Mamba package manager](https://github.com/conda-forge/miniforge#mambaforge) -* [Copier template engine](https://copier.readthedocs.io) -* [Snakemake workflow management system](https://snakemake.github.io) - -### Step 1: Declare this workflow as a module - -Using this workflow works best by declaring it as a module. -By that - -1. You can easily update to a newer release by just modifying the URL. -2. You can easily extend the workflow with further steps by simply adding additional rules. -3. You can [modifying the existing rules](https://snakemake.readthedocs.io/en/stable/snakefiles/modularization.html#snakefiles-modules) if needed. -4. You can easily add other published workflows to your analysis in the same way. - -#### Case a: Use in a new project - -1. Create a project folder on the system where you want to execute the worklow and enter it. -2. Execute - ``` - copier gh:[[ owner ]]/[[ repo ]] . - ``` - This will generate a file `workflow/Snakefile` with the module usage declaration and a template configuration unter `config`. -3. Open `workflow/Snakefile` and replace `` with the [latest stable release](https://github.com/[[ owner ]]/[[ repo ]]/releases). -4. Modify the configuration according to your needs. - -#### Case b: Use in an existing project - -1. Create a temporary folder and enter it. -2. Execute - ``` - copier gh:[[ owner ]]/[[ repo ]] . - ``` -3. Open `workflow/Snakefile` and replace `` with the [latest stable release](https://github.com/[[ owner ]]/[[ repo ]]/releases). -4. Copy the contents of the `config` folder into your existing project (e.g. integrate the `config.yaml` contents into a subsection of your project configuration) and modify them according to your needs. -5. Move the content of `workflow/Snakefile` into the main Snakefile of your existing project. Take case that rules don't clash with other rules in your project and make sure to pass the relevant parts of the configuration, see the [module documentation](https://snakemake.readthedocs.io/en/stable/snakefiles/modularization.html#snakefiles-modules) for details. -6. Modify the configuration according to your needs. - -### Step 2: Consider using git-based version control - -Consider to use git for recording the current and future state of the source files you have just created. -For using Github, details can be found [here](https://docs.github.com/en/github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line). If you do not want to use git, skip this step. - -### Step 3: Execute workflow - -This workflow will automatically download reference genomes and annotation. -In order to save time and space, consider to use [between workflow caching](https://snakemake.readthedocs.io/en/stable/executing/caching.html) by adding the flag `--cache` to any of the commands below. -The workflow already defines which rules are eligible for caching, so no further arguments are required. -When caching is enabled, Snakemake will automatically share those steps between different instances of this workflow. - -Test your configuration by performing a dry-run via - - snakemake --use-conda -n - -Execute the workflow locally via - - snakemake --use-conda --cores $N - -using `$N` cores. For further options, including cluster or cloud execution, see the [Snakemake documentation](https://snakemake.readthedocs.io/en/stable/executing/cli.html). - -### Step 4: Investigate results - -After successful execution, you can create a self-contained interactive HTML report with all results via: - - snakemake --report report.zip - -This report can, e.g., be forwarded to your collaborators. - -### Step 5: Extend or modify this workflow - -If any changes or extensions you made in your local analysis are generically applicable, you are very welcome to submit them to this repository as a [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests). diff --git a/config/README.md b/config/README.md new file mode 100644 index 0000000..44c6f7e --- /dev/null +++ b/config/README.md @@ -0,0 +1,2 @@ +Describe how to configure the workflow (using config.yaml and maybe additional files). +All of them need to be present with example entries inside of the config folder. diff --git a/copier.yaml b/copier.yaml deleted file mode 100644 index 0d97ced..0000000 --- a/copier.yaml +++ /dev/null @@ -1,7 +0,0 @@ -owner: snakemake-workflows -repo: dna-seq-gatk-variant-calling -module_name: dna_seq - -_exclude: - - copier.yaml - - .git \ No newline at end of file diff --git a/copier.yml.tmpl b/copier.yml.tmpl deleted file mode 100644 index 02f4fe6..0000000 --- a/copier.yml.tmpl +++ /dev/null @@ -1 +0,0 @@ -_subdirectory: .template \ No newline at end of file diff --git a/workflow/Snakefile b/workflow/Snakefile index 897d7cc..3826ec5 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -1,12 +1,4 @@ -# The main entry point of your workflow. -# After configuring, running snakemake -n in a clone of this repository should successfully execute a dry-run of the workflow. - - -rule all: - input: - # The first rule should define the default target files - # Subsequent target rules can be specified below. They should start with all_*. - - -# use includes for common helper functions and sets of rules that serve a common theme -include: "rules/common.smk" \ No newline at end of file +# Main entrypoint of the workflow. +# Please follow the best practices: +# https://snakemake.readthedocs.io/en/stable/snakefiles/best_practices.html, +# in particular regarding the standardized folder structure mentioned there. diff --git a/workflow/rules/common.smk b/workflow/rules/common.smk deleted file mode 100644 index e69de29..0000000