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.
1 answer
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.
use a Makefile + qmake http://gridscheduler.sourceforge.net/htmlman/htmlman1/qmake.html
What is the benifit above using the SGE DRMAA API? http://arc.liv.ac.uk/SGE/howto/drmaa_java.html
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.
Log in to answer this question.