Delimits species from aligned sequences using the algorithm of Puillandre, Brouillet & Achaz (2021). The original C code (asap_core.c, asap_common.c) is executed without modifications; only the Python/graphical dependencies are replaced.
Usage
asap(
x,
model = "simple",
len_seq = NULL,
replicates = 1000L,
pvalue_threshold = 0.001,
slope_weight = 0.1,
score_weight = 0.5,
pairwise.deletion = TRUE
)Arguments
- x
Path to an aligned FASTA file, or an aligned
DNAbin(ape) object. Distance matrices are not accepted; distances are calculated internally from the sequences.- model
Distance model.
"simple"(default) uses Simple_Dist, identical to the ASAP original default. Any model fromape::dist.dna()is also accepted.- len_seq
Sequence length for the coalescent simulations. Inferred from the alignment length when
NULL(default).- replicates
Coalescent replicates. Default:
1000.- pvalue_threshold
P-value threshold. Default:
0.001.- slope_weight
Slope window weight. Default:
0.1.- score_weight
Weight of the p-value rank in the ASAP-score. Default:
0.5.- pairwise.deletion
Passed to
ape::dist.dna(). Default:TRUE.
Value
A list of class "asap" with:
partitionsdata.frame sorted by ascending ASAP-score.
bestList with the best partition (rank 1).
dist_matrixDistance matrix used.
taxaSequence names.
AI Disclaimer
This function was written with assistance of AI coding agent (Claude Code Sonnet 4.6). Correctness was validated by comparing against original software, on a suite of real sequencing datasets, and manual code review. All validation and output
References
Puillandre N, Brouillet S, Achaz G (2021). ASAP: assemble species by automatic partitions. Molecular Ecology Resources, 21(2), 609-620. doi:10.1111/1755-0998.13281
Examples
if (FALSE) { # \dontrun{
library(ape)
seqs <- read.dna("barcode.fasta", format = "fasta")
result <- asap(seqs)
result <- asap("barcode.fasta") # aligned FASTA path also accepted
print(result)
bp <- best_partition(result)
bp$n_groups # number of species
bp$partition # assignment for each sequence
} # }