How To Call Gatk From Java Code In A Pipeline
1
2
Entering edit mode
11.0 years ago
William ★ 5.3k

How can I use the GATK tools as an API from a java program? For example to run the unifed genotyper. How can I do the following command line call as a API call?

java -jar GenomeAnalysisTK.jar -T UnifiedGenotyper -R my.fasta -I my.bam- my.vcf

To use a Picard tool as an API I just do the following.

MergeSamFiles mergeSamFiles = new MergeSamFiles();
ArrayList<File> inputFileList = new ArrayList<File>();
inputFileList.add(new File("myFile.bam"));
mergeSamFiles.INPUT = inputFileList;
//set other parameters;
mergeSamFiles.doWork();

I am looking for the samething with GATK.

gatk java api • 3.2k views
ADD COMMENT
3
Entering edit mode
11.0 years ago

in my version of GATK ( i'm currently looking at an old source) The main class of the GATK is org.broadinstitute.sting.gatk.CommandLineGATK , so you can invoke it in your java program:

String args[]=new String[]{"-T","UnifiedGenotyper","-R ","my.fasta","-I","my.bam- my.vcf"};
CommandLineGATK.main(args);

or, if the CLI exits after 'main':

String args[]=new String[]{"-T","UnifiedGenotyper","-R ","my.fasta","-I","my.bam- my.vcf"};
CommandLineGATK instance = new CommandLineGATK();
CommandLineGATK.start(instance, args);

but I'm not sure embedding the GATK is a good idea.

ADD COMMENT
0
Entering edit mode

What I want to do is to make a small pipeline containing BWA (run on a cluster via SGE DRMAA API), Picard, and GATK to process a bulk of data. Calling the GATK command line from java I guess can't be worse than calling it from perl or a shell script.

ADD REPLY
0
Entering edit mode
ADD REPLY
0
Entering edit mode

What is the benifit above using the SGE DRMAA API? http://arc.liv.ac.uk/SGE/howto/drmaa_java.html

ADD REPLY
0
Entering edit mode

interesting I didn't know this API. But as far as I can see you'll have to code and reinvent the wheel (e.g: do I really need to realign this FASTQ ? Should I merge those BAMS if the file already exists and is newer that the BAMs ? ) while the venerable Make will run those jobs for you.

ADD REPLY

Login before adding your answer.

Traffic: 2962 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6