Partek Flow Documentation

Page tree
Skip to end of metadata
Go to start of metadata

 

In this document, we are using a WDL file based on one of the examples provided by the Broad.

 

Cromwell also supports workflows written in CDL.


 

Write a script which wraps the execution of the pipeline:


#!/usr/bin/env python

import argparse 
import json
import os
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', required=True);
parser.add_argument('-o', '--output', required=True);
parser.add_argument('-g', '--genome', required=True);

args = parser.parse_args()

#write the parameters and hardcoded values into a json file
parameters = {}
parameters['haplotypeCaller.haplotypeCaller.sampleName'] = os.path.basename(args.input)
parameters['haplotypeCaller.haplotypeCaller.inputBAM'] = args.input
parameters['haplotypeCaller.haplotypeCaller.bamIndex'] = args.input + ".bai"
parameters['haplotypeCaller.haplotypeCaller.RefFasta'] = args.genome 
parameters['haplotypeCaller.haplotypeCaller.RefIndex'] = args.genome + '.fai'
parameters['haplotypeCaller.haplotypeCaller.RefDict'] = os.path.splitext(args.genome)[0] +'.dict'
parameters['haplotypeCaller.haplotypeCaller.GATK'] = '/path/to/GenomeAnalysisTK.jar'


inputs = os.path.join(os.path.dirname(args.output), "inputs.json");
with open(inputs, "w") as inputfile:
 json.dump(parameters, inputfile)

#execute the pipeline
output = os.popen('java -jar /path/to/cromwell-40.jar run /path/to/haplotypeCaller.wdl -i ' + inputs).readlines()

#parse the results
for o in output:
 tokens = o.split(':')
 if tokens[0] == '  "haplotypeCaller.haplotypeCaller.vcf"':
  vcf = tokens[1].strip().strip('\"')
  print("Found vcf: " + vcf)
  subprocess.call(["mv", vcf, args.output])
 else:
  print(o.strip())






From Task management click Add task and specify the script



Define the type of input that the pipeline runs on.


You can add multiple output nodes if you want to capture intermediate stages of the execution


You can hard-code all options in the script or define any number of parameters that users should be able to customize.


The custom task will now appear in the task list:


  • No labels