building and documenting bioinformatics workflows with
play

Building and Documenting Bioinformatics Workflows with Python-based - PowerPoint PPT Presentation

Genome Informatics Building and Documenting Bioinformatics Workflows with Python-based Snakemake Johannes K oster, Sven Rahmann German Conference on Bioinformatics September 2012 1 / 13 Genome Structure Informatics 1 Motivation 2


  1. Genome Informatics Building and Documenting Bioinformatics Workflows with Python-based Snakemake Johannes K¨ oster, Sven Rahmann German Conference on Bioinformatics September 2012 1 / 13

  2. Genome Structure Informatics 1 Motivation 2 Snakemake Language 3 Snakemake Engine 4 Conclusion 2 / 13

  3. Genome Motivation Informatics new bwa samples gatk samtools ... tables tools / proteomics scripts results data plots adjust protein parameters networks document ... sequence ... reads 3 / 13

  4. Genome Motivation Informatics new bwa samples gatk samtools ... tables tools / proteomics scripts results data plots adjust protein parameters networks document ... sequence ... reads 3 / 13

  5. Genome Motivation Informatics new bwa samples gatk samtools ... tables tools / proteomics scripts results data plots adjust protein parameters networks document ... sequence ... reads 3 / 13

  6. Genome Motivation Informatics new bwa samples gatk samtools ... tables tools / proteomics scripts results data plots adjust protein parameters networks document ... sequence ... reads 3 / 13

  7. Genome Motivation Informatics new bwa samples gatk samtools ... tables tools / proteomics scripts results data plots adjust protein parameters networks document ... sequence ... reads 3 / 13

  8. Genome Motivation Informatics new bwa samples gatk samtools ... tables tools / proteomics scripts results data plots adjust protein parameters networks document ... sequence ... reads 3 / 13

  9. Genome Workflow Descriptions Informatics IDIR=../include ODIR=obj LDIR=../lib LIBS=-lm CC=gcc CFLAGS=-I$(IDIR) _HEADERS = hello.h HEADERS = $(patsubst %,$(IDIR)/%,$(_HEADERS)) _OBJS = hello.o hellofunc.o OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS)) # build the executable from the object files hello: $(OBJS) $(CC) -o $@ $^ $(CFLAGS) # compile a single .c file to an .o file $(ODIR)/%.o: %.c $(HEADERS) $(CC) -c -o $@ $< $(CFLAGS) # clean up temporary files .PHONY: clean clean: rm -f $(ODIR)/*.o *~ core $(IDIR)/*~ http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor http://www.taverna.org.uk 4 / 13

  10. Genome Why Snakemake? Informatics GNU Make provided us with... a language to write rules to create each output file from input files wildcards for generalization implicit dependency resolution implicit parallelization fast and collaborative development on text files 5 / 13

  11. Genome Why Snakemake? Informatics GNU Make provided us with... a language to write rules to create each output file from input files wildcards for generalization implicit dependency resolution implicit parallelization fast and collaborative development on text files but we missed... easy to read syntax simple scripting inside the workflow creating more than one output file with a rule multiple wildcards in filenames 5 / 13

  12. Genome Snakemake Language Informatics Idea: extend the Python syntax but avoid to write a full parser Snakefile Python tokenizer Token Automaton input: Snakefile tokens emission: Python tokens transition: prefix-free grammar Python Interpreter 6 / 13

  13. Genome Snakemake Language Informatics Idea: extend the Python syntax but avoid to write a full parser Snakefile Python tokenizer Token Automaton input: Snakefile tokens emission: Python tokens transition: prefix-free grammar rule map_reads: input: "hg19.fasta", "{sample}.fastq" Python Interpreter output: "{sample}.sai" shell: "bwa aln {input} > {output}" 6 / 13

  14. Genome Snakemake Language Informatics Idea: extend the Python syntax but avoid to write a full parser Snakefile Python tokenizer Token Automaton input: Snakefile tokens emission: Python tokens transition: prefix-free grammar @rule("map_reads") input: "hg19.fasta", "{sample}.fastq" Python Interpreter output: "{sample}.sai" shell: "bwa aln {input} > {output}" 6 / 13

  15. Genome Snakemake Language Informatics Idea: extend the Python syntax but avoid to write a full parser Snakefile Python tokenizer Token Automaton input: Snakefile tokens emission: Python tokens transition: prefix-free grammar @rule("map_reads") @input("hg19.fasta", "{sample}.fastq") Python Interpreter output: "{sample}.sai" shell: "bwa aln {input} > {output}" 6 / 13

  16. Genome Snakemake Language Informatics Idea: extend the Python syntax but avoid to write a full parser Snakefile Python tokenizer Token Automaton input: Snakefile tokens emission: Python tokens transition: prefix-free grammar @rule("map_reads") @input("hg19.fasta", "{sample}.fastq") Python Interpreter @output("{sample}.sai") shell: "bwa aln {input} > {output}" 6 / 13

  17. Genome Snakemake Language Informatics Idea: extend the Python syntax but avoid to write a full parser Snakefile Python tokenizer Token Automaton input: Snakefile tokens emission: Python tokens transition: prefix-free grammar @rule("map_reads") @input("hg19.fasta", "{sample}.fastq") Python Interpreter @output("{sample}.sai") def __map_reads(input, output, wildcards): shell("bwa aln {input} > {output}") 6 / 13

  18. Genome Example Workflow Informatics For samples { 500 , . . . , 503 } map reads to hg19. 7 / 13

  19. Genome Example Workflow Informatics For samples { 500 , . . . , 503 } map reads to hg19. rule map_reads: input: "hg19.fasta", "{sample}.fastq" output: "{sample}.sai" shell: "bwa aln {input} > {output}" 7 / 13

  20. Genome Example Workflow Informatics For samples { 500 , . . . , 503 } map reads to hg19. rule sai_to_bam: input: "hg19.fasta", "{sample}.sai", "{sample}.fastq" output: "{sample}.bam" shell: "bwa samse {input} | samtools view -Sbh - > {output}" rule map_reads: input: "hg19.fasta", "{sample}.fastq" output: "{sample}.sai" shell: "bwa aln {input} > {output}" 7 / 13

  21. Genome Example Workflow Informatics For samples { 500 , . . . , 503 } map reads to hg19. SAMPLES = "500 501 502 503".split() rule all: input: expand("{sample}.bam", sample=SAMPLES) rule sai_to_bam: input: "hg19.fasta", "{sample}.sai", "{sample}.fastq" output: "{sample}.bam" shell: "bwa samse {input} | samtools view -Sbh - > {output}" rule map_reads: input: "hg19.fasta", "{sample}.fastq" output: "{sample}.sai" shell: "bwa aln {input} > {output}" 7 / 13

  22. Genome Example Workflow Informatics For samples { 500 , . . . , 503 } map reads to hg19. SAMPLES = "500 501 502 503".split() rule all: input: expand("{sample}.bam", sample=SAMPLES) rule sai_to_bam: input: "hg19.fasta", "{sample}.sai", "{sample}.fastq" output: protected("{sample}.bam") shell: "bwa samse {input} | samtools view -Sbh - > {output}" rule map_reads: input: "hg19.fasta", "{sample}.fastq" output: "{sample}.sai" shell: "bwa aln {input} > {output}" 7 / 13

  23. Genome Example Workflow Informatics For samples { 500 , . . . , 503 } map reads to hg19. SAMPLES = "500 501 502 503".split() rule all: input: expand("{sample}.bam", sample=SAMPLES) rule sai_to_bam: input: "hg19.fasta", "{sample}.sai", "{sample}.fastq" output: protected("{sample}.bam") shell: "bwa samse {input} | samtools view -Sbh - > {output}" rule map_reads: input: "hg19.fasta", "{sample}.fastq" output: temp("{sample}.sai") shell: "bwa aln {input} > {output}" 7 / 13

  24. Genome Example Workflow Informatics For samples { 500 , . . . , 503 } map reads to hg19. rule all 500.bam, 501.bam, 502.bam, 503.bam rule sai_to_bam: input: "hg19.fasta", "{sample}.sai", "{sample}.fastq" rule sai to bam rule sai to bam rule sai to bam rule sai to bam output: protected("{sample}.bam") 500.sai 501.sai 502.sai 503.sai shell: "bwa samse {input} | samtools view -Sbh - > {output}" rule map_reads: input: "hg19.fasta", "{sample}.fastq" rule map reads rule map reads rule map reads rule map reads output: temp("{sample}.sai") 500.fastq 501.fastq 502.fastq 503.fastq shell: "bwa aln {input} > {output}" 7 / 13

  25. Genome Example Workflow Informatics For samples { 500 , . . . , 503 } map reads to hg19. rule all 500.bam, 501.bam, 502.bam, 503.bam rule sai to bam rule sai to bam rule sai to bam rule sai to bam 500.sai 501.sai 502.sai 503.sai rule map_reads: input: "hg19.fasta", "{sample}.fastq" rule map reads rule map reads rule map reads rule map reads output: temp("{sample}.sai") 500.fastq 501.fastq 502.fastq 503.fastq shell: "bwa aln {input} > {output}" 7 / 13

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend