organism.py
Find taxonomic ID using NCBI Taxonomy Database
It performs a search using taxonomic ID or organism name and feed Organism object with descendants
Usage
You can run this script from command line passing args or using a configuration file
Command line
You can read help message running organism.py -h
:
usage: organism.py [-h] [--taxon TAXON] [--log LOG] [--groups GROUPS]
[--output_file OUTPUT_FILE] [--conf CONF]
Organism - Find taxonomic ID using taxonomony sqlite database
optional arguments:
-h, --help show this help message and exit
--taxon TAXON Organism name or taxonomic ID
--log LOG Log output
--groups GROUPS Groups descendants from taxon parameter to be
considered
--output_file OUTPUT_FILE
Output filepath
--conf CONF Configuration file
Search for organism names or taxonomic IDs related from taxon parameter and
put into a file
An command example:
organism.py --taxon 1980416 --groups all --output_file test
organism.py --taxon Peribunyaviridae --groups all --output_file test
Config file
You can use a configuration file with this content:
[Organism]
taxon = 1980416
log = organism.log
groups = all
output_file = ids.txt
In first line, you're setting between "[]" the section, organism script use "Organism" section to get parameters. After that, everything is parameter = value
(until it finds another section), they're the same parameters from help message without "--" before the keys.
Run script using:
organism.py --conf example.conf
Organism
It is just a class used as a model/transfer object used to represent a oragnism from NCBI Taxonomy having the following properties:
Property | Type | Description |
---|---|---|
tax_id | int | Taxonomic ID |
name | str | Organism name |
descendants | list | List of Organisms |
Functions
This script have the following functions
get_organism()
This method create request for NCBI Taxonomy and return a Organism
Parameters | Type | Description |
---|---|---|
taxon | str | int |
read_taxonomy_page()
This method reads taxonomy response page and return a Organism object filled
Parameters | Type | Description |
---|---|---|
content | str | Response content from request |