Skip to contents

Keys

The dimoose key object and the ways to write or read one.

dimoose
A dichotomous key
keyFromSpreadsheet()
Build a key from a spreadsheet
keyToSpreadsheet()
Write a key as a spreadsheet
keyFromText()
Read a key written as plain text
parseTextKey()
Parse a key written as plain text into a table of leads
keyFromLeads()
Build a dimoose key from a table of leads
checkNames()
Check a key's species names against GBIF

Exchange formats

Character matrices and keys in the formats of other identification software: SDD (the TDWG standard), DELTA, Lucid and Xper.

readSDD() writeSDD()
Read and write SDD (TDWG Structured Descriptive Data)
readSDDKey() writeSDDKey()
Read and write a dichotomous key stored in SDD
readDELTA() writeDELTA()
Read and write DELTA datasets
readLucid() writeLucid()
Read and write Lucid matrix keys
readLucidKey() writeLucidKey()
Read and write Lucid pathway (dichotomous) keys
readXper() writeXper()
Read and write Xper2 / Xper3 knowledge bases

FishBase

importFishbase()
Import a dichotomous key from FishBase
parseFishbase()
Build a dimoose object from FishBase key pages
rawhtml
Raw FishBase key tables

Building keys from a matrix

A key generated from a table of taxa and their characters.

keyFromMatrix()
Build a dimoose key from a character matrix
vibrioMatrix()
The vibrio dataset as a character matrix
generateTree()
Generate a tree from a feature matrix
keyFromRpart()
Build a dimoose key from a classification tree

Pruning and merging

Cut a key down to some taxa or to a place, or join two keys.

pruneKey()
Prune a key to some of its taxa
regionalKey()
A key to the taxa recorded in a place
mergeKeys()
Graft one key onto a result of another

Quality

How many steps a key takes, and how common each taxon is.

keyQuality()
How quickly a key gets to a result
occurrenceWeights()
How common each taxon of a key is, from GBIF occurrence records

Show and share a key

The interactive page (wizard), diagrams and tree formats.

exportWizard()
Export an interactive dichotomous key
keyDiagram()
Draw a key as a box diagram
toNewick()
Write a key as Newick, with safe labels or node annotations
toIgraph()
Convert a key to an igraph directed graph
toTreedata()
Convert a key to a tidytree treedata (for ggtree)
toAuspiceJSON()
Export a key as Auspice (Nextstrain) JSON v2

Example keys and data

sharkKey() arachnidaKey() vibrioKey() montanaKey()
Example keys
montana
Key to the native broadleaf trees of Montana
arachnida
Key to the Orders of Arachnida
vibrio
Vibrio consensus identification matrix
phylotree17
PhyloTree Build 17: the human mitochondrial DNA phylogeny
phylotree17_mutations
PhyloTree Build 17 mutations, one per row
phylotreeKey()
Build an identification key from PhyloTree Build 17

Vision: models and embeddings

Vision models (PyTorch or ONNX Runtime), photos and their embeddings.

visionModel()
Load a vision model for embedding images
onnxModel()
Load a vision model that runs on ONNX Runtime, without PyTorch
onnxCache()
Folder where dimoose keeps downloaded and converted ONNX models
exportOnnxModel()
Convert an open_clip model to ONNX
exportBrowserModel()
Write what a web page needs to identify photos with a key's species
modelMeta()
Model details as metadata rows
imageSet()
A set of labelled images
imageMeta()
Embed images in a key's metadata
imageMime()
MIME type of an image file from its first bytes
embedImages()
Embed images
embedTexts()
Embed texts
saveEmbeddings() loadEmbeddings()
Save embeddings to a file, and read them back

Vision: keys from photos

discoverSniglets() discoverTerms()
Discover sniglets by clustering patch embeddings
snigletScores() termScores()
Score images against sniglets
keyFromSniglets() keyFromTerms()
Build a key from sniglet scores
snigletNames()
Names of a key's sniglets
renameSniglets()
Rename sniglets
suggestSnigletNames()
Have a vision-language model suggest names for sniglets
claudeNamer()
A sniglet namer that asks Claude
inventNames()
Invent pronounceable names
vocabularyPrompts()
Prompts for a vocabulary of visual features
keyFromClusters()
Build a key by clustering classes and describing each split
patchExemplars()
Add example crops to a sniglet key
scoreImages()
Score new images against a key's features
suggestSpecies()
Suggest which of a key's species a photo shows
identifyPhotos()
Name what a photo shows, as precisely as the evidence allows
featureTable()
A table of machine-computable features
featureScores()
Compute a key's feature scores from embeddings
classify()
Follow a key by machine
evaluateKey()
Accuracy of a key followed by machine
looKey()
Leave-one-out evaluation of a key builder

Benchmark

Identification measured on field photos from iNaturalist.

inatPhotos()
Download a balanced sample of iNaturalist photos
splitByObservation()
Split photos into training and test sets by observation
benchmarkKey()
Benchmark identification on field photos

Keys from sequences and haplogroups

keyFromAlignment()
Build a key from a multiple sequence alignment
alignmentScores()
Score aligned sequences against a key built from an alignment
readHaplogrep()
Read a Haplogrep / PhyloTree tree XML
haplotypeMatrix()
Which mutations each haplogroup carries
macroHaplogroup()
Macrohaplogroup of a haplogroup
recurrentPositions()
Recurrent (homoplasic) mutation sites