Question: Gviz change color of groups
0
gravatar for franceschini.gianmarco
14 months ago by

I am trying to plot two groups within a single track using Gviz.


sample_tissue = DataTrack(data = all_beta, start = sg_tissue$start,
                            end = sg_tissue$end, chromosome = chr, 
genome = gen, name = "Tissue Beta",
                            groups = tissue_all_class, degree = .8, family = c("symmetric", "gaussian"), evaluation = 100,
                            background.title = "brown", type = c("smooth", "p"), cex.legend = 0.7,     
                            cex.title = .6, cex.axis = .6, ylim = c(0,100))

I would like to change default colours (magenta and cyan), is it possible?

I've read the manual and it describes a step involving the use of feature, and the possibility of overwriting the default fill color, but I can't sort it out.

Moreover, I would like to know if it is possible to set different alphas for different elements in the track. In this case, I would like to have alpha = 1 for the "smooth" and alpha=0.5 for the "p", for example.

Thank you for your help,

gviz gviz-package • 569 views
ADD COMMENTlink modified 14 months ago by florian.hahne@novartis.com1.6k • written 14 months ago by franceschini.gianmarco0
Answer: Gviz change color of groups
1
gravatar for florian.hahne@novartis.com
14 months ago by
Switzerland

Have you tried the obvious?

dat <- matrix(runif(400), nrow=4)
dtTrack <- DataTrack(start=seq(1,1000, len=100), width=10, data=dat, chromosome=1, genome="mm9", name="random data")    
library(GenomicRanges)
gr <- GRanges(seqnames="chr1", ranges=IRanges(seq(1,1000, len=100), width=10))
values(gr) <- t(dat)
dtTrack <- DataTrack(range=gr, genome="mm9", name="random data", groups=c(1,1,2,2), col=c("red", "orange"), degree = .8, family = c("symmetric", "gaussian"))
plotTracks(dtTrack, type=c("smooth", "p"))​

For different alpha settings you will indeed need to use the more flexible OverlayTrack functionality.

 

 

 

ADD COMMENTlink written 14 months ago by florian.hahne@novartis.com1.6k

Thank you for your answer, I don't know how I managed to miss this very basic attempt

ADD REPLYlink written 14 months ago by franceschini.gianmarco0
Answer: Gviz change color of groups
0
gravatar for franceschini.gianmarco
14 months ago by

The best workaround I've found is to use overalyed tracks, plotting for each single track only one element, being points or line. In that way the color can be specified for each track. However I am still not able to set different alphas for overlaying tracks, probably because I'm missing something.

ADD COMMENTlink written 14 months ago by franceschini.gianmarco0
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 16.09
Traffic: 121 users visited in the last hour