HowTo? Provide a different fill color for each rectangle in an Gviz AnnotationTrack ?
1
0
Entering edit mode
Malcolm Cook ★ 1.6k
@malcolm-cook-6293
Last seen 6 days ago
United States

I'm using an AnnotationTrack to plot the contigs going into a scaffolded genome.  I have confidence scores for the orientation of each contig  which I would like to visualize with a color scale.  I can compute the colors I want to see, but the package seems not to present an interface to assigning them to the rectangles.  

Am I missing something, or is there perhaps a "workaround" allowing such assignment?

 

Gviz color • 1.2k views
ADD COMMENT
0
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 5.6 years ago
Switzerland

I believe you have been missing this (in the package vignette, section AnnotationTrack, page 33:

Unless we tell the Gviz package how to deal with the respective feature types they will all be treated in a similar fashion, i.e., they will be plotted using the default color as defined by the fill display paramter. To define colors for individual feature types we simply have to add them as additional display parameters, where the parameter name matches the feature type and its value is supposed to be a valid R color qualifier. Of course this implies that we can only use feature names that are not already occupied by other display parameters defined in the package.

plotTracks(aTrack.stacked, groupAnnotation = "group", + foo = "darkred", bar = "darkgreen")

And from the class' documentation, (? AnnotationTrack), this:

feature: Factor (or other vector that can be coerced into one), giving

          the feature types for the individual track items. When

          plotting the track to the device, if a display parameter with

          the same name as the value of 'feature' is set, this will be

          used as the track item's fill color. See 'grouping' for

          details.  Needs to be of equal length as the provided genomic

          coordinates, or of length 1.

Florian

ADD COMMENT

Login before adding your answer.

Traffic: 486 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