Code Monkey home page Code Monkey logo

gganatogram's Introduction

gganatogram

AppVeyor build status Travis build status DOI

Create anatogram images for different organisms.
This package uses the tissue coordinates from the figure in Expression Atlas. https://www.ebi.ac.uk/gxa/home
https://github.com/ebi-gene-expression-group/anatomogram

Citation

Maag JLV. gganatogram: An R package for modular visualisation of anatograms and tissues based on ggplot2 [version 1; referees: 1 approved]. F1000Research 2018, 7:1576 (doi: 10.12688/f1000research.16409.1)

https://f1000research.com/articles/7-1576/v1

citation("gganatogram")
#> 
#> Maag J (2018). "gganatogram: An R package for modular
#> visualisation of anatograms and tissues based on ggplot2."
#> _f1000research_. Version 1: Awaiting peer review, <URL:
#> https://f1000research.com/articles/7-1576/v1>.
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Article{,
#>     title = {gganatogram:  An R package for modular visualisation of anatograms and tissues based on ggplot2},
#>     author = {Jesper Maag},
#>     journal = {f1000research},
#>     year = {2018},
#>     note = {Version 1: Awaiting peer review},
#>     url = {https://f1000research.com/articles/7-1576/v1},
#>   }

If you use the tissue plots from gganatogram please cite Expression Atlas as well.
Petryszak et al. 2015
If you use the main cell figure, please cite The Protein Atlas.
Thul PJ et al. 2017

More plot examples can be found at https://jespermaag.github.io/blog/2018/gganatogram/

Install

Install from github using devtools.

## install from Github
devtools::install_github("jespermaag/gganatogram")

shiny

I have now included a shiny app for gganatogram.
An online version can be found at shinapps.io.
https://jespermaag.shinyapps.io/gganatogram/
Unfortunately, there is a limit of 25h per month of app activity, so if you know R/Rstudio, please run it locally.
To run it locally, use the following command.

library(shiny)
runGitHub( "gganatogram", "jespermaag",  subdir = "shiny") 

Usage

This package requires ggplot2 and ggpolypath which loads when loading the package

library(gganatogram)
library(dplyr)
library(viridis)
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)

hgMale <- gganatogram(data=hgMale_key, fillOutline='#440154FF', organism='human', sex='male', fill="value") + theme_void() +  scale_fill_viridis()
hgFemale <- gganatogram(data=hgFemale_key, fillOutline='#440154FF', organism='human', sex='female', fill="value") + theme_void() +  scale_fill_viridis()
mmMale <- gganatogram(data=mmMale_key, fillOutline='#440154FF', organism='mouse', sex='male', fill="value") + theme_void() +  scale_fill_viridis()
mmFemale <- gganatogram(data=mmFemale_key, outline = T, fillOutline='#440154FF', organism='mouse', sex='female', fill="value")  +theme_void()   +  scale_fill_viridis()

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

In order to use the function gganatogram, you need to have a data frame with organ, colour, and value if you want to.

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, 2, 5, 5), 
 stringsAsFactors=F)

 head(organPlot)
#>       organ           type colour value
#> 1     heart    circulation    red    10
#> 2 leukocyte    circulation    red     5
#> 3     nerve nervous system purple     1
#> 4     brain nervous system purple     8
#> 5     liver      digestion orange     2
#> 6   stomach      digestion orange     5

Using the function gganatogram with the filling the organs based on colour.

gganatogram(data=organPlot, fillOutline='#a6bddb', organism='human', sex='male', fill="colour")

Of course, we can use the ggplot themes and functions to adjust the plots

gganatogram(data=organPlot, fillOutline='#a6bddb', organism='human', sex='male', fill="colour") + 
theme_void()

We can also plot all tissues available using hgMale_key

