Thanks Asaf, yeh I agree the built-in option does not work properly.
How to get 1 top hit only for each query in blastx
I am running blastx using the following command:
blastx -query CDS.fa -db local_path_nr -num_threads 36 -evalue 1e-5 -outfmt 6 -max_target_seqs 1 -out CDS_blast.txt
I aim to get one hit for each query only but there are still, say 2-3 hits, per query occasionally. How do I save the top hit only? I know this can be done post-blast, but can I simply achieve it while running blast? Thanks!
• 5,458 views
•
link
2 answers
The max_hsps never really worked properly, they have some explanation for this if I recall. You can use sort to do that:
sort -k1,1 -k11,11g CDS_blast.txt | sort --merge -u -k1,1
This will sort by query sequence and p-value (assuming default format 6 output), then will select the first result (lowest p-value) for each query
• 0 views
•
link
• 0 views
•
link
Log in to answer this question.
It should be easy for you to parse the output file such that only the top hit is retained.
Duplicate question. You could try the suggested answer from a previous post
Can it be
max_hsps?https://www.ncbi.nlm.nih.gov/books/NBK279684/
I guess this command does not apply to blastx