Git Product home page Git Product logo

glossary's Introduction

Introduction

This small script allows the management of simple glossaries.

Dependencies

This script depends on the following packages:

library(magrittr)
library(dplyr)
library(glue)
library(reactable)

Use

Load and create a glossary

source("glossary.R")
glossary <- create_glossary()

Add terms in the glossary

glossary$add_term(
   "UMI",
   "Unique Molecular Identifier. Each PCR primer is associated to a UMI to identify PCR duplicates when quantifying the transcripts. Therefore the number of counts corresponds to the number of UMI which is the quantification measure per feature."
)

Synonyms can also be provided:

glossary$add_term(
   "MT",
   "Genes coded by mitochondrial genome. MT (%) corresponds to the percentage of UMI corresponding to mitochondrial genes."
)
glossary$add_synonyms("MT", "MT (%)")

Showing the glossary

  • glossary$get_table() returns the glossary tibble
  • glossary$view() shows the glossary in a reactable

Get definitions

The following function is used to get the definitions of terms of interest. It’s case insensitive and support plurals by default.

glossary$get_definitions(c("mt", "UMIs"))
## # A tibble: 2 x 3
##   Term  Definition                                                      Synonyms
##   <chr> <chr>                                                           <list>  
## 1 mt    Genes coded by mitochondrial genome. MT (%) corresponds to the… <chr [2…
## 2 UMIs  Unique Molecular Identifier. Each PCR primer is associated to … <chr [1…

In an markdown or html document, the definitions can be shown in tooltips using the glossary$get_html_definitions() function. For example: UMIs. CSS style can be customized using the style parameter (Unfortunately, CSS are not rendered in GitHub markdown as it is a part of the sanitization process).

To make it easier to use in an Rmd document in RStudio this function can be copied in a function with a shorter name such as:

td <- glossary$get_html_definitions

And then the following markdown snippet can be added in RStudio (Edit Snippets button in Global Options -> Code):

snippet td
    `r${2} td(${1})`

glossary's People

Contributors

patzaw avatar

Stargazers

Jimmy Briggs avatar

Watchers

 avatar

glossary's Issues

First reference to term definition

The first time the definition should appear in the text and not as a tooltip .
It should be the default feature that could be turned off.

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.