Title: | Runs Allelematch Regression Tests |
Version: | 1.0.5 |
Description: | Automates regression testing of package 'allelematch'. Over 2500 tests covers all functions in 'allelematch', reproduces the examples from the documentation and includes negative tests. The implementation is based on 'testthat'. |
License: | MIT + file LICENSE |
Depends: | R (≥ 2.10) |
Imports: | allelematch, digest, remotes, testthat (≥ 3.0.0), utils, withr |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
Language: | en-US |
LazyData: | true |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-09-02 07:45:13 UTC; Torva |
Author: | Department of Wildlife, Fish and Environmental Studies at Swedish University of Agricultural Sciences [cph], Göran Spong [cph] (Senior Lecturer at the Department of Wildlife, Fish and Environmental Studies), Paul Galpern [ctb] (Author of the excellent package 'allelematch' from which the five amExample data files have been copied under MIT license), Torvald Staxler [aut, cre] |
Maintainer: | Torvald Staxler <torvald.staxler@telia.com> |
Repository: | CRAN |
Date/Publication: | 2025-09-02 08:10:02 UTC |
amregtest: Runs Allelematch Regression Tests
Description
Automates regression testing of package 'allelematch'. Over 2500 tests covers all functions in 'allelematch', reproduces the examples from the documentation and includes negative tests. The implementation is based on 'testthat'.
Author(s)
Maintainer: Torvald Staxler torvald.staxler@telia.com
Other contributors:
Department of Wildlife, Fish and Environmental Studies at Swedish University of Agricultural Sciences [copyright holder]
Göran Spong Goran.Spong@slu.se (Senior Lecturer at the Department of Wildlife, Fish and Environmental Studies) [copyright holder]
Paul Galpern pgalpern@gmail.com (Author of the excellent package 'allelematch' from which the five amExample data files have been copied under MIT license) [contributor]
Example 1 High quality data set
Description
This is sample data copied from amExampleData in version 5.2.1 of package allelematch. We use this data to test 'allelematch' backwards compatibility.
Format
Data frame with samples in rows, and alleles in columns. Missing data is represented as "-99".
Details
The data in this example is simulated to represent a high quality data set that might result from a laboratory protocol where samples were run multiple times to confirm their identity. It has no genotyping error, a near-zero missing data load, and approximately 60% of the individuals have been artificially resampled more than once.
References
https://github.com/cran/allelematch
Example 2 Good quality data set
Description
This is sample data copied from amExampleData in version 5.2.1 of package allelematch.
Format
Data frame with samples in rows, and alleles in columns. Missing data is represented as "-99".
Details
The data in this example have also been simulated, this time to reflect the qualities of good quality data set, where genotyping error and missing data exist, but these can be confidently handled by allelematch without manual intervention. At each locus a random 4% of heterozygotes lost their second allele to simulate an allele dropout, and a random 4% of samples at each locus had alleles set to missing.
References
https://github.com/cran/allelematch
Example 3 Marginal quality data set
Description
This is sample data copied from amExampleData in version 5.2.1 of package allelematch.
Format
Data frame with samples in rows, and alleles in columns. Missing data is represented as "-99".
Details
The data in this example have been simulated to represent a data set of marginal quality where the use of allelematch combined with careful manual review of the results is required to achieve a confident assessment of the unique genotypes. At each locus a random 4% of heterozygotes lost their second allele to simulate an allele dropout, and a random 10% of samples at each locus had alleles set to missing.
References
https://github.com/cran/allelematch
Example 4 Low quality data set
Description
This is sample data copied from amExampleData in version 5.2.1 of package allelematch.
Format
Data frame with samples in rows, and alleles in columns. Missing data is represented as "-99".
Details
For this example we have simulated a low quality data set where uncertainty created by genotyping error and missing data, combined with a lack of information in the form of allelic diversity across loci will result in a low confidence assessment of the unique genotypes. At each locus a random 6% of heterozygotes lost their second allele to simulate an allele dropout, and a random 20% of samples at each locus had alleles set to missing.
References
https://github.com/cran/allelematch
Example 5 Wildlife data set
Description
This is sample data copied from amExampleData in version 5.2.1 of package allelematch.
Format
Data frame with samples in rows, and alleles in columns. Missing data is represented as "-99".
Details
In this final example we use real data from the non-invasive sampling of a wildlife population. The data have been anonymized by changing sampling details. A single column giving the gender is also available and we show how this can be used as an extra locus. Missing data is also more common at some loci than at others, with a total load of about 10%.
References
https://github.com/cran/allelematch
Package Overview
Description
Package 'amregtest' automates regression testing of package allelematch.
The API is simple. There are only three functions:
| artRun | | Executes the test, or a subset of the tests |
| artList | Lists the available tests without running them | |
| artVersion | Shows the installed versions of 'allelematch' and 'amregtest' | |
The prefix "art" is short for "Allelematch Regression Test".
See artData for a description of data sets used as input.
References
https://github.com/cran/allelematch
Example data used by amregtest
Description
This example data is used when testing allelematch backwards compatibility
using artRun. The tests load this data and passes it to amDataset.
It includes data that was imported from version 5.2.1 of allelematch.
It was still unchanged in 5.2.5.
| amExample1 | | Example 1 High quality data set |
| amExample2 | Example 2 Good quality data set | |
| amExample3 | Example 3 Marginal quality data set | |
| amExample4 | Example 4 Low quality data set | |
| amExample5 | Example 5 Wildlife data set | |
See allelematchSuppDoc.pdf
for a more detailed description.
It also includes a large data set gathered from field work:
| ggSample | | Very large wildlife data set |
Format
Data frames with varying numbers of samples in rows, and alleles in columns. Missing data is represented as "-99".
References
https://github.com/cran/allelematch
Lists available tests in amregtest
without running them
Description
Use the output to select a value for parameter filter
to artRun.
Useful when debugging.
Usage
artList(verbose = TRUE)
Arguments
verbose |
logical. If TRUE (the default), prints additional info to stdout |
Value
A character vector containing the names of all the tests
See Also
artVersion and artRun
Examples
# See what version of packages 'allelematch' and 'amregtest'
# are currently loaded:
artVersion()
# List the available tests:
artList()
# Run all the tests:
# artRun() # Takes several minutes
# Run the first of the available tests:
artRun(filter="allelematch_1-amDataset$")
Runs the regression test
Description
Runs regression tests on package allelematch to make sure it is backwards compatible.
The full set of tests will take a couple of minutes.
Call artList to see the available tests with without running them.
Usage
artRun(filter = "", verbose = TRUE)
Arguments
filter |
If specified, only tests with names matching this perl regular expression will be executed. Character vector of length 1. See also artList |
verbose |
logical. If TRUE (the default), prints version of tested allelematch to stdout |
Details
If any of the test executed with artRun should fail, then we want to be able
to run that specific test under the debugger.
Set a breakpoint in allelematch.R
and call artRun(filter="<the test that reproduces the problem>")
Note that it is the last loaded version of allelematch
that will be executed,
not the last edited. In RStudio, CTRL+SHIFT+B will build, install and load.
Value
A list (invisibly) containing data about the test results as returned by testthat::test_package
See Also
artVersion and artList
Examples
# See what version of packages 'allelematch' and 'amregtest'
# are currently loaded:
artVersion()
# List the available tests:
artList()
# Run all the tests:
# artRun() # Takes several minutes
# Run the first of the available tests:
artRun(filter="allelematch_1-amDataset$")
Returns package version
Description
Displays version of this package (amregtest) and of allelematch,
together with build timestamps.
The version is specified in the file DESCRIPTION, tag "Version: ".
Usage
artVersion(verbose = TRUE)
Arguments
verbose |
logical. If TRUE (the default), prints additional info to stdout, including versions and build timestamps of 'allelematch' and 'amregtest'. |
Value
The loaded version of this package (amregtest-package) in a character vector of length one
See Also
Examples
# See what version of packages 'allelematch' and 'amregtest'
# are currently loaded:
artVersion()
# List the available tests:
artList()
# Run all the tests:
# artRun() # Takes several minutes
# Run the first of the available tests:
artRun(filter="allelematch_1-amDataset$")
Data sets originating from GG work
Description
Large data set gathered from field work in 2022. Here used to test package allelematch for backwards compatibility.
Combines a reference db of known individuals with new samples to be analyzed.
Format
This data is saved on semicolon (";") delimited .csv format, as described under 'Details' in utils::data.
Data samples in rows, and alleles in columns. Missing data is represented as "-99".