Skip to content

Commit

Permalink
Rewrite of workflow template with most recent best practices.
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Dec 1, 2021
1 parent e4ccf7c commit d160a6d
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 124 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/conventional-prs.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: true
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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/[email protected]
with:
directory: .test
snakefile: workflow/Snakefile
args: "--report report.zip"
50 changes: 50 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
results/**
resources/**
.snakemake
.snakemake/**
4 changes: 4 additions & 0 deletions .snakemake-workflow-catalog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
usage:
software-stack-deployment:
conda: true
report: true
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
29 changes: 8 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <path>

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.
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).
83 changes: 0 additions & 83 deletions README.md.tmpl

This file was deleted.

2 changes: 2 additions & 0 deletions config/README.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 0 additions & 7 deletions copier.yaml

This file was deleted.

1 change: 0 additions & 1 deletion copier.yml.tmpl

This file was deleted.

16 changes: 4 additions & 12 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
@@ -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"
# 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.
Empty file removed workflow/rules/common.smk
Empty file.

0 comments on commit d160a6d

Please sign in to comment.