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 Build Status Documentation Status Quality Gate Status Maintainability Rating Coverage

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

Internal representation is networkx MultiDiGraph which is a property graph.

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

Installation

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 Project Code

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

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 Safe 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

To exit the environment, type:

deactivate

To re-enter, source the activate command again.

Alternately, you can also use conda env to manage packages and the development environment:

conda create -n translator-modules python=3.7
conda activate translator-modules

Some IDE's (e.g. PyCharm) may also have provisions for directly creating a virtual environment. This should work just fine.

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, we install the remaining KGX Python package dependencies without error:

pip3 install .

It is sometimes better to use the python -m pip version of pip rather than just pip to ensure that the proper version of pip - i.e. for the python3 in your virtual environment - is used (i.e. once again, better check your pip version. On some systems, it may run the operating system's version, which may not be compatible with your venv installed Python 3.7)

python -m pip install .

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.1.0.tar.gz (57.2 kB view details)

Uploaded Source

Built Distributions

kgx-0.1.0-py3.8.egg (65.4 kB view details)

Uploaded Source

kgx-0.1.0-py3-none-any.whl (67.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kgx-0.1.0.tar.gz
  • Upload date:
  • Size: 57.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for kgx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d13f55d58d5e231226579144cff0deff2dba98e0639e867cdb1a255e8d4dcb2
MD5 5c31ac2265e757381d373fe299ed317d
BLAKE2b-256 eb5b63b6d7a2daae709badd1591b625863b1f1f1874cfa8db5901444875c6140

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kgx-0.1.0-py3.8.egg
  • Upload date:
  • Size: 65.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for kgx-0.1.0-py3.8.egg
Algorithm Hash digest
SHA256 959e2f9f39bee3ff9ba3385884fe06491e7074c643f37556cac71e63cbedeb7e
MD5 631a07f42cae3cde69918ed8cce6b341
BLAKE2b-256 32cf377302be1d5014f5944d45f6a7c0e37108ad83d5cd6b663c387944092e9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kgx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 67.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for kgx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a29fc08c77623559fe858fff08ceb6e28614efe3de7d11e1e572e96c6033f61d
MD5 28ff5dd064255b923b274231088693c5
BLAKE2b-256 56d09fbcb245c143688d267a1fd9f22e1e20d3ed7af5956d5381af51aa7c4812

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