Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Build SVG Custom User Interface in R, rmd, qmd and Shiny

NotificationsYou must be signed in to change notification settings

patzaw/bscui

Repository files navigation

CRAN_Status_BadgeCRAN Download Badge

Render SVG as interactive figures to display contextual information,with selectable and clickable user interface elements. These figures canbe seamlessly integrated into ‘rmarkdown’ and ‘Quarto’ documents, aswell as ‘shiny’ applications, allowing manipulation of elements andreporting actions performed on them. Additional features include pan,zoom in/out functionality, and the ability to export the figures in SVGor PNG formats.

Installation

From CRAN

install.packages("bscui")

Dependencies

The following R packages available on CRAN are required:

And those are suggested for building the vignettes and running someexamples:

  • knitr: A General-PurposePackage for Dynamic Report Generation in R
  • rmarkdown: DynamicDocuments for R
  • here: A Simpler Way to FindYour Files
  • xml2: Parse XML
  • dplyr: A Grammar of DataManipulation
  • readr: Read RectangularText Data
  • stringr: Simple,Consistent Wrappers for Common String Operations
  • glue: Interpreted StringLiterals
  • scales: Scale Functionsfor Visualization
  • shiny: Web ApplicationFramework for R
  • reactable: InteractiveData Tables for R
  • reactable.extras:Extra Features for ‘reactable’ Package

From github

devtools::install_github("patzaw/bscui")

Documentation

vignette("bscui")

Examples

Building figures

This example relies on a figure of animal cells taken fromSwissBioPics.

##################################@### Preparing data ----library(bscui)library(xml2)library(readr)library(dplyr)svg<-xml2::read_xml(system.file("examples","Animal_cells.svg.gz",package="bscui"))info<-readr::read_tsv(system.file("examples","uniprot_cellular_locations.txt.gz",package="bscui"),col_types=strrep("c",6))|>   mutate(id= sub("-","",`Subcellular location ID`))##################################@### Building the figure ----figure<- bscui(svg)|>   set_bscui_ui_elements(info|>         mutate(ui_type="selectable",title=Name         )|>         select(id,ui_type,title)   )|>   set_bscui_styles(info|>         filter(Name=="Cytosol")|>         mutate(fill="#FF7F7F")|>         select(id,fill)   )|>   set_bscui_attributes(info|>         filter(Name=="Cytoskeleton")|>         mutate(display="none")|>         select(id,display)   )|>   set_bscui_selection("SL0188")|>   set_bscui_options(zoom_min=1,clip=TRUE)figure##################################@### Saving the figure ----if(interactive()){## Temporary directory to save example filetdir<- tempdir()## Interactive html filef_path<- file.path(tdir,"figure.html")figure|>htmlwidgets::saveWidget(file=f_path)   cat(f_path)## PNG imagef_path<- file.path(tdir,"figure.png")figure|>      set_bscui_options(show_menu=FALSE)|>      export_bscui_to_image(file=f_path,zoom=2)   cat(f_path)}

Figures in ‘shiny’

The following ‘shiny’ application relies on human female anatomicaldiagram taken from theEBI gene expressiongroup.

shiny::runApp(system.file("examples","shiny-anatomogram",package="bscui"))

About

Build SVG Custom User Interface in R, rmd, qmd and Shiny

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp