In this vignette, we focus on the different visualizations you can generate by changing the arguments for the image and barplot methods. The main arguments to image, when using a CytobandData object from the package are
The barplot method only takes the what argument, which in this case must be a length-one character vector.
To produce the figures in this gallery, we will use a dataset that comes with the package, already processed,
library(RCytoGPS)
data(cytoData)
colnames(cytoData)
## [1] "Chromosome" "loc.start" "loc.end" "Band" "Arm"
## [6] "A.Loss" "A.Gain" "A.Fusion" "B.Loss" "B.Gain"
## [11] "B.Fusion" "C.Loss" "C.Gain" "C.Fusion"
<- CytobandData(cytoData)
bandData <- c("A.Loss", "A.Gain", "A.Fusion") Acolumns
The banddata object includes data at the resolution of a cytoband for three sets of samples (denoted A, B, and C), describing the frequency of loss, gain, and fusion events for each set.
The first visual is a barplot to show the frequencies of cytogenetic
events mapped to the associated chromosome. The main parameters for
barplot
are (1) the CytobandData object containing
the dataset, (2) the specific data column that you want to graph, and
(3) the color of the graph.
<- par(mfrow=c(2,1))
opar barplot(bandData, "A.Loss", col = "forestgreen")
barplot(bandData, "B.Loss", col="orange")
par(opar)
Plots of the data along one chromosome can be oriented either horizontally or vertically. By (our) definition, “horizontal” and “vertical” refer to the orientation of the chromosome with its cytoband shading. Unless specified, the horiz argument is set to FALSE by default.
The “vertical stacked chromosome” allows you to see a vertical barplot and its associated chromosome on the y axis, this allows you to see multiple cytogenetic events on a specified chromosome. The parameters to produce this image are the dataset, the cytogenetic event, and a specific chromosome.
image(bandData, what = Acolumns[1:3], chr = 2)
The next visual is nearly identical to “vertical stack chromosome” with the exception that the visual is set along the x-axis instead of the y axis.
image(bandData, Acolumns[1:3], chr = 2, horiz = TRUE)
This set of visuals allows the user to directly compare two sets of cytogenetic events on a specified chromosome on the y-axis.
image(bandData, what = list("A.Loss", "B.Loss"), chr = 5)
The next visual is similar to the previous visual except that the orientation is switched from vertical to horizontal.
image(bandData, what = list("A.Loss", "B.Loss"), chr = 5, horiz = TRUE)
We can also produce “idiograms” that show the data for all chromosomes at once rather than just one chromosome at a time.
The simplest idiogram visualizes a single data colum of cytogenetic
events for all chromosomes. The parameters are similar to the previous
visuals with the exception that chr is set to all
and we describe the colors using the argument pal (for
pallete).
image(bandData, what = Acolumns[1], chr = "all", pal = "orange")
This image allows you to do a comparison between two cytogenetic events on all the chromosomes.
image(bandData, what = Acolumns[1:2], chr = "all",
pal=c("orange", "forestgreen"))
The next visual is the same as the previous with the exception that the user can dictate how many total rows they want to display. (The default is 2; permitted values range from 1 to 4.)
image(bandData, what = Acolumns[1:2], chr = "all", nrows = 3,
pal=c("orange", "forestgreen"))
This visual is the same as before except that we have switched from vertical to horizontal.
image(bandData, what = Acolumns[1:2], chr = "all",
pal=c("orange", "forestgreen"), horiz = TRUE)
The image method also allows you to graph more than two (up to ten) data columns.
image(bandData, what = Acolumns[1:3], chr = "all",
pal=c("forestgreen", "orange", "purple"), nrows=3, horiz = FALSE)
Lastly, this image is the same as the previous with the exception of the graphs being plotted horizontally.
image(bandData, what = Acolumns, chr = "all",
pal=c("forestgreen", "orange", "purple"), nrows=3, horiz= TRUE)
sessionInfo()
## R version 4.4.1 (2024-06-14 ucrt)
## Platform: x86_64-w64-mingw32/x64
## Running under: Windows 11 x64 (build 22631)
##
## Matrix products: default
##
##
## locale:
## [1] LC_COLLATE=C
## [2] LC_CTYPE=English_United States.utf8
## [3] LC_MONETARY=English_United States.utf8
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.utf8
##
## time zone: America/New_York
## tzcode source: internal
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] RCytoGPS_1.2.7
##
## loaded via a namespace (and not attached):
## [1] digest_0.6.36 R6_2.5.1 fastmap_1.2.0 xfun_0.46
## [5] rjson_0.2.21 cachem_1.1.0 knitr_1.48 htmltools_0.5.8.1
## [9] rmarkdown_2.27 lifecycle_1.0.4 cli_3.6.3 sass_0.4.9
## [13] jquerylib_0.1.4 compiler_4.4.1 highr_0.11 tools_4.4.1
## [17] evaluate_0.24.0 bslib_0.8.0 yaml_2.3.10 rlang_1.1.4
## [21] jsonlite_1.8.8