-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding darshan this likely should be added as a view that can be used on the fly, but this container should be an OK start (and we can adjust as needed) Signed-off-by: vsoch <vsoch@users.noreply.github.com>* wrong container tag
- Loading branch information
Showing
6 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ARG tag=3.11 | ||
FROM python:${tag} | ||
|
||
# docker build -t snakemake . | ||
# command: snakemake --cores 1 --flux --jobs 1 | ||
# workdir: /workflow | ||
|
||
RUN apt-get update | ||
ENV DEBIAN_FRONTEND="noninteractive" | ||
RUN apt-get update && \ | ||
apt-get -y install \ | ||
git \ | ||
curl \ | ||
&& apt-get clean \ | ||
&& apt-get autoremove \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# Wrappers to ensure we source the mamba environment! | ||
RUN git clone --depth 1 https://github.com/snakemake/snakemake-tutorial-data /workflow | ||
WORKDIR /workflow | ||
|
||
# This wraps the existing entrypoint | ||
COPY ./Snakefile ./ | ||
RUN mkdir ./scripts | ||
COPY ./scripts/plot-quals.py ./scripts/plot-quals.py | ||
|
||
# instead of altering the entrypoint to active the environment! | ||
RUN pip install snakemake && \ | ||
pip install git+https://github.com/snakemake/snakemake-interface-common && \ | ||
pip install git+https://github.com/snakemake/snakemake-executor-plugin-flux && \ | ||
pip install git+https://github.com/snakemake/snakemake-interface-executor-plugins && \ | ||
pip install git+https://github.com/snakemake/snakemake-executor-flux | ||
|
||
WORKDIR /code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Flux Snakemake Example | ||
|
||
This is an example container where you can build (optional) and run | ||
the [Snakemake tutorial workflow](https://snakemake.readthedocs.io/en/stable/tutorial/tutorial.html): | ||
|
||
```bash | ||
$ docker build -t snakemake . | ||
``` | ||
|
||
or with a tag for the restful API: | ||
|
||
```bash | ||
$ docker build --no-cache --build-arg app="latest" -t snakemake . | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
SAMPLES = ["A", "B"] | ||
|
||
|
||
rule all: | ||
input: | ||
"plots/quals.svg" | ||
|
||
|
||
rule bwa_map: | ||
input: | ||
"data/genome.fa", | ||
"data/samples/{sample}.fastq" | ||
output: | ||
"mapped_reads/{sample}.bam" | ||
shell: | ||
"bwa mem {input} | samtools view -Sb - > {output}" | ||
|
||
|
||
rule samtools_sort: | ||
input: | ||
"mapped_reads/{sample}.bam" | ||
output: | ||
"sorted_reads/{sample}.bam" | ||
shell: | ||
"samtools sort -T sorted_reads/{wildcards.sample} " | ||
"-O bam {input} > {output}" | ||
|
||
|
||
rule samtools_index: | ||
input: | ||
"sorted_reads/{sample}.bam" | ||
output: | ||
"sorted_reads/{sample}.bam.bai" | ||
shell: | ||
"samtools index {input}" | ||
|
||
|
||
rule bcftools_call: | ||
input: | ||
fa="data/genome.fa", | ||
bam=expand("sorted_reads/{sample}.bam", sample=SAMPLES), | ||
bai=expand("sorted_reads/{sample}.bam.bai", sample=SAMPLES) | ||
output: | ||
"calls/all.vcf" | ||
shell: | ||
"bcftools mpileup -f {input.fa} {input.bam} | " | ||
"bcftools call -mv - > {output}" | ||
|
||
|
||
rule plot_quals: | ||
input: | ||
"calls/all.vcf" | ||
output: | ||
"plots/quals.svg" | ||
script: | ||
"scripts/plot-quals.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import matplotlib | ||
matplotlib.use("Agg") | ||
import matplotlib.pyplot as plt | ||
from pysam import VariantFile | ||
|
||
quals = [record.qual for record in VariantFile(snakemake.input[0])] | ||
plt.hist(quals) | ||
|
||
plt.savefig(snakemake.output[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dockerbuild: | ||
build_args: | ||
tag: | ||
key: python | ||
versions: | ||
- "3.11" |