This is a test version of Biostars. For the public version, visit https://www.biostars.org.
ncbi blast results in multi-sequence fasta file

I have a fasta file that has 1000s of sequences, i.e.:

>loc.1 
ATGGTTTTTCCGTATACTTCACTGACTGCTGCTTGTAATTTTTCAGCATCCTCAAATTTTCAATTGTCAGAAACATGTCTAAACAATGAGGTCCCTCCAGTATTTATAAATAGCAACGGCCAAAATTGTTCCCGGCCCAATATGTCTTATAATGCTGACTTTCAAGTTTCAAATAGTCATTGTAATGAAACCACTGACAGTATTGGTAGTGGTCAAAATACTACTACTGATATGAATTACGATCCAAATAATAGTCAGAACTTTTCATTTTCCTCAAATGTTCTTGGTAATCTACAAAACTGGAATGGTAAAAGATCTAATTATTTCAGTTACAAACTCAATGACATGAAACAATTTTATAATCAAGAAATACCGTTAGTGGACAATTCCGTACCGATTTACACAAATGG
>loc.2 
  CAGGTAAAAATCTGGTTTCAAAATCGTCGGTCCAAGTATAAAAAGCTTATTAAGCAAGGTCAGGATCCAAGCATCCTGATGAATGGAGAATTTAATGACAGCATGGATGAAATGACGGAAGATCAAATCGACGAAGATAATTGTATCAAACCAAAAGCAGAAATGCTATTAACAAGCGATCCAAATAATCCTAGAGGCGATAGTTCTGATATTCCAACTGAAA

I am using ncbi blastn in terminal against this file to search for a sequence of interest. However, I simply want to print out the top 5 hits. Instead, it goes through each locus id and makes an alignment. How can I do this easily - there does not seem to be any options available in blastn to give only the best scoring hits in a multi-sequence file?

blast ncbi

Blast options should apply to each search individually. Is -num_descriptions 5 -num_alignments 5 not working? How did you make your index (using the file example you have posted)? Are you using blast 2 sequences instead of blastn?

1 answer

You can customise the number of alignments by customising following parameters in BLASTN output.

-num_descriptions <Integer, >=0>
   Number of database sequences to show one-line descriptions for
   Not applicable for outfmt > 4
   Default = `500'
    * Incompatible with:  max_target_seqs
 -num_alignments <Integer, >=0>
   Number of database sequences to show alignments for
   Default = `250'
    * Incompatible with:  max_target_seqs
  

Log in to answer this question.