Skip to main content

A Python library and set of command line utilities for exchanging Knowledge Graphs (KGs) that conform to or are aligned to the Biolink Model.

Project description

Knowledge Graph Exchange

Python Run testsDocumentation Status Quality Gate Status Maintainability Rating Coverage PyPI Docker

KGX (Knowledge Graph Exchange) is a Python library and set of command line utilities for exchanging Knowledge Graphs (KGs) that conform to or are aligned to the Biolink Model.

The core datamodel is a Property Graph (PG), represented internally in Python using a networkx MultiDiGraph model.

KGX allows conversion to and from:

KGX will also provide validation, to ensure the KGs are conformant to the Biolink Model: making sure nodes are categorized using Biolink classes, edges are labeled using valid Biolink relationship types, and valid properties are used.

Internal representation is a property graph, specifically a networkx MultiDiGraph.

The structure of this graph is expected to conform to the Biolink Model standard, briefly summarized here:

  • Nodes
    • id: CURIE; required
    • name: string; recommended
    • category: string; broad high level type. Corresponds to node label in Neo4j
    • other properties
  • Edges
    • subject: CURIE; required
    • edge_label: CURIE; required; Corresponds to edge label in Neo4j
    • object: CURIE, required
    • relation: CURIE; required
    • other properties

In addition to the main code-base, KGX also provides a series of command line operations.

Installation for Users

KGX is available on PyPI and you can install KGX via python pip.

Note: the installation of KGX requires Python 3.7+

pip install kgx

Installation for Developers

Python 3.7+ and Core Tool Dependencies

Note: the installation of KGX requires Python 3.7+

You should first confirm what version of Python you have running and upgrade to v3.7 as necessary, following best practices of your operating system. It is also assumed that the common development tools are installed including git, pip, and all necessary development libraries for your operating system.

Getting the repository

Go to where you wish to host your local project repository and clone the repository:

cd /path/to/your/local/git/project/folder
git clone https://github.com/NCATS-Tangerine/kgx.git

# then enter into the cloned project repository
cd kgx

Configuring a virtual environment for KGX

For convenience, make use of the Python venv module to create a lightweight virtual environment.

Note that you may also have to install the appropriate venv package for Python 3.7.

For example, under Ubuntu Linux, you might

sudo apt-get install python3.7-venv  

Once venv is available, type:

python3 -m venv venv
source venv/bin/activate

Installing Python Dependencies

The Python dependencies of the application need to be installed into the local environment using a version of pip matched to your Python 3.7+ installation (assumed here to be called pip3).

Again, follow the specific directives of your operating system for the installation.

For example, under Ubuntu Linux, to install the Python 3.7 matched version of pip, type the following:

sudo apt-get install python3-pip

which will install the pip3 command.

At this point, it is advisable to separately install the wheel package dependency before proceeding further (Note: it is assumed here that your venv is activated)

pip3 install wheel

After installation of the wheel package, install KGX:

pip3 install -r requirements.txt

To install KGX,

python3 setup.py install

To test installation was successful, run the following:

kgx --help

which invokes the KGX CLI tool.

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

kgx-0.5.0.tar.gz (65.5 kB view details)

Uploaded Source

Built Distributions

kgx-0.5.0-py3.8.egg (79.0 kB view details)

Uploaded Source

kgx-0.5.0-py3-none-any.whl (81.2 kB view details)

Uploaded Python 3

File details

Details for the file kgx-0.5.0.tar.gz.

File metadata

  • Download URL: kgx-0.5.0.tar.gz
  • Upload date:
  • Size: 65.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.1

File hashes

Hashes for kgx-0.5.0.tar.gz
Algorithm Hash digest
SHA256 e2c98b51bfa78e5731edc662ad829d447856f4eba8e253ac5a9953fd134ab68e
MD5 ac90e39e682516acbc9d1b4387d56ead
BLAKE2b-256 67137b7910b2763826f59fd8645a646e2d7862f5f743743318cd2ee4968432d0

See more details on using hashes here.

File details

Details for the file kgx-0.5.0-py3.8.egg.

File metadata

  • Download URL: kgx-0.5.0-py3.8.egg
  • Upload date:
  • Size: 79.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.1

File hashes

Hashes for kgx-0.5.0-py3.8.egg
Algorithm Hash digest
SHA256 0dc9eafedf68c43fb03415ad7c2577ae9b0bd06b2ece22bec06539376ef72c67
MD5 8287695a3515ccab63cbe7dcee39d2db
BLAKE2b-256 de087b33bb6709801231906541819a9ee3565e2bd3588d9303ba07cad9d2a81c

See more details on using hashes here.

File details

Details for the file kgx-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: kgx-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 81.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.1

File hashes

Hashes for kgx-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1356fb9c88a4c91e24d380f04c200bc527f168d9751f585d114b34af70c3db9c
MD5 4fe5e9fde6d85f6ff73eba2f4ff12293
BLAKE2b-256 dd621be2f86ffc0b895669a1384929ca96058b73efb3b60772cb0d3876582f00

See more details on using hashes here.

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