Color Bed Track Annotations by Name
1
0
Entering edit mode
4.0 years ago
taraeicher ▴ 50

I am trying to upload a custom BED track to the UCSC Genome Browser. This track contains annotations from ChromHMM's 15-state model, i.e.

chr10   0       119600  15_Quies
chr10   119600  120400  1_TssA
chr10   120400  136200  14_ReprPCWk
chr10   136200  139400  15_Quies
chr10   139400  145200  9_Het
chr10   145200  162800  15_Quies
chr10   162800  165000  9_Het
chr10   165000  176200  15_Quies
chr10   176200  176600  7_Enh
chr10   176600  177000  5_TxWk


What I want to do is to visualize this track with a different color for each annotation. However, the closest track parameter I can find is itemRgb = On, and to use that I would need to manually add a separate color for each annotation in the BED file. Is there an easier way for me to do this, or if not, is there a one-line command I can use to add in the RGB values?

BED UCSC ChromHMM Custom tracks • 1.6k views
3
Entering edit mode
4.0 years ago

using awk to insert tge missing BED columns until the RGB column:

awk '{c="255,0,0";if($4=="15_Quies") {c="0,255,0";} else if($4=="1_TssA") {c="0,0,255";} printf("%s\t0\t.\t%s\t%s\t%s\n",$0,$2,\$3,c);}' your.bed

0
Entering edit mode

Thank you! This solution works well and is very helpful.