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 custom. Show all posts
Showing posts with label custom. Show all posts
Monday, July 14, 2014
Thursday, January 23, 2014
Formatting Excel Cells with Zero Filling
While Microsoft Excel could use some improvements for data management and analysis, it remains my program of choice for putting together summary tables, particularly the descriptive statistics of most Table 1's. I'm pretty particular with formatting and wanted to create a Table 1 with column percentages that all lined up nicely. To do this I needed to zero fill numbers both before and after the decimal point so that each number, when formatted, took up the same amount of space in the column. I the past I would do this by pasting the table as text (without formulas) and then manually filling in zeros. This was tedious, especially when having to redo tables after sample numbers changed.
Today I found out there is a way to have Excel automatically include these zeros. You can do this by creating a custom number format. Here's how to do so.
1). Right click on the cell you want to format and choose Format Cells...
2). Click the Number tab and select Custom in the Category: list.
3). Put in your desired formatting. You can do this by building off other format types. In my case, I wanted to have a format so that the numbers 3.5562 and 55 appeared as (03.6) and (55.0), respectively. To do this the Type: box needed to have the format (00.0). This will zero fill both before and after the decimal point as well as round all numbers by one decimal place.
As you can imagine, you can customize this to zero fill based on your particular needs or desired format type. Below is an example Table 1 excerpt to show how the formatting looks.
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.
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.
Subscribe to:
Posts (Atom)
