-
Notifications
You must be signed in to change notification settings - Fork 22
Feature/workflow #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jakevc
wants to merge
13
commits into
master
Choose a base branch
from
feature/workflow
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/workflow #18
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e17983e
add official workflow to tutorial
jakevc b740210
snakefmt
jakevc 9a3ba8f
update ci
jakevc 93cf633
update ci
jakevc d1f0481
bump superlinter
jakevc 9e97cb0
cache docker artifact
jakevc ee7d2cf
udpate ci
jakevc 4daa61e
address warning
jakevc 36dd2f9
update docker run commmand
jakevc 76eafb7
update docker run command
jakevc 1150d82
fix docker run command
jakevc 9da520d
fix
jakevc 9db203d
address warning
jakevc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -1,15 +1,98 @@ | ||
name: Test container build | ||
name: Build, Lint, and Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches_ignore: [] | ||
branches-ignore: [] | ||
|
||
env: | ||
DOCKER_TAG_NAME: snakemake-tutorial | ||
|
||
jobs: | ||
docker-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Lint Dockerfile | ||
uses: hadolint/hadolint-action@v3.1.0 | ||
with: | ||
dockerfile: Dockerfile | ||
no-fail: true | ||
|
||
- name: Build Docker Image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
tags: ${{ env.DOCKER_TAG_NAME }} | ||
outputs: type=docker, dest=/tmp/${{ env.DOCKER_TAG_NAME }}.tar | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.DOCKER_TAG_NAME }} | ||
path: /tmp/${{ env.DOCKER_TAG_NAME }}.tar | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
needs: docker-build | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Lint Snakefile | ||
uses: github/super-linter@v7 | ||
env: | ||
VALIDATE_ALL_CODEBASE: false | ||
DEFAULT_BRANCH: master | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
VALIDATE_SNAKEMAKE_SNAKEFMT: true | ||
|
||
- name: Download Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: snakemake-tutorial | ||
path: /tmp | ||
|
||
- name: Load Docker Image | ||
run: docker load -i /tmp/${{ env.DOCKER_TAG_NAME }}.tar | ||
|
||
- name: DryRun Snakefile | ||
run: docker run ${{ env.DOCKER_TAG_NAME }} snakemake --cores 1 --dryrun | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: docker-build | ||
steps: | ||
- uses: actions/checkout@master | ||
- run: docker build . | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Download Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ env.DOCKER_TAG_NAME }} | ||
path: /tmp | ||
|
||
- name: Load Docker Image | ||
run: docker load -i /tmp/${{env.DOCKER_TAG_NAME}}.tar | ||
|
||
- name: Run Tests | ||
run: docker run -v $(pwd):/work -w /work ${{env.DOCKER_TAG_NAME}} \ | ||
conda run -n ${{env.DOCKER_TAG_NAME}} -tutorial snakemake --cores 1 | ||
|
||
This file contains hidden or 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,5 @@ | ||
calls | ||
plots | ||
sorted_reads | ||
mapped_reads | ||
.snakemake |
This file contains hidden or 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM snakemake/snakemake:stable | ||
ADD environment.yaml . | ||
RUN conda create -n snakemake-tutorial --clone snakemake; \ | ||
conda env update -n snakemake-tutorial -f environment.yaml; | ||
RUN mkdir -p /tmp/conda | ||
ENV CONDA_PKGS_DIRS /tmp/conda | ||
ENV CONDA_PKGS_DIRS=/tmp/conda |
This file contains hidden or 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 hidden or 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]) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.