This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Excluding an organism in biopython BLAST

I have just started using BLAST in biopython, and can do basic searches. I know how to limit my search to particular taxa with eg entrez_query = "txid9606[ORGN]" but I also want to be able to exclude some taxa. How can I do this?

biopython blast

Not 100% sure on this by any means but I think with entrez the usual booleans are supported so you could try = "... NOT txid1234[ORGN]" but I don't think this is possible with commandline blast. You'd probably have to filter those sequences out when you build the database, or after you run the BLAST.

Others may well know better though.

OK thanks that seems to have worked

entrez_query = "txid9606[ORGN]"

That query needs to be

entrez_query = "9606[TtaxID]" OR entrez_query = "human[ORGN]"

Entrez search limiting can only be done with remote blast searches at NCBI.

On other hand, if I recall right, taxID based inclusion/exclusion can only be done with local blast. I will confirm that later today.

OK thanks, I have seen [orgn], [ORGN] and [organism] in different places, do these all do the same thing? What is the different between entrez limiting and taxID inclusion/exclusion - I thought these were the same thing?

The search term categories should be equivalent.

TaxID exclusion can only be done with local blast searches. You can precisely include/exclude organisms/classes if you know the taxID. Here are the relevant options from blast help. Searching with taxID's is just one option for Entrez queries.

 -taxids <String>
   Restrict search of database to include only the specified taxonomy IDs
   (multiple IDs delimited by ',')
    * Incompatible with:  gilist, seqidlist, taxidlist, negative_gilist,
   negative_seqidlist, negative_taxids, negative_taxidlist, remote, subject,
   subject_loc
 -negative_taxids <String>
   Restrict search of database to everything except the specified taxonomy IDs
   (multiple IDs delimited by ',')
    * Incompatible with:  gilist, seqidlist, taxids, taxidlist,
   negative_gilist, negative_seqidlist, negative_taxidlist, remote, subject,
   subject_loc

0 answers

No answers yet.

Log in to answer this question.