Skip to main content

Python client for the Polymer Genomics API — DNA biophysical properties and curated genomic reference data

Project description

polymer-genomics

Python client for the Polymer Genomics API — DNA biophysical properties and curated genomic reference data.

Install

pip install polymer-genomics

Quick Start

from polymer_genomics import PolymerClient

client = PolymerClient(api_key="pk_live_...")

# Evaluate a DNA sequence (physics linter)
report = client.evaluate("ATGCGATCGATCGATCG" * 20)
print(report["flag_counts"])
print(report["summary"]["mean_dG37"])

# Compare wild-type vs mutant
delta = client.compare({
    "wt":  "ATGCGATCGATCG" * 20,
    "mut": "ATGCGATCAATCG" * 20,
})
print(delta["deltas_vs_reference"])

# Look up a gene
tp53 = client.gene("hg38", "TP53")
print(tp53["symbol"], tp53["chr"], tp53["start"])

# GTEx expression
expr = client.gene_expression("hg38", "BRCA1")
print(expr["tissues"]["Breast - Mammary Tissue"])

# Query a genomic region
features = client.region("hg38", "chr17:7668402-7687550", layers=["cpg_islands"])

# Methylation probes
probe = client.probe("hg38", "cg00000029")
batch = client.batch_probes("hg38", ["cg00000029", "cg00000108"])

# Biophysical properties of a genomic region
bp = client.biophysics("hg38", "chr17:7668402-7669000")

# Batch evaluate up to 100 sequences
batch = client.batch_evaluate({
    "v1": "ATGCGATCGATCG" * 20,
    "v2": "ATGCAATCGATCG" * 20,
    "v3": "ATGCGATCAATCG" * 20,
})
print(batch["summary"])  # GC range, warning counts

# Region profile — everything about a region in one call
profile = client.region_profile("hg38", "chr17:7668402-7687550")
print(profile["summary"])  # layers with/without features
print(profile["flags"])    # significance flags

# Platform statistics
stats = client.platform_summary()
print(stats["platform"]["total_rows"])

# Cross-layer query recipes
recipes = client.recipes()
recipe = client.recipe("silencing_prone_regions")
# Use recipe filters with client.intersect()

# Reference data
nn = client.nn_parameters()          # nearest-neighbor thermodynamics
aa = client.amino_acid_properties()  # amino acid physicochemical data
pc = client.physical_constants()     # DNA/protein physical constants

Authentication

Pass your API key to the constructor:

client = PolymerClient(api_key="pk_live_...")

Or omit it for local development:

client = PolymerClient(base_url="http://localhost:8000")

Error Handling

from polymer_genomics import (
    PolymerAPIError,
    PolymerAuthError,
    PolymerNotFoundError,
    PolymerValidationError,
    PolymerRateLimitError,
)

try:
    client.gene("hg38", "NOTREAL")
except PolymerNotFoundError:
    print("Gene not found")
except PolymerRateLimitError:
    print("Slow down")
except PolymerAPIError as e:
    print(f"API error {e.status_code}: {e.message}")

API Reference

See the full API docs at api.polymerbio.org/docs.

License

MIT

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

polymer_genomics-0.3.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

polymer_genomics-0.3.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file polymer_genomics-0.3.0.tar.gz.

File metadata

  • Download URL: polymer_genomics-0.3.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for polymer_genomics-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a2e526ae27240b31f72501a6ec84b0c26ff0b4d621b990ee4be1967cb29edb0c
MD5 44181ec4fc8d45da060afb25a4d4066d
BLAKE2b-256 f6fdf95f4c3e628afcd1d56217100783bd2141216d94a24674bfc2b66d07acbe

See more details on using hashes here.

File details

Details for the file polymer_genomics-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: polymer_genomics-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for polymer_genomics-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6cd90c7ff0223d4f748c6a6cf1af76f76290299a79d462cc9e01b653794f8cf
MD5 658bd43b2f0a8820a8439a705110907f
BLAKE2b-256 2183318a3f7abad63d492c1591a1f799b3a73dd9a0bbd6aa5b85843e67d65572

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