Hi,
I've an issue to plot a figure using Gviz? I've a dataframe containing several genomic positions (chr, pos, strand) and want to plot a specific region containing these features. The strand information is important in this plot thus I would like to use the arrow shape and a specific color to highlight it (strand + = red ; "-" = blue). I want only the arrow border line to be colored, and white within it. Thus I will us the "col" parameter (and will put the fill parameter to "white")
So :
library(Gviz)
# specify color for each features
col <- df$strand
col[col=="+"]<-"red"
col[col=="-"]<-"blue"
# create track containing the colored line
aTrack <- AnnotationTrack(start=df$pos,width=1000,chromosome="chr15",strand=t$strand,genome="hg19",col=col,name="foo",fill="white")
# create track where the whole arrow is colored
bTrack <- AnnotationTrack(start=df$pos,width=1000,chromosome="chr15",strand=t$strand,genome="hg19",fill=col,name="foo")
# plot both tracks
plotTracks(list(aTrack,bTrack),shape="arrow")
Here's the results :
You can see that the second track colored the arrows in the right manner (majority of blue ones and a few red ones), but for the first track all the arrow are red ... even though I use the same variable to assign the colors.
Anyone can help me?
Here's my session info :
R version 3.0.1 (2013-05-16)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=fr_BE.UTF-8 LC_NUMERIC=C
[3] LC_TIME=fr_BE.UTF-8 LC_COLLATE=fr_BE.UTF-8
[5] LC_MONETARY=fr_BE.UTF-8 LC_MESSAGES=fr_BE.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_BE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel grid stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] GenomicRanges_1.14.4 XVector_0.2.0 IRanges_1.20.7
[4] BiocGenerics_0.8.0 Gviz_1.6.0 ggplot2_1.0.1
loaded via a namespace (and not attached):
[1] acepack_1.3-3.3 AnnotationDbi_1.24.0 Biobase_2.22.0
[4] biomaRt_2.18.0 Biostrings_2.30.1 biovizBase_1.10.8
[7] bitops_1.0-6 BSgenome_1.30.0 cluster_2.0.3
[10] colorspace_1.2-6 DBI_0.3.1 dichromat_2.0-0
[13] digest_0.6.9 foreign_0.8-66 Formula_1.2-1
[16] GenomicFeatures_1.14.5 gridExtra_2.2.1 gtable_0.2.0
[19] Hmisc_3.17-0 labeling_0.3 lattice_0.20-33
[22] latticeExtra_0.6-28 magrittr_1.5 MASS_7.3-31
[25] munsell_0.4.3 nnet_7.3-12 plyr_1.8
[28] proto_0.3-10 RColorBrewer_1.1-2 RCurl_1.95-4.1
[31] reshape2_1.2.2 rpart_4.1-10 Rsamtools_1.14.3
[34] RSQLite_0.11.4 rtracklayer_1.22.7 scales_0.2.4
[37] splines_3.0.1 stats4_3.0.1 stringi_1.0-1
[40] stringr_1.0.0 survival_2.38-3 tools_3.0.1
[43] XML_3.98-1.1 zlibbioc_1.8.0
Thanks