hgMale_key$organ
#>  [1] "thyroid_gland"             "bone_marrow"              
#>  [3] "frontal_cortex"            "prefrontal_cortex"        
#>  [5] "pituitary_gland"           "aorta"                    
#>  [7] "gastroesophageal_junction" "left_ventricle"           
#>  [9] "caecum"                    "ileum"                    
#> [11] "rectum"                    "nose"                     
#> [13] "breast"                    "tongue"                   
#> [15] "left_atrium"               "pulmonary_valve"          
#> [17] "mitral_valve"              "penis"                    
#> [19] "nasal_pharynx"             "spinal_cord"              
#> [21] "throat"                    "tricuspid_valve"          
#> [23] "diaphragm"                 "liver"                    
#> [25] "stomach"                   "spleen"                   
#> [27] "duodenum"                  "gall_bladder"             
#> [29] "pancreas"                  "colon"                    
#> [31] "small_intestine"           "appendix"                 
#> [33] "smooth_muscle"             "urinary_bladder"          
#> [35] "bone"                      "cartilage"                
#> [37] "esophagus"                 "salivary_gland"           
#> [39] "parotid_gland"             "submandibular_gland"      
#> [41] "skin"                      "pleura"                   
#> [43] "brain"                     "heart"                    
#> [45] "adrenal_gland"             "lymph_node"               
#> [47] "adipose_tissue"            "skeletal_muscle"          
#> [49] "leukocyte"                 "temporal_lobe"            
#> [51] "atrial_appendage"          "coronary_artery"          
#> [53] "hippocampus"               "vas_deferens"             
#> [55] "seminal_vesicle"           "epididymis"               
#> [57] "tonsil"                    "lung"                     
#> [59] "amygdala"                  "trachea"                  
#> [61] "bronchus"                  "nerve"                    
#> [63] "cerebellum"                "cerebellar_hemisphere"    
#> [65] "kidney"                    "renal_cortex"             
#> [67] "testis"                    "prostate"
gganatogram(data=hgMale_key, fillOutline='#a6bddb', organism='human', sex='male', fill="colour") +theme_void()

We can also skip plotting the outline of the graph

organPlot %>%
    dplyr::filter(type %in% c('circulation', 'nervous system')) %>%
gganatogram(outline=F, fillOutline='#a6bddb', organism='human', sex='male', fill="colour") + 
theme_void()

We can fill the tissues based on the values given to each organ

gganatogram(data=organPlot, fillOutline='#a6bddb', organism='human', sex='male', fill="value") + 
theme_void() +
scale_fill_gradient(low = "white", high = "red")

We can also use facet_wrap to compare groups. First create add two data frames together with different values and the conditions in the type column

compareGroups <- rbind(data.frame(organ = c("heart", "leukocyte", "nerve", "brain", "liver", "stomach", "colon"), 
  colour = c("red", "red", "purple", "purple", "orange", "orange", "orange"), 
 value = c(10, 5, 1, 8, 2, 5, 5), 
 type = rep('Normal', 7), 
 stringsAsFactors=F),
 data.frame(organ = c("heart", "leukocyte", "nerve", "brain", "liver", "stomach", "colon"), 
  colour = c("red", "red", "purple", "purple", "orange", "orange", "orange"), 
 value = c(5, 5, 10, 8, 2, 5, 5), 
 type = rep('Cancer', 7), 
 stringsAsFactors=F))
gganatogram(data=compareGroups, fillOutline='#a6bddb', organism='human', sex='male', fill="value") + 
theme_void() +
facet_wrap(~type) +
scale_fill_gradient(low = "white", high = "red") 

You can also split the tissues into types while retaining the outline

gganatogram(data=hgMale_key, outline = T, fillOutline='#a6bddb', organism='human', sex='male', fill="colour") +
facet_wrap(~type, ncol=4) +
theme_void()

Added female option

All female tissues

