BAM file option: Color by strand (invert colors)

67 views
Skip to first unread message

Andy Rampersaud

unread,
May 1, 2015, 3:54:27 PM5/1/15
to gen...@soe.ucsc.edu
Hi,

I have some BAM files from TopHat2 I've visualized on the UCSC Browser.  The kit used to generated these RNA-Seq samples produce read pile-ups that have the opposite strand color as the parental gene. 

In other words, negative (red) strand genes will have positive (blue) strand reads and positive (blue) strand genes will have negative (red) strand reads.  Is there an easy way to "invert" colors for my BAM file (without modifying information in my BAM file)?   

It would be convenient if the "Color by strand" option in the track line had some sort of "invert" option.  I also saw there's a user-defined tag ("YC" tag) that can be specified in the BAM file. 

What would be the best way to get my read color the same as the parental gene color?

Thanks,
Andy

--
Andy Rampersaud
Graduate Student, Bioinformatics
Waxman Lab, Boston University

Matthew Speir

unread,
May 5, 2015, 5:54:02 PM5/5/15
to Andy Rampersaud, gen...@soe.ucsc.edu
Hi Andy,

Thank you for your question about changing the coloring for your reads based on their strand. Unfortunately, there currently is not an option in the track controls that will automatically switch the coloring used by the "color-by-strand" mode. However, we do think your suggestion sounds like a good idea and we are looking into adding something like it in the future. I can let you know when it is available. In the meantime, I think that most straightforward option would be to add the "YC" tag to manually color the reads in your files based on their strand. Then you can use the "bamColorMode=tag" option when declaring your custom tracks to use this custom coloring scheme. You can find more about configuring BAM tracks on the following help pages: http://genome.ucsc.edu/goldenPath/help/bam.html and http://genome.ucsc.edu/goldenPath/help/trackDb/trackDbHub.html#bam.

I hope this is helpful. If you have any further questions, please reply to gen...@soe.ucsc.edu. All messages sent to that address are archived on a publicly-accessible Google Groups forum. If your question includes sensitive data, you may send it instead to genom...@soe.ucsc.edu.

Matthew Speir
UCSC Genome Bioinformatics Group
--


Andy Rampersaud

unread,
May 6, 2015, 2:49:36 PM5/6/15
to gen...@soe.ucsc.edu
Hi Matthew,

Thanks for your answer.  How would you recommend adding the "YC" tag to color reads based on their strand?  The closest tool I found was "bedtools tag (aka tagBam)" but it does not have the flexibility to add a color value depending on the strand. 

https://groups.google.com/forum/#!msg/bedtools-discuss/JHGSPnyyYK8/fMAk10UjsP8J

I'm guessing my approach would be to convert my BAM file to a SAM file then process the text with a Perl script then recreate my SAM file then convert it back to a BAM file.

Andy

Luvina Guruvadoo

unread,
May 14, 2015, 12:25:41 PM5/14/15
to Andy Rampersaud, gen...@soe.ucsc.edu
Hello Andy,

Yes, converting your BAM file to SAM and processing it with a Perl script sounds like a good approach.

If you have any further questions, please reply to gen...@soe.ucsc.edu. All messages sent to that address are archived on a publicly-accessible forum. If your question includes sensitive data, you may send it instead to genom...@soe.ucsc.edu.

- - -
Luvina Guruvadoo
UCSC Genome Bioinformatics Group


--


Reply all
Reply to author
Forward
0 new messages