shinybody

An Interactive Anatomography Widget for Shiny

https://github.com/robert-norberg/shinybody

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.5%) to scientific vocabulary
Last synced: 6 months ago · JSON representation

Repository

An Interactive Anatomography Widget for Shiny

Basic Info
  • Host: GitHub
  • Owner: robert-norberg
  • License: other
  • Language: R
  • Default Branch: main
  • Size: 810 KB
Statistics
  • Stars: 13
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

shinybody

shinybody is an htmlwidget of the human body that allows you to hide/show and assign colors to 79 different body parts. The human widget is an htmlwidget, so it works in Quarto documents, R Markdown documents, or anything other HTML medium. It also functions as an input/output widget in a shiny app.

Installation

You can install the development version of shinybody from GitHub with:

``` r

install.packages("devtools")

devtools::install_github("robert-norberg/shinybody") ```

You can install from CRAN with:

r install.packages("shinybody")

Example

Here is a simple example of using the human widget in an R Markdown document:

``` r library(shinybody)

exampleorgans <- c("brain", "eye", "heart", "stomach", "bladder") myorgandf <- subset(shinybody::shinybodyorgans, organ %in% exampleorgans) myorgandf$show <- TRUE myorgandf$color <- grDevices::rainbow(nrow(myorgandf)) myorgandf$selected[1] <- TRUE myorgandf$hovertext <- mapply( function(o, clr) htmltools::strong(tools::toTitleCase(o), style = paste("color:", clr)), myorgandf$organ, myorgandf$color, SIMPLIFY = FALSE ) human(gender = "female", organdf = myorgandf) ```

Here is a complete list of the organs that are available:

#>                           Male Female
#> adipose_tissue              ✅     ✅
#> adrenal_gland               ✅     ✅
#> amygdala                    ✅     ✅
#> aorta                       ✅     ✅
#> appendix                    ✅     ✅
#> atrial_appendage            ✅     ✅
#> bladder                     ✅     ✅
#> bone                        ✅     ✅
#> bone_marrow                 ✅     ✅
#> brain                       ✅     ✅
#> breast                      ✅     ✅
#> bronchus                    ✅     ✅
#> caecum                      ✅     ✅
#> cartilage                   ✅     ✅
#> cerebellar_hemisphere       ✅     ✅
#> cerebellum                  ✅     ✅
#> cerebral_cortex             ✅     ✅
#> circulatory_system          ✅     ✅
#> colon                       ✅     ✅
#> coronary_artery             ✅     ✅
#> diaphragm                   ✅     ✅
#> duodenum                    ✅     ✅
#> ectocervix                  ❌     ✅
#> endometrium                 ❌     ✅
#> epididymis                  ✅     ❌
#> esophagus                   ✅     ✅
#> eye                         ✅     ✅
#> fallopian_tube              ❌     ✅
#> frontal_cortex              ✅     ✅
#> gall_bladder                ✅     ✅
#> gastroesophageal_junction   ✅     ✅
#> heart                       ✅     ✅
#> ileum                       ✅     ✅
#> kidney                      ✅     ✅
#> left_atrium                 ✅     ✅
#> left_ventricle              ✅     ✅
#> liver                       ✅     ✅
#> lung                        ✅     ✅
#> lymph_node                  ✅     ✅
#> mitral_valve                ✅     ✅
#> nasal_pharynx               ✅     ✅
#> nasal_septum                ✅     ✅
#> nerve                       ✅     ✅
#> nose                        ✅     ✅
#> oral_cavity                 ✅     ✅
#> ovary                       ❌     ✅
#> pancreas                    ✅     ✅
#> parotid_gland               ✅     ✅
#> penis                       ✅     ❌
#> pituitary_gland             ✅     ✅
#> placenta                    ❌     ✅
#> pleura                      ✅     ✅
#> prefrontal_cortex           ✅     ✅
#> prostate_gland              ✅     ❌
#> pulmonary_valve             ✅     ✅
#> rectum                      ✅     ✅
#> renal_cortex                ✅     ✅
#> salivary_gland              ✅     ✅
#> seminal_vesicle             ✅     ❌
#> skeletal_muscle             ✅     ✅
#> skin                        ✅     ✅
#> small_intestine             ✅     ✅
#> smooth_muscle               ✅     ✅
#> spinal_cord                 ✅     ✅
#> spleen                      ✅     ✅
#> stomach                     ✅     ✅
#> submandibular_gland         ✅     ✅
#> temporal_lobe               ✅     ✅
#> testis                      ✅     ❌
#> throat                      ✅     ✅
#> thyroid_gland               ✅     ✅
#> tongue                      ✅     ✅
#> tonsil                      ✅     ✅
#> trachea                     ✅     ✅
#> tricuspid_valve             ✅     ✅
#> uterine_cervix              ❌     ✅
#> uterus                      ❌     ✅
#> vagina                      ❌     ✅
#> vas_deferens                ✅     ❌