hgFemale_key$organ
#>  [1] "atrial_appendage"          "ectocervix"               
#>  [3] "hippocampus"               "pleura"                   
#>  [5] "bronchus"                  "trachea"                  
#>  [7] "lung"                      "tonsil"                   
#>  [9] "submandibular_gland"       "breast"                   
#> [11] "spinal_cord"               "pancreas"                 
#> [13] "liver"                     "colon"                    
#> [15] "bone_marrow"               "urinary_bladder"          
#> [17] "stomach"                   "duodenum"                 
#> [19] "esophagus"                 "gall_bladder"             
#> [21] "spleen"                    "small_intestine"          
#> [23] "placenta"                  "endometrium"              
#> [25] "vagina"                    "aorta"                    
#> [27] "pituitary_gland"           "gastroesophageal_junction"
#> [29] "caecum"                    "appendix"                 
#> [31] "ileum"                     "left_atrium"              
#> [33] "left_ventricle"            "pulmonary_valve"          
#> [35] "mitral_valve"              "diaphragm"                
#> [37] "bone"                      "cartilage"                
#> [39] "throat"                    "rectum"                   
#> [41] "nasal_septum"              "nasal_pharynx"            
#> [43] "cerebellum"                "cerebellar_hemisphere"    
#> [45] "prefrontal_cortex"         "frontal_cortex"           
#> [47] "nose"                      "temporal_lobe"            
#> [49] "cerebral_cortex"           "kidney"                   
#> [51] "renal_cortex"              "coronary_artery"          
#> [53] "tricuspid_valve"           "thyroid_gland"            
#> [55] "skin"                      "parotid_gland"            
#> [57] "adipose_tissue"            "heart"                    
#> [59] "smooth_muscle"             "brain"                    
#> [61] "adrenal_gland"             "lymph_node"               
#> [63] "skeletal_muscle"           "ovary"                    
#> [65] "leukocyte"                 "salivary_gland"           
#> [67] "fallopian_tube"            "uterus"                   
#> [69] "uterine_cervix"            "nerve"
gganatogram(data=hgFemale_key, outline = T, fillOutline='#a6bddb', organism='human', sex='female', fill="colour")  +theme_void()

You can also split the tissues into types while retaining the outline

gganatogram(data=hgFemale_key, outline = T, fillOutline='#a6bddb', organism='human', sex='female', fill="colour") +
facet_wrap(~type, ncol=4) +
theme_void()

To display the female reproductive system with outline.

hgFemale_key %>%
    dplyr::filter(type=='reproductive') %>%
    gganatogram( outline = T, fillOutline='#a6bddb', organism='human', sex='female', fill="colour")  +
    theme_void()  +
    coord_cartesian(xlim = c(30, 75), ylim = c(-110, -80))

Added mouse

Male

mmMale_key$organ
#>  [1] "aorta"                     "brown_adipose_tissue"     
#>  [3] "stomach"                   "duodenum"                 
#>  [5] "pancreas"                  "spleen"                   
#>  [7] "adrenal_gland"             "kidney"                   
#>  [9] "colon"                     "small_intestine"          
#> [11] "caecum"                    "jejunum"                  
#> [13] "ileum"                     "esophagus"                
#> [15] "gall_bladder"              "lymph_node"               
#> [17] "seminal_vesicle"           "penis"                    
#> [19] "femur"                     "bone_marrow"              
#> [21] "cartilage"                 "quadriceps_femoris"       
#> [23] "spinal_cord"               "lung"                     
#> [25] "diaphragm"                 "trachea"                  
#> [27] "hindlimb"                  "trigeminal_nerve"         
#> [29] "sciatic_nerve"             "intestinal_mucosa"        
#> [31] "liver"                     "heart"                    
#> [33] "brain"                     "skeletal_muscle"          
#> [35] "circulatory_system"        "blood_vessel"             
#> [37] "skin"                      "prostate_gland"           
#> [39] "vas_deferens"              "epididymis"               
#> [41] "testis"                    "urinary_bladder"          
#> [43] "thymus"                    "peripheral_nervous_system"
#> [45] "eye"
gganatogram(data=mmMale_key, outline = T, fillOutline='#a6bddb', organism='mouse', sex='male', fill="colour")  +theme_void()  +coord_fixed()

gganatogram(data=mmMale_key, outline = T, fillOutline='#a6bddb', organism='mouse', sex='male', fill="colour")  +theme_void()+facet_wrap(~type, ncol=4)

Female

