ALL Metrics
-
Views
-
Downloads
Get PDF
Get XML
Cite
Export
Track
Software Tool Article

gganatogram: An R package for modular visualisation of anatograms and tissues based on ggplot2

[version 1; peer review: 2 approved]
PUBLISHED 28 Sep 2018
Author details Author details
OPEN PEER REVIEW
REVIEWER STATUS

This article is included in the RPackage gateway.

This article is included in the Neuroconductor collection.

Abstract

Displaying data onto anatomical structures is a convenient technique to quickly observe tissue related information. However, drawing tissues is a complex task that requires both expertise in anatomy and the arts. While web based applications exist for displaying gene expression on anatograms, other non-genetic disciplines lack similar tools. Moreover, web based tools often lack the modularity associated with packages in programming languages, such as R. Here I present gganatogram, an R package used to plot modular species anatograms based on a combination of the graphical grammar of ggplot2 and the publicly available anatograms from the Expression Atlas. This combination allows for quick and easy, modular, and reproducible generation of anatograms. Using only one command and a data frame with tissue name, group, colour, and value, this tool enables the user to visualise specific human and mouse tissues with desired colours, grouped by a variable, or displaying a desired value, such as gene-expression, pharmacokinetics, or bacterial load across selected tissues. I hope that this tool will be useful by the wider community in biological sciences. Community members are welcome to submit additional anatograms, which can be incorporated into the package.
A stable version gganatogram has been deposited to neuroconductor, and a development version can be found on github/jespermaag/gganatogram.

Keywords

Anatograms, Anatomy, Tissues, Organs, ggplot2, R, Expression Atlas

Introduction

Efficiently displaying tissue information in multicellular organisms can be a laborious and time consuming process. Often researchers want to showcase differences in values, such as gene expression or pharmacokinetics between tissues in one organism, or between similar tissues in different groups.

Whereas bar charts and heatmaps provide an informative view of the differences between groups, it can be difficult to immediately observe the biological significance (Figure 1a–b). As compared to an anatogram, where it is easy to quickly spot the differences between tissues or groups, and immediately provide biological context to these observations (Figure 1c). This also has the added benefit that the audience, whether reading a paper or attending a lecture, will have to spend less time and effort to grasp the results.

8d4c178c-3151-4642-81ec-7c1b8bf0ac8e_figure1.gif

Figure 1. Comparison between barplot (top left), heatmap (top right), and anatogram (bottom) to display tissue values between groups.

The values in the graphs are the same.

Several online tools to display gene expression in different tissues already exist14. Although these tools provide important information regarding gene expression in various tissues and organisms, other disciplines besides genetics are unable to utilise these applications due to the focus on genes. Moreover, these tools often only include a predefined set of experiments that can be visualised, leading to difficulties in presenting your own data. Other caveats with these tools are that it can be laborious to recreate the plot or automatically create plots from results.

Here I present gganatogram, an open source R package based on ggplot25 utilising the publicly available mouse and human anatograms from the Expression Atlas1,2. With this package it is easy for any R user to quickly visualise anatograms with specified colours, groups, and values. Using the familiar grammar from ggplot25, this program allows for modular anatograms to be generated.

Methods

Implementation

gganatogram is stored on neuroconductor6, an open-source platform for rapid testing and dissemination of reproducible computational imaging software. A development version can be found on github/jespermaag/gganatogram, which allows for the community to post issues with the package, submit requests, or add anatograms by creating coordinate files.

source("https://neuroconductor.org/neurocLite.R")
neuro_install("gganatogram", release = "stable",
release_repo = latest_neuroc_release(release = "stable"))

The development version can be installed from github:

devtools::install_github("jespermaag/gganatogram")

Briefly, to generate the main list objects that contain all tissue coordinates, I downloaded SVG files from the Expression Atlas (Available from gganatogram GitHub page2) and processed them using a custom python script (available from GitHub). The script scraped through the SVG files to extract the name, coordinates, and SVG transformations. These were then post-processed in R to create the rda files that make up the tissue coordinates.

Operation

gganatogram requires an installation of R3.0.0, ggplot25 v.3.0.0 and ggpolypath7 v.0.1.0. The program should be able to run on any computer with the system requirements for R. Plots can be generated using a basic data.frame containing organ name, colour, type, or value, with the specified column names below. Organs are plotted one at a time based on the order of the data.frame. The tissue of each consecutive row will be layered on top of the previous. The gganatogram package provides four such data.frames containing all tissues available to plot, one for each human and mouse, and divided by sex.

hgMale_key, hgFemale_key, mmMale_key, mmFemale_key

These data frames have already specified colour, type, and an assigned random number to facilitate the start of plotting.

head(hgFemale_key)
            organ  colour      type     value
1        pancreas  orange digestion 10.373146
2           liver  orange digestion 19.723172
3           colon  orange digestion 14.853335
4     bone_marrow #41ab5d     other 19.681587
5 urinary_bladder  orange digestion 14.914273
6         stomach  orange digestion  2.667599

The main function is called gganatogram(). By default, and without any arguments, it plots the outline of a male human with standard ggplot2 parameters. By adding just a few options, it is possible to quickly change to female, fill specified organs by selected colour, or fill the organs based on a value (Figure 2).

