# taxon exclude list for searching local blast database using blastn

I am looking for a solution to exlude certain entries when searching a local blast nt database (with blastn), specifically the sequences from uncultured / environmental samples, ideally using their taxon ids. This should ideally replicate the results from the BLAST web interface, when checking the option "Exclude Uncultured/environmental sample sequences", see screenshot below.

Three approaches that I am aware of so far are:

(1) grep taxon IDs for any taxa with "uncultured" or "environmental" in their scientific name from names.dmp and fetch the GIs belonging to these taxa using the E-utils. Then use the -negative_gilist parameter for blastn. However, GIs are discontinued for future records, so this method should be replaced by Acc.Ver identifiers.

(2) locally format the blast database after prepocessing the nt file by myself and exclude records belonging to the taxa list as obtained in (1).

(3) Postprocess the blast output and remove the relevant lines, but this approach might remove a lot of alignments, whereas (1) and (2) would always generate the desired number of output alignments.

So, I am looking for other suggestions, preferably without preprocessing the nt file. Ideally, one would like to have a -negative_taxalist option for blastn, which would resemble what is possible on the NCBI BLAST web interface, where one can exclude taxa, see screenshot below.

Thanks!

Species level taxon ids can be obtained from higher level taxon ids using the script get_species_taxids.sh, e.g.: get_species_taxids.sh -n Enterobacterales