mmFemale_key$organ
#>  [1] "aorta"                     "circulatory_system"       
#>  [3] "brown_adipose_tissue"      "stomach"                  
#>  [5] "duodenum"                  "pancreas"                 
#>  [7] "spleen"                    "adrenal_gland"            
#>  [9] "kidney"                    "colon"                    
#> [11] "small_intestine"           "caecum"                   
#> [13] "jejunum"                   "ileum"                    
#> [15] "esophagus"                 "gall_bladder"             
#> [17] "vagina"                    "uterus"                   
#> [19] "urinary_bladder"           "tongue"                   
#> [21] "Peyer's_patch"             "femur"                    
#> [23] "bone_marrow"               "cartilage"                
#> [25] "quadriceps_femoris"        "skeletal_muscle"          
#> [27] "spinal_cord"               "diaphragm"                
#> [29] "hindlimb"                  "trigeminal_nerve"         
#> [31] "eye"                       "intestinal_mucosa"        
#> [33] "brain"                     "heart"                    
#> [35] "liver"                     "sciatic_nerve"            
#> [37] "blood_vessel"              "skin"                     
#> [39] "mammary_gland"             "title8178"                
#> [41] "reproductive_system"       "lymph_node"               
#> [43] "thymus"                    "thyroid_gland"            
#> [45] "lung"                      "peripheral_nervous_system"
#> [47] "trachea"
gganatogram(data=mmFemale_key, outline = T, fillOutline='#a6bddb', organism='mouse', sex='female', fill="colour")  +theme_void()    +coord_fixed()

gganatogram(data=mmFemale_key, outline = T, fillOutline='#a6bddb', organism='mouse', sex='female', fill="colour")  +theme_void()+facet_wrap(~type, ncol=4)

Cellular structures

I have now included cellular substructures, using the cell.svg from the Protein Atlas. If you use the main cell figure (hopefully more will be added), please cite Thul PJ et al. 2017

The cellular data can be access using cell_key

length(cell_key)
#> [1] 1
cell_key
#> $cell
#>                            organ  type    colour       value
#> 1                        cytosol other steelblue  2.07159434
#> 4         intermediate_filaments other   #984EA3 14.89497057
#> 6                actin_filaments other   #FFFF33  5.87440944
#> 8           focal_adhesion_sites other   #F781BF  8.12483660
#> 10 microtubule_organizing_center other   #66C2A5  8.67564889
#> 12                    centrosome other   #8DA0CB  1.02852838
#> 13                  microtubules other   #E78AC3  9.48882657
#> 16              microtubule_ends other   #E5C494  4.80457195
#> 18             secreted_proteins other   #8DD3C7  9.20191105
#> 20                lipid_droplets other   #BEBADA  3.48903574
#> 22                     lysosomes other   #80B1D3  3.73790434
#> 24                   peroxisomes other   #B3DE69  6.79465458
#> 26                     endosomes other   #D9D9D9 13.48636296
#> 28         endoplasmic_reticulum other   #CCEBC5 11.36654344
#> 30               golgi_apparatus other   #7FC97F 11.29225961
#> 32                   nucleoplasm other   #FDC086  2.07964782
#> 34              nuclear_membrane other   #386CB0  7.98595837
#> 36                nuclear_bodies other   #BF5B17  0.05868359
#> 38              nuclear_speckles other   #1B9E77  0.61672243
#> 40                      nucleoli other   #7570B3 14.96900579
#> 42     nucleoli_fibrillar_center other   #66A61E  8.72324527
#> 44                rods_and_rings other   #A6761D  9.53194209
#> 46                  mitochondria other   #A6CEE3  1.29396698
#> 48               plasma_membrane other   #B2DF8A 13.45657571

To plot the whole cell with colours or values, use the following command. If you want to specify a background colour, you either have to remove the cytosol or change the colour of cytosol to the desired colour.

gganatogram(data=cell_key[['cell']], outline = T, fillOutline='steelblue', organism="cell", fill="colour")  +theme_void()   + coord_fixed()

gganatogram(data=cell_key[['cell']], outline = T, fillOutline='lightgray', organism="cell", fill="value")  +theme_void() +  coord_fixed() +  scale_fill_viridis()

To see all the subsstructures individually, you can plot the data one at a time

figureList <- list()
for (i in 1:nrow(cell_key[['cell']])) {
    figureList[[i]] <- gganatogram(data=cell_key[['cell']][i,], outline = T, fillOutline='steelblue', organism="cell", fill="colour")  +theme_void() +ggtitle(cell_key[['cell']][i,]$organ) + theme(plot.title = element_text(hjust=0.5, size=16)) + coord_fixed()
}

do.call(grid.arrange,  c(figureList[1:4], ncol=2))

