Question: Color Bed Track Annotations by Name
0
gravatar for taraeicher
18 months ago by
taraeicher10
taraeicher10 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 • 699 views
ADD COMMENTlink modified 18 months ago by Pierre Lindenbaum119k • written 18 months ago by taraeicher10
3
gravatar for Pierre Lindenbaum
18 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum119k 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 18 months ago by Pierre Lindenbaum119k

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

ADD REPLYlink modified 18 months ago • written 18 months ago by taraeicher10
Please log in to add an answer.

Help
Access

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