Skip to content

Instantly share code, notes, and snippets.

@IanSudbery
Last active March 25, 2019 22:38
Show Gist options
  • Save IanSudbery/cc274d97d38fd88df34ca392b7a0d859 to your computer and use it in GitHub Desktop.
Save IanSudbery/cc274d97d38fd88df34ca392b7a0d859 to your computer and use it in GitHub Desktop.
Example of standard ruffus syntax
from ruffus import transform, suffix, pipeline_run
from task_functions import run_bwa, sort_bam
@transform("*.fastq", suffix(".fastq"), ".bam")
def step1(infile, outfile);
run_bwa(infile, outfile)
@transform(run_bwa, suffix(".bam"), ".sorted_bam")
def step2(infile, outfile):
sort_bam(infile, outfile)
pipeline_run([step2], multithread=1)
from ruffus import transform, suffix, pipeline_run
@transform("*.fastq", suffix(".fastq"), ".bam")
def run_bwa(input_file, output_file):
print "Align DNA sequences in %s to a genome -> %s " % (input_file, output_file)
# make dummy output file
open(output_file, "w").close()
@transform(run_bwa, suffix(".bam"), ".sorted_bam")
def sort_bam(input_file, output_file):
print "Sort DNA sequences in %s -> %s " % (input_file, output_file)
# make dummy output file
open(output_file, "w").close()
pipeline_run([sort_bam], multithread = 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment