Skip to main content

STRING DB API Client

Project description

STRINGX

PyPI Version Python Version STRING Version

STRINGX is an API client for the STRING database, built on top of HTTPX.

Features

Inspired on the well-established usability of httpx, stringx provides a clean and easy to use interface to the STRING API while following usage recommendations and best practices:

  • Requires client identification;
  • Uses POST requests;
  • Allows linking to a specific STRING version;
  • When applicable, enforces specifying the species parameter.

A customizable client allows targeting any API version and provides support for all output formats available: TSV, JSON, XML, etc...

Installation

STRINGX requires Python 3.9+ and is available on PyPI.

$ pip install stringx

Usage

The stringx module provides a direct interface to the current API version. JSON is the default response format and can be easily integrated with pandas for further processing.

import pandas as pd
import stringx

stringx.identity = ""  # please identify yourself

df = pd.Dataframe(
    stringx.network(identifiers=["7227.FBpp0074940", "7227.FBpp0082908"], species=7227)
)

[!TIP] STRING understands a variety of identifiers and does its best to disambiguate your input. Nevertheless, it is recommended to map your identifiers first. Querying the API with a disambiguated identifier (for example 9606.ENSP00000269305 for human TP53) will guarantee much faster server response.

Client Identification

The STRING API requires its callers to identify themselves. To address this, STRINGX enforces that the identity value is set. If done at the module level all subsequent requests will carry this information.

import stringx

stringx.identity = "my_project_name"

You can also identify your clients independently.

import stringx

with stringx.Client(identity="my_project_name") as client:
    ...

with stringx.Client(
    address="https://version-10-5.string-db.org",
    identity="me@example.com"
) as client:
    ...

Regardless of how you choose to do it, STRINGX always appends its own information to your identity.

Using one of the clients instantiated above as example, the caller_identity parameters passed to the STRING API would be my_project_name (python-stringx/x.y.z).

Documentation

🚧🚧🚧

Refer to the official API documentation for details.

License

STRING data is freely available under a CC-BY-4.0 license. Please provide appropriate credit when using the data. No changes or additions are made to the data by STRINGX.

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

stringx-0.6.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stringx-0.6.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file stringx-0.6.0.tar.gz.

File metadata

  • Download URL: stringx-0.6.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.13.3 CPython/3.10.6 Linux/5.15.146.1-microsoft-standard-WSL2

File hashes

Hashes for stringx-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c0bff66e1e83f4773eae39c854f52ac7a3636ecd0fdadb112a9fc473e5e19a24
MD5 666d7dcaccc7c21ed2d5354846d8079e
BLAKE2b-256 95bd6676be1f30273cc614a45026dd71704d110356889dd906cc3da42c591c16

See more details on using hashes here.

File details

Details for the file stringx-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: stringx-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.13.3 CPython/3.10.6 Linux/5.15.146.1-microsoft-standard-WSL2

File hashes

Hashes for stringx-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a14bebaa430bcfea14d2c9ed1c59781df776226b60a06b2b4136be79fd16e4f
MD5 1f65662a47e05abccd5a3a61a795d306
BLAKE2b-256 87222ab5304515b5b8dfbd7ff1012533936f67c80706f4a279b36302fd3c392f

See more details on using hashes here.

Supported by

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