Package 'chromer'

Title: Interface to Chromosome Counts Database API
Description: A programmatic interface to the Chromosome Counts Database (<https://taux.evolseq.net/CCDB_web/>), Rice et al. (2014) <doi:10.1111/nph.13191>. This package is part of the 'ROpenSci' suite (<https://ropensci.org>).
Authors: Matthew Pennell [aut] , Paula Andrea Martinez [aut] , Karl W Broman [aut, cre]
Maintainer: Karl W Broman <[email protected]>
License: MIT + file LICENSE
Version: 0.8
Built: 2024-12-18 05:25:01 UTC
Source: https://github.com/ropensci/chromer

Help Index


Returns chromosome counts from Chromosome Counts Database API

Description

This function calls the Chromsome Counts Database (CCDB) API and returns all counts for specified higher taxa.

Usage

chrom_counts(
  taxa,
  rank = c("species", "genus", "family", "majorGroup"),
  full = FALSE,
  foptions = list()
)

Arguments

taxa

Taxonomic name(s) to query. Can be either a single name, a vector of multiple names or a list. If supplying multiple names, these must all be of the same rank.

rank

Rank to query.

full

Logical. Whether to return full records. Defaults to FALSE which returns only partial records. Partial records includes the resolved name as well as the gametophytic (n) and sporophytic (2n) counts.

foptions

additional options to be passed to httr::GET

Details

When using the API to query for species, both matched names and resolved names are searched. This means that all records for potential synonyms will be returned as well. Currently species binomials must be specified by either 'genus species' (i.e., space between genus and species) or 'genus_species'.

To search for subspecies (subsp.) or varieties (var.), you can use search terms like:

"Solanum acaule var. albicans".

Searching for "Solanum acaule" will return all subspecies and varieties.

Currently the only acceptable search terms when specifying "majorGroup" are "Angiosperms", "Gymnosperms", "Pteridophytes", or "Bryophytes".

Value

A data.frame containing all records matched by query

Examples

## Not run: 

## Get all counts for genus Castilleja
chrom_counts("Castilleja", "genus")

## Get all counts for both Castilleja and Lachemilla
chrom_counts(c("Castilleja", "Lachemilla"), "genus")

## Get all counts for Castilleja miniata
chrom_counts("Castilleja miniata", "species")

## Get all counts for only Castilleja miniata subsp. elata
chrom_counts("Castilleja miniata subsp. elata", "species")

## Note that searching for "Castilleja miniata" will return
## all subspecies and varieties

## Get all counts for the Orobanchaceae
chrom_counts("Orobanchaceae", "family")


## End(Not run)

Summarize chromosome counts from API call

Description

This function processes and cleans the data returned from the API call for use in downstream analysis.

Usage

summarize_counts(counts)

Arguments

counts

A 'chrom.counts' object inherited from chrom_counts.

Details

The results from the API call are a bit messy and difficult to use for downstream analyses. This function cleans up the data in three ways. First, it combines aggregates and summarizes all records from each species. Second, many of the counts are combined with text characters (e.g., "#-#", "c.#", and "#, #, #". This function uses regular expressions to pull out all and any numeric values from these strings. Third, some of the records are gametophytic (n) counts and others are from sporophytes (2n); the function simply divides the sporophytic counts in half so that all measurements are on a common scale.

IMPORTANT: Use this function with caution. Parsing the counts programmatically may be useful but it may generate erroneous results in some cases if input is in an odd format. For example, if the count is "#+-#", the function will return both the first and second # as valid counts . Given the creativity(?) of researchers in entering data, it is hard to predict all possible ways that the counts may be represented. Therefore, some manual checking will probably be necessary.

Value

A data.frame containing the resolved binomial, the count type (gametophytic or sporophytic), the counts, the inferred gametophytic count (for sporophytic records) and the number of records supporting each count.

Examples

## Not run: 

## Get all counts for genus Castilleja
res <- chrom_counts("Castilleja", "genus")

## summarize the results
summarize_counts(res)


## End(Not run)