Entering edit mode
p1990
•
0
@p1990-11044
Last seen 6.8 years ago
Hi,
I have read through the Gviz vignette extensively. I have two data tracks (dot plot) in my overlay, how can I change colour of the groups from something other than the standard blue and pink?
Ideally I would be able to set the colour for each specific dot using a vector - in an overlay and also single datatrack!
Finally I also want to label specific data points.
Any help is very much appreciated, I've spent a long time reading through documentation!
Current working code (sorry, looks a bit complicated than it is!)
library(Gviz) library(GenomicRanges) library(GenomicFeatures) library(gridExtra) library(trackViewer) library(biomaRt) start = 700e3; end = 1e6; chr = 1 gen = "hg19" df1_trait = "first" df2_trait = "second" gtrack <- GenomeAxisTrack(col="black", fontsize=17) df1 <- data.frame(Y=rnorm(100), BP=seq(start,end, length.out=100)) df2 <- data.frame(Y=rnorm(100), BP=seq(start,end, length.out=100)) dtrack1 <- DataTrack(data = df2$Y, start = df2$BP, end = df2$BP+1, chromosome = chr, genome = gen, groups = factor(df2_trait,levels = c(df1_trait, df2_trait)), name="Log10P", legend=TRUE) dtrack <- DataTrack(data = df1$Y, start = df1$BP, end = df1$BP+1, chromosome = chr, genome = gen, groups = factor(df1_trait,levels = c(df1_trait, df2_trait)), name="Log10P", legend=TRUE) overlapTracks <- OverlayTrack(trackList = list(dtrack, dtrack1), background.title = "#001f4d", legend=TRUE) grtrack <- BiomartGeneRegionTrack(genome="hg19", chromosome=chr, start=start, end=end, name="Ensembl", transcriptAnnotation="symbol", stacking="squish", collapseTranscripts="longest", background.title="brown", background.panel = "#FFFEDB", col="black", fill="salmon", fontcolor="black") ylims <- extendrange(range(c(values(dtrack), values(dtrack1)))) png(file="saveit.png", height=600, width=700) plotTracks(list(overlapTracks, gtrack, grtrack), from=start, to=end, col.line=NULL, ylim=ylims, fontsize=14, groupAnnotation = "group") dev.off()
ah done, i was just confused by the fact that it wanted a vector when i was passing in a single colour for each plot.
Do you have any ideas for my other two questions?
Thanks James!