Is anyone aware of a tool that would allow me to:
- upload a list of genomic locations, say a BED file.
- go through all of these locations one by one (i.e. by clicking next/next/next or similar) and
- visualise my choice of tracks at these locations?
I know genome browser does almost everything, but not the step #2, or am I mistaken?
3 answers
Given your (UCSC-formatted) BED file, you could use the ucsc-fetch script to make a folder of images containing UCSC Genome Browser shots. The track selection is based on a tracks file that describes what is shown and how it is shown (full, dense, etc.).
Once you have that folder of images, you could use a tool like SimpleViewer to make a gallery. You might use a Perl or Python script that makes the required XML-formatted gallery file (this describes how the gallery is constructed and what images go into it), copies images to the images subfolder, and uses ImageMagick to make thumbnails to copy to the thumbs subfolder.
Images in the resulting SimpleViewer gallery can be opened in a web browser and you can navigate through them with arrow keys or mouse-click events. It's a pretty slick bit of gear.
I use a variation of the above recipe to make plot galleries for internal use in our lab. I use an internally-written equivalent of ucsc-fetch that works with internal UCSC Genome Browser instances, and hooks into SimpleViewer Pro for some extra browser functionality - for example, to offer a link to internal Genome Browser instances at the image's equivalent BED coordinate range and browser session ID, to load specific tracks.
It works pretty great. For various reasons, I'm not sure we can release our internal ucsc-fetch equivalent to the public, but here's the Perl script I use to make a SimpleViewer-based gallery XML file and other resources from an input folder of images. The use of this Gist by others would need some local customization, but perhaps it can help save some time:
You'll need to install ImageMagick, have a folder containing SimpleViewer or SimpleViewer Pro resources available, and a Perl library installed called XML::Writer to handle making the gallery XML file. But with an hour or two of coding and tweaking, the arrangement I describe above can be pretty easily repeated by others.
The IGV Genome Browser lets you run batch scripts (open the session with all the tracks the way you want them, go to "Tools" --> "Run batch script"). The batch script could simply contain the genomic regions you're interested in and the command to take snapshots, more explanations here. Handily, BEDtools lets you make an IGV batch script directly from your original BED file: page 82 of this pdf
So, you would:
- Run
bedtools bedtoigv -i your_regions.bed > your_batch_script.txt - Open IGV
- Load all the tracks into IGV
- Go to "Tools" --> "run batch script" --> select
your_batch_script.txt - Sit back and relax while IGV is taking all the snapshots at the regions you specified
- Upload a BED file of your regions of interest in the UCSC genome browseras a custom track.
- Run the following awk script in your BED to get the hyperlinks to the regions (e.g with genome=hg38:
cat your.bed | \
sed -e 's/^chr//' -e 's/^/chr/' | \
awk 'BEGIN{printf("<html><body>\n");} {printf("<a href=\"http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg38&position=%s%3A%s-%s\" target=\"_blank\">%s:%s-%s</a>\n",$1,$2,$3,$1,$2,$3);} END{printf("</body></html>\n");}' > explore.html
Log in to answer this question.
So pretty much the consensus of the answers seems to be: "No. You need to write a less or more complicated script to do this." with plenty of suggestions on how to do this below.
Behind every convenient technology, there are usually people sweating the details on your behalf, yes.
What exactly would have merited a "yes, there is a convenient way" in your opinion?
IMHO, running bedTools once and subsequently loading the script beats having to click "next" for x number of times, but I may have misunderstood your intention.