Here is a very simple shiny app using the human widget:

``` r library(shiny) library(shinybody)

maleorgans <- shinybodyorgans$organ[shinybodyorgans$male] femaleorgans <- shinybodyorgans$organ[shinybodyorgans$female]

ui <- function() { fluidPage( selectInput( inputId = "gender", label = "Select Gender", choices = c("male", "female"), multiple = FALSE, selected = "male" ), selectInput( inputId = "bodyparts", label = "Select Body Parts to Show", choices = maleorgans, multiple = TRUE, selected = maleorgans[1:5] ), humanOutput(outputId = "humanwidget"), verbatimTextOutput(outputId = "clickedbodypartmsg"), verbatimTextOutput(outputId = "selectedbodypartsmsg") ) }

server <- function(input, output, session) { observe({ g <- input$gender if (g == "male") { organchoices <- maleorgans } else { organchoices <- femaleorgans } updateSelectInput( session = session, inputId = "bodyparts", choices = organchoices, selected = organ_choices[1:5] ) })

output$humanwidget <- renderHuman({ selectedorgandf <- subset(shinybody::shinybodyorgans, organ %in% input$bodyparts) selectedorgandf$show <- TRUE human( gender = input$gender, organdf = selectedorgandf, selectcolor = "red" ) }) output$clickedbodypartmsg <- renderPrint({ paste("You Clicked:", input$clickedbodypart) }) output$selectedbodypartsmsg <- renderPrint({ paste("Selected:", paste(input$selectedbody_parts, collapse = ", ")) }) }

shinyApp(ui = ui, server = server) ```

shinybody is crosstalk compatible. Here is an example of a simple crosstalk widget using shinybody and DT.

``` r library(shinybody) library(DT)

exampleorgans <- c("brain", "eye", "heart", "stomach", "bladder") myorgandf <- subset(shinybody::shinybodyorgans, organ %in% exampleorgans) myorgandf$show <- TRUE myorgandf$color <- grDevices::rainbow(nrow(myorgandf)) myorgandf$selected[1] <- TRUE myorgandf$hovertext <- mapply( function(o, clr) htmltools::strong(tools::toTitleCase(o), style = paste("color:", clr)), myorgandf$organ, myorgan_df$color, SIMPLIFY = FALSE )

myorgandfshareddata <- crosstalk::SharedData$new(myorgandf)

checkboxes <- crosstalk::filtercheckbox( id = "filter", label = "Organ", sharedData = myorgandfshared_data, group = ~organ )

tbl <- DT::datatable( data = myorgandfshareddata, options = list( pageLength = 10, columnDefs = list( list(visible = FALSE, targets = c("male", "female", "show", "selected", "hovertext")) ) ), rownames = FALSE, height = "500px", autoHideNavigation = TRUE )

crosstalk::bscols( htmltools::tagList(checkboxes, tbl), human(gender = "female", organdf = myorgandfshared_data), device = "sm" ) ```

Owner

  • Name: Robert Norberg
  • Login: robert-norberg
  • Kind: user

Data Scientist IV on the Health Informatics team.

GitHub Events

Total
  • Release event: 3
  • Watch event: 12
  • Delete event: 5
  • Member event: 1
  • Push event: 40
  • Pull request review event: 1
  • Pull request event: 11
  • Fork event: 1
  • Create event: 13
Last Year
  • Release event: 3
  • Watch event: 12
  • Delete event: 5
  • Member event: 1
  • Push event: 40
  • Pull request review event: 1
  • Pull request event: 11
  • Fork event: 1
  • Create event: 13

Packages

  • Total packages: 1
  • Total downloads:
    • cran 165 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: shinybody

An Interactive Anatomography Widget for 'shiny'

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 165 Last month
Rankings
Dependent packages count: 27.5%
Forks count: 29.0%
Stargazers count: 32.5%
Dependent repos count: 33.8%
Average: 42.0%
Downloads: 87.0%
Maintainers (1)
Last synced: 7 months ago

Dependencies

DESCRIPTION cran