| Title: | Genesys PGR Client |
|---|---|
| Description: | Access data on plant genetic resources from genebanks around the world published on Genesys (<https://www.genesys-pgr.org>). Your use of data is subject to terms and conditions available at <https://www.genesys-pgr.org/content/legal/terms>. |
| Authors: | Global Crop Diversity Trust [cph], Matija Obreza [aut, cre], Nora Castaneda [ctb] |
| Maintainer: | Matija Obreza <[email protected]> |
| License: | Apache License 2.0 |
| Version: | 2.2.0 |
| Built: | 2026-05-16 07:12:27 UTC |
| Source: | https://github.com/cran/genesysr |
Get partial API v2 URL for the provided path
api2_url(path)api2_url(path)
path |
relative path of the API v2 endpoint (e.g. |
Returns "/api/v2" + path
api2_url("/me")api2_url("/me")
Provide OAuth2 token to use for authorization with Genesys
authorization(authorization)authorization(authorization)
authorization |
OAuth2 Authorization header obtained from somewhere else (e.g. an ENV variable) |
Run Land-or-Sea check on MCPD data. Uploads only rows where ORIGCTY, DECLATITUDE and DECLONGITUDE are provided.
check_country(mcpd)check_country(mcpd)
mcpd |
Accession passport data in MCPD format |
Results from validator
## Not run: geoCheck <- genesysr::check_country(mcpd) ## End(Not run)## Not run: geoCheck <- genesysr::check_country(mcpd) ## End(Not run)
Run Land-or-Sea check on MCPD data using https://validator.genesys-pgr.org. Uploads only rows where DECLATITUDE and DECLONGITUDE are provided. In practice it is better to use 'check_country' if ORIGCTY data exists.
check_landorsea(mcpd)check_landorsea(mcpd)
mcpd |
Accession passport data in MCPD format |
Results from validator
## Not run: waterCheck <- genesysr::check_landorsea(mcpd) ## End(Not run)## Not run: waterCheck <- genesysr::check_landorsea(mcpd) ## End(Not run)
Duplicate input rows are removed using dplyr::distinct() and results are returned for unique rows.
check_taxonomy(mcpd, toCurrentTaxa = FALSE)check_taxonomy(mcpd, toCurrentTaxa = FALSE)
mcpd |
Accession passport data in MCPD format |
toCurrentTaxa |
Should obsoleted names be reported? |
Results from validator
## Not run: taxaCheck <- genesysr::check_taxonomy(mcpd) ## End(Not run)## Not run: taxaCheck <- genesysr::check_taxonomy(mcpd) ## End(Not run)
The client must be enabled for Client Credential grant on Genesys.
client_login()client_login()
Download passport data for one genebank in Excel format and save it to disk
download_mcpd(instituteCode, file = NULL)download_mcpd(instituteCode, file = NULL)
instituteCode |
FAO WIEWS institute code |
file |
Target file name. Defaults to Genesys-provided file name in the current working directory. |
The downloaded MCPD file name
## Not run: # Download MCPD passport data for NGA039 excelFile <- download_mcpd("NGA039") ## End(Not run)## Not run: # Download MCPD passport data for NGA039 excelFile <- download_mcpd("NGA039") ## End(Not run)
Download PDCI data for one genebank in Excel format and save it to disk.
download_pdci(instituteCode, file = NULL)download_pdci(instituteCode, file = NULL)
instituteCode |
FAO WIEWS institute code |
file |
Target file name. Defaults to Genesys-provided file name in the current working directory. |
The downloaded PDCI file name
## Not run: # Download PDCI data for NGA039 excelData <- download_pdci("NGA039") ## End(Not run)## Not run: # Download PDCI data for NGA039 excelData <- download_pdci("NGA039") ## End(Not run)
Add filter on accession DOI
filter_DOI(filter = list(), DOI)filter_DOI(filter = list(), DOI)
filter |
Existing filters (or blank list if not provided) |
DOI |
Accession DOI |
Add filter by genus
filter_GENUS(filter = list(), GENUS)filter_GENUS(filter = list(), GENUS)
filter |
Existing filters (or blank list if not provided) |
GENUS |
List of genera |
Add filter by genus
filter_INSTCODE(filter = list(), INSTCODE)filter_INSTCODE(filter = list(), INSTCODE)
filter |
Existing filters (or blank list if not provided) |
INSTCODE |
List of WIEWS institute codes |
Add filter on Country of origin of material
filter_ORIGCTY(filter = list(), ORIGCTY)filter_ORIGCTY(filter = list(), ORIGCTY)
filter |
Existing filters (or blank list if not provided) |
ORIGCTY |
Country of origin |
Add filter on Biological status of sample
filter_SAMPSTAT(filter = list(), SAMPSTAT)filter_SAMPSTAT(filter = list(), SAMPSTAT)
filter |
Existing filters (or blank list if not provided) |
SAMPSTAT |
Biological status of sample |
Add filter on specific epithet
filter_SPECIES(filter = list(), SPECIES)filter_SPECIES(filter = list(), SPECIES)
filter |
Existing filters (or blank list if not provided) |
SPECIES |
List of specific epithets |
Get accession passport data as a data table.
get_accessions(filters = NULL, fields = SELECT_INFO_FIELDS)get_accessions(filters = NULL, fields = SELECT_INFO_FIELDS)
filters |
an R |
fields |
list of fields to fetch from Genesys. See examples. The following constants are also available SELECT_INFO_FIELDS, SELECT_GEO_FIELDS and SELECT_INFO_FIELDS (default). |
Data table
## Not run: # Retrieve all accession data by country of origin (Slovenia, Ivory Coast) accessions <- genesysr::get_accessions(list(countryOfOrigin = list(code3 = list("SVN", "CIV")))) # Focus on geolocation data musa <- genesysr::get_accessions( list(taxonomy = list(genus = list("Musa"))), select = genesysr::SELECT_GEO_FIELDS ) # Fetch only accession number and coordinates of Musa accessions musa <- genesysr::get_accessions( list(taxonomy = list(genus = list("Musa"))), fields = c("ACCENUMB", "DECLATITUDE", "DECLONGITUDE") ) ## End(Not run)## Not run: # Retrieve all accession data by country of origin (Slovenia, Ivory Coast) accessions <- genesysr::get_accessions(list(countryOfOrigin = list(code3 = list("SVN", "CIV")))) # Focus on geolocation data musa <- genesysr::get_accessions( list(taxonomy = list(genus = list("Musa"))), select = genesysr::SELECT_GEO_FIELDS ) # Fetch only accession number and coordinates of Musa accessions musa <- genesysr::get_accessions( list(taxonomy = list(genus = list("Musa"))), fields = c("ACCENUMB", "DECLATITUDE", "DECLONGITUDE") ) ## End(Not run)
Fetch Genesys crops. Note that the list of Genesys crops does not fully correspond with various CROPNAME in MCPD provided by genebanks.
list_crops()list_crops()
Genesys crops
## Not run: # Retrieve all Genesys crops crops <- genesysr::list_crops() ## End(Not run)## Not run: # Retrieve all Genesys crops crops <- genesysr::list_crops() ## End(Not run)
Institute filters: - code: list of WIEWS institute codes - accessions: boolean, TRUE list only institutes with accessions in Genesys, FALSE without accessions - country$code3: list of ISO3166 country codes
list_institutes(filters = list(), at.least = NULL)list_institutes(filters = list(), at.least = NULL)
filters |
an R |
at.least |
stop fetching when at.least records are received from Genesys |
List of institutes
## Not run: # Retrieve taxa of selected accessions filters <- c(); filters$accessions = TRUE; # Has accessions in Genesys institutes <- genesysr::list_institutes(filters) ## End(Not run)## Not run: # Retrieve taxa of selected accessions filters <- c(); filters$accessions = TRUE; # Has accessions in Genesys institutes <- genesysr::list_institutes(filters) ## End(Not run)
Fetch taxonomic data of selected accessions.
list_species(filters = list())list_species(filters = list())
filters |
an R |
Taxonomic records of selected accessions
## Not run: # Retrieve taxa of selected accessions taxa <- genesysr::list_species(mcpd_filter(INSTCODE = c("LBN002", "MEX002"))) ## End(Not run)## Not run: # Retrieve taxa of selected accessions taxa <- genesysr::list_species(mcpd_filter(INSTCODE = c("LBN002", "MEX002"))) ## End(Not run)
See FAO/Bioversity Multi-Crop Passport Descriptors.
mcpd_filter( filter = list(), INSTCODE = NULL, DOI = NULL, ORIGCTY = NULL, SAMPSTAT = NULL, GENUS = NULL, SPECIES = NULL )mcpd_filter( filter = list(), INSTCODE = NULL, DOI = NULL, ORIGCTY = NULL, SAMPSTAT = NULL, GENUS = NULL, SPECIES = NULL )
filter |
Existing filters (or blank list if not provided) |
INSTCODE |
WIEWS Institute Code of the holding institute |
DOI |
Accession DOI |
ORIGCTY |
Country of origin |
SAMPSTAT |
Biological status of sample |
GENUS |
List of genera |
SPECIES |
List of specific epithets (within specified genera) |
# Filter accessions from Mexico and Slovenia mcpd_filter(ORIGCTY = c("MEX", "SVN"))# Filter accessions from Mexico and Slovenia mcpd_filter(ORIGCTY = c("MEX", "SVN"))
Who am i? Loads and prints the user profile from Genesys as JSON. You need to be logged in.
me()me()
## Not run: # Login setup_production() user_login() me() ## End(Not run)## Not run: # Login setup_production() user_login() me() ## End(Not run)
Print Genesys client configuration
print_setup()print_setup()
List of all supported passport data fields
SELECT_ALL_FIELDSSELECT_ALL_FIELDS
An object of class character of length 49.
List of passport data fields relevant for GIS analysis
SELECT_GEO_FIELDSSELECT_GEO_FIELDS
An object of class character of length 16.
List of basic passport data fields
SELECT_INFO_FIELDSSELECT_INFO_FIELDS
An object of class character of length 8.
Configure the Genesys environment
setup(server = NULL, client_id = NULL, client_secret = NULL)setup(server = NULL, client_id = NULL, client_secret = NULL)
server |
Server base URL (e.g. "https://api.genesys-pgr.org" or "https://api.sandbox.genesys-pgr.org") |
client_id |
OAuth client ID |
client_secret |
OAuth client secret |
See utility methods setup_production, setup_sandbox
# Link with sandbox setup_sandbox()# Link with sandbox setup_sandbox()
Use the Genesys R Client with <https://api.genesys-pgr.org> requiring user_login
setup_production()setup_production()
Use the Genesys R Client with <https://api.sandbox.genesys-pgr.org> requiring user_login
setup_sandbox()setup_sandbox()
The authorization URL will open in a browser, ask the user to grant permissions to R.
user_login(redirect_uri = "http://127.0.0.1:48913")user_login(redirect_uri = "http://127.0.0.1:48913")
redirect_uri |
a custom redirect_uri to submit as part of the authentication request. This is most useful if the default port is blocked and you wish to specify another port: 'redirect_uri = "http://127.0.0.1:44211"'. Note that using 'http://localhost' will not work. |
After successful authentication the browser will display the message: "Authentication complete. Please close this page and return to R."
Close the browser and return to R.