do.call(grid.arrange,  c(figureList[5:8], ncol=2))

do.call(grid.arrange,  c(figureList[9:12], ncol=2))

do.call(grid.arrange,  c(figureList[13:16], ncol=2))

do.call(grid.arrange,  c(figureList[17:20], ncol=2))

do.call(grid.arrange,  c(figureList[21:24], ncol=2))

Other organisms i.e. tier 2 organisms

Expression atlas contains other organisms than human and mice, however, these are not as well anotated.
All the expression atlas anatograms can be found here https://ebi-gene-expression-group.github.io/anatomogram/
Unfortunately, I won't be able to add other organs to these since I'm neither an anatomist nor artist.
If anyone would like to add more organs, I would love for you to contribute.

To create these plots, I have added two other objects other_key and other_list.
These are lists within lists, and to plot all the organs from an organisms use other_key[["organism"]] as data, and "organism" as organism.
Also, the organ names are so far a mix of UBERON and plant ids.

length(other_key)
#> [1] 24
names(other_key)
#>  [1] "anolis_carolinensis"                 
#>  [2] "arabidopsis_thaliana"                
#>  [3] "bos_taurus"                          
#>  [4] "brachypodium_distachyon.flower_parts"
#>  [5] "brachypodium_distachyon.whole_plant" 
#>  [6] "gallus_gallus"                       
#>  [7] "hordeum_vulgare.flower_parts"        
#>  [8] "hordeum_vulgare.whole_plant"         
#>  [9] "macaca_mulatta"                      
#> [10] "monodelphis_domestica"               
#> [11] "oryza_sativa.flower_parts"           
#> [12] "oryza_sativa.whole_plant"            
#> [13] "papio_anubis"                        
#> [14] "rattus_norvegicus"                   
#> [15] "solanum_lycopersicum.flower_parts"   
#> [16] "solanum_lycopersicum.whole_plant"    
#> [17] "sorghum_bicolor.flower_parts"        
#> [18] "sorghum_bicolor.whole_plant"         
#> [19] "tetraodon_nigroviridis"              
#> [20] "triticum_aestivum.flower_parts"      
#> [21] "triticum_aestivum.whole_plant"       
#> [22] "xenopus_tropicalis"                  
#> [23] "zea_mays.flower_parts"               
#> [24] "zea_mays.whole_plant"

To plot bos_taurus use the following command. Unfortunately, I have not managed to add the correct names yet.

other_key[["bos_taurus"]]
#>             organ  type  colour     value
#> 2        duodenum other #E41A1C 11.381132
#> 3           brain other #377EB8  2.264810
#> 4          kidney other #4DAF4A  4.131599
#> 5            lung other #984EA3  3.182946
#> 6           colon other #FF7F00  3.114481
#> 7           heart other #FFFF33 13.141334
#> 8           liver other #A65628 17.251310
#> 9  pulmonary vein other #F781BF 13.414659
#> 19 UBERON_0001013 other #999999 12.126515
#> 20 UBERON_0001013 other #66C2A5  1.898023
#> 21 UBERON_0001013 other #FC8D62 19.290389
#> 22 UBERON_0014892 other #8DA0CB 10.994221
#> 23 UBERON_0014892 other #E78AC3 16.761115
#> 24 UBERON_0014892 other #A6D854  2.468627
#> 25 UBERON_0014892 other #FFD92F  1.556285
#> 26 UBERON_0014892 other #E5C494  3.461740
#> 27 UBERON_0014892 other #B3B3B3 18.595027

gganatogram(data=other_key[["bos_taurus"]], outline = T, fillOutline='white', organism="bos_taurus", sex='female', fill="colour")  +
        theme_void() +
        ggtitle("bos_taurus") + 
        theme(plot.title = element_text(hjust=0.5)) + 
        coord_fixed()

Here is a way to loop through all the other organisms and plot their organs.

library(gridExtra)
plotList <- list()
for (organism in names(other_key)) {
    plotList[[organism]] <- gganatogram(data=other_key[[organism]], outline = T, fillOutline='white', organism=organism, sex='female', fill="colour")  +
                theme_void() +
                ggtitle(organism) + 
                theme(plot.title = element_text(hjust=0.5, size=9)) + 
                coord_fixed()
}

