-
Notifications
You must be signed in to change notification settings - Fork 11
/
README.Rmd
170 lines (116 loc) · 4.63 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
bold
====
```{r echo=FALSE}
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
warning = FALSE,
message = FALSE
)
```
[![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 version](https://www.r-pkg.org/badges/version/bold)](https://cran.r-project.org/package=bold)
[![cran checks](https://cranchecks.info/badges/worst/bold)](https://cranchecks.info/pkgs/bold)
[![R-check](https://github.com/ropensci/bold/workflows/R-check/badge.svg)](https://github.com/ropensci/bold/actions/)
[![codecov.io](https://codecov.io/github/ropensci/bold/coverage.svg?branch=master)](https://codecov.io/github/ropensci/bold?branch=master)
[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/bold)](https://github.com/r-hub/cranlogs.app)
`bold` accesses BOLD barcode data.
The Barcode of Life Data Systems (BOLD) is designed to support the generation and application of DNA barcode data. The platform consists of four main modules: a data portal, a database of barcode clusters, an educational portal, and a data collection workbench.
This package retrieves data from the BOLD database of barcode clusters, and allows for searching of over 1.7M public records using multiple search criteria including sequence data, specimen data, specimen *plus* sequence data, as well as trace files.
Documentation for the BOLD API: http://v4.boldsystems.org/index.php/api_home
See also the taxize book for more options for taxonomic workflows with BOLD: https://taxize.dev/
## Installation
__Installation instructions__
__Stable Version__
```{r eval=FALSE}
install.packages("bold")
```
__Development Version__
Install `sangerseqR` first (used in function `bold::bold_trace()` only)
For R < 3.5
```{r eval=FALSE}
source("http://bioconductor.org/biocLite.R")
biocLite("sangerseqR")
```
For R >= 3.5
```{r eval=FALSE}
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("sangerseqR")
```
Then install `bold`
```{r eval=FALSE}
remotes::install_github("ropensci/bold")
```
## Usage
```{r}
library("bold")
```
### Search for sequence data only
By default you download `fasta` file, which is given back to you as a `data.frame`
```{r}
res <- bold_seq(taxon='Coelioxys')
head(res)
```
You can optionally get back the `crul` response object
```{r}
res <- bold_seq(taxon='Coelioxys', response=TRUE)
res$response_headers
```
### Search for specimen data only
By default you download `tsv` format data, which is given back to you as a `data.frame`
```{r}
res <- bold_specimens(taxon='Osmia')
head(res[,1:8])
```
### Search for specimen plus sequence data
By default you download `tsv` format data, which is given back to you as a `data.frame`
```{r}
res <- bold_seqspec(taxon='Osmia', sepfasta=TRUE)
res$fasta[1:2]
```
Or you can index to a specific sequence like
```{r}
res$fasta['GBAH0293-06']
```
### Get trace files
This function downloads files to your machine - it does not load them into your R session - but prints out where the files are for your information.
```{r}
x <- bold_trace(ids = 'ACRJP618-11', progress = FALSE)
read_trace(x$ab1)
```
### Large data
Sometimes with `bold_seq()` you request a lot of data, which can cause problems due
to BOLD's servers.
An example is the taxonomic name _Arthropoda_. When you send a request like
`bold_seq(taxon = "Arthropoda")` BOLD attempts to give you back sequences
for all records under _Arthropoda_. This, as you can imagine, is a lot of
sequences.
```{r}
library("taxize")
```
Using `taxize::downstream` get children of _Arthropoda_
```{r}
x <- downstream("Arthropoda", db = "ncbi", downto = "class")
nms <- x$Arthropoda$childtaxa_name
```
Optionally, check that the name exists in BOLD's data. Any that are not in
BOLD will give back a row of NAs
```{r}
checks <- bold_tax_name(nms)
# all is good
checks[,1:5]
```
Then pass those names to `bold_seq()`. You could pass all names in at once,
but we're trying to avoid the large data request problem here, so run each
one separately with `lapply` or a for loop like request.
```{r eval = FALSE}
out <- lapply(nms, bold_seq)
```
## Citation
Get citation information for `bold` in R by running: `citation(package = 'bold')`
## Meta
* Please [report any issues or bugs](https://github.com/ropensci/bold/issues)
* License: MIT
* Get citation information for `bold` in R doing `citation(package = 'bold')`
* Please note that this project is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By participating in this project you agree to abide by its terms.