Skip to content

Commit

Permalink
Merged in recent master release, bumped version number
Browse files Browse the repository at this point in the history
  • Loading branch information
fontikar committed Nov 19, 2024
2 parents 64b386a + c1a539a commit c78090a
Show file tree
Hide file tree
Showing 22 changed files with 343 additions and 200 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
^CRAN-SUBMISSION$
^revdep
^.DS_Store
^help

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ docs/
/doc/
/Meta/
revdep/
inst/cheatsheet/APCalign-cheatsheet.pptx
inst/cheatsheet/establishment-means.pdf
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: APCalign
Title: Resolving Plant Taxon Names Using the Australian Plant Census
Version: 1.1.0
Version: 1.1.2.9000
Authors@R: c(
person(given = "Daniel", family = "Falster", role = c("aut", "cre", "cph"), email = "[email protected]", comment = c(ORCID = "0000-0002-9814-092X")),
person(given = "Elizabeth", family = "Wenk", role = c("aut", "ctb"), email = "[email protected]", comment = c(ORCID = "0000-0001-5640-5910")),
Expand Down Expand Up @@ -38,7 +38,7 @@ Suggests:
here,
testthat (>= 3.0.0)
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Config/testthat/edition: 3
VignetteBuilder: knitr
URL: https://traitecoevo.github.io/APCalign/, https://github.com/traitecoevo/APCalign
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export(create_species_state_origin_matrix)
export(create_taxonomic_update_lookup)
export(default_version)
export(get_apc_genus_family_lookup)
export(get_versions)
export(load_taxonomic_resources)
export(native_anywhere_in_australia)
export(standardise_names)
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# APCalign 1.1.0
# APCalign 1.1.2

- Added `get_versions()`

- Create a genus->family lookup from the specified APC release

Expand Down
3 changes: 2 additions & 1 deletion R/APCalign-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ utils::globalVariables(
"accepted_name_2",
"alternative_accepted_name_tmp",
"pro_parte",
"suggested_collapsed_name"
"suggested_collapsed_name",
"versions"
)
)

4 changes: 2 additions & 2 deletions R/create_taxonomic_update_lookup.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
#' makes erroneous matches.
#' @param identifier A dataset, location or other identifier,
#' which defaults to NA.
#' @param quiet Logical to indicate whether to display messages while
#' @param quiet Logical to indicate whether to display messages while loading data and
#' aligning taxa.
#' @param output file path to save the output. If this file already exists,
#' this function will check if it's a subset of the species passed in and try
Expand Down Expand Up @@ -167,7 +167,7 @@ create_taxonomic_update_lookup <- function(taxa,
APNI_matches = TRUE,
imprecise_fuzzy_matches = FALSE,
identifier = NA_character_,
resources = load_taxonomic_resources(),
resources = load_taxonomic_resources(quiet = quiet),
quiet = FALSE,
output = NULL) {

Expand Down
46 changes: 44 additions & 2 deletions R/load_taxonomic_resources.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' @examples
#' \donttest{
#' load_taxonomic_resources(stable_or_current_data="stable",
#' version="0.0.2.9000")}
#' version="2024-10-11")}
#'

load_taxonomic_resources <-
Expand Down Expand Up @@ -302,7 +302,7 @@ load_taxonomic_resources <-
##'
##'
##' # Load the a stable version of the dataset
##' dataset_access_function(version="0.0.2.9000",type = "stable")
##' dataset_access_function(version="2024-10-11",type = "stable")
##'
##' @noRd
dataset_access_function <-
Expand Down Expand Up @@ -487,3 +487,45 @@ dataset_get <- function(version = default_version(),

}
}


