git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/branches/RELEASE_2_11/madman/Rpacks/Gviz@71610 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
Package: Gviz |
2 |
-Version: 1.2.0 |
|
2 |
+Version: 1.2.1 |
|
3 | 3 |
Title: Plotting data and annotation information along genomic coordinates |
4 | 4 |
Author: Florian Hahne, Steffen Durinck, Robert Ivanek, Arne Mueller, Steve Lianoglou> |
5 | 5 |
Maintainer: Florian Hahne <florian.hahne@novartis.com> |
... | ... |
@@ -2354,6 +2354,18 @@ setMethod("drawGD", signature("AlignedReadTrack"), function(GdObject, minBase, m |
2354 | 2354 |
return(coords) |
2355 | 2355 |
} |
2356 | 2356 |
|
2357 |
+ |
|
2358 |
+## A more generic method to come up with colors for chromosome bands that still relies a bit on biovizBase |
|
2359 |
+.getBioColorIdeo <- function(type){ |
|
2360 |
+ type <- as.character(type) |
|
2361 |
+ ocols <- getBioColor("CYTOBAND") |
|
2362 |
+ cols <- c(ocols[c("gneg", "stalk", "acen")], gpos=unname(ocols["gpos100"]), gvar=unname(ocols["gpos100"])) |
|
2363 |
+ gpcols <- unique(grep("gpos", type, value=TRUE)) |
|
2364 |
+ crmp <- colorRampPalette(c(cols["gneg"], cols["gpos"]))(100) |
|
2365 |
+ posCols <- setNames(crmp[as.integer(gsub("gpos", "", gpcols))], gpcols) |
|
2366 |
+ return(c(cols, posCols)) |
|
2367 |
+} |
|
2368 |
+ |
|
2357 | 2369 |
## The actual drawing method |
2358 | 2370 |
setMethod("drawGD", signature("IdeogramTrack"), function(GdObject, minBase, maxBase, prepare=FALSE, ...) { |
2359 | 2371 |
imageMap(GdObject) <- NULL |
... | ... |
@@ -2401,7 +2413,7 @@ setMethod("drawGD", signature("IdeogramTrack"), function(GdObject, minBase, maxB |
2401 | 2413 |
grid.rect(minBase/len, 0.1, width=min(1,(maxBase-minBase)/len), height=0.8, just=c("left","bottom"), |
2402 | 2414 |
gp=gpar(col="transparent", fill=fill)) |
2403 | 2415 |
## Color mapping for the bands taken from the biovizBase package |
2404 |
- cols <- getBioColor("CYTOBAND") |
|
2416 |
+ cols <- .getBioColorIdeo(values(GdObject)$type) |
|
2405 | 2417 |
vals <- data.frame(values(GdObject), col=cols[as.character(values(GdObject)$type)], stringsAsFactors=FALSE) |
2406 | 2418 |
## For the rounded caps we need to figure out the overlap with existing bands for proper coloring |
2407 | 2419 |
bevel <- 0.02 |