APSCALE-blast
Taxonomic assignment of OTUs/ESVs with BLAST+, part of the metabarcoding pipeline APSCALE.
- Input: a FASTA file with OTU/ESV sequences (from APSCALE or any other pipeline) and a reference database
- Output: a taxonomy table (
.xlsx) with the best hit per sequence, a flag for ambiguous assignments and the thresholds used, plus a report (*_report.xlsx) and a ready-to-use methods text (*_methods.txt)
Installation
The easiest way is the conda environment of the APSCALE installer, which installs APSCALE-blast and all its dependencies.
Alternatively, install via pip (Python ≥ 3.10):
pip install apscale_blast
With pip, BLAST+ must be installed separately and be available in your PATH.
Usage
# Taxonomic assignment
apscale_blast -db ./MIDORI2_srRNA_BLAST -q ./ESVs.fasta -o ./my_run
# Re-BLAST sequences without a good match against a second database
apscale_blast -db ./MIDORI2_srRNA_BLAST -db2 ./my_local_db -q ./ESVs.fasta -o ./my_run
# Re-BLAST an existing result (results are saved next to the table as *_reblast.xlsx)
apscale_blast -reblast_only ./my_run/my_run_taxonomy.xlsx -db2 ./my_local_db -q ./ESVs.fasta
# Validate species assignments with GBIF occurrences (e.g. Germany, Luxembourg, France)
apscale_blast gbif -countries DE,LU,FR -q ./my_run/my_run_taxonomy.xlsx
# Only replace synonyms by their accepted names (GBIF backbone)
apscale_blast gbif -synonyms -q ./my_run/my_run_taxonomy.xlsx
# Calculate database-specific similarity thresholds (+ gap analysis of the database)
apscale_blast dboptimiser -db ./MIDORI2_srRNA_BLAST
# ... and benchmark all assignment settings on the database
apscale_blast dboptimiser -db ./MIDORI2_srRNA_BLAST -f
# Create your own database (graphical interface)
apscale_blast dbcreator
All options are listed with apscale_blast -h (or e.g. apscale_blast gbif -h).
Use a separate output folder (-o) for each query file. Interrupted runs can be restarted with the same command: finished BLAST subsets are skipped.
Running on a shared server
-n_cores sets the total number of cores. BLAST runs in n_cores / blast_threads parallel jobs (default -blast_threads 8, e.g. 40 cores = 5 jobs with 8 threads each; 6 cores = 1 job with 6 threads). Each job reads the complete database, so few jobs with several threads cause much less disk IO than many single-threaded jobs. If the server still struggles, reduce -n_cores, use larger subsets (-subset_size 500) or copy the database to a local disk.
How it works
- The sequences are BLASTed (blastn, default megablast) against the database in parallel subsets. Alignment gaps (
-) in the query are removed. - Hits covering less than 80% of the query are discarded (
-min_coverage), so that short local alignments cannot outcompete longer ones. Sequences without any remaining hit are reported as NoMatch. - The best hits are selected with one of four filter modes (
-filter): 1 = similarity, then e-value; 2 = e-value, then similarity (default); 3 = similarity only; 4 = query identity (similarity × coverage), then bit score.-sim_rangekeeps hits within a range below the best similarity. If the database contains a reference rating, hits more than-rating_range(default 5) below the best rating are removed. - Each assignment is trimmed to the taxonomic level supported by its similarity.
- If several taxa remain, they are resolved with flags: F1 dominant species, F2 two species of one genus, F3 several species of one genus, F4 trimming to the most recent common ancestor.
- Optionally, sequences below 99% similarity (
-reblast_sim), without a species-level assignment or with flag F2/F3 are BLASTed again against a second database (-db2).
Similarity thresholds
apscale_blast dboptimisercalculates thresholds per taxonomic level that best separate the similarity to the same taxon from the similarity to the closest other taxon (leave-one-out on the database, one sequence per species). Use-fp_weight 2(or higher) for more conservative thresholds. The results are saved asdb_thresholds.xlsxin the database folder.db_thresholds.xlsxalso contains a gap analysis: for each species, whether it is sufficiently represented, has only one sequence, whose own references were not found, is as similar to another species as to its own references (mislabelling or shared barcodes), or shows high variation within the species.- With
-f, the dboptimiser also benchmarks the assignment settings on the database (BLAST task, filter mode, similarity range, thresholds, with/without rating) on full-length and truncated test sequences. Results (precision, recall, F1 and the decision for each test sequence) are saved indbbenchmark/<database>/db_benchmark.xlsxwith one figure per test set. - If the database contains a
db_thresholds.xlsx(created withapscale_blast dboptimiser), its database-wide thresholds are used. - With
-threshold_level class(or order, family, ...), each sequence gets the thresholds of its class. Classes based on fewer than 50 sequences use the database-wide thresholds. - With
-thresholds 98,95,90,87,85(species, genus, family, order, class), your own values are used. - Without
db_thresholds.xlsx, the default98,95,90,87,85is used.
Databases
Pre-compiled databases are available here and are updated regularly. Custom databases can be created with apscale_blast dbcreator. Each database folder contains a citation.txt.
Citation
Please cite BLAST+ and the database(s) you used:
- BLAST+: Camacho et al. (2009) BMC Bioinformatics 10: 421. https://doi.org/10.1186/1471-2105-10-421
- MIDORI2: Leray et al. (2022) Environmental DNA 4: 894–907. https://doi.org/10.1002/edn3.303
- UNITE: Abarenkov et al. (2024) Nucleic Acids Research 52: D791–D797. https://doi.org/10.1093/nar/gkad1039 (and the DOI of the UNITE release you used)
- SILVA: Quast et al. (2013) Nucleic Acids Research 41: D590–D596. https://doi.org/10.1093/nar/gks1219
- PR2: Guillou et al. (2013) Nucleic Acids Research 41: D597–D604. https://doi.org/10.1093/nar/gks1160
- Diat.barcode: Rimet et al. (2019) Scientific Reports 9: 15116. https://doi.org/10.1038/s41598-019-51500-6
- ITS2 vascular plants: Quaresma et al. (2024) Scientific Data 11: 129. https://doi.org/10.1038/s41597-024-02962-5
- trnL (CRUX / Anacapa): Curd et al. (2019) Methods in Ecology and Evolution 10: 1469–1475. https://doi.org/10.1111/2041-210X.13214
- BOLD Systems: Ratnasingham et al. (2024) BOLD v4, in DNA Barcoding: Methods and Protocols, pp. 403–441, plus the DOI of the BOLD data package you used
Metadata
Release files for apscale-blast 3.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| apscale_blast-3.0.3.tar.gz | 60.6 kB | Without provenance | Details for apscale_blast-3.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apscale_blast-3.0.3-py3-none-any.whl | Python 3 | none | any | Details for apscale_blast-3.0.3-py3-none-any.whl |
Total release size: 122.6 kB
Release files / apscale_blast-3.0.3.tar.gz
| Download URL | apscale_blast-3.0.3.tar.gz |
|---|---|
| Size | 60.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24ffb32f0b074e6bc387df9885281db797676ce79548e9a6ab7458c318c635a8
|
|
BLAKE2b-256 checksum How to use checksums |
4763e3bd6507d15dc8306d0a6b38dd8373f8e62665a33ace4f8dbb2bc38b9929
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / apscale_blast-3.0.3-py3-none-any.whl
| Download URL | apscale_blast-3.0.3-py3-none-any.whl |
|---|---|
| Size | 62.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4adc15554f48e67fa00824e9491c9a787db6d020231e63bf9a0f578a66367043
|
|
BLAKE2b-256 checksum How to use checksums |
124e959def833de558437902ea7830ea8cb08acdd94f7f9a2e174a237ad127f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Security for apscale-blast 3.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.