Skip to content

Commit

Permalink
test new pipeline workflow after updating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmeaton committed Sep 21, 2020
1 parent 04dcd80 commit f4e9d11
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 6 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#------------------------------------------------------------------------------#
name: Pipeline
#------------------------------------------------------------------------------#
# Global workflow environment variables
env:
CONDA_ENVS_PATH: "/home/runner/miniconda/envs:/usr/share/miniconda/envs"
CONDA_PKGS_DIRS: "/home/runner/miniconda/pkgs"
#------------------------------------------------------------------------------#
# Workflow conditions
on:
push:
branches:
- '*'
paths:
- '.github/workflows/pipeline.yaml'
- 'workflow/Snakefile'
- 'workflow/rules/*.smk'
- 'workflow/envs/*.yaml'
pull_request:
branches:
- '*'
release:
types: [published]
#------------------------------------------------------------------------------#
jobs:
#----------------------------------------------------------------------------#
# Install dependencies
install :
runs-on: ubuntu-latest
steps:
#------------------------------------------------------------------------#
# Checkout Repository
- name: checkout repo
uses: actions/checkout@v2
#------------------------------------------------------------------------#
# Setup conda with mamba
- name: setup conda
uses: goanpeca/setup-miniconda@v1
with:
auto-update-conda: true
mamba-version: "*"
channels: conda-forge
#------------------------------------------------------------------------#
# Restore (cache) conda environments
- name: cache default env
id: cache-default
uses: actions/cache@v2
with:
path: /home/runner/miniconda/envs/default
key: snakemake-default-${{ runner.os }}-${{ hashFiles('workflow/envs/default.yaml') }}
# Check conda environments
- name: check cache
run: |
conda info --envs
# Create environment (if not cached)
- name: create default environment
if: steps.cache-default.outputs.cache-hit != 'true'
shell: bash -l {0}
run:
mamba env create -f workflow/envs/default.yaml
#------------------------------------------------------------------------#
# Test pipeline
- name: test pipeline
shell: bash -l {0}
run:
conda activate default;
snakemake all --use-conda --profile profiles/gh-actions;
conda deactivate;
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
results/*
test/*
sra/*
workflow/logs/*
34 changes: 30 additions & 4 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ report: "report/workflow.rst"
# -----------------------------------------------------------------------------#

rule all:
"""
The default pipeline target.
"""
input:
"results/iqtree/iqtree.treefile"

Expand All @@ -57,9 +60,32 @@ rule help:
"""
run:
for rule in workflow.rules:
print("-" * 80)
print("rule: ", rule.name )
print(rule.docstring )
if rule._input: print("input: ", rule._input)
if rule._output: print("output: ", rule._output)
if rule._params: print("params: ", rule._params)
print("")
# Rule Inputs
if rule._input:
print("\tinput:")
for in_file in rule.input:
print("\t\t" + in_file)
for in_file in rule.input.keys():
print("\t\t" + in_file + ": " + str(rule.input[in_file]))
if rule._output:
print("\toutput:")
for out_file in rule.output:
print("\t\t" + out_file)
for out_file in rule.output.keys():
print("\t\t" + out_file + ": " + str(rule.output[out_file]))
if rule._params:
print("\tparams:")
for param in rule.params.keys():
print("\t\t" + param + ": " + str(rule.params[param]))
if rule.resources:
print("\tresources:")
for resource in rule.resources.keys():
print("\t\t" + resource.strip("_") + ": " + str(rule.resources[resource]))
if rule.conda_env:
print("\t\tconda: ", rule.conda_env)
if rule._log:
print("\t\tlog: ", rule._log)
#print(rule.conda_env)
5 changes: 5 additions & 0 deletions workflow/envs/iqtree.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- bioconda
- defaults
dependencies:
- iqtree=2.0.3
8 changes: 6 additions & 2 deletions workflow/rules/phylogeny.smk
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ rule iqtree:
snp_aln = "results/snippy_multi/snippy-core.full.aln"
output:
tree = "results/iqtree/iqtree.treefile"
run:
shell("touch {output.tree}")
threads:
workflow.cores,
conda:
os.path.join(envs_dir,"iqtree.yaml")
shell:
"touch {output.tree}"

0 comments on commit f4e9d11

Please sign in to comment.