Hi,
I'm using Gviz to display transcripts. I wanna highlight some exons with different color. My input is a tab-separated plain text file like the following:
new=read.table("myfile",header=T)
head(new,1)
   chromosome  start  end width strand   feature   gene exon transcript color
1  chrX 586072 586344   273      + protein_coding Gene1  Exon1 Trans1 red
gen="hg19"
chr="chrX"
gtrack <- GeneRegionTrack(new, genome = gen,chromosome = chr, fill=as.vector(new$color))
plotTracks(list(gtrack))
However, I found exons were not colored in the order of "color" column. My input file has already been sorted by coordinates. Did I miss something? How can I match an exon to its color?
Any help is appreciated. Thanks a lot.

Thanks heap, Florian. It works perfectly, however it turned out a new question. I still have some exons not colored as expected. They were colored by the default yellow color which is not in my list. I found those exons are too close to their neighbors to be distinguished on the plot. Is that why they were not colored? Is there a way to achieve it without changing the plotted genomic range? Thanks a lot.
I have a similar problem. I want to use TxDb as input and to highlight one whole transcripts of a gene. But the result confuses me.
I created the TxDb from a GRanges Object, which is a subset of GencodeV14 mm10 (filter: gene_id==" ENSMUSG00000060126.14").
Creating a standard GeneRegionTrack is easy then:
I inspected some slots of the GeneRegionTrack to understand the structure:
I would have expected that
feature(grTrack)[1]belongs togroup(grTrack)[1]. The slotstart(grTrack)seems to match, too. If I am right, the paramter "fill" has to have the same order. Thus, one shoud be able to fill transcripts parts by using slot "group".However, the plot is strange. Exons of different transcripts are filled red instead of the choosen transcript.
Is that a bug, an example of somewhat "erratic" you mentioned or do I miss something? Using parameter "
fill" withinplotTracksis no option, because I want to use several other tracks.