Skip to content

Commit

Permalink
feat: addition of snakemake compatible format and linting (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkatsanto authored Dec 4, 2022
1 parent ccc13f9 commit efa0375
Show file tree
Hide file tree
Showing 13 changed files with 1,791 additions and 1,980 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:

snakemake-graphs:
snakemake-graphs-format:
runs-on: ubuntu-20.04
defaults:
run:
Expand All @@ -36,20 +36,30 @@ jobs:
- name: Update zarp env with root. packages
run: mamba env update -n zarp -f install/environment.root.yml

- name: Update zarp env with dev. packages
run: mamba env update -n zarp -f install/environment.dev.yml

- name: Display all miniconda & env info
run: |
conda info -a
conda list
- name: Run test script for snakemake format
run: bash tests/test_format/test_snakefmt.sh

- name: Run test script for snakemake lint
run: bash tests/test_format/test_snakemake_lint.sh

- name: Run test script for snakemake rulegraph
run: bash tests/test_create_rule_graph/test.sh

- name: Run test script for snakemake DAG
run: bash tests/test_create_dag_image/test.sh


integration-singularity:
needs:
- snakemake-graphs
- snakemake-graphs-format
runs-on: ubuntu-20.04
defaults:
run:
Expand Down Expand Up @@ -86,7 +96,7 @@ jobs:

integration-singularity-tempflag:
needs:
- snakemake-graphs
- snakemake-graphs-format
runs-on: ubuntu-20.04
defaults:
run:
Expand Down Expand Up @@ -123,7 +133,7 @@ jobs:

integration-singularity-MultipleLanes:
needs:
- snakemake-graphs
- snakemake-graphs-format
runs-on: ubuntu-20.04
defaults:
run:
Expand Down Expand Up @@ -160,7 +170,7 @@ jobs:

integration-conda:
needs:
- snakemake-graphs
- snakemake-graphs-format
runs-on: ubuntu-20.04
defaults:
run:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ pip-selfcheck.json
config/*
!config/PUT_YOUR_WORKFLOW_RUN_CONFIGS_HERE
!config/README.md
!config/config.yaml
._*
._.DS_Store
.snakemake/
Expand Down
18 changes: 18 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
# Required fields
samples: "tests/input_files/samples.tsv"
output_dir: "results"
log_dir: "logs"
cluster_log_dir: "logs/cluster"
kallisto_indexes: "results/kallisto_indexes"
salmon_indexes: "results/salmon_indexes"
star_indexes: "results/star_indexes"
alfa_indexes: "results/alfa_indexes"
# Optional fields
rule_config: "tests/input_files/rule_config.yaml"
report_description: "No description provided by user"
report_logo: "images/logo.128px.png"
report_url: "https://zavolan.biozentrum.unibas.ch/"
author_name: "NA"
author_email: "NA"
...
2 changes: 2 additions & 0 deletions install/environment.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ channels:
dependencies:
- bedtools=2.29.2
- biopython=1.76
- snakefmt
- unzip=6.0



23 changes: 23 additions & 0 deletions tests/test_format/test_snakefmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# This script is currently exiting with non-zero status.
# This is expected behaviour though, as several parameters can't be inferred from the test files.

# Tear down test environment
cleanup () {
rc=$?
cd $user_dir
echo "Exit status: $rc"
}
trap cleanup EXIT

# Set up test environment
set -eo pipefail # ensures that script exits at first command that exits with non-zero status
set -u # ensures that script exits when unset variables are used
set -x # facilitates debugging by printing out executed commands
user_dir=$PWD
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
cd $script_dir

# Run tests
snakefmt --check ../../workflow
27 changes: 27 additions & 0 deletions tests/test_format/test_snakemake_lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# This script is currently exiting with non-zero status.
# This is expected behaviour though, as several parameters can't be inferred from the test files.

# Tear down test environment
cleanup () {
rc=$?
cd $user_dir
echo "Exit status: $rc"
}
trap cleanup EXIT

# Set up test environment
set -eo pipefail # ensures that script exits at first command that exits with non-zero status
set -u # ensures that script exits when unset variables are used
set -x # facilitates debugging by printing out executed commands
user_dir=$PWD
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
cd $script_dir

# Run tests
snakemake \
--snakefile="../../workflow/Snakefile" \
--profile="../../profiles/local-singularity" \
--configfile="../input_files/config.yaml" \
--lint
2 changes: 1 addition & 1 deletion tests/test_htsinfer_workflow/test.local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cleanup () {
rm -rf .java/
rm -rf .snakemake/
rm -rf logs/
#rm -rf results/
rm -rf results/
rm -rf Log.out
cd $user_dir
echo "Exit status: $rc"
Expand Down
Loading

0 comments on commit efa0375

Please sign in to comment.