bb_blast_best_hit - ampinzonv/BB3 GitHub Wiki
bb_blast_best_hit
Function: Extract the best BLAST hit per (qseqid, sseqid) pair from a tabular BLAST output.
๐ Description
This function parses a BLAST output file (in outfmt 6
with 14 columns) and retains only the best hit for each unique (query, subject) pair. The best hit is determined by the lowest e-value; if multiple hits share the same e-value, the one with the highest bitscore is selected.
๐ฅ Input
- A BLAST result file in tabular format (
outfmt 6
) with 14 columns. - Use
--input -
for STDIN.
๐ค Output
- One line per unique
(qseqid, sseqid)
pair, representing the best hit.
๐งช Examples
Filter best hits from a file:
bb_blast_best_hit --input blast_results.tsv
Using a pipeline:
cat blast_results.tsv | bb_blast_best_hit --input -
Save output:
bb_blast_best_hit --input blast_results.tsv --outfile best_hits.tsv
โ๏ธ Usage
bb_blast_best_hit --input FILE [--outfile FILE] [--quiet] [--force]
๐งต Options
Option | Description |
---|---|
--input FILE |
Input BLAST file (outfmt 6, 14 columns) or - for STDIN (required) |
--outfile FILE |
Output file (optional, default: STDOUT) |
--quiet |
Suppress log messages |
--force |
Overwrite output file if it exists |
๐ Notes
- Input must include the following 14 columns:
qseqid sseqid pident length mismatch gapopen qstart qend sstart send evalue bitscore qlen slen
- If no valid hits are found or input is malformed, the function will return an error.