8d4c178c-3151-4642-81ec-7c1b8bf0ac8e_figure2.gif

Figure 2.

(A) Default plot generated by calling gganatogram(), (B) adding female, plotting specified organs by (C) colour, (D) value.

library(gganatogram)
library(gridExtra)
organPlot <- data.frame(organ = c("heart", "leukocyte", "nerve", "brain",
"liver", "stomach", "colon"),
type = c("circulation", "circulation", "nervous␣system", "nervous␣system",
"digestion", "digestion", "digestion"),
colour = c("red", "red", "purple", "purple", "orange", "orange", "orange"),
value = c(10, 5, 1, 8, 10, 5, 10),
stringsAsFactors=F)

A <- gganatogram()
B <- gganatogram(fillOutline="#a6bddb", sex="female") + theme_void()
C <- gganatogram(data=organPlot, fillOutline="#a6bddb", organism="human",
      sex="female", fill="colour")+ theme_void()
D <- gganatogram(data=organPlot, fillOutline="#a6bddb", organism="human",
      sex="female", fill="value")+ theme_void()
grid.arrange(A, B, C, D, ncol=4)

Use cases

This section provides additional plotting examples.

To plot all tissues per organism, use the provided key files that exist per organism and sex. This displays all tissues in the order of each data frame. To change the order in which organs are layered on top of each other, reorder the data frame to have those tissues at the bottom (Figure 3).

8d4c178c-3151-4642-81ec-7c1b8bf0ac8e_figure3.gif

Figure 3. Displaying all tissues available for human and mouse, male and female.

The colours are specified in the provided key data frames.

library(gganatogram)
library(gridExtra)
hgMale <- gganatogram(data=hgMale_key, fillOutline="#a6bddb", organism="human",
           sex="male", fill="colour") + theme_void()

hgFemale <- gganatogram(data=hgFemale_key, fillOutline="#a6bddb",
             organism="human", sex="female", fill="colour") + theme_void()

mmMale <- gganatogram(data=mmMale_key, fillOutline="#a6bddb", organism="mouse",
           sex="male", fill="colour") + theme_void()

mmFemale <- gganatogram(data=mmFemale_key, outline = T, fillOutline="#a6bddb",
             organism="mouse", sex="female", fill="colour") + theme_void()

grid.arrange(hgMale, hgFemale, mmMale, mmFemale, ncol=4)

To compare anatograms, e.g. draw one specific anatogram side by side and compare values, a long table has to be created with the type column changed to the variables to compare. The following code recreates (Figure 1c).

normal <- data.frame(organ = c("heart", "leukocyte", "nerve", "brain", "liver", 
"stomach", "colon"),
value = c(10, 5, 1, 2, 2, 5, 5),
type = rep("Normal", 7),
stringsAsFactors=F)

cancer <- data.frame(organ = c("heart", "leukocyte", "nerve", "brain", "liver", 
"stomach", "colon"),
value = c(5, 5, 10, 12, 15, 5, 10), type = rep("Cancer", 7),
stringsAsFactors=F)

compareGroups <- rbind(normal, cancer)

gganatogram(data=compareGroups, fillOutline="white", organism="human",
sex="male", fill="value") +
              theme_void() +
              facet_wrap(~type) +
              scale_fill_gradient(low = "white", high = "steelblue")

Organs can also be separated by faceting, as per standard ggplot2 using facet_wrap (Figure 4). This can help to display organs that are nested on top of each other.

8d4c178c-3151-4642-81ec-7c1b8bf0ac8e_figure4.gif

Figure 4. Faceting tissues based on type and displaying the corresponding colour.

library(gganatogram)

gganatogram(hgMale_key, fillOutline="#a6bddb", organism="human",
sex="male", fill="colour") +
theme_void() +
facet_wrap(~type)

Because I elected to use ggplot25 for the package, the user can add additional layers from standard plots. This can be useful to show highlight features, such as metastasis, location of tissue biopsies, or gene expression of specific biopsies (Figure 5).

8d4c178c-3151-4642-81ec-7c1b8bf0ac8e_figure5.gif

Figure 5. Geom points added to a gganatogram to show the location of tissue biopsies (top left) along with a barplot of biopsy expression for an example gene (bottom).

Another option is to fill both tissues and points by value (top right). Red colour around plot added for emphasis.

library(gganatogram)
library(dplyr)
library(gridExtra)

biopsies <- data.frame(biopsy = c("liver", "heart", "prostate", "stomach", "brain"),
         x = c(50, 55, 53, 60, 57),
         y = c(60, 48, 95, 68, 10),
         value = c(10, 15, 5, 2, 15))
p <- hgMale_key %>%
        dplyr::filter(organ %in% c("liver", "heart", "prostate", "stomach", 
        "brain")) %>%
        gganatogram(fillOutline="lightgray", organism="human", sex="male",
        fill="colour") + theme_void() +
        ggtitle("Position of biopsies")
        
p <- p + geom_point(data = biopsies, pch=21, size=2, aes(x =x, y = -y,
fill = biopsy, colour= biopsy))

p2 <- ggplot(biopsies, aes(x = biopsy, y = value, fill = biopsy)) +
         geom_bar(stat= "identity", col="black") +
         theme_minimal() +
         theme(legend.position= "none")+
         theme(axis.text.x = element_text(angle = 60, hjust = 1))+
         ggtitle("Gene1␣expression")
        
p3 <- hgMale_key%>%
         dplyr::filter(organ %in% c("liver", "heart", "prostate", "stomach", 
         "brain"))%>%
         gganatogram(fillOutline="lightgray", organism="human", sex="male", 
         fill="value") + theme_void() +
         ggtitle("Value␣of␣biopsies") +
         geom_point(data = biopsies, pch=21, size=3, aes(x =x, y = -y,
         fill = value), colour="red")
        
lay <- rbind(c(1,2), c(1,2), c(3, NULL))
grid.arrange(p, p3, p2, layout_matrix = lay)

Summary

In summary, I have designed and implemented an R package to easily visualise anatograms based on ggplot25 and the anatograms from Expression Atlas2, which when combined create a powerful tool to plot and display tissue information.

The one line command to generate these plots should allow for users with even limited R knowledge to create informative anatograms for publications or presentations.

Data availability

SVG files are available from GitHub: https://github.com/ebi-gene-expression-group/anatomogram/tree/master/src/svg

Software availability

Comments on this article Comments (0)

Version 2
VERSION 2 PUBLISHED 28 Sep 2018
Comment
Author details Author details
Competing interests
Grant information
Copyright
Download
 
Export To
metrics
Views Downloads
F1000Research - -
PubMed Central
Data from PMC are received and updated monthly.
- -
Citations
CITE
how to cite this article
Maag JLV. gganatogram: An R package for modular visualisation of anatograms and tissues based on ggplot2 [version 1; peer review: 2 approved] F1000Research 2018, 7:1576 (https://doi.org/10.12688/f1000research.16409.1)
NOTE: it is important to ensure the information in square brackets after the title is included in all citations of this article.
track
receive updates on this article
Track an article to receive email alerts on any updates to this article.

Open Peer Review

Current Reviewer Status: ?
Key to Reviewer Statuses VIEW
ApprovedThe paper is scientifically sound in its current form and only minor, if any, improvements are suggested
Approved with reservations A number of small changes, sometimes more significant revisions are required to address specific details and improve the papers academic merit.
Not approvedFundamental flaws in the paper seriously undermine the findings and conclusions
Version 1
VERSION 1
PUBLISHED 28 Sep 2018
Views
30
Cite
Reviewer Report 30 Oct 2018
Saskia Freytag, Population Health and Immunity Division, Walter and Eliza Hall Institute (WEHI), Department of Medical Biology, University of Melbourne, Parkville, Vic, Australia 
Approved
VIEWS 30
This article describes a new R package, which allows easy plotting of discrete and continuous measurements onto human and mouse anatomy.

This is a really valuable R package contribution, as it fills a real void in the ... Continue reading
CITE
CITE
HOW TO CITE THIS REPORT
Freytag S. Reviewer Report For: gganatogram: An R package for modular visualisation of anatograms and tissues based on ggplot2 [version 1; peer review: 2 approved]. F1000Research 2018, 7:1576 (https://doi.org/10.5256/f1000research.17925.r39943)
NOTE: it is important to ensure the information in square brackets after the title is included in all citations of this article.
Views
33
Cite
Reviewer Report 22 Oct 2018
Helder I. Nakaya, University of São Paulo, São Paulo, Brazil 
Approved
VIEWS 33
The author describes an R package that displays discrete and continuous data onto anatomical structures. The structures are based on mouse and human anatograms from the Expression Atlas project and the grammar from ggplot2 R library. The code example was easy ... Continue reading
CITE
CITE
HOW TO CITE THIS REPORT
Nakaya HI. Reviewer Report For: gganatogram: An R package for modular visualisation of anatograms and tissues based on ggplot2 [version 1; peer review: 2 approved]. F1000Research 2018, 7:1576 (https://doi.org/10.5256/f1000research.17925.r39255)
NOTE: it is important to ensure the information in square brackets after the title is included in all citations of this article.

Comments on this article Comments (0)

Version 2
VERSION 2 PUBLISHED 28 Sep 2018
Comment
Alongside their report, reviewers assign a status to the article:
Approved - the paper is scientifically sound in its current form and only minor, if any, improvements are suggested
Approved with reservations - A number of small changes, sometimes more significant revisions are required to address specific details and improve the papers academic merit.
Not approved - fundamental flaws in the paper seriously undermine the findings and conclusions
Sign In
If you've forgotten your password, please enter your email address below and we'll send you instructions on how to reset your password.

The email address should be the one you originally registered with F1000.

Email address not valid, please try again

You registered with F1000 via Google, so we cannot reset your password.

To sign in, please click here.

If you still need help with your Google account password, please click here.

You registered with F1000 via Facebook, so we cannot reset your password.

To sign in, please click here.

If you still need help with your Facebook account password, please click here.

Code not correct, please try again
Email us for further assistance.
Server error, please try again.