A class to represent the schematic display of a chromosome, also known as an ideogram. The respective information is typically directly fetched from UCSC.
The chromosome for which to create the ideogram. Has to be
a valid UCSC chromosome identifier of the form chrx
, or a single
integer or numeric character unless
option(ucscChromosomeNames=FALSE)
. The user has to make sure that the
respective chromosome is indeed defined for the the track's genome.
The genome on which to create the ideogram. This has to be a valid UCSC genome identifier if the ideogram data is to be fetched from the UCSC repository.
Character scalar of the track's name used in the title panel when plotting. Defaults to the selected chromosome.
A data.frame
with the cytoband information for all
available chromosomes on the genome similar to the data that would be
fetched from UCSC. The table needs to contain the mandatory columns
chrom
, chromStart
, chromEnd
, name
and
gieStain
with the chromosome name, cytoband start and end
coordinates, cytoband name and coloring information, respectively. This can
be used when no connection to the internet is available or when the cytoband
information has been cached locally to avoid the somewhat slow connection to
UCSC.
Additional items which will all be interpreted as further display parameters.
The return value of the constructor function is a new object of class
IdeogramTrack
.
Ideograms are schematic depictions of chromosomes, including chromosome band
information and centromere location. The relevant data for various species
is stored in the UCSC data base. The initializer method of the class will
automatically fetch the respective data for a given genome and chromosome
from UCSC and fill the appropriate object slots. When plotting
IdeogramTracks
, the current genomic location is indicated on the
chromosome by a colored box.
The Gviz.ucscUrl
option controls which URL is being used to connect
to UCSC. For instance, one could switch to the European UCSC mirror by
calling options(Gviz.ucscUrl="http://genome-euro.ucsc.edu/cgi-bin/"
.
When fetching ideogram data from UCSC the results are cached for faster
acces. See clearSessionCache
on details to delete these cached
items.
Objects can be created using the constructor function IdeogramTrack
.
# \dontshow{
## Load some sample data
data(idTrack)
# }
## Construct the object
if (FALSE) {
idTrack <- IdeogramTrack(chromosome = 7, genome = "mm9")
}
# \dontshow{
## For some annoying reason the postscript device does not know about
## the sans font
if (!interactive()) {
font <- ps.options()$family
displayPars(idTrack) <- list(fontfamily = font, fontfamily.title = font)
}
# }
## Plotting
plotTracks(idTrack, from = 5000000, to = 9000000)
## Track names
names(idTrack)
#> [1] "chr7"
names(idTrack) <- "foo"
plotTracks(idTrack, from = 5000000, to = 9000000)
## Accessors
chromosome(idTrack)
#> chr7
#> "chr7"
if (FALSE) {
chromosome(idTrack) <- "chrX"
}
genome(idTrack)
#> [1] "mm9"
if (FALSE) {
genome(id) <- "hg19"
}
range(idTrack)
#> IRanges object with 20 ranges and 0 metadata columns:
#> start end width
#> <integer> <integer> <integer>
#> [1] 0 15943333 15943334
#> [2] 15943333 19131999 3188667
#> [3] 19131999 29760888 10628890
#> [4] 29760888 36138221 6377334
#> [5] 36138221 39326888 3188668
#> ... ... ... ...
#> [16] 116917775 124357997 7440223
#> [17] 124357997 129140997 4783001
#> [18] 129140997 144021442 14880446
#> [19] 144021442 147741553 3720112
#> [20] 147741553 152524553 4783001
ranges(idTrack)
#> GRanges object with 20 ranges and 2 metadata columns:
#> seqnames ranges strand | name type
#> <Rle> <IRanges> <Rle> | <factor> <factor>
#> [1] qA1 0-15943333 * | qA1 gpos100
#> [2] qA2 15943333-19131999 * | qA2 gneg
#> [3] qA3 19131999-29760888 * | qA3 gpos33
#> [4] qB1 29760888-36138221 * | qB1 gneg
#> [5] qB2 36138221-39326888 * | qB2 gpos33
#> ... ... ... ... . ... ...
#> [16] qF1 116917775-124357997 * | qF1 gneg
#> [17] qF2 124357997-129140997 * | qF2 gpos33
#> [18] qF3 129140997-144021442 * | qF3 gneg
#> [19] qF4 144021442-147741553 * | qF4 gpos33
#> [20] qF5 147741553-152524553 * | qF5 gneg
#> -------
#> seqinfo: 97 sequences from an unspecified genome; no seqlengths
## Annotation
values(idTrack)
#> name type
#> 1 qA1 gpos100
#> 2 qA2 gneg
#> 3 qA3 gpos33
#> 4 qB1 gneg
#> 5 qB2 gpos33
#> 6 qB3 gneg
#> 7 qB4 gpos33
#> 8 qB5 gneg
#> 9 qC gpos100
#> 10 qD1 gneg
#> 11 qD2 gpos66
#> 12 qD3 gneg
#> 13 qE1 gpos100
#> 14 qE2 gneg
#> 15 qE3 gpos33
#> 16 qF1 gneg
#> 17 qF2 gpos33
#> 18 qF3 gneg
#> 19 qF4 gpos33
#> 20 qF5 gneg
## coercion
as(idTrack, "data.frame")
#> X.seqnames X.start X.end X.width X.strand X.name X.type name type
#> 1 qA1 0 15943333 15943334 * qA1 gpos100 qA1 gpos100
#> 2 qA2 15943333 19131999 3188667 * qA2 gneg qA2 gneg
#> 3 qA3 19131999 29760888 10628890 * qA3 gpos33 qA3 gpos33
#> 4 qB1 29760888 36138221 6377334 * qB1 gneg qB1 gneg
#> 5 qB2 36138221 39326888 3188668 * qB2 gpos33 qB2 gpos33
#> 6 qB3 39326888 49955776 10628889 * qB3 gneg qB3 gneg
#> 7 qB4 49955776 56864554 6908779 * qB4 gpos33 qB4 gpos33
#> 8 qB5 56864554 63773332 6908779 * qB5 gneg qB5 gneg
#> 9 qC 63773332 74933665 11160334 * qC gpos100 qC gpos100
#> 10 qD1 74933665 80779554 5845890 * qD1 gneg qD1 gneg
#> 11 qD2 80779554 84499665 3720112 * qD2 gpos66 qD2 gpos66
#> 12 qD3 84499665 94597109 10097445 * qD3 gneg qD3 gneg
#> 13 qE1 94597109 104694553 10097445 * qE1 gpos100 qE1 gpos100
#> 14 qE2 104694553 107351775 2657223 * qE2 gneg qE2 gneg
#> 15 qE3 107351775 116917775 9566001 * qE3 gpos33 qE3 gpos33
#> 16 qF1 116917775 124357997 7440223 * qF1 gneg qF1 gneg
#> 17 qF2 124357997 129140997 4783001 * qF2 gpos33 qF2 gpos33
#> 18 qF3 129140997 144021442 14880446 * qF3 gneg qF3 gneg
#> 19 qF4 144021442 147741553 3720112 * qF4 gpos33 qF4 gpos33
#> 20 qF5 147741553 152524553 4783001 * qF5 gneg qF5 gneg