Learn R Programming

spider

Overview

The official GitHub repository for the R package "SPecies IDentity and Evolution in R" (spider).

spider provides functions for the analysis of species limits and DNA barcoding data. Included are functions for generating important summary statistics from DNA barcode data, assessing specimen identification efficacy, testing and optimizing divergence threshold limits, assessment of diagnostic nucleotides, and calculation of the probability of reciprocal monophyly. Additionally, a sliding window function offers opportunities to analyse information across a gene, often used for marker design in degraded DNA studies. Further information on the package has been published in Brown et al. (2012).

For an introduction to the package, visit our spider tutorial and manual. Over time, the tutorial will be expanded and moved into GitHub vignettes and project pages.

If you are interested in previous versions (before v1.5.0) of the spider source code, check out our old repository hosted at r-forge.

Installation

Stable CRAN version:

install.packages("spider")

Or development version from GitHub:

devtools::install_github("boopsboops/spider")

Examples

Here, we will do a quick "best close match" analysis (Meier et al., 2006) on a Anoteropsis wolf spider dataset (Vink & Paterson, 2003) to see how well DNA barcodes can identify individuals in a simulated identification scenario.

# load up the data
library("spider")
data(anoteropsis)
# make a quick species vector (unique species name for each individual) from the taxon labels
anoSpp <- sapply(strsplit(rownames(anoteropsis), split="_"), function(x) paste(x[1], x[2]))
head(anoSpp, n=4)
#> [1] "Artoria flavimanus" "Artoria separata" "Anoteropsis adumbrata" "Anoteropsis adumbrata"
# get some statistics about the sequence lengths
seqStat(anoteropsis)
#> Min    Max   Mean Median Thresh 
#> 395    409    408    409     33
# make a distance matrix from raw p-distances
anoDist <- ape::dist.dna(anoteropsis, model="raw", pairwise.deletion=TRUE)
# calculate identification success based on a 1% interspecific threshold
table(bestCloseMatch(distobj=anoDist, sppVector=anoSpp, threshold=0.01))
#> correct incorrect     no id 
#>      11         2        20 

Current contributors

Meta

Copy Link

Version

Install

install.packages('spider')

Monthly Downloads

372

Version

1.5.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Rupert Collins

Last Published

July 13th, 2026

Functions in spider (1.5.3)

nonConDist

Nearest non-conspecific and maximum intra-specific distances
rmSingletons

Detect and remove singletons
rankSlidWin

Rank a 'slidWin' object.
rnucDiag

Nucleotide diagnostics for species alignments
polyBalance

Balance of a phylogenetic tree with polytomies
plot.haploAccum

Plotting haplotype accumulation curves
paa

Population Aggregate Analysis
read.GB

Download sequences from GenBank with metadata.
plot.ordinDNA

Plot an 'ordinDNA' object
read.BOLD

Downloads DNA sequences from the Barcode of Life Database (BOLD)
plot.slidWin

Plot a 'slidWin' object
slideNucDiag

Sliding nucleotide diagnostics
search.BOLD

Downloads DNA sequences from the Barcode of Life Database (BOLD)
sarkar

Dummy sequences illustrating the categories of diagnostic nucleotides
salticidae

Cytochrome oxidase I (COI) sequences of world-wide species of Salticidae
slidingWindow

Create windows along an alignment
rosenberg

Rosenberg's probability of reciprocal monophyly
seqStat

Sequence statistics
slideBoxplots

Boxplots across windows
slideAnalyses

Sliding window analyses
seeBarcode

Create illustrative barcodes
tclust

Clustering by a threshold
threshOpt

Threshold optimisation
sppDist

Intra and inter-specific distances
spider-package

Species Identity and Evolution in R
sppVector

Species Vectors
titv

Number of pairwise transitions and transversions in an alignment.
sppDistMatrix

Mean intra- and inter-specific distance matrix
tajima.K

Calculate Tajima's K index of divergence
stats.BOLD

Downloads DNA sequences from the Barcode of Life Database (BOLD)
tiporder

Orders tip labels by their position on the tree.
threshID

Measures of identification accuracy
tree.comp

Tree comparisons
woodmouse

Cytochrome b Gene Sequences of Woodmice
checkDNA

Check a DNA alignment for missing data
nucDiag

Nucleotide diagnostics for species alignments
haploAccum

Haplotype accumulation curves
anoteropsis

Cytochrome oxidase I (COI) sequences of New Zealand _Anoteropsis_ species
chaoHaplo

Chao estimator of haplotype number
is.ambig

Missing bases in alignments
cgraph

Complete graph
dolomedes

Cytochrome oxidase I (COI) sequences of New Zealand _Dolomedes_ species
localMinima

Determine thresholds from a density plot
nearNeighbour

Measures of identification accuracy
bestCloseMatch

Measures of identification accuracy
maxInDist

Nearest non-conspecific and maximum intra-specific distances
heatmapSpp

Visualise a distance matrix using a heatmap
minInDist

Nearest non-conspecific and maximum intra-specific distances
ordinDNA

Calculates a Principal Components Ordination of genetic distances
monophyly

Species monophyly over a tree
dataStat

Taxa statistics
monophylyBoot

Species monophyly over a tree
blockAlignment

Make all sequences the same length