do.call(grid.arrange,  c(plotList[1:4], ncol=2))

do.call(grid.arrange,  c(plotList[5:8], ncol=2))

do.call(grid.arrange,  c(plotList[9:12], ncol=2))

do.call(grid.arrange,  c(plotList[13:16], ncol=2))

do.call(grid.arrange,  c(plotList[17:20], ncol=2))

do.call(grid.arrange,  c(plotList[21:24], ncol=2))

gganatogram's People

Contributors

adigherman avatar brennanpincardiff avatar erjanmx avatar jespermaag avatar muschellij2 avatar stephenturner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gganatogram's Issues

Request: ability to map to body segments rather than organs

Thanks for the great package! Much of my research involves measuring skin temperatures of different body segments (e.g. face, hands, chest, etc) and I haven't found an elegant way to visualize those data in R yet. I came across your package and thought it would be perfect for this particular application with some modifications. I would be happy to help determine the coordinates of typical body segments if that was useful.

plugin to expression atlas?

Hi,

Great tool, just what I was looking for and hoped someone would create. A quick question: do you have existing code for, given a gene symbol, getting expression data for that gene for all human or mouse tissues such that it can be quickly visualised on your body map? Seems to me like the most common use case, and if the code was included it would speed update/usage.

Best wishes
/Alistair

Help understand X and Y values

Hi,
I find your package interesting and I would like to use it in my research. I have a question for the following code in your publication

`biopsies <- data.frame(biopsy = c("liver", "heart", "prostate", "stomach", "brain"),
` x = c(55, 50, 53, 60, 57),
 y = c(48, 60, 95, 68, 10),
 value = c(10, 15, 5, 2, 15)) 

How do you decide on the X and Y values? For my research I want to use: tongue", "lung", "nasal_pharynx", "urinary_bladder"

Facetting only works if facet variable is named "type"

Hi,
Thank you so much for your work and for providing this package. The plots look amazing!

Here is one thing that took me a while to figure out. When using facet_wrap to facet the plot, it only works when the facet variable is named type. Using any other name results in the following error:
Error in combine_vars(data, params$plot_env, vars, drop = params$drop)

I would kindly suggest to allow for other variable names or to make it explicit in the documentation that the variable has to be named "type".

overlaying data

Hello
I am a big fan of your package : simple and efficient!
for my new project, I would like to plot diagram on top of the human body based on the coordinate of the organs...
the first thing I did was to try to find the centroids of these organs.. I did the following although it is probably not ideal... (all suggestions are welcome)


df_cat<- data.frame()
for(i in 1:length(unique(names(hgMale_list)))){
        organ=unique(names(hgMale_list))[i]
        coordinates <- hgMale_list[i]
        lat=mean(coordinates[[1]]$X1,na.rm=T)
        lon=mean(coordinates[[1]]$X2,na.rm=T)
        df<- cbind(organ,lat,lon)
        df_cat=rbind(df_cat,df)
        
}

then is the tricky part.
I do have my 'background' body with


organPlot <- data.frame(organ = c("heart", "aorta", "spleen", "brain", "liver", "duodenum", "colon", "prostate"), 
                        type = c("circulation", "circulation",  "circulation", "nervous system", "digestion", "digestion", "digestion",'reproductive'), 
                        colour = c("#F08080", "#F08080", "#F08080", "#c6e2ff", "#FDE1C1", "#D3EBED", "#57BFC5",'#F39325'), 
                        value = c(10, 5, 1, 8, 2, 5, 5,5), 
                        stringsAsFactors=F)
plot1 <- gganatogram(data=organPlot, fillOutline='white', organism='human', sex='male', fill="colour")+theme_bars()
plot1

but I would like to overlay a pie chart (ggplot) on top of a given organs
a simple geom_point works

plot1+geom_point(aes(x=52.64,y=-4.84),size=5)

but what would you suggest to add another ggplot 'nested' /'on top' of the body?
if you can think about alternative ways to do that, all ideas are very welcome!

thank you again for making this package available

Here's an example with 2 plots...

Add eyes + ears

This is my new favourite package - thank you so much!

Is it possible to add eyes and ears?

Thank you again

Feature request: Brain anatomy

Hi,

