Question: Gviz: Setting Up Colour / Fill for AnnotationTrack (strand-dependent colour)
gravatar for JezDD
10 months ago by
JezDD0 wrote:

'm new to bioinformatics, so please excuse if this is a silly question.
I need help to generate some plots using Gviz for some genome sequencing data from a parasite.

I have managed to generate the plots, but I'm struggling to set up the annotation track to show different colours for CDSs depending on the "+" or "-" strand orientation.

For this, I have tried the following:

#Set fill as a function of CDS orientation
cor <- strand(aTrack)
plotTracks(list(gTrack,dTrack,aTrack), from=1, to=853233, fill.histogram="red", fill=cor, shape="arrow", type="hist")


And this is what I get:

I'm importing a GFF file containing only the CDSs from a original GFF file. I have also tried with the original file and the results are similar.
Please, also note that, in the AnnotationTrack, not all CDSs are represented as arrows, even though I am setting the shape as arrow.
Worst, I get mixed colouring, with no colouring of "+" and "-" strands with blue and red, respectively.
I have no idea how I can fix this!!

Thanks in advance for any help!



ADD COMMENTlink modified 10 months ago by Robert Ivanek650 • written 10 months ago by JezDD0
Answer: Gviz: Setting Up Colour / Fill for AnnotationTrack (strand-dependent colour)
gravatar for Robert Ivanek
10 months ago by
Robert Ivanek650
Robert Ivanek650 wrote:


You can colour the individual items in the AnnotationTrack by setting the feature to "plus" and "minus" strand. Then in plotTracks function provide two additional arguments which set colours to "plus" and "minus" features:


strand(ctrack) <- rep(c("+","-","+","-"), c(7,2,1,2))
feature(ctrack) <- ifelse(strand(ctrack)=="+", "plus", "minus") 

plotTracks(ctrack, plus="darkred", minus="darkgreen")

Hope that helps. 


ADD COMMENTlink written 10 months ago by Robert Ivanek650

It worked perfectly!
Thank you so much, Robert!


ADD REPLYlink written 10 months ago by JezDD0
Please log in to add an answer.


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