Title: | Heat map plotting by genome coordinate |
---|---|
Description: | The ChromHeatMap package can be used to plot genome-wide data (e.g. expression, CGH, SNP) along each strand of a given chromosome as a heat map. The generated heat map can be used to interactively identify probes and genes of interest. |
Authors: | Tim F. Rayner |
Maintainer: | Tim F. Rayner <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.61.0 |
Built: | 2024-11-29 04:40:33 UTC |
Source: | https://github.com/bioc/ChromHeatMap |
This is a greatly reduced subset of the Chiaretti et al. ALL data set (available in its entirety as the Bioconductor ALL package). The data in this subset consist of microarrays from 15 different individuals with acute lymphoblastic leukemia (ALL). The data are further restricted to chromosome 22 only. This data set is intended for demonstration purposes only.
ALLs.chr22
ALLs.chr22
An ExpressionSet with the following covariates:
ageThe age of the patient in years.
mol.biolThe assigned molecular biology of the cancer (mainly for those with B-cell ALL). In this data set this is restricted to ALL1/AF4 and E2A/PBX1.
The ALL Bioconductor data package
Sabina Chiaretti, Xiaochun Li, Robert Gentleman, Antonella Vitale, Marco Vignetti, Franco Mandelli, Jerome Ritz, and Robin Foa Gene expression profile of adult T-cell acute lymphocytic leukemia identifies distinct subsets of patients with different response to therapy and survival. Blood, 1 April 2004, Vol. 103, No. 7.
This is a greatly reduced subset of the Chiaretti et al. ALL data
set (available in its entirety as the Bioconductor ALL package). The
data in this subset consist of microarrays from 15 different
individuals with acute lymphoblastic leukemia (ALL). The data are
further restricted to chromosome 22 only. This data set is intended
for demonstration purposes only. See the documentation for
makeChrStrandData
for a description of the ChrStrandData object
format. This format directly associates the ExpressionSet data with
chromosome location, speeding up retrieval of data during heat map plotting.
chrdata
chrdata
A ChrStrandData object
The ALL Bioconductor data package
Sabina Chiaretti, Xiaochun Li, Robert Gentleman, Antonella Vitale, Marco Vignetti, Franco Mandelli, Jerome Ritz, and Robin Foa Gene expression profile of adult T-cell acute lymphocytic leukemia identifies distinct subsets of patients with different response to therapy and survival. Blood, 1 April 2004, Vol. 103, No. 7.
Plots a either one or two ChrStrandMatrix objects (typically
constructed using the createChrMatrix
function) as heat maps
along a specified chromosome, optionally clustering samples and
including an idiogram.
chrHeatMap (strand.data, cytopaint.func=NULL, col = "heat.colors", start, end, breaks, RowSideColors, title=TRUE, margins = c(6, 6), cexCyto = 0.8, srtCyto=90, lmat = NULL, lhei = NULL, lwid = NULL, ...)
chrHeatMap (strand.data, cytopaint.func=NULL, col = "heat.colors", start, end, breaks, RowSideColors, title=TRUE, margins = c(6, 6), cexCyto = 0.8, srtCyto=90, lmat = NULL, lhei = NULL, lwid = NULL, ...)
strand.data |
A ChrStrandMatrix object, or a list of such
objects, one per strand to be plotted (or a single matrix for ‘both’
strands), created using the |
cytopaint.func |
A function closure taking a single argument, ‘boxwidth’,
and plotting its enclosed idiogram data at that width. See
|
col |
A vector of colors to use for the heat map, or the name of a function generating such a vector. |
start |
The starting genome coordinate for the plot. |
end |
The ending genome coordinate for the plot. |
breaks |
A vector of numeric break points indicating the boundaries
between the |
RowSideColors |
A vector of colors to use for a color band indicating e.g. sample categories. |
title |
If TRUE, this causes the function to include default heat map subtitles indicating which chromosome and strand has been plotted. If FALSE or NULL, subtitles will left blank. If this argument is set to a character vector of the same length and order as strand.data its contents will be used as heat map subtitles. |
margins |
A numeric vector indicating the c(bottom, left) margins of the plot containing X and Y axes labels. |
cexCyto |
A positive number used to control the font size for the
idiogram plot. For plots spanning just a few cytobands it may be
worth setting this to a larger number, and |
srtCyto |
A number indicating the degree to which the idiogram text labels should be rotated. This defaults to 90 degrees, but for more detailed plots a setting of zero here often looks better. |
lmat |
An optional matrix to be passed to |
lhei |
An optional vector of |
lwid |
An optional vector of |
... |
Additional arguments are passed to the |
Typically this function should not be called directly, but rather via
the wrapper plotChrMap
function. This function uses cytoband
data from the UCSC genome annotation database and code adapted from
the quantsmooth package to draw an idiogram of the chromosome, or a
subset thereof.
This function is executed for its side effects.
Tim F Rayner
lodplot and quantsmooth packages
plotChrMap
, createChrMatrix
, drawMapDendro
data('demo') stranddata <- createChrMatrix( chrdata, chr=22, strand='forward', start=21925000, end=24300000 ) chrHeatMap(stranddata)
data('demo') stranddata <- createChrMatrix( chrdata, chr=22, strand='forward', start=21925000, end=24300000 ) chrHeatMap(stranddata)
ChrMapPlot objects are generated as an output from the main
plotChrMap
function, which users can then pass to the
grabChrMapProbes
function.
Objects of this class are created using the plotChrMap
function:
plotChrMap(chrdata, '22')
An array of probe or gene identifiers, with names corresponding to chromosome coordinates
.
The leftmost interval number (most usually 1).
The rightmost interval number.
Standard generic methods:
show(ChrMapPlot)
Generates a short description of the ChrMapPlot object.
Tim F Rayner
data('demo') plotmap <- plotChrMap(chrdata, '22', cytoband='q11.23') probes <- grabChrMapProbes(plotmap) library('hgu95av2.db') genes <- mget(probes, hgu95av2SYMBOL, ifnotfound=NA)
data('demo') plotmap <- plotChrMap(chrdata, '22', cytoband='q11.23') probes <- grabChrMapProbes(plotmap) library('hgu95av2.db') genes <- mget(probes, hgu95av2SYMBOL, ifnotfound=NA)
This generic function simply returns the names of all the chromosomes represented by a given ChrStrandData or ChrStrandMatrix object. Note that not every sample associated with a ChrStrandData object need have data from every chromosome.
chrNames(object)
chrNames(object)
object |
Object derived from class ChrStrandData or ChrStrandMatrix |
chrNames(object)
returns a character vector listing the chromosomes.
Tim F Rayner
Container for data from high-throughput assays mapped to chromosome locations.
The most convenient way to create a ChrStrandData object is to use the
makeChrStrandData
function, which can be used to convert data
stored in either an ExpressionSet
or data frame into a
ChrStrandData
object:
makeChrStrandData(ALL, lib = "hgu95av2.db")
a 'list', whose components correspond to samples in the same order as appearing in the columns of 'expr'. Each component is also a 'list', named by chromosomes "1"-"22", "X" and "Y". Each named component is again a 'list' with two elements named "posS" and "negS", corresponding to the forward and reverse strands of a chromosome, each of which is a list containing start coordinates ("x"), end coordinates("xe") and the corresponding data values ("y").
A string giving the name of the annotation data package to use.
The list of chromosomes represented in the object.
Class-specific methods.
annotation(ChrStrandData)
Returns the name of the AnnotationDbi library used to annotate the object.
chrNames(ChrStrandData)
Returns a list of the chromosomes represented in the object.
sampleNames(ChrStrandData)
Returns the names of the samples associated with the object.
Standard generic methods:
show(ChrStrandData)
Generates a short description of the ChrStrandData object.
summary(ChrStrandData)
Generates a summary of the data available for each chromosome in the ChrStrandData object.
Tim F Rayner
makeChrStrandData
, ChrStrandMatrix-class
.
data('demo') chrdata <- makeChrStrandData(exprs(ALLs.chr22), lib = "hgu95av2.db")
data('demo') chrdata <- makeChrStrandData(exprs(ALLs.chr22), lib = "hgu95av2.db")
Container for chromosome-specific subsets of data selected from an
genome-wide ChrStrandData object, suitable for use with
chrHeatMap
.
Typically, objects of this class are created and used internally by
the createChrMatrix
and chrHeatMap
functions. Objects
can be created in a similar fashion by end-users:
createChrMatrix(chrdata, chr=22, strand='forward', start=21925000,
end=24300000, interval=5000)
Note that this function may combine data from multiple probes or genes (taking the mean) into a single chromosomal locus based on the size of the specified interval. If this happens the combined probe/gene identifiers are concatenated in the output object, separated by a semicolon.
The data matrix, arranged with samples in columns and genomic locations in rows.
An array of probe or gene identifiers associated with the
data. The names attached to this array correspond with chromosome
coordinate (specifically, the starting coordinates, i.e. the
left-hand edges). These identifiers will ultimately be returned by e.g. the
grabChrMapProbes
function.
The chromosome name or number.
The chromosome strand ('forward', 'reverse' or 'both').
The starting chromosome coordinates for each genomic location.
The ending chromosome coordinates for each genomic location.
Class-specific methods.
chrNames(ChrStrandMatrix)
Returns the name of the chromosome for the object.
strandName(ChrStrandMatrix)
Returns the chromosome strand for the object.
sampleNames(ChrStrandMatrix)
Returns the names of the samples associated with the object.
featureNames(ChrStrandMatrix)
Returns the probe or gene identifiers associated with the object.
exprs(ChrStrandMatrix)
Returns the chromosome-specific data matrix for the object.
Standard generic methods:
show(ChrStrandMatrix)
Generates a short description of the ChrStrandMatrix object.
summary(ChrStrandMatrix)
Generates a summary of the data available for each sample in the ChrStrandMatrix object.
Tim F Rayner
createChrMatrix
, ChrStrandData-class
.
data('demo') stranddata <- createChrMatrix( chrdata, chr=22, strand='forward', start=21925000, end=24300000 )
data('demo') stranddata <- createChrMatrix( chrdata, chr=22, strand='forward', start=21925000, end=24300000 )
Given a data object from makeChrStrandData, generate a matrix containing a subset of the data from a given region of a given chromosome strand, with data binned at appropriate intervals along the chromosome. The minimum width of the binning interval is controlled using the "interval" argument, which can therefore be used to control the output resolution of the data.
createChrMatrix(data, chr, strand = c('forward','reverse','both'), subset = NULL, start=1, end, interval=ceiling((end - start)/500))
createChrMatrix(data, chr, strand = c('forward','reverse','both'), subset = NULL, start=1, end, interval=ceiling((end - start)/500))
data |
A ChrStrandData object (e.g. generated by |
chr |
The name of the chromosome to plot. |
strand |
The chromosome strand to plot (‘both’ indicates that both strands should be overlaid in a single heatmap). |
subset |
An optional numeric vector indicating which samples should be plotted. |
start |
The starting chromosome coordinate from which to plot. |
end |
The ending chromosome coordinate. |
interval |
The (optional) size of the data bins to use along the chromosome, in bases. |
Typically this function will not be called directly, but rather via
the wrapper plotChrMap
function.
Note that this function may combine data from multiple probes or genes (taking the mean) into a single chromosomal locus based on the size of the specified interval. If this happens the combined probe/gene identifiers are concatenated in the output object, separated by a semicolon.
A ChrStrandMatrix object suitable for use with chrHeatMap
and
drawMapDendro
.
Tim F Rayner
plotChrMap
, chrHeatMap
,
drawMapDendro
, ChrStrandMatrix-class
, ChrStrandData-class
data('demo') stranddata <- createChrMatrix( chrdata, chr=22, strand='forward', start=21925000, end=24300000 )
data('demo') stranddata <- createChrMatrix( chrdata, chr=22, strand='forward', start=21925000, end=24300000 )
This data set contains cytoband information for a range of species, taken directly from the UCSC genome annotation database. This data set is designed to be easily extendable to cover new species.
cytobands
cytobands
A list of data frames, one per species, each with one row per cytoband and the following columns:
chrThe chromosome number for the cytoband, prefixed with 'chr'.
startThe start coordinate for the cytoband.
endThe end coordinate for the cytoband.
bandThe cytoband number (i.e., the '23.3' in '1q23.3').
stainThe cytoband stain (see the stains
data set).
armThe chromosome arm for the cytoband (i.e., the 'q' in '1q23.3').
The list names (i.e. names(cytobands)
) should correspond to
species names in the AnnotationDbi packages used.
The UCSC genome annotation database: http://hgdownload.cse.ucsc.edu/downloads.html
Given a data matrix, cluster by sample (if desired), and plot the
dendrogram and heatmap along chromosome coordinates. This function
reuses code from the gplots heatmap.2
function. Note that this
function makes assumptions about the current layout of the display
device, and so should generally be called only via plotChrMap
.
drawMapDendro(x, start, end, col = "heat.colors", dendrogram = TRUE, Rowv = TRUE, margins = c(6, 6), na.rm=TRUE, hclustfun = hclust, distfun = dist, breaks, RowSideColors, cexRow, cexCol, xlab, ylab, labRow, labCol, na.color = 'gray', ...)
drawMapDendro(x, start, end, col = "heat.colors", dendrogram = TRUE, Rowv = TRUE, margins = c(6, 6), na.rm=TRUE, hclustfun = hclust, distfun = dist, breaks, RowSideColors, cexRow, cexCol, xlab, ylab, labRow, labCol, na.color = 'gray', ...)
x |
The strand-specific data matrix to cluster and plot, usually
generated using |
start |
The starting genome coordinate for the plot. |
end |
The ending genome coordinate for the plot. |
col |
A character vector of colors to use in the heat map, or the name of a function generating such a vector. |
dendrogram |
A boolean flag indicating whether or not to draw the dendrogram. |
Rowv |
Determines if and how the sample dendrogram should be
reordered. If a |
margins |
A numeric vector indicating the c(bottom, left) margins of the plot containing X and Y axes labels. |
na.rm |
Whether or not to remove NA from calculations. |
hclustfun |
Function used to compute the hierarchical clustering when
|
distfun |
Function used to compute the distance (dissimilarity) between
both rows and columns. Defaults to |
breaks |
(Optional) Either a numeric vector indicating the
splitting points for binning |
RowSideColors |
(Optional) Character vector of length |
cexRow , cexCol
|
(Optional) Positive numbers, used as
|
xlab , ylab
|
X- and Y- axis titles; defaults to none. |
labRow , labCol
|
Character vectors with row and column labels to
use; these default to |
na.color |
Color to use for missing value ( |
... |
Additional arguments are passed to the |
This function makes assumptions about the plot layout, usually set by
the enclosing chrHeatMap
function. Typically neither of these
functions should be called directly, but rather via the wrapper
plotChrMap
function.
This function is executed for its side effects.
Tim F Rayner
plotChrMap
, createChrMatrix
, chrHeatMap
data('demo') stranddata <- createChrMatrix( chrdata, chr=22, strand='forward', start=21925000, end=24300000 ) layout(matrix(1:2, ncol=2), widths=c(0.1,1)) drawMapDendro( stranddata, margins=c(0,0) )
data('demo') stranddata <- createChrMatrix( chrdata, chr=22, strand='forward', start=21925000, end=24300000 ) layout(matrix(1:2, ncol=2), widths=c(0.1,1)) drawMapDendro( stranddata, margins=c(0,0) )
Allows the user to interactively select regions of the plotChrMap heatmap, identifying all the probes or genes plotted in those regions.
grabChrMapProbes( plotmap )
grabChrMapProbes( plotmap )
plotmap |
The output of the |
This function takes the output of the plotChrMap
function and
uses it to identify the probes or genes responsible for the signals plotted on
the plotChrMap
heatmap. It asks the user to select two points
on either side of the heatmap bands of interest (specifically,
boundary for inclusion of a given band is its left-hand edge), and
returns a vector of probe/gene identifiers. This can be passed directly to
AnnotationDbi::mget to yield gene symbols and other annotation.
Note that the plotting area layout() and par() values are not reset on exit, so that this function can be reused as many times as is desired.
A character vector of probe/gene identifiers. If multiple identifiers
have been averaged into a single band these identifiers will be string
concatenated, separated by semicolons. The start, end and interval
arguments to plotChrMap
can be used in such cases to plot the
data at a higher resolution, splitting such loci into separate bands.
Tim F Rayner
data('demo') plotmap <- plotChrMap(chrdata, '22', cytoband='q11.23') probes <- grabChrMapProbes(plotmap) library('hgu95av2.db') genes <- mget(probes, hgu95av2SYMBOL, ifnotfound=NA)
data('demo') plotmap <- plotChrMap(chrdata, '22', cytoband='q11.23') probes <- grabChrMapProbes(plotmap) library('hgu95av2.db') genes <- mget(probes, hgu95av2SYMBOL, ifnotfound=NA)
Given an ExpressionSet, or a data matrix with row names corresponding
to the probe or gene IDs in an accompanying annotation package, this function
returns a data structure that can be used with the plotChrMap
function. This code is based on the Makesense method from the
geneplotter package, extended to use both the CHRLOC and CHRLOCEND
annotation environments from recent AnnotationDbi packages.
In principle, any AnnotationDbi-based package could be used to provide chromosome location data to this function; all that matters is that the probe or gene identifiers used by the annotation package should be from the same source as the data ExpressionSet featureNames or matrix row names.
makeChrStrandData(expr, lib)
makeChrStrandData(expr, lib)
expr |
The ExpressionSet or data matrix to remap. |
lib |
The name of the annotation package to use. |
A ChrStrandData object suitable for use with plotChrMap.
Tim F Rayner
geneplotter, annotate and AnnotationDbi packages
plotChrMap
, ChrStrandData-class
data('demo') chrdata <- makeChrStrandData(exprs(ALLs.chr22), lib = "hgu95av2.db")
data('demo') chrdata <- makeChrStrandData(exprs(ALLs.chr22), lib = "hgu95av2.db")
Given a data matrix with row names corresponding to the probe or gene IDs in
an accompanying annotation package, returns a data structure that can
be used with the plotChrMap
function. Based on the Makesense
method from the geneplotter package.
Given an ExpressionSet object, returns a ChrStrandData object.
Given a matrix object (where
rownames(expr)
yields the probe or gene identifiers used by the
annotation package), returns a ChrStrandData object.
Creates a GRangesList object suitable for uploading to the UCSC genome browser using the rtracklayer package.
makeRangedDataList( data, chr, start = 1, end, genome, subset = NULL, cytoband, plot=FALSE, session )
makeRangedDataList( data, chr, start = 1, end, genome, subset = NULL, cytoband, plot=FALSE, session )
data |
A ChrStrandData object, output from the |
chr |
Chromosomal id, chromosome to plot 1:22,X,Y. |
start |
Optional start chromosome position from which to commence plotting. |
end |
Optional end chromosome position. |
genome |
The name of the genome from which the data coordinates
are taken (e.g. "hg18"). Passed to |
subset |
Optional numeric vector listing the samples from |
cytoband |
Optional cytological band to plot (e.g. ‘q23’). |
plot |
An optional flag indicating whether to automatically plot the resulting GRangesList on the UCSC browser or not. |
session |
An optional rtracklayer UCSCSession object. Ignored unless plot=TRUE. |
This function is used to create GRangesList objects from ChrStrandData
objects (see the makeChrStrandData
function). If the plot
argument is set to TRUE, the data is also uploaded to a UCSC browser
session using default settings. See the rtracklayer package for more
information on RangedData and UCSCSession objects.
A GRangesList object containing the data for the specified genome region. See the rtracklayer package for more information on this object class.
Tim F Rayner
rtracklayer package
makeChrStrandData
,
GRangesList
plotChrMap
,
data('demo') r <- makeRangedDataList( data=chrdata, chr=22, cytoband='q11.23', genome='hg18' )
data('demo') r <- makeRangedDataList( data=chrdata, chr=22, cytoband='q11.23', genome='hg18' )
Given a ChrStrandData object (produced by the makeChrStrandData
function), this function plots a heat map of its data values along a
specified chromosome, optionally clustering samples and including an
idiogram.
plotChrMap( data, chr, start = 1, end, subset = NULL, cytoband, interval = ceiling((end-start)/500), strands = c('forward', 'reverse'), ... )
plotChrMap( data, chr, start = 1, end, subset = NULL, cytoband, interval = ceiling((end-start)/500), strands = c('forward', 'reverse'), ... )
data |
A ChrStrandData object, output from the |
chr |
Chromosomal id, chromosome to plot 1:22,X,Y. |
start |
Optional start chromosome position from which to commence plotting. |
end |
Optional end chromosome position. |
subset |
Optional numeric vector listing the samples from |
cytoband |
Optional cytological band to plot (e.g. ‘q23’). |
interval |
An optional interval size controlling the plot detail level. |
strands |
The chromosome strands to plot (a one- or two-element character vector, values ‘forward’, ‘reverse’, or ‘both’). |
... |
Additional arguments are passed to the |
This function is used to plot ChrStrandData objects (the output of the
makeChrStrandData
function) as heatmaps arranged along genome
coordinates. The default heat map will plot the entire forward strand
for the chosen chromosome at the top of the figure, with an idiogram
and the reverse strand below it. To plot both strands overlaid, use
the strands='both'
argument. Probe or gene signals are averaged over a
window size controlled by interval
, such that the default
length of each heat map segment is 1/500 the total heat map
width. This can be varied as required to control the resolution of the
plot. This function uses both the start and end chromosomal locations
for each gene to plot heatmap positions, and as such will not work
with older AnnotationDbi packages.
See the related functions from this package for further plotting
arguments which may be passed to this function. In particular, see the
drawMapDendro
documentation for arguments used to control
sample clustering and plot axis font sizes, and chrHeatMap
for
arguments relating to the idiogram plot. Note that the plotting area
layout() and par() values are not reset on exit, so that
grabChrMapProbes
can be subsequently used on the output.
Idiogram plotting is currently only supported for data mapping to human, mouse and rat genomes. In principle this is extendable to any organism for which the UCSC genome browser includes cytoband information. Please contact the maintainer of this package for help in such cases.
A ChrMapPlot object containing a list of probe/gene identifiers mapped to
their corresponding display locations, for use with
grabChrMapProbes
.
Tim F Rayner
annotate package
drawMapDendro
, chrHeatMap
, makeChrStrandData
, grabChrMapProbes
data('demo') plotChrMap(chrdata, '22', cytoband='q11', labRow=ALLs.chr22$mol.biol, cexCol=0.8, cexCyto=1.2, srtCyto=0)
data('demo') plotChrMap(chrdata, '22', cytoband='q11', labRow=ALLs.chr22$mol.biol, cexCol=0.8, cexCyto=1.2, srtCyto=0)
This is a data set describing the display parameters used to plot cytoband data.
stains
stains
A data frame with one row per cytoband type, and the following columns:
typeThe cytoband type. This must correspond to the "stain"
column in the cytoband data frame (see the cytobands
documentation).
bandcolThe shade of gray used to colour the cytobands. A
number between 0 (black) and 1 (white). Passed as the "col"
argument to rect
.
textcolThe shade of gray used for the cytoband text labels. A
number between 0 (black) and 1 (white). Passed as the "col"
argument to text
.
banddensThe shading density to use for the band
colour. Passed as the "density" argument to rect
.
bandbordThe shade of gray used for the plotted cytoband
borders. A number between 0 (black) and 1 (white). Passed as the
"border" argument to rect
.
Developed based on the design of the idiogram Bioconductor package
This generic function simply returns the chromosome strand which name of all the chromosomes represented by a given ChrStrandData object. Note that not every sample associated with the object need have data from every chromosome.
strandName(object)
strandName(object)
object |
Object derived from class ChrStrandMatrix |
strandName(object)
returns the name of the strand from which
the object data is taken.
Tim F Rayner