Getting species lineage

Often one is faced with a task to get the lineage for a list of species. I did not find anything easily adaptable so I decided to create a small script which uses the NCBI Taxonomy to provide annotation of the lineage for a specified list of species which is provided in the file.

To get all the data and script you can visit Download section and get lineage.zip
To execute a script(posted below or found in the lineage.zip) in the shell (terminal) you need to have a file with species name (for example if you have a file species.txt the code would be):

After script finishes it will produce a file: species_lineage.txt – where the complete lineage will be reported  (each of elements is separated by “|”).

Alternatively, for the newest annotation, one can visit NCBI Taxonomy FTP and download a file taxdmp.zip. After, one should unzip this archive. A file called lineage.py should be created inside this new directory with a copy of the script posted above. Execution is performed as stated above.