Skip to content

Instantly share code, notes, and snippets.

@brentp
Created September 21, 2011 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brentp/1232981 to your computer and use it in GitHub Desktop.
Save brentp/1232981 to your computer and use it in GitHub Desktop.
Display a VCF in UCSC

##VCF in UCSC

Note, documentation is now available here: http://genome.ucsc.edu/goldenPath/help/vcf.html

It's possible to display a vcf in the UCSC genome browser

First grab tabix from sourceforge:

svn co https://samtools.svn.sourceforge.net/svnroot/samtools/trunk/tabix
cd tabix && make

Then add that directory to your PATH.

bgzip the vcf and index with tabix

bgzip t.vcf
tabix -p vcf t.vcf.gz

Put t.vcf.gz and t.vcf.gz.tbi in a web directory. Along with a bed file, t.bed with contents:

track type=vcfTabix name="$NAME" visibility=full bigDataUrl="http://example.com/path.to/t.vcf.gz"

Adjusting the paths to match your server.

Note the type is vcfTabix

Finally, point your web-browser to: http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg19&position=chr11:1240203-1247497&hgt.customText=http://example.com/path.to/t.bed

and the variant track will be visible.

@AngieHinrichs
Copy link

Thanks for noticing, Brent! We haven't officially announced VCF support as of 9/28/11, but I'm tying up loose ends like documentation and hope it's ready to announce with our next tri-weekly software release. Most of my testing has been done with VCF from 1000 Genomes project (also some dbSNP b134 VCF), so I anticipate some hiccups with VCF from completely different sources and tools.

I would greatly appreciate sample URLs or files if anyone encounters any errors.

Also, I have been spending a lot of time on a haplotype-clustering display suggested by David Haussler for VCF with genotypes from multiple samples. I'm curious whether most VCF out there (beyond huge projects like 1000 Genomes) contains genotypes for multiple samples, or just calls. ?

@brentp
Copy link
Author

brentp commented Sep 28, 2011

Thanks for implementing!
I've tried VCFs from samtools and freebayes and they both render fine.
Not sure what exactly you mean by the haplotype clustering, but (in my opinion) support for some type of visualization of genotypes would be great!
I generally have multiple samples in my VCF's.

@karmel
Copy link

karmel commented Nov 18, 2011

Hi! I was successful in creating and uploading several VCF files to the UCSC browser, but trying to view them in "pack" mode gives an error like: vcfTrack.c: gtHapIx 10 out of range [0,9).

Has anyone seen this? It appears to be caused by a failed attempt to draw the dendrogram-- is there anyway to configure the track so that this error is either ignored (i.e., no haplotype determination is attempted) or fixed (i.e., a correct haplotype is determined)? I know it should work because the first time I loaded a VCF track it did-- but now I can't figure out what changed to cause the error.

Thanks!

@AngieHinrichs
Copy link

karmel, I would like to debug the error -- can you post (or email to angie at soe . ucsc . edu) a sample VCF that gets that error? Also, what tool created those VCF files? Thanks!

@karmel
Copy link

karmel commented Nov 18, 2011

Of course as soon as I seek help, I figure out the issue. The gtHapIx error was caused by incorrect AC,AN values in the INFO column; I suspected that was the case early on, and I fixed the file with the vcf-tools fix-ac-an function. However, upon reloading the files, the error persisted. It looks like, though, this was a caching issue, not a processing issue-- after I deleted the track and reloaded from scratch, the issue was fixed. My error. If we want to take something away here, though, perhaps you could add to the error message a helpful, "Make sure your VCF key=value pairs like AC and AN are correct." :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment