diff --git a/perl/liftOverVCF.pl b/perl/liftOverVCF.pl index 6e3b0fccf..24d125bb2 100755 --- a/perl/liftOverVCF.pl +++ b/perl/liftOverVCF.pl @@ -12,16 +12,18 @@ my $newRef = undef; my $oldRef = undef; my $out = undef; my $tmp = "/tmp"; +my $recordOriginalLocation = undef; GetOptions( "vcf=s" => \$in, "gatk=s" => \$gatk, "chain=s" => \$chain, "newRef=s" => \$newRef, "oldRef=s" => \$oldRef, "out=s" => \$out, - "tmp=s" => \$tmp); + "tmp=s" => \$tmp, + "recordOriginalLocation" => \$recordOriginalLocation); -if ( !$in || !$gatk || !$chain || !$newRef || !$oldRef || !$out ) { - print "Usage: liftOverVCF.pl\n\t-vcf \t\t\n\t-gatk \t\t\n\t-chain \t\t\n\t-newRef \t\n\t-oldRef \t\n\t-out \t\t\n\t-tmp \t\t\n"; +if ( !$in || !$gatk || !$chain || !$newRef || !$oldRef || !$out || !defined($recordOriginalLocation)) { + print "Usage: liftOverVCF.pl\n\t-vcf \t\t\n\t-gatk \t\t\n\t-chain \t\t\n\t-newRef \t\n\t-oldRef \t\n\t-out \t\t\n\t-tmp \t\t\n\t-recordOriginalLocation \t\t\n"; print "Example: ./liftOverVCF.pl\n\t-vcf /humgen/gsa-hpprojects/GATK/data/Comparisons/Validated/1kg_snp_validation/all_validation_batches.b36.vcf\n\t-chain b36ToHg19.broad.over.chain\n\t-out lifted.hg19.vcf\n\t-gatk /humgen/gsa-scr1/ebanks/Sting_dev\n\t-newRef /seq/references/Homo_sapiens_assembly19/v0/Homo_sapiens_assembly19\n\t-oldRef /humgen/1kg/reference/human_b36_both\n"; exit(1); } @@ -34,7 +36,7 @@ my $unsorted_vcf = "$tmp_prefix.unsorted.vcf"; # lift over the file print "Lifting over the vcf..."; -my $cmd = "java -jar $gatk/dist/GenomeAnalysisTK.jar -T LiftoverVariants -R $oldRef.fasta -B:variant,vcf $in -o $unsorted_vcf -chain $chain -dict $newRef.dict"; +my $cmd = "java -jar $gatk/dist/GenomeAnalysisTK.jar -T LiftoverVariants -R $oldRef.fasta -B:variant,vcf $in -o $unsorted_vcf -chain $chain -dict $newRef.dict -recordOriginalLocation $recordOriginalLocation"; system($cmd); # we need to sort the lifted over file now