Previously, I made a post on adding custom tracks to the UCSC Genome Broswer and have even expanded on coloring these tracks. For most of my applications, I have simply used standard .bed files that plot features of interest in the Genome Browser in relation to other UCSC tracks. Today I wanted to plot data from overlapping features in a depth plot similar to what one would see after next-generation sequencing. I found the easiest way to do this was by importaing a BedGraph file into the Genome Browser. Following steps similar to the custom tracks post, you go to the My Data -> Custom Tracks -> Add Custom Tracks and then upload the BedGraph file. Below is an example of what the header and the first few lines need to look like.
More details and options on the BedGraph track format can be found here on the UCSC webpage.
A repository of programs, scripts, and tips essential to
genetic epidemiology, statistical genetics, and bioinformatics
Welcome to the Genome Toolbox! I am glad you navigated to the blog and hope you find the contents useful and insightful for your genomic needs. If you find any of the entries particularly helpful, be sure to click the +1 button on the bottom of the post and share with your colleagues. Your input is encouraged, so if you have comments or are aware of more efficient tools not included in a post, I would love to hear from you. Enjoy your time browsing through the Toolbox.
Showing posts with label Genome Browser. Show all posts
Showing posts with label Genome Browser. Show all posts
Monday, July 14, 2014
Friday, November 22, 2013
Install liftOver Locally on UNIX
Many of the UCSC genome tools are available for download for use locally on your UNIX system. liftOver is an example of one such tool. To download, go to their apps download page, select your operating system, and then click on the liftOver link. Here are links for liftOver_linux.x86_64 and liftOver_linux.x86_64.v287. For some reason, I could only get the linux.x86_64.v287 version to work on my system. Once downloaded, make it executable.
The next step is to get the required chain files needed to convert from one genome build to another. All UCSC genome builds are listed here and you can select the desired "LiftOver files" link under the genome build that you want to convert from. This will take you to a downloads page with links to the chain files. Chain files are appropriately named so you know what builds you are converting to and from. For example, hg19ToHg18.over.chain.gz is the chain file needed to convert from hg19 to hg18. Once downloaded, unzip the file for use.
To run liftOver, the useage is:
liftOver oldFile map.chain newFile unMapped
where:
oldFile is the file you want to convert from
map.chain is the chain file used to convert from one build to another
newFile is the converted file you want to create
unMapped is a file that contains all the unmapped positions
For more details on usage, just type liftOver in the command line.
The next step is to get the required chain files needed to convert from one genome build to another. All UCSC genome builds are listed here and you can select the desired "LiftOver files" link under the genome build that you want to convert from. This will take you to a downloads page with links to the chain files. Chain files are appropriately named so you know what builds you are converting to and from. For example, hg19ToHg18.over.chain.gz is the chain file needed to convert from hg19 to hg18. Once downloaded, unzip the file for use.
To run liftOver, the useage is:
liftOver oldFile map.chain newFile unMapped
where:
oldFile is the file you want to convert from
map.chain is the chain file used to convert from one build to another
newFile is the converted file you want to create
unMapped is a file that contains all the unmapped positions
For more details on usage, just type liftOver in the command line.
Tuesday, November 19, 2013
Color Features in UCSC Genome Browser Custom Track with RGB BED File Field
Custom tracks are incredibly useful in visualizing your data in the UCSC genome browser. All that is needed is for your data to be in a compatible format. I typically use .bed files. The first three columns of .bed files are required fields for chromosome, start, and stop position:
(1) chrom - name of the chromosome or scaffold. Chromosome names can be given with or without the 'chr' prefix.
(2) chromStart - Start position of the feature in standard chromosomal coordinates (i.e. first base is 0).
(3) chromEnd - End position of the feature in standard chromosomal coordinates
(4) name - Label to be displayed under the feature.
(5) score - A score between 0 and 1000.
(6) strand - defined as + (forward), - (reverse), or . (not applicable).
(7) thickStart - field used by UCSC drawing code, typically same as chromStart.
(8) thickEnd - field used by UCSC drawing code, typically same as chromEnd.
(9) itemRgb - an RGB color value (e.g. 0,0,255).
name - unique name to identify this track in the custom tracks list.
description - label to be displayed above the track in Genome Browser.
priority - integer defining the order in which to display tracks, if multiple tracks are defined.
useScore - a value from 1 to 4, which determines how scored data will be displayed. Additional parameters may be needed.
itemRgb - if set to 'on' (case-insensitive), the individual RGB values defined in tracks will be used.
(1) chrom - name of the chromosome or scaffold. Chromosome names can be given with or without the 'chr' prefix.
(2) chromStart - Start position of the feature in standard chromosomal coordinates (i.e. first base is 0).
(3) chromEnd - End position of the feature in standard chromosomal coordinates
The next six fields are optional. Note that columns cannot be empty (ie: lower-numbered fields must always be populated if higher-numbered ones are used).
(4) name - Label to be displayed under the feature.
(5) score - A score between 0 and 1000.
(6) strand - defined as + (forward), - (reverse), or . (not applicable).
(7) thickStart - field used by UCSC drawing code, typically same as chromStart.
(8) thickEnd - field used by UCSC drawing code, typically same as chromEnd.
(9) itemRgb - an RGB color value (e.g. 0,0,255).
Coloring elements is fairly straightforward. First define RGB values for each track feature in the itemRgb field (9th column) and ensure fields 1-8 have appropriate values. Then, upload your track as a custom track (see above link) to UCSC. Once uploaded, click on the track name (usually "User Track") and edit the configuration to include: itemRgb="On". Other configuration values can be changed as well:
name - unique name to identify this track in the custom tracks list.
description - label to be displayed above the track in Genome Browser.
priority - integer defining the order in which to display tracks, if multiple tracks are defined.
useScore - a value from 1 to 4, which determines how scored data will be displayed. Additional parameters may be needed.
itemRgb - if set to 'on' (case-insensitive), the individual RGB values defined in tracks will be used.
Here's an example configuration:
Encode Features with no Strand Information in UCSC BED Format
The UCSC Genome Browser is a powerful tool that allows you to visualize your own data in custom tracks with respect to scores of other publicly available data tracks. To use some of the more advanced features for plotting .bed files, strand information is a required field in the .bed files. Usually, I would just arbitrarily assign a "+" for the strand information to indicate the feature was on the plus strand, when in actuality there is no relevant strand for the feature. This results in arrows (>>>>>>) being drawn over the feature in Genome Browser, not the end of the world, but still not the polished look I was going for. To circumvent this, I tried to leave the field blank when uploading a custom track, however, I would get the error: "Error line 1 of custom track: Expecting + or - in strand". Then I stumbled on a simple fix, that doesn't seem to be documented well. All Genome Browser needs is a period (.) in the strand field of the .bam file for each feature and all seems to work fine. The result: a sharp looking feature track in Genome Browser.
Wednesday, August 14, 2013
Download Data Track from UCSC Genome Browser
Did you know you can download tracks you visualize in the UCSC Genome Browser for personal use and analysis? Here's how to do it.
(1) Click on the grey bar on the far left side of the UCSC data track. This will bring you to the track settings page.
(2) Click on the link called View table schema. This will bring up a new page with track information and a description of data fields.
(3) Look for the field called Primary Table and copy the name.
(4) Go to the UCSC FTP site (link) and find the correct genome build you are after. Usually you will want to select hg19 or hg18.
(5) Click on the database link and then search for the name of the field you copied from the Primary Table field in step 3.
(6) There will usually be a .sql and a .txt.gz for most tracks. You are interested in the .txt.gz file. You can click on it to download via your internet web browser or right click on the link to copy the web address and use the wget command to download it. Here's and example script to download the NHGRI GWAS catalog using the wget command:
(7) Extract the compressed .txt.gz file with the following command, where filename is the name of the file you downloaded
This method should work for downloading the majority of the UCSC data tracks. Sometimes it takes a bit of digging around the UCSC FTP site to find the dataset you are looking for, but in most cases I have been successful in finding it on the UCSC FTP site.
One final note: If you are interested in downloading only a small portion of the track (for example, just a region on chromosome 8), you can download this region using the UCSC Table browser. Here's how to do this:
(1) Follow steps (1) and (2) above.
(2) Once on the Table Schema page for the track of interest go to the link bar on the top of the page and select Tools > Table Browser. This will take you to the UCSC Table Browser where all the fields will already be filled in with the track you are interested in.
(3) To download your region of interest click on the radio button next to position and type in your desired coordinates (ex: chr8:128362121-129551294).
(4) Make sure all the filters are cleared and give your output a filename. Select get output and your file will be downloaded. There is no need to unzip unless you chose the gzip compressed option.
Best wishes and good luck analyzing UCSC data tracks!
(1) Click on the grey bar on the far left side of the UCSC data track. This will bring you to the track settings page.
(2) Click on the link called View table schema. This will bring up a new page with track information and a description of data fields.
(3) Look for the field called Primary Table and copy the name.
(4) Go to the UCSC FTP site (link) and find the correct genome build you are after. Usually you will want to select hg19 or hg18.
(5) Click on the database link and then search for the name of the field you copied from the Primary Table field in step 3.
(6) There will usually be a .sql and a .txt.gz for most tracks. You are interested in the .txt.gz file. You can click on it to download via your internet web browser or right click on the link to copy the web address and use the wget command to download it. Here's and example script to download the NHGRI GWAS catalog using the wget command:
(7) Extract the compressed .txt.gz file with the following command, where filename is the name of the file you downloaded
This method should work for downloading the majority of the UCSC data tracks. Sometimes it takes a bit of digging around the UCSC FTP site to find the dataset you are looking for, but in most cases I have been successful in finding it on the UCSC FTP site.
One final note: If you are interested in downloading only a small portion of the track (for example, just a region on chromosome 8), you can download this region using the UCSC Table browser. Here's how to do this:
(1) Follow steps (1) and (2) above.
(2) Once on the Table Schema page for the track of interest go to the link bar on the top of the page and select Tools > Table Browser. This will take you to the UCSC Table Browser where all the fields will already be filled in with the track you are interested in.
(3) To download your region of interest click on the radio button next to position and type in your desired coordinates (ex: chr8:128362121-129551294).
(4) Make sure all the filters are cleared and give your output a filename. Select get output and your file will be downloaded. There is no need to unzip unless you chose the gzip compressed option.
Best wishes and good luck analyzing UCSC data tracks!
Tuesday, May 28, 2013
Custom Tracks in UCSC Genome Browser
One of my colleagues recently shared a web link to a custom track they had uploaded and visualized on the standard UCSC Genome Browser. A bit impressed, I looked into how to do this myself. UCSC has a pretty informative webpage detailing how to add custom tracks to Genome Browser. Here's a quick summary of what you need to do.
First get your data in one of the formats supported by Genome Browser (.gtf, .gff, .bed, .wig, or .psl). I usually prefer .bed when appropriate. Next login to your account on Genome Browser. If you don't have an account, sign up for a free one here. Then go to the UCSC Add Custom Tracks link. Select the appropriate genome and assembly and then upload your data under the "Paste URLs or data" section. After pressing Submit, it will take you to a new page where you will see that your new track is generated and where you can follow a link to see it in the Genome Browser. You can now explore how other tracks match up to your custom track. You can also save your session and share it with others by creating a URL link to it. Here is an example of a custom track I made from FASTA files where I wanted to compare gaps in FASTA files to the Gaps track at UCSC. Have fun with custom tracks on UCSC Genome Browser.
First get your data in one of the formats supported by Genome Browser (.gtf, .gff, .bed, .wig, or .psl). I usually prefer .bed when appropriate. Next login to your account on Genome Browser. If you don't have an account, sign up for a free one here. Then go to the UCSC Add Custom Tracks link. Select the appropriate genome and assembly and then upload your data under the "Paste URLs or data" section. After pressing Submit, it will take you to a new page where you will see that your new track is generated and where you can follow a link to see it in the Genome Browser. You can now explore how other tracks match up to your custom track. You can also save your session and share it with others by creating a URL link to it. Here is an example of a custom track I made from FASTA files where I wanted to compare gaps in FASTA files to the Gaps track at UCSC. Have fun with custom tracks on UCSC Genome Browser.
Generate URLs to Share Genome Browser Sessions
Its happened to me several times before. I spend several minutes zooming in on a region of interest and selecting all the tracks I want to see on Genome Browser, but have no great way of sharing the session with a colleague. I usually do a print screen and email a copy of the screenshot, but then they have no way of manipulating the view themselves. I always think in the back of my head that there must be a better way to do this. Well, the good news is there is!
Today I stumbled across a way to generate a URL link to what Genome Browser calls a "session". A session is zoomed in view of a genomic region that contains all the tracks one is interested in. These sessions can easily be saved and then shared with a colleague with a web link. All you really need is a UCSC Genome Browser account. If you don't have one, you can sign up here.
Once you have an account, go to the My Data (or Sessions...depending on what page you are on) tab on the header of the Genome Browser webpage. Click Login and enter your username and password. Then go back to the genome browser and zoom in on your region and pick the tracks you want to display. When you get things picture perfect and ready to share, click on the My Data tab again, and select Sessions. Go to Save Settings and under "Save current settings as named session" insert a name, check the box next to allow this session to be loaded by others, and press submit. This will save the session and under My Sessions you should see the session you just saved. You can right click on the Browser link next to the session name you just created and copy the link address to share with your colleagues. Here is an example I made that displays common SNPs in the 8q24.21 region. Happy URL sharing!
Today I stumbled across a way to generate a URL link to what Genome Browser calls a "session". A session is zoomed in view of a genomic region that contains all the tracks one is interested in. These sessions can easily be saved and then shared with a colleague with a web link. All you really need is a UCSC Genome Browser account. If you don't have one, you can sign up here.
Once you have an account, go to the My Data (or Sessions...depending on what page you are on) tab on the header of the Genome Browser webpage. Click Login and enter your username and password. Then go back to the genome browser and zoom in on your region and pick the tracks you want to display. When you get things picture perfect and ready to share, click on the My Data tab again, and select Sessions. Go to Save Settings and under "Save current settings as named session" insert a name, check the box next to allow this session to be loaded by others, and press submit. This will save the session and under My Sessions you should see the session you just saved. You can right click on the Browser link next to the session name you just created and copy the link address to share with your colleagues. Here is an example I made that displays common SNPs in the 8q24.21 region. Happy URL sharing!
Subscribe to:
Posts (Atom)