git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Gviz@69035 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,11 +1,11 @@ |
1 | 1 |
Package: Gviz |
2 |
-Version: 1.1.12 |
|
2 |
+Version: 1.1.15 |
|
3 | 3 |
Title: Plotting data and annotation information along genomic coordinates |
4 |
-Author: Florian Hahne, Steffen Durinck, Robert Ivanek, Arne Mueller |
|
4 |
+Author: Florian Hahne, Steffen Durinck, Robert Ivanek, Arne Mueller, Steve Lianoglou> |
|
5 | 5 |
Maintainer: Florian Hahne <florian.hahne@novartis.com> |
6 | 6 |
Depends: R (>= 2.10.0), methods, grid |
7 |
-Imports: IRanges (>= 1.13.19), rtracklayer (>= 1.15.5), lattice, RColorBrewer, biomaRt (>= 2.11.0), GenomicRanges (>= 1.7.14), AnnotationDbi (>= 1.17.11), Biobase (>= 2.15.3), BiocGenerics (>= 0.1.4), GenomicFeatures (>= 1.9.7) |
|
8 |
-Suggests: xtable, GenomicFeatures |
|
7 |
+Imports: IRanges (>= 1.13.19), rtracklayer (>= 1.15.5), lattice, RColorBrewer, biomaRt (>= 2.11.0), GenomicRanges (>= 1.7.14), AnnotationDbi (>= 1.17.11), Biobase (>= 2.15.3), BiocGenerics (>= 0.1.4), GenomicFeatures (>= 1.9.7), BSgenome (>= 1.25.1), Biostrings (>= 2.25.1), biovizBase (>= 1.5.7) |
|
8 |
+Suggests: xtable, GenomicFeatures, BSgenome.Hsapiens.UCSC.hg19 |
|
9 | 9 |
biocViews: Visualization, Microarray |
10 | 10 |
Description: Genomic data analyses requires integrated visualization of known genomic information and new experimental data. Gviz uses the biomaRt and the rtracklayer packages to perform live annotation queries to Ensembl and UCSC and translates this to e.g. gene/transcript structures in viewports of the grid graphics package. This results in genomic information plotted together with your data. |
11 | 11 |
Collate: Gviz.R AllGenerics.R AllClasses.R Gviz-methods.R |
... | ... |
@@ -7,8 +7,12 @@ |
7 | 7 |
|
8 | 8 |
importClassesFrom(biomaRt, Mart) |
9 | 9 |
|
10 |
+importClassesFrom(Biostrings, DNAStringSet, BStringSet, DNAString, BString) |
|
11 |
+ |
|
10 | 12 |
importClassesFrom(GenomicRanges, GRanges) |
11 | 13 |
|
14 |
+importClassesFrom(BSgenome, BSgenome) |
|
15 |
+ |
|
12 | 16 |
importClassesFrom(GenomicFeatures, "TranscriptDb") |
13 | 17 |
|
14 | 18 |
importClassesFrom(IRanges, IRanges, GroupedIRanges, NormalIRanges) |
... | ... |
@@ -29,15 +33,17 @@ importMethodsFrom(BiocGenerics, cbind, duplicated, eval, intersect, lapply, |
29 | 33 |
mapply, order, paste, pmax, pmin, rbind, sapply, setdiff, |
30 | 34 |
table, tapply, unique) |
31 | 35 |
|
36 |
+importMethodsFrom(BSgenome, providerVersion) |
|
37 |
+ |
|
32 | 38 |
importMethodsFrom(GenomicFeatures, isActiveSeq, "isActiveSeq<-", exonsBy, transcriptsBy, transcripts) |
33 | 39 |
|
34 | 40 |
importMethodsFrom(GenomicRanges, "elementMetadata<-", genome, "genome<-", |
35 |
- seqlengths, seqnames, strand, "strand<-") |
|
41 |
+ seqlengths, seqnames, seqlevels, seqinfo, strand, "strand<-", seqnameStyle) |
|
36 | 42 |
|
37 | 43 |
importMethodsFrom(IRanges, as.data.frame, as.list, as.matrix, as.vector, |
38 |
- "colnames<-", coverage, diff, disjointBins, end, "end<-", |
|
44 |
+ "colnames<-", coverage, diff, disjointBins, end, "end<-", range, |
|
39 | 45 |
findOverlaps, findRun, gsub, ifelse, "%in%", levels, match, |
40 |
- mean, ncol, nlevels, nrow, queryHits, ranges, reduce, rev, |
|
46 |
+ mean, ncol, nlevels, nrow, queryHits, ranges, "ranges<-", reduce, rev, |
|
41 | 47 |
Rle, rownames, "rownames<-", runmean, runValue, "runValue<-", |
42 | 48 |
score, sort, split, start, "start<-", sub, subjectHits, |
43 | 49 |
substring, t, tolower, unlist, values, "values<-", which, |
... | ... |
@@ -51,6 +57,8 @@ importMethodsFrom(rtracklayer, chrom, close, getTable, "tableName<-", |
51 | 57 |
|
52 | 58 |
importFrom(Biobase, listLen, rowMax, rowMin) |
53 | 59 |
|
60 |
+importFrom(Biostrings, DNAStringSet, BStringSet, DNAString, BString, reverseComplement) |
|
61 |
+ |
|
54 | 62 |
importFrom(BiocGenerics, getObjectSlots) |
55 | 63 |
|
56 | 64 |
importFrom(biomaRt, getBM, useMart) |
... | ... |
@@ -69,7 +77,7 @@ importFrom(grid, convertHeight, convertWidth, convertX, convertY, |
69 | 77 |
popViewport, pushViewport, stringHeight, stringWidth, unit, |
70 | 78 |
upViewport, viewport) |
71 | 79 |
|
72 |
-importFrom(IRanges, IRanges) |
|
80 |
+importFrom(IRanges, IRanges, subseq) |
|
73 | 81 |
|
74 | 82 |
importFrom(lattice, current.panel.limits, panel.abline, panel.grid, panel.lines, |
75 | 83 |
panel.points, panel.polygon, panel.segments, panel.xyplot, panel.text, |
... | ... |
@@ -84,6 +92,8 @@ importFrom(rtracklayer, GenomicData, ucscGenomes, browserSession) |
84 | 92 |
|
85 | 93 |
importFrom(stats, loess.smooth) |
86 | 94 |
|
95 |
+importFrom(biovizBase, getBioColor) |
|
96 |
+ |
|
87 | 97 |
importFrom(utils, assignInNamespace, browseURL, head, write.table) |
88 | 98 |
|
89 | 99 |
export(".chrName", |
... | ... |
@@ -94,6 +104,7 @@ export(".chrName", |
94 | 104 |
"BiomartGeneRegionTrack", |
95 | 105 |
"DataTrack", |
96 | 106 |
"DisplayPars", |
107 |
+ "drawGD", |
|
97 | 108 |
"GeneRegionTrack", |
98 | 109 |
"GenomeAxisTrack", |
99 | 110 |
"IdeogramTrack", |
... | ... |
@@ -102,7 +113,8 @@ export(".chrName", |
102 | 113 |
"availableDisplayPars", |
103 | 114 |
"clearSessionCache", |
104 | 115 |
"exportTracks", |
105 |
- "plotTracks") |
|
116 |
+ "plotTracks", |
|
117 |
+ "SequenceTrack") |
|
106 | 118 |
|
107 | 119 |
exportClasses("AlignedReadTrack", |
108 | 120 |
"AnnotationTrack", |
... | ... |
@@ -113,7 +125,8 @@ exportClasses("AlignedReadTrack", |
113 | 125 |
"GeneRegionTrack", |
114 | 126 |
"GenomeAxisTrack", |
115 | 127 |
"IdeogramTrack", |
116 |
- "ImageMap") |
|
128 |
+ "ImageMap", |
|
129 |
+ "SequenceTrack") |
|
117 | 130 |
|
118 | 131 |
exportMethods("[", |
119 | 132 |
"as.list", |
... | ... |
@@ -152,6 +165,9 @@ exportMethods("[", |
152 | 165 |
"range", |
153 | 166 |
"ranges", |
154 | 167 |
"score", |
168 |
+ "seqnames", |
|
169 |
+ "seqlevels", |
|
170 |
+ "seqinfo", |
|
155 | 171 |
"setPar", |
156 | 172 |
"split", |
157 | 173 |
"stacking", |
... | ... |
@@ -161,6 +177,7 @@ exportMethods("[", |
161 | 177 |
"start<-", |
162 | 178 |
"strand", |
163 | 179 |
"strand<-", |
180 |
+ "subseq", |
|
164 | 181 |
"subset", |
165 | 182 |
"symbol", |
166 | 183 |
"symbol<-", |
... | ... |
@@ -16,6 +16,7 @@ setClassUnion("NumericOrNULL", c("numeric", "NULL")) |
16 | 16 |
setClassUnion("ListOrEnv", c("list", "environment")) |
17 | 17 |
setClassUnion("GRangesOrIRanges", c("GRanges", "IRanges")) |
18 | 18 |
setClassUnion("NULLOrMissing", c("NULL", "missing")) |
19 |
+setClassUnion("BSgenomeOrNULL", c("BSgenome", "NULL")) |
|
19 | 20 |
##---------------------------------------------------------------------------------------------------------------------- |
20 | 21 |
|
21 | 22 |
|
... | ... |
@@ -469,6 +470,7 @@ setClass("AnnotationTrack", |
469 | 470 |
name="AnnotationTrack", |
470 | 471 |
dp=DisplayPars(fill="lightblue", |
471 | 472 |
col="transparent", |
473 |
+ col.line="darkgray", |
|
472 | 474 |
lty="solid", |
473 | 475 |
lwd=1, |
474 | 476 |
lex=1, |
... | ... |
@@ -689,10 +691,13 @@ setClass("GeneRegionTrack", |
689 | 691 |
end=0, |
690 | 692 |
name="GeneRegionTrack", |
691 | 693 |
dp=DisplayPars(fill="orange", |
694 |
+ min.distance=0, |
|
695 |
+ col=NULL, |
|
692 | 696 |
geneSymbols=TRUE, |
693 | 697 |
showExonId=FALSE, |
694 | 698 |
collapseTranscripts=FALSE, |
695 |
- shape=c("smallArrow", "box")))) |
|
699 |
+ shape=c("smallArrow", "box"), |
|
700 |
+ thinBoxFeature=c("utr", "ncRNA", "utr3", "utr5", "miRNA", "lincRNA")))) |
|
696 | 701 |
|
697 | 702 |
|
698 | 703 |
## Making sure all the display parameter defaults are being set |
... | ... |
@@ -1382,7 +1387,7 @@ setMethod("initialize", "AlignedReadTrack", function(.Object, coverageOnly=FALSE |
1382 | 1387 |
.makeParMapping() |
1383 | 1388 |
.Object <- .updatePars(.Object, "AlignedReadTrack") |
1384 | 1389 |
.Object <- callNextMethod() |
1385 |
- .Object <- setCoverage(.Object) |
|
1390 |
+ .Object <- setCoverage(.Object) |
|
1386 | 1391 |
if(coverageOnly) |
1387 | 1392 |
{ |
1388 | 1393 |
## from <- min(unlist(lapply(.Object@coverage, function(y) if(length(y)) min(start(y))))) |
... | ... |
@@ -1436,3 +1441,128 @@ AlignedReadTrack <- function(range=NULL, start=NULL, end=NULL, width=NULL, chrom |
1436 | 1441 |
|
1437 | 1442 |
|
1438 | 1443 |
|
1444 |
+##---------------------------------------------------------------------------------------------------------------------- |
|
1445 |
+## SequenceTrack: |
|
1446 |
+## |
|
1447 |
+## A generic track to visualize nucleotide sequences. This class is virtual. |
|
1448 |
+## Slots: |
|
1449 |
+## o chromosome: a character vector giving the active chromosome for which the |
|
1450 |
+## track is defined. Valid chromosome names are: |
|
1451 |
+## - a single numeric character |
|
1452 |
+## - a string, starting with 'chr', followed by any additional characters |
|
1453 |
+## o genome: character giving the reference genome for which the track is defined. |
|
1454 |
+## A bunch of DisplayPars are set during object instantiation: |
|
1455 |
+## o foo: bar |
|
1456 |
+setClass("SequenceTrack", |
|
1457 |
+ representation=representation("VIRTUAL", |
|
1458 |
+ chromosome="character", |
|
1459 |
+ genome="character"), |
|
1460 |
+ contains="GdObject", |
|
1461 |
+ prototype=prototype(name="Sequence", |
|
1462 |
+ dp=DisplayPars(size=NULL, |
|
1463 |
+ fontcolor=getBioColor("DNA_BASES_N"), |
|
1464 |
+ fontsize=10, |
|
1465 |
+ fontface=2, |
|
1466 |
+ lwd=2, |
|
1467 |
+ col="darkgray", |
|
1468 |
+ min.width=2, |
|
1469 |
+ showTitle=FALSE, |
|
1470 |
+ background.title="transparent", |
|
1471 |
+ noLetters=FALSE, |
|
1472 |
+ complement=FALSE, |
|
1473 |
+ add53=FALSE), |
|
1474 |
+ genome=as.character(NA), |
|
1475 |
+ chromosome="chrNA")) |
|
1476 |
+ |
|
1477 |
+## Essentially we just update the display parameters here and set the chromosome and the genome |
|
1478 |
+setMethod("initialize", "SequenceTrack", function(.Object, chromosome, genome, ...) { |
|
1479 |
+ ## the diplay parameter defaults |
|
1480 |
+ .makeParMapping() |
|
1481 |
+ .Object <- .updatePars(.Object, "SequenceTrack") |
|
1482 |
+ if(!missing(chromosome) && !is.null(chromosome)){ |
|
1483 |
+ .Object@chromosome <- .chrName(chromosome)[1] |
|
1484 |
+ } |
|
1485 |
+ if(missing(genome) || is.null(genome)) |
|
1486 |
+ genome <- as.character(NA) |
|
1487 |
+ .Object@genome <- genome |
|
1488 |
+ .Object <- callNextMethod(.Object, ...) |
|
1489 |
+ return(.Object) |
|
1490 |
+}) |
|
1491 |
+ |
|
1492 |
+## We want the following behaviour in the constructor: |
|
1493 |
+## a) sequence is missing (NULL) => build SequenceDNAStringSetTrack with chromosome NA and genome as supplied or NA if missing |
|
1494 |
+## b) sequence is DNAStringSet => build SequenceDNAStringSetTrack where chromosome is names(sequence)[1] or the supplied |
|
1495 |
+## chromosome if available, and genome as supplied or NA if missing |
|
1496 |
+## c) sequence is BSgenome => build SequenceBSgenomeTrack where chromosome is seqnames(sequence)[1] or the supplied |
|
1497 |
+## chromosome if available, and genome is the supplied genome or the one extracted from the BSgenome object |
|
1498 |
+SequenceTrack <- function(sequence=NULL, chromosome=NULL, genome, name="Sequence", ...){ |
|
1499 |
+ if(is(sequence, "BSgenome")){ |
|
1500 |
+ if(missing(genome)) |
|
1501 |
+ genome <- providerVersion(sequence) |
|
1502 |
+ if(is.null(chromosome)) |
|
1503 |
+ chromosome <- seqnames(sequence)[1] |
|
1504 |
+ obj <- new("SequenceBSgenomeTrack", sequence=sequence, chromosome=chromosome, genome=genome, name=name, ...) |
|
1505 |
+ }else{ |
|
1506 |
+ if(missing(genome)) |
|
1507 |
+ genome <- as.character(NA) |
|
1508 |
+ if(!is.null(sequence)){ |
|
1509 |
+ if(is.null(names(sequence))) |
|
1510 |
+ stop("The sequences in the DNAStringSet must be named") |
|
1511 |
+ if(any(duplicated(names(sequence)))) |
|
1512 |
+ stop("The sequence names in the DNAStringSet must be unique") |
|
1513 |
+ if(is.null(chromosome)) |
|
1514 |
+ chromosome <- names(sequence)[1] |
|
1515 |
+ } |
|
1516 |
+ obj <- new("SequenceDNAStringSetTrack", sequence=sequence, chromosome=chromosome, genome=genome, name=name, ...) |
|
1517 |
+ } |
|
1518 |
+ return(obj) |
|
1519 |
+} |
|
1520 |
+##---------------------------------------------------------------------------------------------------------------------- |
|
1521 |
+ |
|
1522 |
+ |
|
1523 |
+ |
|
1524 |
+##---------------------------------------------------------------------------------------------------------------------- |
|
1525 |
+## SequenceDNAStringSetTrack: |
|
1526 |
+## |
|
1527 |
+## A track to visualize nucleotide sequences that are stored in a DNSStringSet |
|
1528 |
+## Slots: |
|
1529 |
+## o sequence: a DNAStringSet object that contains all the sequence data |
|
1530 |
+##---------------------------------------------------------------------------------------------------------------------- |
|
1531 |
+setClass("SequenceDNAStringSetTrack", |
|
1532 |
+ representation=representation(sequence="DNAStringSet"), |
|
1533 |
+ contains="SequenceTrack", |
|
1534 |
+ prototype=prototype(sequence=DNAStringSet())) |
|
1535 |
+ |
|
1536 |
+setMethod("initialize", "SequenceDNAStringSetTrack", function(.Object, sequence, ...) { |
|
1537 |
+ if(missing(sequence) || is.null(sequence)) |
|
1538 |
+ sequence <- DNAStringSet() |
|
1539 |
+ .Object@sequence <- sequence |
|
1540 |
+ .Object <- callNextMethod(.Object, ...) |
|
1541 |
+ return(.Object) |
|
1542 |
+}) |
|
1543 |
+##---------------------------------------------------------------------------------------------------------------------- |
|
1544 |
+ |
|
1545 |
+ |
|
1546 |
+ |
|
1547 |
+##---------------------------------------------------------------------------------------------------------------------- |
|
1548 |
+## SequenceBSgenomeTrack: |
|
1549 |
+## |
|
1550 |
+## A track to visualize nucleotide sequences that are stored in a BSgenome package |
|
1551 |
+## Slots: |
|
1552 |
+## o sequence: a DNAStringSet object that contains all the sequence data |
|
1553 |
+## o pointerCache: an environemnt to hold pointers to the BSgenome sequences to prevent garbage collection. This |
|
1554 |
+## will only be filled once the individual sequences have been accessed for the first time |
|
1555 |
+##---------------------------------------------------------------------------------------------------------------------- |
|
1556 |
+setClass("SequenceBSgenomeTrack", |
|
1557 |
+ representation=representation(sequence="BSgenomeOrNULL", pointerCache="environment"), |
|
1558 |
+ contains="SequenceTrack", |
|
1559 |
+ prototype=prototype(sequence=NULL)) |
|
1560 |
+ |
|
1561 |
+setMethod("initialize", "SequenceBSgenomeTrack", function(.Object, sequence=NULL, ...) { |
|
1562 |
+ .Object@sequence <- sequence |
|
1563 |
+ .Object@pointerCache <- new.env() |
|
1564 |
+ .Object <- callNextMethod(.Object, ...) |
|
1565 |
+ return(.Object) |
|
1566 |
+}) |
|
1567 |
+ |
|
1568 |
+##---------------------------------------------------------------------------------------------------------------------- |
... | ... |
@@ -3,14 +3,27 @@ |
3 | 3 |
##---------------------------------------------------------------------------------------------------------------------------- |
4 | 4 |
## Extract the full GRanges object from the range slot of an object inheriting from RangeTrack |
5 | 5 |
setMethod("ranges", "RangeTrack", function(x) x@range) |
6 |
+setReplaceMethod("ranges", "RangeTrack", function(x, value) { |
|
7 |
+ x@range <- value |
|
8 |
+ return(x)}) |
|
6 | 9 |
setMethod("ranges", "GenomeAxisTrack", function(x) x@range) |
10 |
+setReplaceMethod("ranges", "GenomeAxisTrack", function(x, value) { |
|
11 |
+ x@range <- value |
|
12 |
+ return(x)}) |
|
13 |
+ |
|
7 | 14 |
|
8 | 15 |
## Extract the IRanges part of the GRanges object from the range slot of an object inheriting from RangeTrack |
9 | 16 |
setMethod("range", "RangeTrack", function(x) ranges(x@range)) |
10 | 17 |
setMethod("range", "GenomeAxisTrack", function(x) ranges(x@range)) |
11 | 18 |
|
12 |
-## seqnames from the range track |
|
19 |
+## seqnames, levels and infofrom the range track |
|
13 | 20 |
setMethod("seqnames", "RangeTrack", function(x) as.character(seqnames(ranges(x)))) |
21 |
+setMethod("seqnames", "SequenceDNAStringSetTrack", function(x) as.character(names(x@sequence))) |
|
22 |
+setMethod("seqnames", "SequenceBSgenomeTrack", function(x) as.character(seqnames(x@sequence))) |
|
23 |
+setMethod("seqlevels", "RangeTrack", function(x) unique(seqnames(x))) |
|
24 |
+setMethod("seqlevels", "SequenceDNAStringSetTrack", function(x) seqnames(x)[width(x@sequence)>0]) |
|
25 |
+setMethod("seqlevels", "SequenceBSgenomeTrack", function(x) seqnames) |
|
26 |
+setMethod("seqinfo", "RangeTrack", function(x) table(seqnames(x))) |
|
14 | 27 |
|
15 | 28 |
## Min and max ranges |
16 | 29 |
setMethod("min", "RangeTrack", function(x) min(start(x))) |
... | ... |
@@ -42,13 +55,18 @@ setMethod("start", "GenomeAxisTrack", function(x) if(length(x)) start(range(x)) |
42 | 55 |
setMethod("end", "GenomeAxisTrack", function(x) if(length(x)) end(range(x)) else NULL) |
43 | 56 |
setMethod("width", "GenomeAxisTrack", function(x) if(length(x)) as.integer(width(range(x))) else NULL) |
44 | 57 |
setMethod("start", "IdeogramTrack", function(x) NULL) |
58 |
+setMethod("start", "SequenceTrack", function(x) NULL) |
|
45 | 59 |
setMethod("end", "IdeogramTrack", function(x) NULL) |
60 |
+setMethod("end", "SequenceTrack", function(x) NULL) |
|
46 | 61 |
setMethod("width", "IdeogramTrack", function(x) NULL) |
62 |
+setMethod("width", "SequenceTrack", function(x) NULL) |
|
47 | 63 |
|
48 | 64 |
## Return the number of individual annotation items (independent of any grouping) in a RangeTrack |
49 | 65 |
setMethod("length", "RangeTrack", function(x) sum(seqnames(x) == chromosome(x))) |
50 | 66 |
setMethod("length", "GenomeAxisTrack", function(x) length(ranges(x))) |
51 | 67 |
setMethod("length", "IdeogramTrack", function(x) length(ranges(x))) |
68 |
+setMethod("length", "SequenceTrack", function(x) |
|
69 |
+ if(chromosome(x) %in% seqnames(x)) length(x@sequence[[chromosome(x)]]) else 0) |
|
52 | 70 |
|
53 | 71 |
## Extract the elementMetadata slot from the GRanges object of an object inheriting from RangeTrack as a data.frame. |
54 | 72 |
## For a DataTrack object these values are stored as a numeric matrix in the data slot, and we return this instead. |
... | ... |
@@ -72,11 +90,62 @@ setReplaceMethod("values", "DataTrack", function(x, value){ |
72 | 90 |
return(x) |
73 | 91 |
}) |
74 | 92 |
|
75 |
- |
|
76 |
- |
|
93 |
+ |
|
94 |
+## Extract a subsequence from a SequenceTrack. For performance reasons we restrict this to a maximum |
|
95 |
+## of one million nucleotides (which is already more than plenty...) |
|
96 |
+setMethod("subseq", "SequenceTrack", function(x, start=NA, end=NA, width=NA){ |
|
97 |
+ padding <- "-" |
|
98 |
+ if(!is.na(start[1]+end[1]+width[1])){ |
|
99 |
+ warning("All 'start', 'stop' and 'width' are provided, ignoring 'width'") |
|
100 |
+ width <- NA |
|
101 |
+ } |
|
102 |
+ ## We want start and end to be set if width is provided |
|
103 |
+ if(!is.na(width[1])){ |
|
104 |
+ if(is.na(start) && is.na(end)) |
|
105 |
+ stop("Two out of the three in 'start', 'end' and 'width' have to be provided") |
|
106 |
+ if(is.na(start)) |
|
107 |
+ start <- end-width[1]+1 |
|
108 |
+ if(is.na(end)) |
|
109 |
+ end <- start+width[1]-1 |
|
110 |
+ } |
|
111 |
+ w <- length(x) |
|
112 |
+ if(is.na(start)) |
|
113 |
+ start <- 1 |
|
114 |
+ if(w>0){ |
|
115 |
+ if(is.na(end)) |
|
116 |
+ end <- w |
|
117 |
+ rstart <- max(1, start[1], na.rm=TRUE) |
|
118 |
+ rend <- max(rstart, min(end[1], w, na.rm=TRUE)) |
|
119 |
+ }else{ |
|
120 |
+ if(is.na(end)) |
|
121 |
+ end <- start |
|
122 |
+ rend <- end |
|
123 |
+ rstart <- start |
|
124 |
+ } |
|
125 |
+ if(rend<rstart) |
|
126 |
+ stop("'end' has to be bigger than 'start'") |
|
127 |
+ if((rend-rstart+1)>10e6) |
|
128 |
+ stop("Sequence is too big! Unable to extract") |
|
129 |
+ finalSeq <- rep(DNAString(padding), end-start+1) |
|
130 |
+ if(chromosome(x) %in% seqnames(x) && rend>rstart){ |
|
131 |
+ chrSeq <- x@sequence[[chromosome(x)]] |
|
132 |
+ seq <- subseq(chrSeq, start=rstart, end=rend) |
|
133 |
+ if(is(x, "SequenceBSgenomeTrack")) seq <- unmasked(seq) |
|
134 |
+ subseq(finalSeq, ifelse(start<1, abs(start)+2, 1), width=rend-rstart+1) <- seq |
|
135 |
+ } |
|
136 |
+ if(is(x, "SequenceBSgenomeTrack") && chromosome(x) %in% seqnames(x)) |
|
137 |
+ x@pointerCache[[chromosome(x)]] <- x@sequence[[chromosome(x)]] |
|
138 |
+ if(.dpOrDefault(x, "complement", FALSE)) |
|
139 |
+ finalSeq <- complement(finalSeq) |
|
140 |
+ return(finalSeq) |
|
141 |
+}) |
|
142 |
+ |
|
143 |
+ |
|
77 | 144 |
|
78 | 145 |
## Set or extract the chromosome from a RangeTrack object |
146 |
+setMethod("chromosome", "GdObject", function(GdObject) return(NULL)) |
|
79 | 147 |
setMethod("chromosome", "RangeTrack", function(GdObject) GdObject@chromosome) |
148 |
+setMethod("chromosome", "SequenceTrack", function(GdObject) GdObject@chromosome) |
|
80 | 149 |
setReplaceMethod("chromosome", "GdObject", function(GdObject, value){ |
81 | 150 |
return(GdObject) |
82 | 151 |
}) |
... | ... |
@@ -84,6 +153,10 @@ setReplaceMethod("chromosome", "RangeTrack", function(GdObject, value){ |
84 | 153 |
GdObject@chromosome <- .chrName(value[1]) |
85 | 154 |
return(GdObject) |
86 | 155 |
}) |
156 |
+setReplaceMethod("chromosome", "SequenceTrack", function(GdObject, value){ |
|
157 |
+ GdObject@chromosome <- .chrName(value[1]) |
|
158 |
+ return(GdObject) |
|
159 |
+}) |
|
87 | 160 |
setReplaceMethod("chromosome", "IdeogramTrack", function(GdObject, value){ |
88 | 161 |
## We have changed the class definition to include the bands for all chromosomes, but still want the old objects to work |
89 | 162 |
chromosome <- .chrName(value[1]) |
... | ... |
@@ -109,6 +182,7 @@ setReplaceMethod("isActiveSeq", "GdObject", function(x, value){ |
109 | 182 |
|
110 | 183 |
## Set or extract the genome from a RangeTrack object |
111 | 184 |
setMethod("genome", "RangeTrack", function(x) x@genome) |
185 |
+setMethod("genome", "SequenceTrack", function(x) x@genome) |
|
112 | 186 |
setReplaceMethod("genome", "GdObject", function(x, value){ |
113 | 187 |
return(x) |
114 | 188 |
}) |
... | ... |
@@ -342,7 +416,7 @@ setMethod("setStacks", "StackedTrack", function(GdObject, ...) { |
342 | 416 |
return(GdObject) |
343 | 417 |
}) |
344 | 418 |
setMethod("setStacks", "AnnotationTrack", function(GdObject, from, to) { |
345 |
- if(!.needsStacking(GdObject)) |
|
419 |
+ if(!.needsStacking(GdObject) || length(GdObject)==0) |
|
346 | 420 |
{ |
347 | 421 |
bins <- rep(1, length(GdObject)) |
348 | 422 |
} else { |
... | ... |
@@ -441,13 +515,19 @@ setMethod("consolidateTrack", signature(GdObject="GdObject"), function(GdObject, |
441 | 515 |
displayPars(GdObject) <- pars |
442 | 516 |
return(GdObject) |
443 | 517 |
}) |
444 |
-## For RangeTracks we want to set the chromosome |
|
518 |
+## For RangeTracks and SequenceTracks we want to set the chromosome |
|
445 | 519 |
setMethod("consolidateTrack", signature(GdObject="RangeTrack"), function(GdObject, chromosome, ...) { |
446 | 520 |
if(!is.null(chromosome)) |
447 | 521 |
chromosome(GdObject) <- chromosome |
448 | 522 |
GdObject <- callNextMethod() |
449 | 523 |
return(GdObject) |
450 | 524 |
}) |
525 |
+setMethod("consolidateTrack", signature(GdObject="SequenceTrack"), function(GdObject, chromosome, ...) { |
|
526 |
+ if(!is.null(chromosome)) |
|
527 |
+ chromosome(GdObject) <- chromosome |
|
528 |
+ GdObject <- callNextMethod() |
|
529 |
+ return(GdObject) |
|
530 |
+}) |
|
451 | 531 |
## For StackedTracks we want to set the stacking (which could have been passed in as a display parameter) |
452 | 532 |
setMethod("consolidateTrack", signature(GdObject="StackedTrack"), function(GdObject, ...) { |
453 | 533 |
GdObject <- callNextMethod() |
... | ... |
@@ -516,7 +596,7 @@ setMethod("consolidateTrack", signature(GdObject="AnnotationTrack"), function(Gd |
516 | 596 |
missing <- which(!cols %in% colnames(anno)) |
517 | 597 |
for(i in missing) |
518 | 598 |
anno[,cols[missing]] <- if(cols[i]=="density") 1 else NA |
519 |
- rRed <- reduce(grange, min.gapwidth=minXDist) |
|
599 |
+ rRed <- if(length(grange)>1) reduce(grange, min.gapwidth=minXDist) else grange |
|
520 | 600 |
if(length(rRed) < length(grange)) |
521 | 601 |
{ |
522 | 602 |
## Some of the items have to be merged and we need to make sure that the additional annotation data that comes with it |
... | ... |
@@ -713,11 +793,10 @@ setMethod("collapseTrack", signature(GdObject="DataTrack"), function(GdObject, d |
713 | 793 |
if(nrow(sc)>1) |
714 | 794 |
{ |
715 | 795 |
newDat <- rbind(newDat, |
716 |
- matrix(sapply(2:nrow(sc), function(x) { |
|
717 |
- rm[ind] <- rep(sc[x,], width(GdObject)) |
|
718 |
- suppressWarnings(runValue(runmean(Rle(as.numeric(rm)), k=windowSize, endrule="constant")))[seqSel]}), |
|
719 |
- nrow=nrow(sc)-1, byrow=TRUE) |
|
720 |
- ) |
|
796 |
+ matrix(sapply(2:nrow(sc), function(x) { |
|
797 |
+ rm[ind] <- rep(sc[x,], width(GdObject)) |
|
798 |
+ suppressWarnings(runValue(runmean(Rle(as.numeric(rm)), k=windowSize, endrule="constant", na.rm=TRUE)))[seqSel]}), |
|
799 |
+ nrow=nrow(sc)-1, byrow=TRUE)) |
|
721 | 800 |
} |
722 | 801 |
sc <- newDat |
723 | 802 |
} else { |
... | ... |
@@ -885,8 +964,8 @@ setMethod("subset", signature(x="StackedTrack"), function(x, from=NULL, to=NULL, |
885 | 964 |
x <- setStacks(x) |
886 | 965 |
return(x) |
887 | 966 |
}) |
888 |
-## In order to keep the grouping information for track regions in the clipped areas we also have to |
|
889 |
-## keep, for each group, the min-1 and max+1 items. |
|
967 |
+## In order to keep the grouping information for track regions in the clipped areas we have to |
|
968 |
+## keep all group elements that overlap with the range |
|
890 | 969 |
setMethod("subset", signature(x="AnnotationTrack"), function(x, from=NULL, to=NULL, sort=FALSE, stacks=FALSE){ |
891 | 970 |
## Subset to a single chromosome first |
892 | 971 |
csel <- seqnames(x) != chromosome(x) |
... | ... |
@@ -901,38 +980,15 @@ setMethod("subset", signature(x="AnnotationTrack"), function(x, from=NULL, to=NU |
901 | 980 |
x <- setStacks(x) |
902 | 981 |
return(x) |
903 | 982 |
} |
904 |
- |
|
905 | 983 |
## Now remove everything except for the overlapping groups by first subselecting all groups in the range... |
906 |
- gsel <- group(x)[queryHits(findOverlaps(range(x), IRanges(ranges["from"], ranges["to"])))] |
|
984 |
+ granges <- unlist(range(split(ranges(x), group(x)))) |
|
985 |
+ gsel <- names(granges)[subjectHits(findOverlaps(GRanges(seqnames=chromosome(x), ranges=IRanges(ranges["from"], ranges["to"])), granges))] |
|
907 | 986 |
x <- x[group(x) %in% gsel] |
908 |
- ## check if there is anything that overlaps |
|
909 |
- if (length(gsel)) { |
|
910 |
- ## ... and then finding everything that overlaps |
|
911 |
- coords <- data.frame(cbind(start(x), end(x))) |
|
912 |
- grps <- sapply(split(coords, group(x)), range) |
|
913 |
- gsel <- group(x) %in% colnames(grps)[subjectHits(findOverlaps(IRanges(ranges["from"], ranges["to"]), |
|
914 |
- IRanges(grps[1,], grps[2,])))] |
|
915 |
- x <- x[gsel] |
|
916 |
- ## Now only keep the adjancend items if there are any. |
|
917 |
- lsel <- end(x) < ranges["from"] |
|
918 |
- rsel <- start(x) > ranges["to"] |
|
919 |
- ## Nothing to do if everything is within the range |
|
920 |
- if(any(lsel | rsel)) |
|
921 |
- { |
|
922 |
- grp <- group(x) |
|
923 |
- if(any(table(grp)>1)) |
|
924 |
- { |
|
925 |
- lsel[lsel][unlist(sapply(split(seq_len(sum(lsel)), grp[lsel]), max))] <- FALSE |
|
926 |
- rsel[rsel][unlist(sapply(split(seq_len(sum(rsel)), grp[rsel]), min))] <- FALSE |
|
927 |
- } |
|
928 |
- x <- x[!(lsel | rsel),] |
|
929 |
- } |
|
930 |
- if(sort) |
|
987 |
+ if(sort) |
|
931 | 988 |
x <- x[order(range(x)),] |
932 |
- if(stacks) |
|
989 |
+ if(stacks) |
|
933 | 990 |
x <- setStacks(x) |
934 |
- } |
|
935 |
- } |
|
991 |
+ } |
|
936 | 992 |
return(x) |
937 | 993 |
}) |
938 | 994 |
## For the axis track we may have to clip the highlight ranges on the axis. |
... | ... |
@@ -1080,19 +1136,20 @@ setMethod("drawGrid", signature(GdObject="AlignedReadTrack"), function(GdObject, |
1080 | 1136 |
detail <- match.arg(.dpOrDefault(GdObject, "detail", "coverage"), c("coverage", "reads")) |
1081 | 1137 |
if(detail=="coverage"){ |
1082 | 1138 |
GdObject <- subset(GdObject, from=from, to=to) |
1083 |
- cov <- coverage(GdObject, strand="*") |
|
1084 |
- val <- if(length(cov)) runValue(cov) else 1 |
|
1085 | 1139 |
## We have to figure out the data range, taking transformation into account |
1086 |
- ylim <- .dpOrDefault(GdObject, "ylim") |
|
1087 |
- if(is.null(ylim)) |
|
1088 |
- { |
|
1089 |
- ylim <- c(0, range(val, finite=TRUE, na.rm=TRUE)[2]) |
|
1140 |
+ ylim <- .dpOrDefault(GdObject, "ylim") |
|
1141 |
+ if (is.null(ylim)) { |
|
1142 |
+ maxs <- sapply(c("+", "-"), function(s) { |
|
1143 |
+ cvr <- coverage(GdObject, strand=s) |
|
1144 |
+ if (length(cvr)) max(cvr, na.rm=TRUE, finite=TRUE) else 0L |
|
1145 |
+ }) |
|
1146 |
+ y.max <- max(maxs, na.rm=TRUE, finite=TRUE) |
|
1147 |
+ ylim <- c(0, if (y.max == 0) 1 else y.max) |
|
1090 | 1148 |
trans <- displayPars(GdObject, "transformation")[[1]] |
1091 |
- if(!is.null(trans)) |
|
1149 |
+ if (!is.null(trans)) |
|
1092 | 1150 |
ylim <- c(0, trans(ylim[2])) |
1093 |
- } |
|
1094 |
- for(s in c("+", "-")) |
|
1095 |
- { |
|
1151 |
+ } |
|
1152 |
+ for(s in c("+", "-")) { |
|
1096 | 1153 |
pushViewport(viewport(height=0.5, y=ifelse(s=="-", 0, 0.5), just=c("center", "bottom"))) |
1097 | 1154 |
dummy <- DataTrack(start=rep(mean(c(from, to)),2), end=rep(mean(c(from, to)),2), data=ylim, |
1098 | 1155 |
genome=genome(GdObject), chromosome=chromosome(GdObject)) |
... | ... |
@@ -1102,9 +1159,9 @@ setMethod("drawGrid", signature(GdObject="AlignedReadTrack"), function(GdObject, |
1102 | 1159 |
drawGrid(dummy, from=from, to=to) |
1103 | 1160 |
popViewport(1) |
1104 | 1161 |
} |
1105 |
- } |
|
1162 |
+ } |
|
1106 | 1163 |
return(NULL) |
1107 |
- }) |
|
1164 |
+ }) |
|
1108 | 1165 |
##---------------------------------------------------------------------------------------------------------------------------- |
1109 | 1166 |
|
1110 | 1167 |
|
... | ... |
@@ -1152,6 +1209,11 @@ setMethod("drawGD", signature("StackedTrack"), function(GdObject, ...){ |
1152 | 1209 |
ylim <- c(0, 1) |
1153 | 1210 |
middle <- mean(ylim) |
1154 | 1211 |
space <- diff(ylim)/8 |
1212 |
+ if (inherits(GdObject, "GeneRegionTrack")) { |
|
1213 |
+ thinBox <- .dpOrDefault(GdObject, "thinBoxFeature", c("utr", "ncRNA", "utr3", "utr5", "miRNA", "lincRNA")) |
|
1214 |
+ space <- ifelse(feature(GdObject) %in% thinBox, space + ((middle - |
|
1215 |
+ space) / 2), space) |
|
1216 |
+ } |
|
1155 | 1217 |
shape <- .dpOrDefault(GdObject, "shape", "arrow") |
1156 | 1218 |
color <- .getBiotypeColor(GdObject) |
1157 | 1219 |
id <- identifier(GdObject, lowest=TRUE) |
... | ... |
@@ -1261,7 +1323,10 @@ setMethod("drawGD", signature("AnnotationTrack"), function(GdObject, minBase, ma |
1261 | 1323 |
bartext <- barsAndLab$labels |
1262 | 1324 |
## ... and then draw whatever is needed |
1263 | 1325 |
shape <- .dpOrDefault(GdObject, "shape", "arrow") |
1264 |
- border <- .dpOrDefault(GdObject, "col", "transparent")[1] |
|
1326 |
+ border <- .dpOrDefault(GdObject, "col")[1] |
|
1327 |
+ col.line <- .dpOrDefault(GdObject, "col.line")[1] |
|
1328 |
+ if(is.null(border)) |
|
1329 |
+ border <- ifelse(is(GdObject, "GeneRegionTrack"), NA, "transparent") |
|
1265 | 1330 |
lwd <- .dpOrDefault(GdObject, "lwd", 2) |
1266 | 1331 |
lty <- .dpOrDefault(GdObject, "lty", 1) |
1267 | 1332 |
alpha <- .dpOrDefault(GdObject, "alpha", 1) |
... | ... |
@@ -1279,17 +1344,19 @@ setMethod("drawGD", signature("AnnotationTrack"), function(GdObject, minBase, ma |
1279 | 1344 |
fontfamily.group <- .dpOrDefault(GdObject, "fontfamily.group", fontfamily) |
1280 | 1345 |
if(nrow(box)>0){ |
1281 | 1346 |
if(nrow(bar)>0) |
1282 |
- .arrowBar(bar$sx1, bar$sx2, y=bar$y, bar$strand, box[,1:4, drop=FALSE], col=bar$col, lwd=lwd, lty=lty, |
|
1347 |
+ .arrowBar(bar$sx1, bar$sx2, y=bar$y, bar$strand, box[,1:4, drop=FALSE], |
|
1348 |
+ col=if(is.null(col.line)) bar$col else rep(col.line, length(bar$col)), lwd=lwd, lty=lty, |
|
1283 | 1349 |
alpha=alpha, barOnly=(!"smallArrow" %in% .dpOrDefault(GdObject, "shape", "box") || stacking(GdObject)=="dense"), |
1284 | 1350 |
diff=res, min.height=.dpOrDefault(GdObject, "min.height", 3)) |
1285 | 1351 |
if("box" %in% shape || ("smallArrow" %in% shape && !"arrow" %in% shape)) |
1286 | 1352 |
grid.rect(box$cx2, box$cy1, width=box$cx2-box$cx1, height=box$cy2-box$cy1, |
1287 |
- gp=gpar(col=border, fill=box$fill, lwd=lwd, lty=lty, alpha=alpha), |
|
1353 |
+ gp=gpar(col=if(is.na(border)) box$fill else border, fill=box$fill, lwd=lwd, lty=lty, alpha=alpha), |
|
1288 | 1354 |
default.units="native", just=c("right", "bottom")) |
1355 |
+ |
|
1289 | 1356 |
if("ellipse" %in% shape){ |
1290 | 1357 |
ellCoords <- .box2Ellipse(box) |
1291 | 1358 |
grid.polygon(x=ellCoords$x1, y=ellCoords$y1, id=ellCoords$id, |
1292 |
- gp=gpar(col=border, fill=box$fill, lwd=lwd, lty=lty, alpha=alpha), |
|
1359 |
+ gp=gpar(col=if(is.na(border)) box$fill else border, fill=box$fill, lwd=lwd, lty=lty, alpha=alpha), |
|
1293 | 1360 |
default.units="native") |
1294 | 1361 |
} |
1295 | 1362 |
if("arrow" %in% shape && !"box" %in% shape){ |
... | ... |
@@ -1590,7 +1657,7 @@ setMethod("drawGD", signature("GenomeAxisTrack"), function(GdObject, minBase, ma |
1590 | 1657 |
just=c("right", "top"), gp=gpar(cex=cex*.75, fontface=fontface), |
1591 | 1658 |
default.units="native") |
1592 | 1659 |
grid.text(label=expression("5'"), x=axRange[2]+textXOff, y=-pyOff, |
1593 |
- just=c("left", "top"), gp=gpar(cex=lcex, fontface=fontface), |
|
1660 |
+ just=c("left", "top"), gp=gpar(cex=cex*0.75, fontface=fontface), |
|
1594 | 1661 |
default.units="native") |
1595 | 1662 |
} |
1596 | 1663 |
popViewport() |
... | ... |
@@ -2291,6 +2358,8 @@ setMethod("drawGD", signature("IdeogramTrack"), function(GdObject, minBase, maxB |
2291 | 2358 |
imageMap(GdObject) <- NULL |
2292 | 2359 |
chrnam <- paste("Chromosome", gsub("chr", "", chromosome(GdObject))) |
2293 | 2360 |
cex <- .dpOrDefault(GdObject, "cex", 1) |
2361 |
+ if(.dpOrDefault(GdObject, "break", FALSE)) |
|
2362 |
+ browser() |
|
2294 | 2363 |
## Nothing to do if there are no ranges in the object |
2295 | 2364 |
if(!length(GdObject)) |
2296 | 2365 |
return(invisible(GdObject)) |
... | ... |
@@ -2414,6 +2483,73 @@ setMethod("drawGD", signature("IdeogramTrack"), function(GdObject, minBase, maxB |
2414 | 2483 |
}) |
2415 | 2484 |
##---------------------------------------------------------------------------------------------------------------------------- |
2416 | 2485 |
|
2486 |
+##---------------------------------------------------------------------------------------------------------------------------- |
|
2487 |
+## Draw a SequenceTrack |
|
2488 |
+##---------------------------------------------------------------------------------------------------------------------------- |
|
2489 |
+setMethod("drawGD", signature("SequenceTrack"), function(GdObject, minBase, maxBase, prepare=FALSE, ...) { |
|
2490 |
+ fcol <- .dpOrDefault(GdObject, "fontcolor", getBioColor("DNA_BASES_N")) |
|
2491 |
+ cex <- max(0.3, .dpOrDefault(GdObject, "cex", 1)) |
|
2492 |
+ if(.dpOrDefault(GdObject, "break", FALSE)) |
|
2493 |
+ browser() |
|
2494 |
+ pushViewport(viewport(xscale=c(minBase, maxBase), clip=TRUE, |
|
2495 |
+ gp=gpar(alpha=.dpOrDefault(GdObject, "alpha", 1), |
|
2496 |
+ fontsize=.dpOrDefault(GdObject, "fontsize", 12), |
|
2497 |
+ fontface=.dpOrDefault(GdObject, "fontface", 2), |
|
2498 |
+ lineheight=.dpOrDefault(GdObject, "lineheight", 1), |
|
2499 |
+ fontfamily=.dpOrDefault(GdObject, "fontfamily", 1), |
|
2500 |
+ cex=cex))) |
|
2501 |
+ if(prepare){ |
|
2502 |
+ pres <- .pxResolution() |
|
2503 |
+ nsp <- max(as.numeric(convertHeight(stringHeight(stringWidth(DNA_ALPHABET)),"native"))) |
|
2504 |
+ nsp <- nsp/pres["y"]*2 |
|
2505 |
+ displayPars(GdObject) <- list("neededVerticalSpace"=nsp) |
|
2506 |
+ popViewport(1) |
|
2507 |
+ return(invisible(GdObject)) |
|
2508 |
+ } |
|
2509 |
+ imageMap(GdObject) <- NULL |
|
2510 |
+ delta <- maxBase-minBase |
|
2511 |
+ if(delta==0) |
|
2512 |
+ return(invisible(GdObject)) |
|
2513 |
+ lwidth <- max(as.numeric(convertUnit(stringWidth(DNA_ALPHABET),"inches"))) |
|
2514 |
+ perLetter <- vpLocation()$isize["width"]/(maxBase-minBase+1) |
|
2515 |
+ diff <- .pxResolution(.dpOrDefault(GdObject, "min.width", 2), coord="x") |
|
2516 |
+ ## FIXME: Need to deal with sequences that are too long. |
|
2517 |
+ if(diff>1 || (maxBase-minBase+1)>=10e6){ |
|
2518 |
+ grid.lines(x=unit(c(minBase, maxBase), "native"), y=0.5, |
|
2519 |
+ gp=gpar(col=.dpOrDefault(GdObject, "col", "darkgray"), |
|
2520 |
+ lwd=.dpOrDefault(GdObject, "lwd", 2))) |
|
2521 |
+ }else{ |
|
2522 |
+ |
|
2523 |
+ sequence <- as.character(as(subseq(GdObject, start=minBase, end=maxBase-1), "Rle")) |
|
2524 |
+ at <- seq((minBase+0.5), maxBase - 1 + 0.5, by=1) |
|
2525 |
+ sequence[sequence=="-"] <- "" |
|
2526 |
+ if(perLetter<0.5 && .dpOrDefault(GdObject, "add53", FALSE)) |
|
2527 |
+ sequence[c(1, length(sequence))] <- "" |
|
2528 |
+ col <- fcol[toupper(sequence)] |
|
2529 |
+ if(lwidth<perLetter && !.dpOrDefault(GdObject, "noLetters", FALSE)){ |
|
2530 |
+ grid.text(x=unit(at, "native"), y=0.5, label=sequence, rot=.dpOrDefault(GdObject, "rotation", 0), |
|
2531 |
+ gp=gpar(col=col)) |
|
2532 |
+ } else { |
|
2533 |
+ grid.rect(x=unit(at, "native"), y=0.05, width=unit(1, "native"), height=0.9, |
|
2534 |
+ gp=gpar(fill=col, col="white"), just=c(0.5, 0)) |
|
2535 |
+ } |
|
2536 |
+ } |
|
2537 |
+ ## The direction indicators |
|
2538 |
+ if(.dpOrDefault(GdObject, "add53", FALSE)) |
|
2539 |
+ { |
|
2540 |
+ if(.dpOrDefault(GdObject, "complement", FALSE)){ |
|
2541 |
+ grid.text(label=expression("3'"), x=unit(minBase+0.1, "native"), just=c(0, 0.5), gp=gpar(col="#808080", cex=0.8)) |
|
2542 |
+ grid.text(label=expression("5'"), x=unit(maxBase-0.1, "native"), just=c(1, 0.5), gp=gpar(col="#808080", cex=0.8)) |
|
2543 |
+ }else{ |
|
2544 |
+ grid.text(label=expression("5'"), x=unit(minBase+0.1, "native"), just=c(0, 0.5), gp=gpar(col="#808080", cex=0.8)) |
|
2545 |
+ grid.text(label=expression("3'"), x=unit(maxBase-0.1, "native"), just=c(1, 0.5), gp=gpar(col="#808080", cex=0.8)) |
|
2546 |
+ } |
|
2547 |
+ } |
|
2548 |
+ popViewport(1) |
|
2549 |
+ return(invisible(GdObject)) |
|
2550 |
+}) |
|
2551 |
+##---------------------------------------------------------------------------------------------------------------------------- |
|
2552 |
+ |
|
2417 | 2553 |
|
2418 | 2554 |
|
2419 | 2555 |
|
... | ... |
@@ -2489,6 +2625,8 @@ setAs("InferredDisplayPars", "list", |
2489 | 2625 |
|
2490 | 2626 |
setAs("DisplayPars", "list", function(from, to) as.list(from@pars)) |
2491 | 2627 |
|
2628 |
+setAs("DNAString", "Rle", function(from, to) Rle(strsplit(as.character(from), "")[[1]])) |
|
2629 |
+ |
|
2492 | 2630 |
setMethod("as.list", "DisplayPars", function(x) as(x, "list")) |
2493 | 2631 |
|
2494 | 2632 |
setMethod("as.list", "InferredDisplayPars", function(x) as(x, "list")) |
... | ... |
@@ -2503,6 +2641,7 @@ setMethod("tail", "InferredDisplayPars", function(x, n=10, ...){ |
2503 | 2641 |
return(new("InferredDisplayPars", name=x@name, inheritance=x@inheritance[sel], |
2504 | 2642 |
structure(x@.Data[sel], names=names(x)[sel])))}) |
2505 | 2643 |
|
2644 |
+ |
|
2506 | 2645 |
##--------------------------------------------------------------------------------- |
2507 | 2646 |
|
2508 | 2647 |
|
... | ... |
@@ -2664,9 +2803,17 @@ setMethod(".buildRange", signature("GRangesList"), |
2664 | 2803 |
## For TranscriptDb objects we extract the grouping information and use the GRanges method |
2665 | 2804 |
setMethod(".buildRange", signature("TranscriptDb"), |
2666 | 2805 |
function(range, groupId="transcript", tstart, tend, chromosome, ...){ |
2667 |
- |
|
2668 | 2806 |
## If chromosome (and optional start and end) information is present we only extract parts of the annotation data |
2807 |
+ noSubset <- is.null(tstart) && is.null(tend) |
|
2669 | 2808 |
if(!is.null(chromosome)){ |
2809 |
+ chromosome <- .chrName(chromosome) |
|
2810 |
+ ## Seems like TranscriptDb objects use pass by reference for the active chromosomes, so we have to |
|
2811 |
+ ## restore the old values after we are done |
|
2812 |
+ oldAct <- isActiveSeq(range) |
|
2813 |
+ oldRange <- range |
|
2814 |
+ on.exit(isActiveSeq(oldRange)[seqlevels(oldRange)] <- oldAct) |
|
2815 |
+ isActiveSeq(range)[seqlevels(range)] <- FALSE |
|
2816 |
+ isActiveSeq(range) <- structure(rep(TRUE, length(unique(chromosome))), names=unique(chromosome)) |
|
2670 | 2817 |
sl <- seqlengths(range) |
2671 | 2818 |
if(is.null(tstart)) |
2672 | 2819 |
tstart <- rep(1, length(chromosome)) |
... | ... |
@@ -2676,25 +2823,55 @@ setMethod(".buildRange", signature("TranscriptDb"), |
2676 | 2823 |
} |
2677 | 2824 |
sRange <- GRanges(seqnames=chromosome, ranges=IRanges(start=tstart, end=tend)) |
2678 | 2825 |
} |
2679 |
- t2e <- exonsBy(range, "tx") |
|
2680 |
- tids <- rep(names(t2e), elementLengths(t2e)) |
|
2681 |
- t2e <- unlist(t2e) |
|
2682 |
- values(t2e)[["tx_id"]] <- tids |
|
2826 |
+ ## First the mapping of internal transcript ID to transcript name |
|
2827 |
+ txs <- as.data.frame(values(transcripts(range, columns = c("tx_id", "tx_name")))) |
|
2828 |
+ rownames(txs) <- txs[, "tx_id"] |
|
2829 |
+ ## Now the CDS ranges |
|
2830 |
+ t2c <- cdsBy(range, "tx") |
|
2831 |
+ names(t2c) <- txs[names(t2c), 2] |
|
2832 |
+ tids <- rep(names(t2c), elementLengths(t2c)) |
|
2833 |
+ t2c <- unlist(t2c) |
|
2834 |
+ if(length(t2c)){ |
|
2835 |
+ t2c$tx_id <- tids |
|
2836 |
+ t2c$feature_type <- "CDS" |
|
2837 |
+ } |
|
2838 |
+ ## And the 5'UTRS |
|
2839 |
+ t2f <- fiveUTRsByTranscript(range) |
|
2840 |
+ names(t2f) <- txs[names(t2f), 2] |
|
2841 |
+ tids <- rep(names(t2f), elementLengths(t2f)) |
|
2842 |
+ t2f <- unlist(t2f) |
|
2843 |
+ if(length(t2f)){ |
|
2844 |
+ t2f$tx_id <- tids |
|
2845 |
+ t2f$feature_type <- "utr5" |
|
2846 |
+ } |
|
2847 |
+ ## And finally the 3'UTRS |
|
2848 |
+ t2t <- threeUTRsByTranscript(range) |
|
2849 |
+ names(t2t) <- txs[names(t2t), 2] |
|
2850 |
+ tids <- rep(names(t2t), elementLengths(t2t)) |
|
2851 |
+ t2t <- unlist(t2t) |
|
2852 |
+ if(length(t2t)){ |
|
2853 |
+ t2t$tx_id <- tids |
|
2854 |
+ t2t$feature_type <- "utr3" |
|
2855 |
+ } |
|
2856 |
+ ## Now we can merge the three back together (we need to change the column names of t2c to make them all the same) |
|
2857 |
+ colnames(values(t2c))[1:2] <- c("exon_id", "exon_name") |
|
2858 |
+ t2e <- c(t2c, t2f, t2t) |
|
2859 |
+ if(length(t2e)==0) |
|
2860 |
+ return(GRanges()) |
|
2861 |
+ ## Add the gene level annotation |
|
2683 | 2862 |
g2t <- transcriptsBy(range, "gene") |
2684 | 2863 |
gids <- rep(names(g2t), elementLengths(g2t)) |
2685 | 2864 |
g2t <- unlist(g2t) |
2686 | 2865 |
values(g2t)[["gene_id"]] <- gids |
2687 |
- vals <- merge(as.data.frame(values(t2e)[,c("exon_id", "tx_id", "exon_rank")]), as.data.frame(values(g2t)), by="tx_id", all=TRUE) |
|
2688 |
- colnames(vals) <- c("transcript", "exon", "rank", "symbol", "gene") |
|
2689 |
- txs <- as.data.frame(values(transcripts(range, columns = c("tx_id", "tx_name")))) |
|
2690 |
- rownames(txs) <- txs[, "tx_id"] |
|
2691 |
- vals$symbol <- txs[as.character(vals$transcript),"tx_name"] |
|
2692 |
- vals$id <- vals$exon |
|
2866 |
+ values(t2e)$gene_id <- gids[match(values(t2e)$tx_id, as.character(txs[as.character(values(g2t)$tx_id),2]))] |
|
2867 |
+ vals <- values(t2e)[c("tx_id", "exon_id", "exon_rank", "feature_type", "tx_id", "gene_id")] |
|
2868 |
+ colnames(vals) <- c("transcript", "exon", "rank", "feature", "symbol", "gene") |
|
2869 |
+ ## Finally we re-assign, subset if necessary, and sort |
|
2693 | 2870 |
range <- t2e |
2694 | 2871 |
values(range) <- vals |
2695 |
- if(!is.null(chromosome)) |
|
2872 |
+ if(!noSubset && !is.null(chromosome)) |
|
2696 | 2873 |
range <- subsetByOverlaps(range, sRange) |
2697 |
- return(.buildRange(range=range, chromosome=chromosome, ...))}) |
|
2874 |
+ return(.buildRange(range=sort(range), chromosome=chromosome, ...))}) |
|
2698 | 2875 |
##--------------------------------------------------------------------------------- |
2699 | 2876 |
|
2700 | 2877 |
|
... | ... |
@@ -2715,42 +2892,70 @@ setMethod("tags", "GdObject", function(ImageMap) tags(imageMap(ImageMap))) |
2715 | 2892 |
##--------------------------------------------------------------------------------- |
2716 | 2893 |
## Show methods for the various classes |
2717 | 2894 |
##--------------------------------------------------------------------------------- |
2718 |
-setMethod("show",signature(object="DataTrack"), |
|
2719 |
- function(object){ |
|
2720 |
- cat(sprintf(paste("Data track '%s' at %i position%s containing %i sample%s mapping", |
|
2721 |
- "to chromosome %s on the %s strand of the %s genome:\n"), |
|
2722 |
- names(object), length(object), |
|
2723 |
- ifelse(length(object)==1, "", "s"), |
|
2724 |
- nrow(values(object)), |
|
2725 |
- ifelse(nrow(values(object))==1, "", "s"), |
|
2726 |
- gsub("^chr", "", chromosome(object)), |
|
2727 |
- strand(object)[1], genome(object)), "\n") |
|
2728 |
- print(ranges(object)[chromosome(object) == seqnames(object)]) |
|
2729 |
- }) |
|
2730 | 2895 |
|
2731 |
-setMethod("show",signature(object="AnnotationTrack"), |
|
2896 |
+## A helper function to plot information regarding additional features on other chromosomes |
|
2897 |
+.addFeatInfo <- function(object, addfeat){ |
|
2898 |
+ freqs <- table(seqnames(object)) |
|
2899 |
+ freqs <- freqs[setdiff(names(freqs), chromosome(object))] |
|
2900 |
+ nrChr <- length(freqs) |
|
2901 |
+ msg <- sprintf("There %s %s additional annotation feature%s on %s further chromosome%s%s", |
|
2902 |
+ ifelse(addfeat>1, "are", "is"), |
|
2903 |
+ addfeat, |
|
2904 |
+ ifelse(addfeat>1, "s", ""), |
|
2905 |
+ nrChr, |
|
2906 |
+ ifelse(nrChr>1, "s", ""), |
|
2907 |
+ ifelse(nrChr==1, sprintf(" (%s)", names(freqs)), "")) |
|
2908 |
+ if(nrChr>1){ |
|
2909 |
+ msg <- if(nrChr>10){ |
|
2910 |
+ c(msg, paste(" ", head(names(freqs), 5), ": ", head(freqs, 5), sep="", collapse="\n"), |
|
2911 |
+ " ...", paste(" ", tail(names(freqs), 5), ": ", tail(freqs, 5), sep="", collapse="\n")) |
|
2912 |
+ }else{ |
|
2913 |
+ c(msg, paste(" ", names(freqs), ": ", freqs, " features", sep="", collapse="\n")) |
|
2914 |
+ } |
|
2915 |
+ msg <- c(msg, paste("Call seqlevels(obj) to list all available chromosomes", |
|
2916 |
+ "or seqinfo(obj) for more detailed output")) |
|
2917 |
+ } |
|
2918 |
+ return(msg) |
|
2919 |
+} |
|
2920 |
+ |
|
2921 |
+## A helper function to plot general information about an AnnotationTrack |
|
2922 |
+.annotationTrackInfo <- function(object){ |
|
2923 |
+ msg <- sprintf(paste("| genome: %s\n| active chromosome: %s\n", |
|
2924 |
+ "| annotation features: %s", sep=""), |
|
2925 |
+ genome(object), |
|
2926 |
+ chromosome(object), |
|
2927 |
+ length(object)) |
|
2928 |
+ addfeat <- length(object@range)-length(object) |
|
2929 |
+ if(addfeat>0) |
|
2930 |
+ msg <- c(msg, .addFeatInfo(object, addfeat), "Call chromosome(obj) <- 'chrId' to change the active chromosome") |
|
2931 |
+ return(paste(msg, collapse="\n")) |
|
2932 |
+} |
|
2933 |
+ |
|
2934 |
+setMethod("show",signature(object="DataTrack"), |
|
2732 | 2935 |
function(object){ |
2733 |
- cat(sprintf(paste("Annotation track '%s' containing %i item%s and mapping", |
|
2734 |
- "to chromosome %s of the %s genome:\n"), |
|
2735 |
- names(object), length(object), |
|
2736 |
- ifelse(length(object)==1, "", "s"), |
|
2737 |
- gsub("^chr", "", chromosome(object)), |
|
2738 |
- genome(object)), "\n") |
|
2739 |
- print(ranges(object)[chromosome(object) == seqnames(object)]) |
|
2936 |
+ msg <- sprintf(paste("DataTrack '%s'\n| genome: %s\n| active chromosome: %s\n", |
|
2937 |
+ "| positions: %s\n| samples:%s\n| strand: %s", sep=""), |
|
2938 |
+ names(object), |
|
2939 |
+ genome(object), |
|
2940 |
+ chromosome(object), |
|
2941 |
+ length(object), |
|
2942 |
+ nrow(values(object)), |
|
2943 |
+ strand(object)[1]) |
|
2944 |
+ addfeat <- ncol(object@data)-length(object) |
|
2945 |
+ if(addfeat>0) |
|
2946 |
+ msg <- c(msg, .addFeatInfo(object, addfeat), "Call chromosome(obj) <- 'chrId' to change the active chromosome") |
|
2947 |
+ cat(paste(msg, collapse="\n"), "\n") |
|
2740 | 2948 |
}) |
2741 | 2949 |
|
2742 |
-setMethod("show",signature(object="GeneRegionTrack"), |
|
2743 |
- function(object) { |
|
2744 |
- cat(sprintf(paste("Gene region '%s' ranging from bp %i to bp %i ", |
|
2745 |
- "of chromosome %s of the %s genome containing %i object%s:\n"), |
|
2746 |
- names(object), object@start, object@end, |
|
2747 |
- gsub("^chr", "", chromosome(object)), |
|
2748 |
- genome(object), length(object), |
|
2749 |
- ifelse(length(object)==1, "", "s"))) |
|
2750 |
- print(ranges(object)[chromosome(object) == seqnames(object)]) |
|
2751 |
- }) |
|
2752 | 2950 |
|
2753 |
-setMethod("show",signature(object="GenomeAxisTrack"), |
|
2951 |
+## We have to show the name, genome and currently active chromosome, and, if more ranges are available on additional |
|
2952 |
+## chromosomes some information about that |
|
2953 |
+setMethod("show", signature(object="AnnotationTrack"), function(object) |
|
2954 |
+ cat(sprintf("AnnotationTrack '%s'\n%s\n", names(object), .annotationTrackInfo(object)))) |
|
2955 |
+setMethod("show", signature(object="GeneRegionTrack"), function(object) |
|
2956 |
+ cat(sprintf("GeneRegionTrack '%s'\n%s\n", names(object), .annotationTrackInfo(object)))) |
|
2957 |
+ |
|
2958 |
+setMethod("show", signature(object="GenomeAxisTrack"), |
|
2754 | 2959 |
function(object) { |
2755 | 2960 |
cat(sprintf("Genome axis '%s'\n", names(object))) |
2756 | 2961 |
if(.dpOrDefault(object, "add53", FALSE)) |
... | ... |
@@ -2773,6 +2978,46 @@ setMethod("show",signature(object="IdeogramTrack"), |
2773 | 2978 |
gsub("^chr", "", chromosome(object)), |
2774 | 2979 |
genome(object)), "\n") |
2775 | 2980 |
}) |
2981 |
+ |
|
2982 |
+## A helper function to print general information about SequenceTracks |
|
2983 |
+.sequenceTrackInfo <- function(object){ |
|
2984 |
+ msg <- sprintf(paste("Sequence track '%s':\n", |
|
2985 |
+ "| genome: %s\n", |
|
2986 |
+ "| chromosomes: %s\n", |
|
2987 |
+ "| active chromosome: %s (%s nulceotides)\n", sep=""), |
|
2988 |
+ names(object), |
|
2989 |
+ genome(object), |
|
2990 |
+ length(seqnames(object)), |
|
2991 |
+ chromosome(object), |
|
2992 |
+ length(object)) |
|
2993 |
+ if(length(seqnames(object))>1) |
|
2994 |
+ msg <- paste(msg, "Call seqnames() to list all available chromosomes\n", |
|
2995 |
+ "Call chromosome()<- to change the active chromosome\n", sep="") |
|
2996 |
+ return(msg) |
|
2997 |
+} |
|
2998 |
+ |
|
2999 |
+## We need to show the name, genome, information about the source BSgenome object as well as the currently active chromosome |
|
3000 |
+setMethod("show",signature(object="SequenceBSgenomeTrack"), |
|
3001 |
+ function(object){ |
|
3002 |
+ cat(.sequenceTrackInfo(object), |
|
3003 |
+ sprintf(paste("Parent BSgenome object:\n", |
|
3004 |
+ "| organism: %s (%s)\n", |
|
3005 |
+ "| provider: %s\n", |
|
3006 |
+ "| provider version: %s\n", |
|
3007 |
+ "| release date: %s\n", |
|
3008 |
+ "| release name: %s\n", |
|
3009 |
+ "| package name: %s\n", sep=""), |
|
3010 |
+ organism(object@sequence), |
|
3011 |
+ object@sequence@species, |
|
3012 |
+ provider(object@sequence), |
|
3013 |
+ providerVersion(object@sequence), |
|
3014 |
+ releaseDate(object@sequence), |
|
3015 |
+ releaseName(object@sequence), |
|
3016 |
+ object@sequence@seqs_pkgname), sep="") |
|
3017 |
+ }) |
|
3018 |
+ |
|
3019 |
+## Here we only need the name, genome and currently active chromosome information |
|
3020 |
+setMethod("show", signature(object="SequenceDNAStringSetTrack"), function(object) cat(.sequenceTrackInfo(object))) |
|
2776 | 3021 |
|
2777 | 3022 |
setMethod("show",signature(object="AlignedReadTrack"), |
2778 | 3023 |
function(object){ |
... | ... |
@@ -91,7 +91,7 @@ |
91 | 91 |
size <- if(length(type)==1L){ if(type=="gradient") 1 else if(type=="heatmap") nrow(values(x)) else 5} else 5 |
92 | 92 |
return(size) |
93 | 93 |
} |
94 |
- if(is(x, "GenomeAxisTrack") || is(x, "IdeogramTrack")) |
|
94 |
+ if(is(x, "GenomeAxisTrack") || is(x, "IdeogramTrack") || is(x, "SequenceTrack")) |
|
95 | 95 |
{ |
96 | 96 |
nv <- displayPars(x, "neededVerticalSpace") |
97 | 97 |
size <- displayPars(x, "size") |
... | ... |
@@ -787,7 +787,15 @@ plotTracks <- function(trackList, from=NULL, to=NULL, ..., sizes=NULL, panel.onl |
787 | 787 |
if(!is.list(trackList)) |
788 | 788 |
trackList <- list(trackList) |
789 | 789 |
## We first run very general housekeeping tasks on the tracks for which we don't really need to know anything about device |
790 |
- ## size, resolution or plotting ranges |
|
790 |
+ ## size, resolution or plotting ranges. Chromosomes should all be the same for all tracks, if not we will force them to |
|
791 |
+ ## be set to the first one that can be detected |
|
792 |
+ chrms <- unlist(lapply(trackList, Gviz::chromosome)) |
|
793 |
+ if(is.null(chromosome)){ |
|
794 |
+ chrms <- if(!is.null(chrms)) chrms[gsub("^chr", "", chrms)!="NA"] else chrms |
|
795 |
+ chromosome <- chrms[[1]] |
|
796 |
+ if(!is.null(chrms) && length(unique(chrms))!=1) |
|
797 |
+ warning("The track chromosomes in 'trackList' differ. Setting all tracks to chromosome '", chromosome, "'", sep="") |
|
798 |
+ } |
|
791 | 799 |
trackList <- lapply(trackList, consolidateTrack, chromosome=chromosome, ...) |
792 | 800 |
## Now we figure out the plotting ranges. If no ranges are given as function arguments we take the absolute min/max of all tracks. |
793 | 801 |
if(!panel.only && !add) |
... | ... |
@@ -889,9 +897,10 @@ plotTracks <- function(trackList, from=NULL, to=NULL, ..., sizes=NULL, panel.onl |
889 | 897 |
tmp <- drawGD(trackList[[i]], minBase=ranges["from"], maxBase=ranges["to"], subset=FALSE) |
890 | 898 |
if(!is.null(tmp)) |
891 | 899 |
map[[(length(map)+1)-i]] <- tmp |
892 |
- popViewport(2) |
|
900 |
+ popViewport(1) |
|
893 | 901 |
if(.dpOrDefault(trackList[[i]], "frame", FALSE)) |
894 | 902 |
grid.rect(gp=gpar(col=.dpOrDefault(trackList[[i]], "col.frame", Gviz:::.DEFAULT_SHADED_COL))) |
903 |
+ popViewport(1) |
|
895 | 904 |
} |
896 | 905 |
|
897 | 906 |
popViewport(if(panel.only) 1 else 2) |
... | ... |
@@ -1150,7 +1159,8 @@ availableDisplayPars <- function(class) |
1150 | 1159 |
if(!is.character(class)) |
1151 | 1160 |
class <- class(class) |
1152 | 1161 |
class <- match.arg(class, c("GdObject", "GenomeAxisTrack", "RangeTrack", "NumericTrack", "DataTrack", "IdeogramTrack", "StackedTrack", |
1153 |
- "AnnotationTrack", "DetailsAnnotationTrack", "GeneRegionTrack", "BiomartGeneRegionTrack", "AlignedReadTrack")) |
|
1162 |
+ "AnnotationTrack", "DetailsAnnotationTrack", "GeneRegionTrack", "BiomartGeneRegionTrack", "AlignedReadTrack", |
|
1163 |
+ "SequenceTrack", "SequenceBSgenomeTrack", "SequenceDNSStringSetTrack")) |
|
1154 | 1164 |
parents <- names(getClassDef(class)@contains) |
1155 | 1165 |
.makeParMapping() |
1156 | 1166 |
pars <- .parMappings[c(parents, class)] |
... | ... |
@@ -312,6 +312,18 @@ when features on a track are too close together to be plotted as |
312 | 312 |
separate items with the current device resolution, the package will |
313 | 313 |
try to reasonably merge them in order to avoid overplotting. |
314 | 314 |
|
315 |
+When zooming further in it may become intersting to take a look at the |
|
316 |
+actual genomic sequence at a given position, and the \mgg package |
|
317 |
+provides the track class \Rclass{SequenceTrack} that let's you do |
|
318 |
+that. It can draw the necessary sequence information from one of the |
|
319 |
+\Rclass{BSgenome} packages. |
|
320 |
+ |
|
321 |
+<<zooming2, fig=TRUE, width=7.5, height=3.1>>= |
|
322 |
+library(BSgenome.Hsapiens.UCSC.hg19) |
|
323 |
+strack <- SequenceTrack(Hsapiens, chromosome=chr) |
|
324 |
+plotTracks(list(itrack, gtrack, atrack, grtrack, strack), from=26450430, to=26450490, cex=0.8) |
|
325 |
+@ |
|
326 |
+ |
|
315 | 327 |
So far we have replicated the features of a whole bunch of other |
316 | 328 |
genome browser tools out there. The real power of the package comes |
317 | 329 |
with a rather general track type, the |
... | ... |
@@ -723,6 +735,16 @@ popViewport(2) |
723 | 735 |
names(dTrack) <- "uniform" |
724 | 736 |
@ |
725 | 737 |
|
738 |
+If we need to display some additional information about the individual |
|
739 |
+group levels we can make use of the \Rfunarg{legend} display parameter |
|
740 |
+to add a simple legend to the plot. Depending on the plot type and on |
|
741 |
+some of the other display parameters, the look of this legend may vary |
|
742 |
+slightly. |
|
743 |
+ |
|
744 |
+<<groupingLegend, fig=TRUE, results=hide, width=7.5, height=1.5>>= |
|
745 |
+plotTracks(dTrack, groups=rep(c("control", "treated"), each=3), type=c("a", "p"), legend=TRUE) |
|
746 |
+@ |
|
747 |
+ |
|
726 | 748 |
\subsubsection*{Data transformations} |
727 | 749 |
|
728 | 750 |
The \mgg package offers quite some flexibility to transform data on |
... | ... |
@@ -1102,8 +1124,8 @@ exon, transcript and gene identifiers for each item which will be used |
1102 | 1124 |
to create the transcript groupings. A somewhat special case is to |
1103 | 1125 |
build a \Rclass{GeneRegionTrack} object directly from one of the |
1104 | 1126 |
popular \Rclass{TranscriptDb} objects, an option that is treated in |
1105 |
-more detail below. For more information about the available options |
|
1106 |
-see the class's manual page (\code{?GeneRegionTrack}). |
|
1127 |
+more detail below. For more information about all the available |
|
1128 |
+options see the class's manual page (\code{?GeneRegionTrack}). |
|
1107 | 1129 |
|
1108 | 1130 |
There are a number of accessor methods that make it easy to query and |
1109 | 1131 |
replace for instance exon, transcript or gene assignments. There is |
... | ... |
@@ -1165,7 +1187,31 @@ from the \Rclass{TranscriptDb} object. Please note that while the |
1165 | 1187 |
or \Rfunarg{end} without the chromosome information will not work. |
1166 | 1188 |
|
1167 | 1189 |
<<tdb2grt2>>= |
1168 |
-GeneRegionTrack(txdb, chromosome="chr4", start=40000, end=60000) |
|
1190 |
+txTr <- GeneRegionTrack(txdb, chromosome="chr6", start=300000, end=350000) |
|
1191 |
+@ |
|
1192 |
+ |
|
1193 |
+A nice bonus when building \Rclass{GeneRegionTracks} from |
|
1194 |
+\Rclass{TranscriptDb} objects is that we get additional information |
|
1195 |
+about coding and non-coding regions of the transcripts, i.e., |
|
1196 |
+coordinates of the 5' and 3' UTRs and of the CDS regions. The class' |
|
1197 |
+plotting method can use this inforamtion to distinguish between coding |
|
1198 |
+and non-coding regions based on the shape of the feature. All coding |
|
1199 |
+regions are plotted just as we have seen in the previous examples, |
|
1200 |
+whereas the non-coding regions are drawn as slighly thinner boxes. The |
|
1201 |
+distinction between coding and non-coding is made on the basis of the |
|
1202 |
+object's \code{feature} values in combination with a special display |
|
1203 |
+parameter \code{thinBoxFeature} that enumerates all feature types that |
|
1204 |
+are to be treated as non-coding. Obviously this feature is available |
|
1205 |
+to all \Rclass{GeneRegionTracks}, not only the ones that were build |
|
1206 |
+from \Rclass{TranscriptDb} objects. However, the coding information |
|
1207 |
+has to be added manually and the default value of the |
|
1208 |
+\code{thinBoxFeature} parameter may not be sufficient to cover all |
|
1209 |
+possible cases. It is up to the user to come up with a complete |
|
1210 |
+list of non-coding feature types depending on the source of the data. |
|
1211 |
+ |
|
1212 |
+<<generegtrack3, fig=TRUE, results=hide, width=7.5, height=0.25>>= |
|
1213 |
+feature(txTr) |
|
1214 |
+plotTracks(txTr, showId=TRUE, extend.left=1000) |
|
1169 | 1215 |
@ |
1170 | 1216 |
|
1171 | 1217 |
\subsubsection*{Display parameters for GeneRegionTrack objects} |
... | ... |
@@ -1202,7 +1248,7 @@ biomTrack <- BiomartGeneRegionTrack(genome="hg19", chromosome=chr, start=20e6, e |
1202 | 1248 |
name="ENSEMBL") |
1203 | 1249 |
plotTracks(biomTrack) |
1204 | 1250 |
@ |
1205 |
-<<BiomartGeneRegionTrackDo, echo=FALSE, results=hide, width=7.5, height=1, fig=TRUE>>= |
|
1251 |
+<<BiomartGeneRegionTrackDo, echo=FALSE, results=hide, width=7.5, height=1.25, fig=TRUE>>= |
|
1206 | 1252 |
if(hasBiomartConnection){ |
1207 | 1253 |
biomTrack <- BiomartGeneRegionTrack(genome="hg19", chromosome=chr, start=20e6, end=21e6, |
1208 | 1254 |
name="ENSEMBL") |
... | ... |
@@ -1210,6 +1256,17 @@ if(hasBiomartConnection){ |
1210 | 1256 |
data("biomTrack") |
1211 | 1257 |
} |
1212 | 1258 |
plotTracks(biomTrack) |
1259 |
+@ |
|
1260 |
+ |
|
1261 |
+You may have noticed in the above plot that the track includes |
|
1262 |
+\code{feature} information which is displayed by the different feature |
|
1263 |
+colors and box sizes. This information has been automatically |
|
1264 |
+extracted from Biomart and the respective color coding is part of the |
|
1265 |
+class' definition. We can highlight the feature classes even more by |
|
1266 |
+using similarly colored bars to connect the grouped elements. |
|
1267 |
+ |
|
1268 |
+<<BiomartGeneRegionTrackCol, width=7.5, height=1.25, fig=TRUE>>= |
|
1269 |
+plotTracks(biomTrack, col.line=NULL) |
|
1213 | 1270 |
@ |
1214 | 1271 |
|
1215 | 1272 |
\subsubsection*{Display parameters for BiomartGeneRegionTrack objects} |
... | ... |
@@ -1219,10 +1276,11 @@ see the table above in the previous \Rclass{GeneRegionTrack} section |
1219 | 1276 |
or the man page of the \Rclass{BiomartGeneRegionTrack} class by typing |
1220 | 1277 |
in \code{?BiomartGeneRegionTrack} on the \R command line. |
1221 | 1278 |
|
1222 |
-One additional benefit when fetching the data through Biomart is that |
|
1223 |
-we also receive some information about the annotation feature types, |
|
1224 |
-which is automatically used for the color coding of the track. The |
|
1225 |
-following table shows the available feature types. |
|
1279 |
+As mentioned above, one additional benefit when fetching the data |
|
1280 |
+through Biomart is that we also receive some information about the |
|
1281 |
+annotation feature types, which is automatically used for the color |
|
1282 |
+coding of the track. The following table shows the available feature |
|
1283 |
+types. |
|
1226 | 1284 |
|
1227 | 1285 |
<<BiomartGeneRegionTrackClassTable, echo=FALSE, results=tex>>= |
1228 | 1286 |
addInfo <- t(data.frame(displayPars(biomTrack, names(details[["BiomartGeneRegionTrack"]])))) |
... | ... |
@@ -1391,6 +1449,98 @@ addParTable("DetailsAnnotationTrack") |
1391 | 1449 |
@ |
1392 | 1450 |
|
1393 | 1451 |
|
1452 |
+\subsection{SequenceTrack} |
|
1453 |
+So far we have displayed all kinds of ranges on a genome, but never |
|
1454 |
+really looked at the underlying genomic sequence. To that end, the |
|
1455 |
+\mgg package defines the \Rclass{SequenceTrack} class which can hold |
|
1456 |
+genomic sequence information derived from either a |
|
1457 |
+\Rclass{DNAStringSet} object of, even more convenient, from one of the |
|
1458 |
+\Rclass{BSgenome} packages. There is not formal checking of the |
|
1459 |
+track's genome, so it is up to the user to provide reasonable inputs |
|
1460 |
+to the class' constructor. As with all the other track types, the |
|
1461 |
+constructor has the same name as the class. In this example we build a |
|
1462 |
+\Rclass{SequenceTrack} from the human hg19 UCSC genome. |
|
1463 |
+ |
|
1464 |
+<<SequenceTrack1>>= |
|
1465 |
+library(BSgenome.Hsapiens.UCSC.hg19) |
|
1466 |
+sTrack <- SequenceTrack(Hsapiens) |
|
1467 |
+sTrack |
|
1468 |
+@ |
|
1469 |
+ |
|
1470 |
+Here we retain the same benefits as for regular \Rclass{BSgenome} |
|
1471 |
+objects in that the actual sequence is only loaded into memory when a |
|
1472 |
+particular chromosome is first accessed. Plotting the track yields the |
|
1473 |
+expected result: a character representation of the genomic sequence in |
|
1474 |
+the current plot window. It may be worth noting that the color scheme |
|
1475 |
+that is used to encode the indvidual nucleotides is defined in the |
|
1476 |
+\Rpackage{biovizBase} package and the user is referred to its |
|
1477 |
+documentation for more details. |
|
1478 |
+ |
|
1479 |
+<<SequenceTrack2, results=hide, width=7.5, height=0.5, fig=TRUE>>= |
|
1480 |
+plotTracks(sTrack, chromosome=1, from=20000, to=20050) |
|
1481 |
+@ |
|
1482 |
+ |
|
1483 |
+Sometimes it may be too busy to plot both the sequence letters and the |
|
1484 |
+color coding, and we can assign arbitrary colors by setting the |
|
1485 |
+\code{fontcolor} display parameter. The convention here is that we |
|
1486 |
+need to supply a named vector, with one entry for each of the five |
|
1487 |
+possible nucleotides (A, C, T, G, and N). If any of the entries is |
|
1488 |
+missing, the respective letter will not be drawn at all. |
|
1489 |
+ |
|
1490 |
+<<SequenceTrack3, results=hide, width=7.5, height=0.5, fig=TRUE>>= |
|
1491 |
+fcol <- c(A="darkgray", C="darkgray", T="darkgray", G="darkgray") |
|
1492 |
+plotTracks(sTrack, chromosome=1, from=20000, to=20050, fontcolor=fcol) |
|
1493 |
+@ |
|
1494 |
+ |
|
1495 |
+In this case we are plotting the sequence on the forward strand and we |
|
1496 |
+may want to make this clear by adding direction indicators. |
|
1497 |
+ |
|
1498 |
+<<SequenceTrack4, results=hide, width=7.5, height=0.5, fig=TRUE>>= |
|
1499 |
+plotTracks(sTrack, chromosome=1, from=20000, to=20050, add53=TRUE) |
|
1500 |
+@ |
|
1501 |
+ |
|
1502 |
+If instead we plot the complement sequence on the reverse strand, the |
|
1503 |
+indicators are automatically adjusted. |
|
1504 |
+ |
|
1505 |
+<<SequenceTrack5, results=hide, width=7.5, height=0.3, fig=TRUE>>= |
|
1506 |
+plotTracks(sTrack, chromosome=1, from=20000, to=20050, add53=TRUE, complement=TRUE) |
|
1507 |
+@ |
|
1508 |
+ |
|
1509 |
+So far we have been able to fit the sequence onto our plotting device |
|
1510 |
+without overplotting. I.e., all the letters nicely fit in to their |
|
1511 |
+respective position in the genomic coordinate system. However this |
|
1512 |
+restricts us to very small windows which we can reasonably display. A |
|
1513 |
+much more compact version of the same information is to use colored |
|
1514 |
+boxes rather than individual letters. Those boxes can be stacked much |
|
1515 |
+closer together, which increases the possible window size quite a |
|
1516 |
+bit. The user does not really need to worry about this as the plotting |
|
1517 |
+method will automatically make a reasonable decision based on the |
|
1518 |
+available space. |
|
1519 |
+ |
|
1520 |
+<<SequenceTrack6, results=hide, width=7.5, height=0.3, fig=TRUE>>= |
|
1521 |
+plotTracks(sTrack, chromosome=1, from=20000, to=20100) |
|
1522 |
+@ |
|
1523 |
+ |
|
1524 |
+For added flexibility one can set the \code{noLetters} display |
|
1525 |
+paramter to \code{TRUE} to always force the drawing of boxes. Of |
|
1526 |
+course also the colored box represenation of a sequence has its |
|
1527 |
+limits, and if we cross the threshold when individual boxes can not be |
|
1528 |
+separated anymore, the plotting method falls back to drawing a single |
|
1529 |
+line indicating the presence of a sequence at the given position. |
|
1530 |
+ |
|
1531 |
+<<SequenceTrack7, results=hide, width=7.5, height=0.3, fig=TRUE>>= |
|
1532 |
+plotTracks(sTrack, chromosome=1, from=20000, to=201000) |
|
1533 |
+@ |
|
1534 |
+ |
|
1535 |
+Finally, the selected font size is also contributing to the available |
|
1536 |
+space, and we can cram a little more sequence into a given window by |
|
1537 |
+decreasing it. |
|
1538 |
+ |
|
1539 |
+<<SequenceTrack8, results=hide, width=7.5, height=0.3, fig=TRUE>>= |
|
1540 |
+plotTracks(sTrack, chromosome=1, from=20000, to=20100, cex=0.5) |
|
1541 |
+@ |
|
1542 |
+ |
|
1543 |
+ |
|
1394 | 1544 |
\subsection{Creating tracks from UCSC data} |
1395 | 1545 |
|
1396 | 1546 |
The UCSC data bases contain a multitude of genome annotation data for |
... | ... |
@@ -1595,7 +1745,7 @@ mdTrack <- DataTrack(range=GRanges(seqnames=rep(chroms, c(10, 40, 20, 100)), |
1595 | 1745 |
Now we also want a genome axis and an \Rclass{IdeogramTrack} object to indicate the genomic context. |
1596 | 1746 |
|
1597 | 1747 |
<<multPlot2>>= |
1598 |
-mgTrack <- GenomeAxisTrack(scale=0.5, labelPos="below", exponent=3) |
|
1748 |
+mgTrack <- GenomeAxisTrack(scale=50, labelPos="below", exponent=3) |
|
1599 | 1749 |
chromosome(itrack) <- "chr1" |
1600 | 1750 |
@ |
1601 | 1751 |
|
... | ... |
@@ -265,255 +265,266 @@ updateLinks <- function(outdir, toUpdate) |
265 | 265 |
|
266 | 266 |
details <- list( |
267 | 267 |
|
268 |
+ IdeogramTrack=c(fill="Character scalar. The fill color used for the highlighting of the currently displayed genomic region.", |
|
269 |
+ col="Character scalar. The border color used for the highlighting of the currently displayed genomic region.", |
|
270 |
+ lwd="Numeric scalar. The line width used for the highlighting of the currently displayed genomic region.", |
|
271 |
+ lty="Character or integer scalar. The line type used for the highlighting of the currently displayed genomic region.", |
|
272 |
+ fontcolor="Character scalar. The font color for the chromosome name text.", |
|
273 |
+ fontface="Character scalar. The font face for the chromosome name text.", |
|
274 |
+ fontfamily="Character scalar. The font family for the chromosome name text.", |
|
275 |
+ cex="Numeric scalar. The overall font expansion factor for the chromosome name text.", |
|
276 |
+ size="Numeric scalar. The relative size of the track. Defaults to automatic size setting. Can be overridden in the \\code{\\link{plotTracks}} function.", |
|
277 |
+ showId="Logical scalar. Indicate the chromosome name next to the ideogram.", |
|
278 |
+ bevel="Numeric scalar, between 0 and 1. The level of smoothness for the two ends of the ideogram.", |
|
279 |
+ showTitle="Logical scalar. Plot a title panel. Defaults to omit the title panel.", |
|
280 |
+ background.title="Character scalar. The background color for the title panel. Defaults to omit the background.", |
|
281 |
+ fontsize="Numeric scalar. The font size for the chromosome name text."), |
|
268 | 282 |
|
269 |
- "IdeogramTrack"=c(fill="Character scalar. The fill color used for the highlighting of the currently displayed genomic region.", |
|
270 |
- col="Character scalar. The border color used for the highlighting of the currently displayed genomic region.", |
|
271 |
- lwd="Numeric scalar. The line width used for the highlighting of the currently displayed genomic region.", |
|
272 |
- lty="Character or integer scalar. The line type used for the highlighting of the currently displayed genomic region.", |
|
273 |
- fontcolor="Character scalar. The font color for the chromosome name text.", |
|
274 |
- fontface="Character scalar. The font face for the chromosome name text.", |
|
275 |
- fontfamily="Character scalar. The font family for the chromosome name text.", |
|
276 |
- cex="Numeric scalar. The overall font expansion factor for the chromosome name text.", |
|
277 |
- size="Numeric scalar. The relative size of the track. Defaults to automatic size setting. Can be overridden in the \\code{\\link{plotTracks}} function.", |
|
278 |
- showId="Logical scalar. Indicate the chromosome name next to the ideogram.", |
|
279 |
- bevel="Numeric scalar, between 0 and 1. The level of smoothness for the two ends of the ideogram.", |
|
280 |
- showTitle="Logical scalar. Plot a title panel. Defaults to omit the title panel.", |
|
281 |
- background.title="Character scalar. The background color for the title panel. Defaults to omit the background.", |
|
282 |
- fontsize="Numeric scalar. The font size for the chromosome name text."), |
|
283 |
- |
|
284 | 283 |
|
285 |
- "DataTrack"=c(jitter.x="Logical scalar. Toggle on jittering on the x axis in xy-type plots. See \\code{\\link{panel.xyplot}} for details.", |
|
286 |
- jitter.y="Logical scalar. Toggle off jittering on the y axis in xy-type plots. See \\code{\\link{panel.xyplot}} for details.", |
|
287 |
- factor="Numeric scalar. Factor to control amount of jittering in xy-type plots. See \\code{\\link{panel.xyplot}} for details.", |
|
288 |
- amount="Numeric scalar. Amount of jittering in xy-type plots. See \\code{\\link{panel.xyplot}} for details.", |
|
289 |
- span="Numeric scalar. Parameter controlling the loess calculation for smooth and mountain-type plots. See \\code{\\link{panel.loess}} for details.", |
|
290 |
- degree="Numeric scalar. Parameter controlling the loess calculation for smooth and mountain-type plots. See \\code{\\link{panel.loess}} for details.", |
|
291 |
- family="Character scalar. Parameter controlling the loess calculation for smooth and mountain-type plots. See \\code{\\link{panel.loess}} for details.", |
|
292 |
- evaluation="Numeric scalar. Parameter controlling the loess calculation for smooth and mountain-type plots. See \\code{\\link{panel.loess}} for details.", |
|
293 |
- baseline="Numeric scalar. Y-axis position of an optional baseline. This parameter has a special meaning for mountain-type plots, see the 'Details' section in \\code{\\linkS4class{DataTrack}} for more information.", |
|
294 |
- col.baseline="Character scalar. Color for the optional baseline, defaults to the setting of \\code{col}.", |
|
295 |
- pch="Integer scalar. The type of glyph used for plotting symbols.", |
|
296 |
- lwd.baseline="Numeric scalar. Line width of the optional baseline, defaults to the setting of \\code{lwd}.", |
|
297 |
- lty.baseline="Character or numeric scalar. Line type of the optional baseline, defaults to the setting of \\code{lty}.", |
|
298 |
- col="Character vector. The base colors to use for all plot types. Unless \\code{groups} are specified, only the first color in the vector is usually taken.", |
|
299 |
- col.mountain="Character scalar. Line color in mountain-type plots, defaults to the setting of \\code{col}.", |
|
300 |
- lwd.mountain="Numeric scalar. Line width in mountain-type plots, defaults to the setting of \\code{lwd}.", |
|
301 |
- lty.mountain="Character or numeric scalar. Line type in mountain-type plots, defaults to the setting of \\code{lty}.", |
|
302 |
- fill.mountain="Character vector of length 2. Fill color in mountain-type plots.", |
|
303 |
- fill.histogram="Character scalar. Fill color in histogram-type plots, defaults to the setting of \\code{fill}.", |
|
304 |
- col.histogram="Character scalar. Line color in histogram-type plots.", |
|
305 |
- stackedBars="Logical scalar. When there are several data groups, draw the histogram-type plots as stacked barplots or grouped side by side.", |
|
306 |
- box.ratio="Numeric scalar. Parameter controlling the boxplot appearance. See \\code{\\link{panel.bwplot}} for details.", |
|
307 |
- box.width="Numeric scalar. Parameter controlling the boxplot appearance. See \\code{\\link{panel.bwplot}} for details.", |
|
308 |
- varwidth="Logical scalar. Parameter controlling the boxplot appearance. See \\code{\\link{panel.bwplot}} for details.", |
|
309 |
- notch="Logical scalar. Parameter controlling the boxplot appearance. See \\code{\\link{panel.bwplot}} for details.", |
|
310 |
- notch.frac="Numeric scalar. Parameter controlling the boxplot appearance. See \\code{\\link{panel.bwplot}} for details.", |
|
311 |
- levels.fos="Numeric scalar. Parameter controlling the boxplot appearance. See \\code{\\link{panel.bwplot}} for details.", |
|
312 |
- stats="Function. Parameter controlling the boxplot appearance. See \\code{\\link{panel.bwplot}} for details.", |
|
313 |
- coef="Numeric scalar. Parameter controlling the boxplot appearance. See \\code{\\link{panel.bwplot}} for details.", |
|
314 |
- do.out="Logical scalar. Parameter controlling the boxplot appearance. See \\code{\\link{panel.bwplot}} for details.", |
|
315 |
- size="Numeric scalar. The relative size of the track. Can be overridden in the \\code{\\link{plotTracks}} function. By default the size will be set automatically based on the selected plotting type.", |
|
316 |
- type="Character vector. The plot type, one or several in \\code{c(\"p\",\"l\", \"b\", \"a\", \"s\", \"g\", \"r\", \"S\", \"smooth\", \"histogram\", \"mountain\", \"h\", \"boxplot\", \"gradient\", \"heatmap\")}. See 'Details' section in \\code{\\linkS4class{DataTrack}} for more information on the individual plotting types.", |
|
317 |
- cex="Numeric scalar. The default pixel size for plotting symbols.", |
|
318 |
- ncolor="Integer scalar. The number of colors for the 'gradient' plotting type", |
|
319 |
- gradient="Character vector. The base colors for the 'gradient' plotting type.", |
|
320 |
- collapse="Logical scalar. Collapse overlapping ranges and aggregate the underlying data.", |
|
321 |
- min.distance="Numeric scalar. The mimimum distance in pixel below which to collapse ranges.", |
|
322 |
- window="Numeric or character scalar. Aggregate the rows values of the data matrix to \\code{window} equally sized slices on the data range using the method defined in \\code{aggregation}. If negative, apply a running window of size \\code{windowSize} using the same aggregation method. Alternatively, the special value \\code{auto} causes the function to determine the optimal window size to avoid overplotting.", |
|
323 |
- windowSize="Numeric scalar. The size of the running window when the value of \\code{window} is negative.", |
|
324 |
- separator="Numeric scalar. Number of pixels used to separate individual samples in heatmap-type plots.", |
|
325 |
- transformation="Function. Applied to the data matrix prior to plotting or when calling the \\code{score} method. The function should accept exactly one input argument and its return value needs to be a numeric vector which can be coerced back into a data matrix of identical dimensionality as the input data.", |
|
326 |
- groups="Vector coercable to a factor. Optional sample grouping. See 'Details' section in \\code{\\linkS4class{DataTrack}} for further information.", |
|
327 |
- aggregation="Function or character scalar. Used to aggregate values in windows or for collapsing overlapping items. The function has to accept a numeric vector as a single input parameter and has to return a numeric scalar with the aggregated value. Alternatively, one of the predefined options \\code{mean}, \\code{median} \\code{sum}, \\code{min}, \\code{max} or \\code{extreme} can be supplied as a character scalar. Defaults to \\code{mean}.", |
|
328 |
- aggregateGroups="Logical scalar. Aggregate the values within a sample group using the aggregation funnction specified in the \\code{aggregate} parameter.", |
|
329 |
- ylim="Numeric vector of length 2. The range of the y-axis scale.", |
|
330 |
- h="Integer scalar. Parameter controlling the number of vertical grid lines, see \\code{\\link{panel.grid}} for details.", |
|
331 |
- v="Integer scalar. Parameter controlling the number of vertical grid lines, see \\code{\\link{panel.grid}} for details.", |
|
332 |
- col="Character or integer scalar. The color used for all line and symbol elements, unless there is a more specific control defined elsewhere.", |
|
333 |
- lwd="Integer scalar. The line width for all line elements, unless there is a more specific control defined elsewhere.", |
|
334 |
- lty="Character or integer scalar. The type for all line elements, unless there is a more specific control defined elsewhere.", |
|
335 |
- fill="Character scalar. The fill color for area elements, unless there is a more specific control defined elsewhere.", |
|
336 |
- alpha="Numeric scalar between 0 and 1. The opacity of the plotting elements, if supported by the device.", |
|
337 |
- lwd.grid="Integer scalar. The line width for grid elements. Defaults to the setting of \\code{lwd}.", |
|
338 |
- col.grid="Integer scalar. The line color for grid elements.", |
|
339 |
- lty.grid="Integer scalar. The line type for grid elements. Defaults to the setting of \\code{lty}.", |
|
340 |
- col.line="Character or integer scalar. The color used for line elements. Defaults to the setting of \\code{col}.", |
|
341 |
- col.symbol="Character or integer scalar. The color used for symbol elements. Defaults to the setting of \\code{col}.", |
|
342 |
- na.rm="Boolean controlling whether to discard all NA values when plotting or to keep empty spaces for NAs", |
|
343 |
- legend="Boolean triggering the addition of a legend to the track to indicate groups. This only has an effect if at least two groups are presen.", |
|
344 |
- cex.legend="Numeric scalar. The size factor for the legend text.", |
|
345 |
- fontsize.legend="Numeric scalar. The pixel size for the legend text.", |
|
346 |
- fontface.legend="Integer or character scalar. The font face for the legend text.", |
|
347 |
- fontfamily.legend="Integer or character scalar. The font family for the legend text.", |
|
348 |
- lineheight.legend="Numeric scalar. The line height for the legend text.", |
|
349 |
- fontcolor.legend="Integer or character scalar. The font color for the legend text."), |
|
350 |
- |
|
284 |
+ DataTrack=c(jitter.x="Logical scalar. Toggle on jittering on the x axis in xy-type plots. See \\code{\\link{panel.xyplot}} for details.", |
|
285 |
+ jitter.y="Logical scalar. Toggle off jittering on the y axis in xy-type plots. See \\code{\\link{panel.xyplot}} for details.", |
|
286 |
+ factor="Numeric scalar. Factor to control amount of jittering in xy-type plots. See \\code{\\link{panel.xyplot}} for details.", |
|
287 |
+ amount="Numeric scalar. Amount of jittering in xy-type plots. See \\code{\\link{panel.xyplot}} for details.", |
|
288 |
+ span="Numeric scalar. Parameter controlling the loess calculation for smooth and mountain-type plots. See \\code{\\link{panel.loess}} for details.", |
|
289 |