Dear Florian,
I would like to change the color of some exons in genes from ENSEMBL. In some case, it works well, cf below
gen<- "hg19" chr <- "chr15" start <- 75011669 end <- 75019876 interestfeatures <- rbind(c("75017782","75017835","bad"),c("75013755","75013844","good")) interestcolor <- list("bad"="red", "good"="green") martENSEMBL=useMart(host='grch37.ensembl.org', biomart='ENSEMBL_MART_ENSEMBL', dataset='hsapiens_gene_ensembl') biomTrack <- BiomartGeneRegionTrack(genome = genTrunk, biomart=martENSEMBL, chromosome = chr, start = start, end = end, name = "transcript ENSEMBL of interest", fontcolor="black",groupAnnotation = "group", just.group = "above",showId=showId,size=2, col.line = NULL, col = NULL, collapse= FALSE) myfeatures <- feature(biomTrack) for( f in 1:length(myfeatures)){ for (i in 1:nrow(as.data.frame(interestfeatures))){ if (start(biomTrack)[f] == as.numeric(interestfeatures[i,1]) & end(biomTrack)[f] == as.numeric(interestfeatures[i,2])){ feature(biomTrack)[f] <- as.character(interestfeatures[i,3]) } } } displayPars(biomTrack) <- interestcolor plotTracks(biomTrack, from=start, to=end)
but sometimes, I don't have the good features with the good colors even if the data is correct in the object "biomTrack". Cf example below. Only the coordinate of good genes change.
gen<- "hg19" chr <- "chr15" start <- 75011669 end <- 75019876 interestfeatures <- rbind(c("75017782","75017835","bad"),c("75011883","75012829","good")) interestcolor <- list("bad"="red", "good"="green") martENSEMBL=useMart(host='grch37.ensembl.org', biomart='ENSEMBL_MART_ENSEMBL', dataset='hsapiens_gene_ensembl') biomTrack <- BiomartGeneRegionTrack(genome = genTrunk, biomart=martENSEMBL, chromosome = chr, start = start, end = end, name = "transcript ENSEMBL of interest", fontcolor="black",groupAnnotation = "group", just.group = "above",showId=showId,size=2, col.line = NULL, col = NULL, collapse= FALSE) myfeatures <- feature(biomTrack) for( f in 1:length(myfeatures)){ for (i in 1:nrow(as.data.frame(interestfeatures))){ if (start(biomTrack)[f] == as.numeric(interestfeatures[i,1]) & end(biomTrack)[f] == as.numeric(interestfeatures[i,2])){ feature(biomTrack)[f] <- as.character(interestfeatures[i,3]) } } } displayPars(biomTrack) <- interestcolor plotTracks(biomTrack, from=start, to=end)
Do you know what I need to change to have good colors in the good place ?
Regards
Tiphaine
sessionInfo() R version 3.2.1 (2015-06-18) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu precise (12.04.5 LTS) locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] parallel stats4 grid stats graphics grDevices utils datasets methods base other attached packages: [1] XVector_0.8.0 coMET_0.99.10 psych_1.5.4 Gviz_1.12.1 GenomicRanges_1.20.5 [6] GenomeInfoDb_1.4.1 IRanges_2.2.5 S4Vectors_0.6.1 BiocGenerics_0.14.0 biomaRt_2.24.0 loaded via a namespace (and not attached): [1] Rcpp_0.11.6 biovizBase_1.16.0 lattice_0.20-31 Rsamtools_1.20.4 [5] Biostrings_2.36.1 digest_0.6.8 plyr_1.8.3 futile.options_1.0.0 [9] acepack_1.3-3.3 RSQLite_1.0.0 ggplot2_1.0.1 zlibbioc_1.14.0 [13] GenomicFeatures_1.20.1 rpart_4.1-10 hash_2.2.6 ggbio_1.16.0 [17] proto_0.3-10 splines_3.2.1 BiocParallel_1.2.7 stringr_1.0.0 [21] foreign_0.8-65 RCurl_1.95-4.7 munsell_0.4.2 rtracklayer_1.28.6 [25] mnormt_1.5-3 tcltk_3.2.1 nnet_7.3-10 gridExtra_0.9.1 [29] colortools_0.1.5 Hmisc_3.16-0 matrixStats_0.14.2 gWidgets_0.0-54 [33] XML_3.98-1.3 reshape_0.8.5 GenomicAlignments_1.4.1 MASS_7.3-42 [37] bitops_1.0-6 RBGL_1.44.0 GGally_0.5.0 gtable_0.1.2 [41] DBI_0.3.1 magrittr_1.5 gWidgetstcltk_0.0-55 scales_0.2.5 [45] graph_1.46.0 stringi_0.5-5 pbapply_1.1-1 trackViewer_1.4.0 [49] reshape2_1.4.1 latticeExtra_0.6-26 futile.logger_1.4.1 Formula_1.2-1 [53] lambda.r_1.1.7 RColorBrewer_1.1-2 tools_3.2.1 dichromat_2.0-0 [57] BSgenome_1.36.2 Biobase_2.28.0 OrganismDbi_1.10.0 survival_2.38-3 [61] AnnotationDbi_1.30.1 colorspace_1.2-6 cluster_2.0.2 VariantAnnotation_1.14.6
Hi Tiphaine,
Do you mind sharing how you solved the problem with exons which have an UTR and a protein coding region having the same color?
Sathiya