Skip to content

Instantly share code, notes, and snippets.

@johanneskoester
Last active July 7, 2019 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanneskoester/fb32ea875d6e80677b0c14e54dc7eba5 to your computer and use it in GitHub Desktop.
Save johanneskoester/fb32ea875d6e80677b0c14e54dc7eba5 to your computer and use it in GitHub Desktop.
One way to possibly include type annotations to Snakemake workflow definitions. One could for example use ontologies like edam, as well as mime types.
filetypes:
# this directive automatically generates flags for each type that can be used in the rules below
fq="edam:format_1929"
fa="edam:format_1930"
bam="edam:format_2572"
rule bwa:
input:
fq("genome.fa"),
fa("reads/{sample}.fq")
output:
bam("mapped/{sample}.bam")
conda:
"envs/mapping.yaml"
shell:
"bwa mem -f {input} | samtools view -Sb - > {output}"
rule sort:
input:
# Snakemake would display an error message if the rule creating this input file has not flagged it as bam.
bam("mapped/{sample}.bam")
output:
bam("mapped/{sample}.sorted.bam")
conda:
"envs/mapping.yaml"
shell:
"samtools sort {input} > {output}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment