Browse code

adding a NEWS file

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Gviz@69039 bc3139a8-67e5-0310-9ffc-ced21a209358

Florian Hahne authored on 04/09/2012 08:14:44
Showing 8 changed files

1 1
new file mode 100644
... ...
@@ -0,0 +1,51 @@
1
+CHANGES IN VERSION 1.2.0
2
+-------------------------
3
+
4
+NEW FEATURES
5
+
6
+    o A SequenceTrack class has been added to draw genomic sequence
7
+      information on a Gviz plot. Possible inputs for the track are
8
+      DNAStringSet objects or directly from BSgenome packages.
9
+
10
+    o GeneRegionTracks can now deal with coding and non-coding regions
11
+      by means of the feature property in combination with the
12
+      thinBoxFeature display parameter.
13
+
14
+   
15
+
16
+SIGNIFICANT USER-VISIBLE CHANGES
17
+
18
+    o Updated the show methods for most tracks to give more meaningful
19
+      and more compact information about the track's
20
+      content. Availablability of data on other chromosomes than the
21
+      currently active one should now be indicated.
22
+
23
+    o IdeogramTracks can now be constructed from a cytoband table via
24
+      the new bands argument in the constructor.
25
+
26
+    o AnnotationTrack objects now by default draw connecting lines in
27
+      a light gray color. This feature can be controlled via the
28
+      col.line display parameter.
29
+
30
+    o Sliding window summarization can now deal with NA values.
31
+
32
+    o Exporting drawGD from the name space now to allow for
33
+      sub-classing of GdObjects in other packages.
34
+
35
+    o When building GeneRegionTracks from TrasncriptDb objects, the
36
+      information about UTRs and coding regions is now retained.
37
+
38
+
39
+BUG FIXES
40
+
41
+    o When zooming into the emty space between two grouped features,
42
+      the connecting line will now be plotted for all classes inheriting
43
+      from AnnotationTrack.
44
+
45
+    o An error in calculating ylims when drawing AlignedReadTracks has
46
+      been fixed.
47
+
48
+    o Numerous other little fixes that mainly aim at improving
49
+      performance.
50
+
51
+  
... ...
@@ -1178,21 +1178,34 @@ setClass("IdeogramTrack", contains = "RangeTrack",
1178 1178
                                             bevel=0.45)))
1179 1179
 
1180 1180
 ## Grab the chromosome band and length information from UCSC and fill the ranges slot.
1181
-setMethod("initialize", "IdeogramTrack", function(.Object, genome, chromosome, ...){
1181
+setMethod("initialize", "IdeogramTrack", function(.Object, genome, chromosome, bands, name, ...){
1182 1182
     ## the diplay parameter defaults
1183 1183
     .makeParMapping()
1184 1184
     .Object <- .updatePars(.Object, "IdeogramTrack")
1185
-    if(missing(genome) || missing(chromosome))
1185
+    if(is.null(bands) && (missing(genome) || missing(chromosome)))
1186 1186
         return(callNextMethod(.Object=.Object, range=GRanges(), genome=NULL, chromosome=NULL, ...))
1187
-    chromosome <- .chrName(chromosome)[1]
1188
-    sessionInfo <- .cacheGenomes(genome=genome)
1189
-    .Object@bandTable <- sessionInfo$bands
1190
-    ranges <- sessionInfo$bands[sessionInfo$bands$chrom==chromosome,]
1191
-    if(nrow(ranges)==0)
1187
+    if(is.null(bands)){
1188
+        sessionInfo <- .cacheGenomes(genome=genome)
1189
+        .Object@bandTable <- sessionInfo$bands
1190
+        bands <- sessionInfo$bands
1191
+    }else{
1192
+        .checkClass(bands, "data.frame")
1193
+        cols <- c("chrom", "chromStart", "chromEnd", "name", "gieStain") 
1194
+        miss <- ! cols %in% colnames(bands)
1195
+        if(any(miss))
1196
+            stop(sprintf("The following column%s missing from the bands table: %s",
1197
+                         ifelse(sum(miss)>1, "s are", " is"), paste(cols[miss], collapse=", ")))
1198
+        .Object@bandTable <- bands
1199
+    }
1200
+    chromosome <- if(is.null(chromosome)) as.character(bands[1, "chrom"]) else .chrName(chromosome)[1]
1201
+    bands <- bands[bands$chrom==chromosome,]
1202
+    if(nrow(bands)==0)
1192 1203
         stop("Chromosome '", chromosome, "' does not exist on UCSC genome '", genome, "'")
1193
-    ranges <- GRanges(seqnames=ranges$name, range=IRanges(start=ranges$chromStart, end=ranges$chromEnd),
1194
-                      name=ranges$name, type=ranges$gieStain)
1195
-    .Object <- callNextMethod(.Object=.Object, range=ranges, genome=genome, chromosome=chromosome, ...)
1204
+    if(is.null(name))
1205
+        name <- .chrName(chromosome)[1]
1206
+    ranges <- GRanges(seqnames=as.character(bands$name), range=IRanges(start=bands$chromStart, end=bands$chromEnd),
1207
+                      name=as.character(bands$name), type=as.character(bands$gieStain))
1208
+    .Object <- callNextMethod(.Object=.Object, range=ranges, genome=genome, chromosome=chromosome, name=name, ...)
1196 1209
     return(.Object)
1197 1210
 })
1198 1211
 
... ...
@@ -1201,10 +1214,9 @@ setMethod("initialize", "IdeogramTrack", function(.Object, genome, chromosome, .
1201 1214
 ##    o name: the name of the track. This will be used for the title panel.
1202 1215
 ## All additional items in ... are being treated as DisplayParameters
1203 1216
 ## (N)
1204
-IdeogramTrack <- function(chromosome, genome, name=.chrName(chromosome)[1], ...){
1217
+IdeogramTrack <- function(chromosome=NULL, genome, name=NULL, bands=NULL, ...){
1205 1218
     if(missing(genome)) stop("Need to specify genome for creating an IdeogramTrack")
1206
-    if(missing(chromosome)) stop("Need to specify chromosome for creating an IdeogramTrack")
1207
-    new("IdeogramTrack", chromosome=chromosome, genome=genome, name=name, ...)
1219
+    new("IdeogramTrack", chromosome=chromosome, genome=genome, name=name, bands=bands, ...)
1208 1220
 }
1209 1221
 ##----------------------------------------------------------------------------------------------------------------------
1210 1222
 
... ...
@@ -2399,11 +2399,8 @@ setMethod("drawGD", signature("IdeogramTrack"), function(GdObject, minBase, maxB
2399 2399
     if(!missing(minBase) && !missing(maxBase))
2400 2400
         grid.rect(minBase/len, 0.1, width=min(1,(maxBase-minBase)/len), height=0.8, just=c("left","bottom"),
2401 2401
                   gp=gpar(col="transparent", fill=fill))
2402
-    ## Color mapping for the bands, grayscale for regular and red for centrosome/repetetive regions
2403
-    gpcols <- unique(grep("gpos", values(GdObject)$type, value=TRUE))
2404
-    posCol <- if(length(gpcols)==1) 50 else sort(as.integer(gsub("gpos", "", gpcols)))
2405
-    cols <- c("white", colorRampPalette(c("white","black"))(100)[posCol], "black", rep("darkred", 2))
2406
-    names(cols) <- c("gneg", paste("gpos", if(length(gpcols)==1) "" else posCol, sep=""), "gvar", "acen", "stalk")
2402
+    ## Color mapping for the bands taken from the biovizBase package
2403
+    cols <- getBioColor("CYTOBAND")
2407 2404
     vals <- data.frame(values(GdObject), col=cols[as.character(values(GdObject)$type)], stringsAsFactors=FALSE)
2408 2405
     ## For the rounded caps we need  to figure out the overlap with existing bands for proper coloring
2409 2406
     bevel <- 0.02
... ...
@@ -1,3 +1,25 @@
1
+## Check the class and structure of an object
2
+.checkClass <- function (x, class, length = NULL, verbose = FALSE, mandatory = TRUE){
3
+    if (mandatory && missing(x)) 
4
+        stop("Argument '", substitute(x), "' is missing with no default", 
5
+             call. = verbose)
6
+    msg <- paste("'", substitute(x), "' must be an object of class ", 
7
+        paste("'", class, "'", sep = "", collapse = " or "), 
8
+        sep = "")
9
+    fail <- !any(sapply(class, function(c, y) is(y, c), x))
10
+    if (!is.null(length) && length(x) != length) {
11
+        if (!is.null(x)) {
12
+            fail <- TRUE
13
+            msg <- paste(msg, "of length", length)
14
+        }
15
+    }
16
+    if (fail) 
17
+        stop(msg, call. = verbose)
18
+    else invisible(NULL)
19
+}
20
+
21
+
22
+
1 23
 ## We want to deal with chromosomes in a reasonable way. This coerces likely inputs to a unified 
2 24
 ## chromosome name as understood by UCSC. Accepted inputs are:
3 25
 ##    - a single integer or a character coercable to one
... ...
@@ -1209,7 +1209,7 @@ has to be added manually and the default value of the
1209 1209
 possible cases. It is up to the user to come up with a complete
1210 1210
 list of non-coding feature types depending on the source of the data.
1211 1211
 
1212
-<<generegtrack3,  fig=TRUE, results=hide, width=7.5, height=0.25>>=
1212
+<<generegtrack4,  fig=TRUE, results=hide, width=7.5, height=0.25>>=
1213 1213
 feature(txTr)
1214 1214
 plotTracks(txTr, showId=TRUE, extend.left=1000)
1215 1215
 @
... ...
@@ -1309,10 +1309,10 @@ AnnotationTrack(range=NULL, start=NULL, end=NULL, width=NULL, feature, group,
1309 1309
     \item{}{\code{col="transparent"}: Character or integer scalar. The
1310 1310
       border color for all track items.}
1311 1311
 
1312
-     \item{}{\code{col="darkgray"}: Character scalar. The color used for
1313
-       connecting lines between grouped items. Defaults to a dark gray,
1314
-       but if set to \code{NULL} the same color as for the first item in
1315
-       the group is used.}
1312
+    \item{}{\code{col.line="darkgray"}: Character scalar. The color used for
1313
+      connecting lines between grouped items. Defaults to a dark gray,
1314
+      but if set to \code{NULL} the same color as for the first item in
1315
+      the group is used.}
1316 1316
 
1317 1317
     \item{}{\code{fill="lightblue"}: Character or integer scalar. The
1318 1318
       fill color for untyped items. This is also used to connect grouped
... ...
@@ -1476,10 +1476,6 @@ AnnotationTrack(range=NULL, start=NULL, end=NULL, width=NULL, feature, group,
1476 1476
           in \code{\link{DataTrack}}s and when display parameter
1477 1477
           \code{grid==TRUE}.} 
1478 1478
 
1479
-        \item{}{\code{col.line=NULL}: Integer or character scalar.
1480
-          Default colors for plot lines. Usually the same as the global
1481
-          \code{col} parameter.} 
1482
-
1483 1479
         \item{}{\code{col.symbol=NULL}: Integer or character scalar.
1484 1480
           Default colors for plot symbols. Usually the same as the
1485 1481
           global \code{col} parameter.} 
... ...
@@ -1478,7 +1478,12 @@ GeneRegionTrack(range=NULL, rstarts=NULL, rends=NULL, rwidths=NULL, strand="*",
1478 1478
           factor for the group-level annotation.} 
1479 1479
 
1480 1480
         \item{}{\code{col="transparent"}: Character or integer scalar.
1481
-          The border color for all track items.} 
1481
+          The border color for all track items.}
1482
+	
1483
+	\item{}{\code{col.line="darkgray"}: Character scalar. The color used for
1484
+	  connecting lines between grouped items. Defaults to a dark gray,
1485
+	  but if set to \code{NULL} the same color as for the first item in
1486
+	  the group is used.}
1482 1487
 
1483 1488
         \item{}{\code{fontcolor="white"}: Character or integer scalar.
1484 1489
           The font color for item identifiers.} 
... ...
@@ -1572,10 +1577,6 @@ GeneRegionTrack(range=NULL, rstarts=NULL, rends=NULL, rwidths=NULL, strand="*",
1572 1577
           in \code{\link{DataTrack}}s and when display parameter
1573 1578
           \code{grid==TRUE}.} 
1574 1579
 
1575
-        \item{}{\code{col.line=NULL}: Integer or character scalar.
1576
-          Default colors for plot lines. Usually the same as the global
1577
-          \code{col} parameter.} 
1578
-
1579 1580
         \item{}{\code{col.symbol=NULL}: Integer or character scalar.
1580 1581
           Default colors for plot symbols. Usually the same as the
1581 1582
           global \code{col} parameter.} 
... ...
@@ -25,8 +25,8 @@
25 25
 \description{
26 26
   
27 27
   A class to represent the schematic display of a chromosome, also known
28
-  as an ideogram. The respective information is directly fetched from
29
-  UCSC.
28
+  as an ideogram. The respective information is typically directly
29
+  fetched from UCSC.
30 30
 
31 31
 }
32 32
 
... ...
@@ -38,24 +38,36 @@
38 38
 
39 39
 \usage{
40 40
 
41
-IdeogramTrack(chromosome, genome, name=.chrName(chromosome)[1], ...)
41
+IdeogramTrack(chromosome=NULL, genome, name=NULL, bands=NULL, ...)
42 42
 
43 43
 }
44 44
 
45 45
 \arguments{
46 46
   
47 47
   \item{chromosome}{The chromosome for which to create the ideogram. Has
48
-    to be a valid UCSC chromosome identifier of the form
49
-    \code{chrx}, or a single integer or numeric character. The
50
-    user has to make sure that the respective chromosome is indeed
51
-    defined for the the track's genome.}
48
+    to be a valid UCSC chromosome identifier of the form \code{chrx}, or
49
+    a single integer or numeric character unless
50
+    \code{option(ucscChromosomeNames=FALSE)}. The user has to make sure
51
+    that the respective chromosome is indeed defined for the the track's
52
+    genome.}
52 53
 
53
-  \item{genome}{The genome on which to create the ideogram. This
54
-    has to be a valid UCSC genome identifier.}
54
+  \item{genome}{The genome on which to create the ideogram. This has to
55
+    be a valid UCSC genome identifier if the ideogram data is to be
56
+    fetched from the UCSC repository.}
55 57
 
56 58
   \item{name}{Character scalar of the track's name used in the title
57
-    panel when plotting.}
58
-
59
+    panel when plotting. Defaults to the selected chromosome.}
60
+
61
+  \item{bands}{A \code{data.frame} with the cytoband information for all
62
+    available chromosomes on the genome similar to the data that would
63
+    be fetched from UCSC. The table needs to contain the mandatory
64
+    columns \code{chrom}, \code{chromStart}, \code{chromEnd},
65
+    \code{name} and \code{gieStain} with the chromosome name, cytoband
66
+    start and end coordinates, cytoband name and coloring information,
67
+    respectively. This can be used when no connection to the internet is
68
+    available or when the cytoband information has been cached locally
69
+    to avoid the somewhat slow connection to UCSC.}
70
+    
59 71
   \item{\dots}{Additional items which will all be interpreted as further
60 72
     display parameters.}
61 73