Would really appreciate the ability to map onto specific regions of the brain.

Thanks again for a great piece of software.

/Alistair

Extra tissues to match with GTex

Hi,
We would very much like to use gganatograms for a couple of projects running in our group. I think it fits very well with what we would like to demonstrate using GTex data, except that the pituitary and salivary glands are missing in gganatogram. Would it be possible to add them as two (optional) tissues? I think matching between gganatogram and GTex tissues would potentially be useful to other people using these data.

Best,
Greg

LICENSE file is missing

It would be nice if a license file could be added to the repo and the release tarballs as requested by the GPL.

Venous System

Your package is awesome. It could be possible to have also a depiction of the human venous system to add along with the arteries?
Minor issue... the descending aorta does not match with the circulatory system when plot together.

Thank you in advance.

YEAST PLOT

This is not really an issue but ... is it possible to create a plot of Saccharomyces cerevisiae using gganatogram? This yeast species exists in the repository https://www.ebi.ac.uk/gxa/home but I am not sure how to specify that in the command line.

Thanks
Kobchai

Basic but annoying situation

Dear all,

The package looks really great. When I copy the exercise the plot looks fantastic. However, when I use my dataset which look like:

'data.frame': 26 obs. of 4 variables:
$ organ : chr "adipose_tissue" "adrenal_gland" "brain" "heart" ...
$ colour: chr "red" "red" "red" "red" ...
$ Gene : chr "Stau1" "Stau1" "Stau1" "Stau1" ...
$ value : num 57 117 171 36 35 45 67 121 37 36 ...

And then I try to do any plot, RStudio return this:
Error in stats::complete.cases(dat) :
no input has determined the number of cases

Do you have an idea of what its happening? It's really frustrating, because as I said, when I do the dummy data.frame that you posted works fantastic.

Thank you in advance,

Best

Align Aorta

Align the Aorta so it matches the rest of the circulatory system

not able to run gganatogram

I'm getting this error

Error: GeomPolypath was built with an incompatible version of ggproto.
Please reinstall the package that provides this extension.
> grid.arrange(hgMale,ncol=1)
Error: could not find function "grid.arrange"

This is my script


devtools::install_github("jespermaag/gganatogram")
library(gganatogram)
library(dplyr)
devtools::install_github("dkahle/ggmap")
devtools::install_github("hadley/ggplot2")
install.packages("gridExtra")
library(gridExtra)
hgMale <- gganatogram(data=hgMale_key, fillOutline='#a6bddb', organism='human', sex='male', fill="colour") + theme_void()
grid.arrange(hgMale,ncol=1)


Maybe I'm not installing the packages correctly

Using gganatogram within a loop of tabs

I'm unable to print within a loop of tabs, and it seems like a limitation, as many other types of plots work using the print function.

Here's an example trying to output it using ggplotly. Is there a way to print like this through an "asis" chunk within gganatogram? Thank you.

knitr::opts_chunk$set(echo = TRUE)

library(gganatogram)
library(ggplot2)
library(plotly)

Tabs of Anatograms {.tabset}


list_to_output <- c("Tab 1","Tab 2","Tab 3")

for(i in list_to_output){
  
  cat("\n") 
  cat("### ", i, " {.tabset .tabset-pills}\n") # Create second level headings with the names.
  
  g <- gganatogram(data = hgMale_key,
            organism = "human", sex = "male",
            fill = "value",
            fillOutline = "#a6bddb")
  
  print("This is a test.")

  print(ggplotly(g),cat('\n'))
}

X and Y coordenates to get differentes organ

Hi:
How could I find the X and Y coordenates to get differentes organs:

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)

I am trying to find: Uterine cervix

Thanks in advance

The mouse brain coronal and sagittal sections

A really good tool to show gene expression in different organs. My lab work focuses on the mouse brain and we have some region-specific data to plot. After a long time searching, this is the closest R package that fits my purpose. Is it hard to make several coronal and sagittal maps? Then we can add the gene expression value to each region of the brain.

I found another brain-heatmap project 6 years ago brain-heatmap, I want to do a similar thing on ggplot2.

Looking forward to your reply.

Problem with Shiny

I am trying to upload some example to Shiny.io. to my account. Lamentably i have the same error:

