No project description provided
Project description
tax2graph
Goal
A simple way to convert i4Life tabled taxonomy to Neo4J graph representation.
Example data
A example data are available on data folder. It contains the Sordariomycetes taxonomy downloaded from "i4Life WP4 Download Service of the Catalogue of Life: Darwin Core Archive Export" (see http://www.catalogueoflife.org/DCA_Export/).
Usage
Initialize a connection dict containing at last the password key to perform queries to Neo4J database:
from tax2graph import ConnectionType
connection_variables: ConnectionType = {
"password": str(os.getenv('NEO_PASSWORD'))
}
parser = GraphParser(connection_variables)
And build the graph from Sordariomycetes:
parser.read('tax2graph/data/sordariomycetes/taxa.txt')
parser.build_col_graph()
To perform simple queries use:
parser.get_node('Glomerellales')
parser.get_parent('Glomerellales')
The former code get the Glomerellales node, and the further get the first parent node (Sordariomycetes).
To create custom nodes simple run:
from tax2graph import CustomNodeType
custom_node: CustomNodeType = {
'taxonRank': 'species',
'description': 'A custom clade 4'
}
parser.set_custom_node(custom_node, 'Colletotrichum')
Feel free to add new features and contribute through pull requests. Be happy!!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tax2graph-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5517a51d9fcdd62b8e8238ab6473a63b0c5e719337c745034fc942e0add731ed |
|
MD5 | d8696ce5f44e2892870ab1feba36e1e0 |
|
BLAKE2b-256 | cecd27ed6351158dc026276ec2057d8c43dc6fd3c73205e07317fca48b3c5e86 |