Question: Color Bed Track Annotations by Name
gravatar for taraeicher
2.8 years ago by
taraeicher20 wrote:

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?

ucsc chromhmm custom tracks bed • 1.1k views
ADD COMMENTlink modified 2.8 years ago by Pierre Lindenbaum129k • written 2.8 years ago by taraeicher20
gravatar for Pierre Lindenbaum
2.8 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum129k wrote:

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
ADD COMMENTlink written 2.8 years ago by Pierre Lindenbaum129k

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

ADD REPLYlink modified 2.8 years ago • written 2.8 years ago by taraeicher20
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1234 users visited in the last hour