I have a VCF file that was generated using HG18 and I want to convert it to VCF but that has HG19 data.
I am aware that there is the lift-over tool from UCSC but how do I convert a VCF file from HG18 to a VCF file to HG19, since it seems the lift-over tools produces a BED file instead.
This worked like a charm! :) (P.S.: chromosomes in input vcf must be numerical, not preceded by "chr", and to avoid running into memory problems, use the -Xxm15G flag for the java command [if you have up to this amount of memory available]).
A simple script is here, https://github.com/liqg/vcf-liftover.
Using it is very simple, like this:
zcat test.vcf.gz | ./vcf-liftover GRCh37_to_GRCh38.chain.gz
The converted VCF will output to stdout,you can save the unmapped variants by add a file path to store them.
This hasn't worked for me: the resulting VCF was completely unstructured (but I didn't have time to investigate why this happened). Picard (as per one of the responses above) was very straightforward.
It seems that
LiftoverVariants
is no longer provided with GATK 3.5:The link in the answer is also dead supporting the deprecation of the tool, and GATK seems to be recommending Picard LiftoverVcf.
Do we get the chain file from UCSC?
Yes, this would be a UCSC chain file.