Skip to main content

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

tax2graph-1.0.0.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

tax2graph-1.0.0-py3-none-any.whl (98.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page