Gviz: Setting Up Colour / Fill for AnnotationTrack (strand-dependent colour)
1
0
Entering edit mode
JezDD • 0
@jezdd-19085
Last seen 6.0 years ago

Hi,
'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)
cor[cor=="+"]<-"blue"
cor[cor=="-"]<-"red"
#Plot
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!
:-)

 

 

Gviz gviz-package GFF annotationtrack strand-dependent • 2.5k views
ADD COMMENT
1
Entering edit mode
Robert Ivanek ▴ 750
@robert-ivanek-5892
Last seen 12 months ago
Switzerland

Hi,

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:

library(Gviz)

data(collapseTrack)
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. 

Robert

ADD COMMENT
0
Entering edit mode

It worked perfectly!
Thank you so much, Robert!
Cheers

 

ADD REPLY

Login before adding your answer.

Traffic: 600 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6