Error: Unhandled Exception: Child Task 1134575266 failed: Error parsing manifest: Unknown repository for package source: neuroconductor-devel-releases

My script head:

devtools::install_github("jespermaag/gganatogram")

library(shiny)
library(dplyr)
library(gganatogram)
library(ggplot2)
library(gridExtra)
library(viridis)

hgFemale_key doesn't have spinal cord?

Hi All,

This is an awesome tool and I really like it! I was wondering though, if perhaps you could add in the spinal cord for the hgFemale_key so that it can be displayed?

Thanks so much!

Best wishes,
Claudia

new tissue list and smoothing

Dear Jesper,

I am reaching out to you regarding your impressive work with gganatogram. This is so precious!
Your tool is really inspiring to plot our data in a more comprehensive way. I have some questions:
Is there a way to expand the list of tissues (e.g. occipital cortex)? or adapt some (e.g. split lymphoid tissues into axillary, mesentary, mediastinal, split colon into right and left colon…)?
Also regarding the grouping, I am particularly interested into research focusing on CNS and on genital tract. Is there a way to smooth the plotting and increase resolution (like in ggseg3d) ? For example, I like how the brain and human body are shown in the expression atlas (frontal and sagittal view)
If you are interested/have time, we can continue to chat over email.

thank you!

REQUEST: *Organism* is missing, can you add it?

Request for additional organism or organs

Many people have contacted me asking to add their favorite organisms, so I thought I'd create a guiding thread.

How organisms were chosen

When I first started working on gganatogram, I realised that it would be impossible for me to draw the anatograms myself, so I set out to use well annotated open source SVG files.
I remembered seeing some at the Expression Atlas, and decided to use the ones here https://ebi-gene-expression-group.github.io/anatomogram/
I then also found the cell SVG from the Protein Atlas https://www.proteinatlas.org/images_static/cell.svg

Not all organisms in the Expression Atlas has an anatogram, and most species anatograms are not as well annotated as human and mouse.
Unfortunately, my drawing and anatomy skills are limited, and gganatogram is a hobby project outside my day job, so I won't be able to manually draw organisms/organs and add them.

How to add a tissue to an existing organism

If your favourite organism is included in gganatogram, but some tissues are missing, how do you add it?

Edit SVG in inkscape

The best way to add an organisms would be to download the SVG from the Expression Atlas (https://github.com/ebi-gene-expression-group/anatomogram/tree/master/src/svg), edit the file and create a new path for your tissue and draw it in inkscape (preferably avoid circles and such). If the tissue is annotated similarly to the tissues in the SVG, it should be easy for me to add the organisms.

Add coordinate points

The easiest for me would be to receive the coordinates (x,y) directly, which I can then read in to R and add to the appropriate organism.
One way to to this, which I manually did for some tissues for the human anatograms due to my incapability of handling circles in SVG, was to plot the outline of the organisms, and then plot points as outlining the new tissue. I used DescTools's DrawEllipse, which outputs the coordinates of an circle/ellipse. Otherwise, points that you can connect with a line works,

How to add a whole new organism

As, I mentioned above, I have no way of drawing a whole new organism from scratch. If you are an expert on a specific organisms, and think adding it to gganatogram will greatly help you to save time. I suggest you either point me to a highly annotated SVG file of said organism, or you commit time/commission to draw it from scratch.

I have found a SVG that I want you to add

If you have found an open source SVG that you want me to add, make sure that the anatomy is correct, and that the tissues are names properly. If there's a group of paths, the group name should be the tissue name.

I want to draw my favourite organism

Great! I would be happy to add it to gganatogram to help researchers in your field!
See the guidelines here (https://github.com/ebi-gene-expression-group/anatomogram/tree/master/src/svg) to make them similar to the Expression Atlas SVGs.

In summary

How to add a new organism
image
And send the resulting well annotated SVG to me!

Share your workflow to create the data necessary for the images...

Hi Jesper,
Would it be possible for you to share the workflow that moved the anatogram images from the figure in ArrayExpress Expression Atlas to this package, please?
If so, I think I (and others) might be able to help to make this package useful. As discussed on twitter, it would be great to add the images for female and other species too.
Thanks,
Paul

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.