The UCSC Genome Browser is a wonderful tool for visualizing your genomics data. One of the great features of UCSC Genome Browser is that you can load custom browser tracks using your own data hosted on an http-accessible server.
However, generating the text markup necessary for these tracks is very tedious, and a bit of a pain, especially when you have a large amount of files to work on.
To facilitate the process, I've written a small script that will help you generate these custom browser tracks more easily for a large number of files at once. The code for this can be found here:
To use this script, simply pass it a list of your input files (see docs for compatible file formats):
./make-tracks.py test1.bw test2.bw -url http://myserver.edu.external/ UCSC Tracks output to file: UCSC_custom_tracks-2017-04-04-16-45-46.txt
Output will look like this:
track type=bigWig name="test1.bw" bigDataUrl=http://myserver.edu.external/test1.bw track type=bigWig name="test2.bw" bigDataUrl=http://myserver.edu.external/test2.bw
You can now copy/paste this into UCSC to load as a custom browser track.
Other neat things
You can pass a mixed list of file types and get tracks customized for each type:
./make-tracks.py test.bam test.bw -url http://myserver.edu.external/ -o my_custom_tracks.txt UCSC Tracks output to file: my_custom_tracks.txt
track type=BAM name="test.bam" bigDataUrl=http://myserver.edu.external/test.bam track type=bigWig name="test.bw" bigDataUrl=http://myserver.edu.external/test.bw
You can supply a file with track parameters to apply for all tracks (see docs for details):
./make-tracks.py sample-data/bigwigs/test1.bw sample-data/bigwigs/test2.bw -url http://myserver.edu.external/ -p bigwig_params.txt
track type=bigWig name="test1.bw" bigDataUrl=http://myserver.edu.external/test1.bw visibility=full autoScale=off alwaysZero=on maxHeightPixels=50 graphType=bar viewLimits=0:0.3 track type=bigWig name="test2.bw" bigDataUrl=http://myserver.edu.external/test2.bw visibility=full autoScale=off alwaysZero=on maxHeightPixels=50 graphType=bar viewLimits=0:0.3
You can also use the
-s script argument to print the track lines to std out for piping; see it in action here!
This script should aid creation of UCSC browser custom track lines, and will be especially handy when working with large amounts of files. Let me know what you think, and file an Issue on the GitHub page if you run into any bugs!