Skip to main content

enviPath Python

Documentation Status DOI

Python client for enviPath - the environmental contaminant biotransformation pathway resource.

The client allows you to include enviPath directly into you Python code. This is done by using the REST API of enviPath, all calls to Python functions are translated to remote calls to our enviPath. Please see below for documentation.

Quickstart

If you want to use it with the new API, update the lib via

pip install --upgrade enviPath-python

and initialize the enviPath object as follows:

eP = enviPath('https://beta.envipath.org/api/legacy/', new_api=True)
eP.login(<username>, <password>)

In order to try the new API you have to have an account on e.g. https://beta.envipath.org.

After that you can use the library as before.

from pprint import pprint
from enviPath_python import enviPath

eP = enviPath('https://envipath.org')

bbd = eP.get_package('https://envipath.org/package/32de3cf4-e3e6-4168-956e-32fa5ddb0ce1')

bbd_pws = bbd.get_pathways()

pprint(bbd_pws[0].get_description())

Documentation

The enviPath-python documentation can be found here.

If you are new to enviPath our wiki might also contain some value information.

Examples

Searching data

from enviPath_python import enviPath

eP = enviPath('https://envipath.org')

# get package(s) that should be searched
bbd = eP.get_package('https://envipath.org/package/32de3cf4-e3e6-4168-956e-32fa5ddb0ce1')
soil = eP.get_package('https://envipath.org/package/5882df9c-dae1-4d80-a40e-db4724271456')

# returns a dictionary with properly initialized objects
res = eP.search('c1ccccc1', [bbd, soil])
print(res)

# or use a package to search it
res = bbd.search('c1ccccc1')
print(res)

Accessing Data

from pprint import pprint
from enviPath_python import enviPath

eP = enviPath('https://envipath.org')

# get the EAWAG BBD package
bbd = eP.get_package('https://envipath.org/package/32de3cf4-e3e6-4168-956e-32fa5ddb0ce1')

# access collections (e.g. compounds)
# other collections such as reactions, rules, pathways, etc work the same way
compounds = bbd.get_compounds()

for c in compounds[:10]:
    print(c.get_id(), c.get_name(), c.get_smiles())

Accessing private data

import getpass
from enviPath_python import enviPath

eP = enviPath('https://envipath.org')

# get username + password
username = input("Enter username")
password = getpass.getpass(prompt="Password for {}".format(username))
eP.login(username, password)

print(eP.who_am_i())

for p in eP.get_packages()[:10]:
    print(p)

Predict Pathways

from enviPath_python import enviPath
from enviPath_python.objects import Pathway
from time import sleep

eP = enviPath('https://envipath.org')

# obtain the currently logged in user
me = eP.who_am_i()

# get the package the pathway should be stored in
package = me.get_default_package()

# will trigger the pathway prediction
pw = Pathway.create(package, smiles='CC1(C)C2CCC1(C)C(=O)C2')

# wait until the prediction finished
while pw.is_running():
    print("Sleeping for three secs...")
    sleep(3)

# check result
if pw.has_failed():
    exit(1)
else:
    for node in pw.get_nodes():
        print(node.get_smiles())

Metadata

Release files for enviPath-python 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enviPath-python 0.2.4
File Size Uploaded
envipath_python-0.2.4.tar.gz 44.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for enviPath-python 0.2.4
File Interpreter ABI Platform
envipath_python-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 92.8 kB

Release files / envipath_python-0.2.4.tar.gz

Download URL envipath_python-0.2.4.tar.gz
Size 44.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5bac5b6d620966a2c52f6f8061b21d8c125898b3f9d994d7b4365d835a6f7e80
BLAKE2b-256 checksum
How to use checksums
251a055d76aa0b42b9637b75ba98fdd598691d725e21d62aab0b3a11349eecd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / envipath_python-0.2.4-py3-none-any.whl

Download URL envipath_python-0.2.4-py3-none-any.whl
Size 48.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d8cc8f32155f9f8011fb5521e4a0b0727614d5ab592da2f232ef3792534d749
BLAKE2b-256 checksum
How to use checksums
0169f68f008cf5c877a378aabc6a9da76d401d05d5c917b20f65d7274be57199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page