This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract only insecta information from Blast nr DB.

hello I'm trying to blast on Ubuntu. I downloaded blast DB, but it's too big, so I plan to use only the Insecta DB I need.

  1. blastdbcmd -db nr -entry_batch insecta.txt -outfmt "%f" -out nr_database_insecta.fasta -target_only -dbtype prot
  2. blastdbcmd -db nr -dbtype prot -taxid 50557 -out nr_insecta.fasta -entry all

I used the two commands above, but it doesn't work. Can anyone tell me what problem in here?

Thanks!

blast

also BLAST Database error: No alias or index file found for protein database [nr] in search path [/mnt/d/blast/ncbi-blast-2.14.1+/bin::] I got this message..

Unless you are in the directory where the nr database is located (you seem to be in /mnt/d/blast/ncbi-blast-2.14.1+/bin), the blastdbcmd command will not work. Either you define a BLASTDB variable - see here - or type a full path to the nr database such as /mnt/c/db/nr by using the actual location instead of my made-up example.

1 answer

This does not work because you need to get the taxID's at a lower lever than insecta.

$ blastdbcmd -db nr -taxids 50557 -outfmt %f
Error: [blastdbcmd] Taxonomy ID(s) not found. This could be because the ID(s) provided are not at or below the species level. Please use get_species_taxids.sh to get taxids for nodes higher than species (see https://www.ncbi.nlm.nih.gov/books/NBK546209/).

You can do (you may need to install EntrezDirect):

$ get_species_taxids.sh -t 50557 >insect.id

This will get the insect taxID. Then retrieve the fasta data (only showing you the headers below)

$ blastdbcmd -db nr -taxidlist insect.id -outfmt %f | grep "^>" | head -3
>XP_035731174.1 growth arrest-specific protein 2-like [Vespa mandarinia]
>KAJ3664018.1 hypothetical protein Zmor_008225 [Zophobas morio]
>KAH8395558.1 hypothetical protein KR222_011244 [Zaprionus bogoriensis] 

Another option:

If you have the nr database downloaded you could limit the blast searches to insect taxID's using taxidlist option. Use the insect.id file generated above.

Is the get_species_taxids.sh included in BLAST+? I think that was the better option I have been looking for all the time... Anyway, the documentation has been around since 2008 https://www.ncbi.nlm.nih.gov/books/NBK569846/

I have deleted my answer to avoid confusion because it does the same in a more complicated way.

It has been included in blast+ since v.2.8.1 (based on what I see).

Log in to answer this question.