This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Searching blast+ local database

I am creating a local blast database using blast+ command line tool ,is there any command so that i can search for a sequence in my database using accession id or name.

blast blast+

1 answer

Use blastdbcmd with your local database. Adjust outfmt. Use %a if you just need to see accession number.

blastdbcmd -db your_database_name -entry your_accession_of_interest -outfmt "%f"

You can also search for / retrieve particular entries with -entry or -entry_batch:

 -entry <String>
   Comma-delimited search string(s) of sequence identifiers:
    e.g.: 555, AC147927, 'gnl|dbname|tag', or 'all' to select all
    sequences in the database
    * Incompatible with:  entry_batch, pig, info, list, recursive,
   remove_redundant_dbs, list_outfmt, show_blastdb_search_path
 -entry_batch <File_In>
   Input file for batch processing (Format: one entry per line, seq id 
   followed by optional space-delimited specifier(s)
   [range|strand|mask_algo_id]
    * Incompatible with:  entry, range, strand, mask_sequence_with, pig, info,
   list, recursive, remove_redundant_dbs, list_outfmt,
   show_blastdb_search_path

But it allows me to search by accession number is there any way where i can search by name or length of sequence.

It may be possible to search the sequence by "name" (though you will need to define what you mean by that, I assume some word in the fasta header). You can't search by length (unless you had that information in your fasta headers).

blastdbcmd -db your_database_name -entry all -outfmt "%f" | grep "word_in_title"

But that will give me only the line containing that word not the sequence.Is there any command for that in blast+ tool.

Log in to answer this question.