#' Which versions of taxonomic resources are available?
#'
#' @return tibble of dates when APC/APNI resources were downloaded as a Github Release
#' @export
#'
#' @examples
#' get_versions()
get_versions <- function() {
# Check if there is internet connection
## Dummy variable to allow testing of network
network <- as.logical(Sys.getenv("NETWORK_UP", unset = TRUE))

if (!curl::has_internet() | !network) { # Simulate if network is down
message("No internet connection, please retry with stable connection (default_version)")
return(invisible(NULL))
} else {

# Get all the releases
url <-
paste0(
"https://api.github.com/repos/",
"traitecoevo",
"/",
"APCalign",
"/releases"
)

response <- httr::GET(url)

if(httr::http_error(response) | !network){
message("API currently down, try again later")
return(invisible(NULL))
} else
release_data <- httr::content(response, "text") |> jsonlite::fromJSON()

# Create table
dplyr::tibble(versions = unique(release_data$tag_name) |> sort(decreasing = TRUE)) |>
dplyr::filter(!versions == "2020-05-14") #Excluding first ever release because it is not in parquet format
}
}
39 changes: 21 additions & 18 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,28 @@ library(APCalign)
`APCalign` uses the [Australian Plant Census (APC)](https://biodiversity.org.au/nsl/services/search/taxonomy) and [Australian Plant Name Index](https://biodiversity.org.au/nsl/services/search/names) to align and update Australian plant taxon name strings. 'APCalign' also supplies information about
the established status (native/introduced) of plant taxa across different states/territories. It's useful for updating species list and intersecting them with the APC consensus understanding of established status (native/introduced).

## Installation
## Installation 🛠️

From CRAN:


```{r install, eval= FALSE}
install.packages("APCalign")
library(APCalign)
```

OR for the github version:
OR for the GitHub version:

```{r install2, eval= FALSE}
install.packages("remotes")
remotes::install_github("traitecoevo/APCalign")
install.packages("remotes")
remotes::install_github("traitecoevo/APCalign")
```

## A quick demo

Generating a look-up table can be done with just one function:

```{r,message=FALSE}
library(APCalign)
create_taxonomic_update_lookup(
taxa = c(
"Banksia integrifolia",
Expand All @@ -63,10 +60,9 @@ create_taxonomic_update_lookup(
)
```

if you're going to use APCalign more than once, it will save you time to load the taxonomic resources into memory first:
If you're going to use `APCalign` more than once, it will save you time to load the taxonomic resources into memory first:

```{r,message=FALSE}
tax_resources <- load_taxonomic_resources()
create_taxonomic_update_lookup(
Expand All @@ -83,36 +79,43 @@ create_taxonomic_update_lookup(
Checking for a list of species to see if they are classified as Australian natives:

```{r, message=FALSE}
native_anywhere_in_australia(c("Eucalyptus globulus","Pinus radiata"), resources = tax_resources)
```

Getting a family lookup table for genera from the specified taxonomy:

```{r, message=FALSE}
get_apc_genus_family_lookup(c("Eucalyptus",
"Pinus",
"Actinotus",
"Banksia",
"Acacia",
"Triodia"),
resources = tax_resources)
```


## Shiny application
## Shiny application ✨

We also developed a shiny application for non-R users to update and align their taxonomic names. You can find the application here: https://unsw.shinyapps.io/APCalign-app

## Learn more
## Cheatsheet

<a href="https://github.com/traitecoevo/APCalign/tree/master/inst/cheatsheet/APCalign-cheatsheet.pdf"><img src="man/figures/APCalign-cheatsheet.png" width="60%"/></a>

## Learn more 📚

Highly recommend looking at our [Getting Started](https://traitecoevo.github.io/APCalign/articles/APCalign.html) vignette to learn about how to use `APCalign`. You can also learn more about our [taxa matching algorithm](https://traitecoevo.github.io/APCalign/articles/updating-taxon-names.html).

## Show us support 💛

Please consider citing our work, we are really proud of it!

```{r}
citation("APCalign")
```

## Found a bug?
## Found a bug? 🐛

Did you come across an unexpected taxon name change? Elusive error you can't debug - [submit an issue](https://github.com/traitecoevo/APCalign/issues) and we will try our best to help.

Expand Down
Loading

0 comments on commit c78090a

Please sign in to comment.