forked from nine2k/II-I-II-baRcodes-I-II-III
-
Notifications
You must be signed in to change notification settings - Fork 12
/
README.Rmd
143 lines (94 loc) · 5.66 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
# baRcodeR
<!-- badges: start -->
[![Status](https://www.r-pkg.org/badges/version/baRcodeR)](https://CRAN.R-project.org/package=baRcodeR)
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/baRcodeR)](https://CRAN.R-project.org/package=baRcodeR)
[![Codecov test
coverage](https://codecov.io/gh/ropensci/baRcodeR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/ropensci/baRcodeR?branch=master)
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![CRAN
checks](https://github.com/r-hub/cchecksbadges/blob/gh-pages/summary/baRcodeR.svg)](https://github.com/r-hub/cchecksbadges/blob/gh-pages/summary/baRcodeR.svg)
[![rOpenSci
peer-review](https://badges.ropensci.org/338_status.svg)](https://github.com/ropensci/software-review/issues/338)
<!-- badges: end -->
baRcodeR generates labels for more repeatable workflows with biological samples
## Installation
You can install the released version of baRcodeR from [CRAN](https://CRAN.R-project.org) with:
```
install.packages("baRcodeR")
```
And the development version from [GitHub](https://github.com/) with:
```
# install.packages("devtools")
devtools::install_github("ropensci/baRcodeR", build_vignettes = T)
# for windows users to build vignettes
# install_github("ropensci/baRcodeR", build_opts = c("--no-resave-data", "--no-manual"), build_vignettes = TRUE)
```
> NOTE: Restarting RStudio is necessary for the addin for baRcodeR to appear.
## Quick Start
Text identifiers can be created in a sequential or hierarchical pattern.
```{r}
library(baRcodeR)
example_labels <- uniqID_maker(user = FALSE, string = "Example", level = 1:80)
head(example_labels)
```
Then the text identifiers can be printed out with a laser printer on sticker sheets.
```{r include = F, eval = F}
# generate the image shown in vignettes as png rather than pdf so it shows up in markdown
# pdf_file_name <- "man/figures/example_file"
# create_PDF(Labels = example_labels, name = pdf_file_name)
# pdf_file <- magick::image_read_pdf("man/figures/example_file.pdf")
# magick::image_write(pdf_file, path = "man/figures/example.png", format = "png")
```
```{r eval = F}
pdf_file_name <- tempfile()
create_PDF(Labels = example_labels, name = pdf_file_name)
```
```{r echo = F}
knitr::include_graphics("man/figures/example.png")
```
Th particular layout above defaults to ULINE 1.75" * 0.5" labels but other layouts can be specified through parameters in the `custom_create_PDF` function.
## Introduction
`baRcodeR` is a R package for generating unique identifier strings and printable 2D (QR) barcodes, with the aim of improving repeatability of labelling, tracking and curating data from biological samples. Specifically, users can:
* generate simple ID codes (Ex001, Ex002, Ex003 ...),
* generate hierarchical (i.e. nested) ID codes (A01-B01, A01-B02, A02-B01, A02-B02, A03-B01 ...),
* generate printable PDF files of paired ID codes and QR barcodes with default spacing for ULINE 1.75" * 0.5" WEATHER RESISTANT LABEL for laser printer; item # S-19297 (uline.ca)
* customize the PDF layout for any type of printable format (e.g, vinyl stickers, waterproof paper)
* generate reproducible code for archival purposes (e.g. in publications or online repositories)
* create CSV files to link unique IDs and sampling hierarchy with downstream data collection workflows. For example, the PyTrackDat pipeline can be used to set up a web-based data collection platform: https://github.com/pytrackdat/pytrackdat
Creating unique, scannable barcodes generally involves two steps:
1. Generate unique ID codes with `uniqID_maker()` or `uniqID_hier_maker()`
2. Create a PDF file containing unique ID codes coupled with 2D barcode using `create_PDF()`
If you already have ID codes saved in a CSV file, the csv can be read into a `data.frame()` in R. The `label` column, if it exists will be used as input to generate barcodes. Otherwise, the first column in the data frame will be used.
> NOTE: When printing from pdf, ensure that 'anti-aliasing' or 'smoothing' options are turned OFF, and that you are not using 'fit to page' or similar options that will re-scale the output.
![Flowchart of major functions](man/figures/Flowchart.png)
### Cheat Sheet
A 2-page, quick-reference guide is available via [Figshare](https://dx.doi.org/10.6084/m9.figshare.7043309)
## Usage with RStudio addin
Please load the vignette "Use Addin".
```{r eval = F}
library(baRcodeR)
vignette("use-addin")
```
## Usage from the console
Please load the vignette "Using-baRcodeR" for console use.
```{r eval = F}
vignette("Using-baRcodeR")
```
# Contribution
Please note that the 'baRcodeR' project is released with a
[Contributor Code of Conduct](https://github.com/ropensci/baRcodeR/blob/master/CODE_OF_CONDUCT.md).
By contributing to this project, you agree to abide by its terms.
Please document issues with a description, a minimal reproducible example, and the `sessionInfo()`.
```{r}
sessionInfo()
```
# See also:
- [zintr](https://github.com/carlganz/zintr)is an R interface to the C zint library. Use zintr if you want to create single barcode images. zintr does not include functions for (i) automating the creation of biologically-relevant, unique ID codes or (ii) customizable layouts for printing multiple barcodes.
- [zint](https://zint.org.uk/) is a C library that generates a variety of different barcodes. Just like zintr, zint produces single barcode images.
[![ropensci_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org)