I know this is an old thread, but it took me a long time to figure out the same---this stuff is not well-documented. So I want to post an answer to this thread to clarify how one can achieve what's asked for in this thread (both the remote and local way).
I am using the latest version of BLAST+ (at the time of writing this post, it is version 2.7.1 available here) and I am focusing on 'nucleotides' and "Homo sapiens" in the following example.
Doing a remote BLAST alignment on a specific organism is done in the following way using the -entrez_query
option.
blastn -query blast_query.fasta -db nt -remote -task blastn-short -word_size 7 -evalue 500 -perc_identity 95 -entrez_query "Homo sapiens [organism]" -outfmt 6 -out blast_result_Hsapiens.table -max_target_seqs 10 -max_hsps 5
A local BLAST alignment on a specific organism is done in this way:
You first need to have Entrez Direct installed (setting that up is extremely easy, just follow the guidelines). Then you download your desired GI list
using that tool.
esearch -db nuccore -query "Homo sapiens [organism]" | efetch -db nuccore -format uid > Hsapiens_gilist.gi
Once you have the GI list, you use the -gilist
tag to pass it to BLAST.
blastn -query blast_query.fasta -db nt -task blastn-short -word_size 7 -evalue 500 -perc_identity 95 -gilist Hsapiens_gilist.gi -outfmt 6 -out local_blast_result_Hsapiens.table -max_target_seqs 10 -max_hsps 5
Downloading the GI list can be done manually as well:
- Head over to https://www.ncbi.nlm.nih.gov
- Choose "Nucleotide" next to the search bar
- Type in "Homo sapiens [organism]" and hit the search button
- Click on Send to > Choose Destination: File > Format: GI List > Create File
gi numbers are about to go away so don't use a solution that depends on gi numbers. You could use
-entrez_query
instead.Thanks! I had a look and tried
-entrez_query "txid144197[ORGN]"
but seems not to work.Use
-entrez_query "Stegastes partitus[ORGN]"
that should work.By the way, when the database is downloaded locally, you mainly depend on tools using the GIs right? Do you know what will they become?