Skip to content

Commit

Permalink
Merge branch 'master' into async
Browse files Browse the repository at this point in the history
  • Loading branch information
salix-d committed Sep 8, 2023
2 parents 4148a09 + 90e44fb commit 68f12c8
Show file tree
Hide file tree
Showing 17 changed files with 117 additions and 116 deletions.
59 changes: 4 additions & 55 deletions .github/workflows/R-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
config:
- { os: windows-latest, r: 'release'}
- { os: macOS-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release'}
- { os: ubuntu-latest, r: 'release'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
Expand All @@ -35,55 +35,9 @@ jobs:
extra-packages: any::rcmdcheck
needs: check

# - name: Install dependencies
# run: |
# install.packages("stringi", type="source")
# remotes::install_deps(dependencies = TRUE)
# remotes::install_cran(c("rcmdcheck", "BiocManager"))
# BiocManager::install("sangerseqR")
# shell: Rscript {0}
#
# - uses: r-lib/actions/check-r-package@v2
# with:
# upload-snapshots: true

#- name: Query dependencies
# run: |
# install.packages('remotes')
# saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
# writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
# shell: Rscript {0}

#- name: Cache R packages
# if: runner.os != 'Windows'
# uses: actions/cache@v1
# with:
# path: ${{ env.R_LIBS_USER }}
# key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
# restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

#- name: Install system dependencies
# if: runner.os == 'Linux'
# run: |
# while read -r cmd
# do
# eval sudo $cmd
# done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')

# - name: Install system dependencies
# if: runner.os == 'Linux'
# env:
# RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
# run: |
# Rscript -e "remotes::install_github('r-hub/sysreqs')"
# sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
# sudo -s eval "$sysreqs"

# - name: Check
# env:
# _R_CHECK_CRAN_INCOMING_: false
# run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
# shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true

- name: Session info
run: |
Expand All @@ -92,11 +46,6 @@ jobs:
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
vignettes/cache
.Rproj
*.Rproj
.Rproj.user
.Rhistory
revdep/checks.noindex
revdep/data.sqlite
revdep/library.noindex
revdep/library.noindex
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ BugReports: https://github.com/ropensci/bold/issues
LazyData: yes
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
X-schema.org-applicationCategory: Data Access
X-schema.org-keywords: biodiversity, barcode, DNA, sequences, fasta
X-schema.org-isPartOf: https://ropensci.org
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bold 1.3.0

* Similarly, the now deprecated `bold_identify_parents()` has new argument checks and will throw warnings to not affect existing workflows.

* For `bold_tax_id2()` and `bold_tax_name()`, when querying multiple taxa, if one fails, the loop won't break and will instead throw the API error as a warning. The ouput object will also have 2 new attributes "errors" and "params" that will let you see what errors occured for with request and what parameters were use for the request.
* For `bold_tax_id2()` and `bold_tax_name()`, when querying multiple taxa, if one fails, the loop won't break and will instead throw the API error as a warning. The output object will also have 2 new attributes "errors" and "params" that will let you see what errors occurred for with request and what parameters were use for the request.
To make it easy to retrieve these attributes, 3 new functions have been created:
* `bold_get_attr()` will return a list of the two attributes
* `bold_get_errors()` will return a list of the errors
Expand Down
3 changes: 3 additions & 0 deletions R/bold_filter.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
if (getRversion() >= "2.15.1") {
utils::globalVariables(c("nucleotides", ".I"))
}
#' Filter BOLD specimen + sequence data (output of bold_seqspec)
#'
#' Picks either shortest or longest sequences, for a given grouping variable
Expand Down
2 changes: 1 addition & 1 deletion R/bold_identify.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#' lot of sequences - you are doing a separate query for each one, so it can
#' take a long time - if you run into errors let us know.
#'
#' @section db parmeter options:
#' @section db parameter options:
#'
#' - COX1 Every COI barcode record on BOLD with a minimum sequences
#' length of 500bp (warning: unvalidated library and includes records without
Expand Down
2 changes: 1 addition & 1 deletion R/bold_identify_taxonomy.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ methods::setMethod(
definition = function(x, taxOnly = TRUE) {
b_assert_length(x, len = 0L, name = "x")
taxOnly <- b_assert_logical(taxOnly, name = "taxOnly")
hasID <- vapply(x, \(x) "ID" %in% colnames(x), NA)
hasID <- vapply(x, function(x) "ID" %in% colnames(x), NA)
if (all(!hasID)) {
stop("no column 'ID' found in x")
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/bold_seqspec.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bold_seqspec <- function(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
b_sepFasta(out, format = format)
}
}
#' Seperate sequences (fasta) from `bold_seqspec` output.
#' Separate sequences (fasta) from `bold_seqspec` output.
#'
#' @param x (object) The output of a `bold_seqspec` call.
#' @param format (character) The format used in the `bold_seqspec` call. One of 'tsv' (default) or 'xml'.
Expand Down
2 changes: 1 addition & 1 deletion R/bold_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ b_simplify_stats <- function(x, dataType) {
n <- which(vapply(x, inherits, NA, "integer"))
ov <- vapply(x[-n], `[[`, 0L, "count")
ov <- as.data.frame(c(x[n],ov))
dd <- lapply(x[-n], \(x) {
dd <- lapply(x[-n], function(x) {
y <- x$drill_down
i <- 0
while (!is.data.frame(y) && i < 5) {
Expand Down
2 changes: 1 addition & 1 deletion R/bold_tax_id2.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ b_process_tax_id <- function(x, ids, types, tree) {
out <- b_format_tax_id(out, ids = ids)
} else {
tmp <-
lapply(b_nameself(names(out)), \(id) b_format_tax_id(out[[id]], id))
lapply(b_nameself(names(out)), function(id) b_format_tax_id(out[[id]], id))
out <-
lapply(b_nameself(types), b_grp_dataTypes_tree, x = tmp)
if ("basic" %in% names(out) &&
Expand Down
2 changes: 1 addition & 1 deletion R/bold_trace.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bold_read_trace <- function(x){
else
`names<-`(x, basename(x))
}
lapply(trace_paths, \(trace_path) {
lapply(trace_paths, function(trace_path) {
if (file.exists(trace_path)) {
sangerseqR::readsangerseq(trace_path)
} else {
Expand Down
40 changes: 18 additions & 22 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ b_parse <- function(res, format, raise = TRUE, cleanData = FALSE, multiple = FAL
}
}
b_cleanData <- function(x, emptyValue = NA){
col2clean <- vapply(x, \(x) {
col2clean <- vapply(x, function(x) {
any(b_detect(x, "|", max_count = 1, fixed = TRUE), na.rm = TRUE)
}, NA)
col2clean <- which(col2clean, useNames = FALSE)
Expand Down Expand Up @@ -161,25 +161,21 @@ b_ennum <- function(x, join_word = "and", quote = FALSE) {
}
b_fix_taxonName <- function(x){
# see issue #84
b_replace(
x,
# check if supposed to:
c(
# be quoted; keep quoted text
" ('[^']*)$",
# be in parenthesis; keep parenthesis text
" (\\([^\\(]*)$",
# end with a dot (there might be more cases, but haven't seen them yet)
"( sp(\\. nov)?$)"
),
# add :
c(
# closing quote
" $1\\\\$2\\\\'",
# closing parenthesis
"$1$2)",
# end dot
"$1"
),
vectorize_all = FALSE)
# check if supposed to:
x <- b_replace(x,
# be quoted; keep quoted text
" ('[^']*)$",
# add closing quote
" \\\\$1\\\\'")
x <- b_replace(x,
# be in parenthesis; keep parenthesis text
" (\\([^\\(]*)$",
# add closing parenthesis
" $1)")
x <- b_replace(x,
# end with a dot (there might be more cases, but haven't seen them yet)
"( sp(\\. nov)?$)",
# add end dot
"$1.")
x
}
10 changes: 6 additions & 4 deletions R/utils_assert.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ b_validate <- function(x, choices, name){
}
}
b_get_db <- function(x){
x <- tolower(x)
if (b_detect(x, '^pub(lic)?$|_public$'))
opts <- list(case_insensitive = TRUE)
if (b_detect(x, '^COX[1I]$', opts_regex = opts))
"COX1"
else if (b_detect(x, '^pub(lic)?$|_public$', opts_regex = opts))
"COX1_SPECIES_PUBLIC"
else if (b_detect(x, '^spe(cies)?$|_species$'))
else if (b_detect(x, '^spe(cies)?$|_species$', opts_regex = opts))
"COX1_SPECIES"
else if (b_detect(x, '^(cox1_)?(l640)?bp$'))
else if (b_detect(x, '^(cox[1I]_)?(l640)?bp$', opts_regex = opts))
"COX1_L640bp"
else
x
Expand Down
Loading

0 comments on commit 68f12c8

Please sign in to comment.