These scripts will help you to fetch taxonomic information from a blast result file.
gi_taxid_search.py
: This module contains the GItaxidFinder
class. This class will fetch a taxonid given a ginumber and the gi_taxid_nucl.dmp
file located on your computer. I described this module in detail in my blogpost.blasthittaxonomy.py
: This module contains the TaxonomyFetcher
class which will fetch taxonomic information from NCBI using the taxonid fetched by the GItaxidFinder
class. I described this module in detail in another blogpost.Testgi_taxid_search.py
: unittests for the GItaxidFinder
class.TestTaxonomyFetcher.py
: unittests for the TaxonomyFetcher
class. This one will not work offline as it actually tries to reach the NCBI servers.parsexmlblast.py
: this script will transform your BLAST xml file into a tsv.addTaxonomyToBlastOutput.py
: this script will read in the tsv file created by parsexmlblast.py
and add taxonomic information to it using the modules in this repo.addTaxonomyToBlastOutput.py
as is. You could also use addTaxonomyToBlastOutput.py
as a demonstration of how to use the classes in gi_taxid_search.py
and blasthittaxonomy.py
and write your own wrapper script.blasthittaxonomy.py
. When I wrote these scripts, NCBI did not require you to do so but that could have changed by now. I think it is just a polite thing to do.gi_taxid_nucl.dmp
file (I got it from NCBI's ftp servers) and refer to it in blasthittaxonomy.py
. By default, blasthittaxonomy.py
will look for this file in the current working directory, so you can also put it (or a link to it) there.parsexmlblast.py
: ./parsexmlblast.py <blastresultsfile>
Make sure the blastresultsfile is in xml.addTaxonomyToBlastOutput.py
: ./addTaxonomyToBlastOutput.py <blast output file>
If you want to cite this repository, I recommend you use the following information:
https://github.com/bartaelterman/BlastTaxonomy/releases/tag/v0.2
.Thank you for your interest. If you encouter any problems or if you have optimized some stuff, let me know by reporting an issue or send a pull request.