Skip to main content

Peaksel SDK (Python)

A library to manage chromatography data in Peaksel: upload raw data, fetch the results of parsing (spectra, traces, peaks, injection info, etc).

If you need some advanced processing (like peak deconvolution), you can combine it with:

  • MOCCA for DAD/PDA spectral processing for peak deconvolution, purity and yield calculations
  • matchms for Mass Spec (especially Tandem MS) spectral processing, as well as isotopic pattern score matching and searching, and other machine learning capabilities.
  • Unknown MS peaks analysis for automated identification of unknown MS peaks using custom logic or libraries.
  • Wavelength extraction in a batch to extract a DAD/PDA wavelength chromatogram in all injections of a batch.

To install Peaksel SDK:

pip install elsci-peaksel-sdk

Examples

Read public data

First, we're going to read an already uploaded injection (like this one), and print some spectra info from each detector:

from peakselsdk.Peaksel import Peaksel

# Initialize the entry point:
peaksel = Peaksel("https://peaksel.elsci.io", org_name="elsci")

# Fetch injection info:
injection = peaksel.injections().get("8ehCv4tVR1U")

# Go through all detectors and print the spectra:
for detectorRun in injection.detectorRuns:
    if not detectorRun.has_spectra():
        continue
    spectra = peaksel.blobs().get_spectra(detectorRun.blobs.spectra)  # fetch spectra
    for spectrum in spectra:
        print(f"{spectrum.rt}: {spectrum.x}")

Uploading & parsing vendor files

If you want to upload an injection or read private data, you must authenticate. The general steps stay similar though:

from peakselsdk.Peaksel import Peaksel
from peakselsdk.util.CacheManager import CacheManager, FsCacheManager, NoCacheManager, InMemCacheManager

org = "YOUR ORG NAME"  # or your username if you want to work with your personal data
auth_header = {"Cookie": "SESSION=YOUR SESSION ID"}  # either cookie or Basic Auth
raw_data = "/path/to/zip/with/raw-data.zip"

# Entry point to Peaksel:
peaksel = Peaksel("https://peaksel.elsci.io", org_name=org, default_headers=auth_header)

# Upload & parse, get the ID back:
injection_ids = peaksel.injections().upload(raw_data) 

# Fetch injection info:
injection = peaksel.injections().get(injection_ids[0])

# Now you can do the same operations as in the previous example
# ...

Before running this:

  1. You need to register at Peaksel Hub, get a private SaaS or install Peaksel on your machines.
  2. Determine how you want to authenticate (service account or SessionID, see the next section)

Authentication

If you're just playing, you can run the code on behalf of your own account:

auth_header = {"Cookie": "SESSION=YOUR SESSION ID"}

You can get this cookie from the browser:

  1. In Chrome: open Peaksel -> authenticate -> Press F12
  2. Go to Application tab -> Cookies -> click on the website URL -> copy the Value of the JSESSIONID cookie

Service Accounts auth (Basic Auth)

Service accounts can have their Basic Auth credentials specified in Peaksel configs. This option is available in Private SaaS and on-prem installations. For Peaksel Hub you need to request it (support@elsci.io). If you go with Basic Auth, then in the code you set up auth headers this way:

from peakselsdk.util.api_util import peaksel_basic_auth_header

auth_header = {"Authorization": peaksel_basic_auth_header("your username", "your password")}

Design & Conventions

All the necessary functionality is exposed from peakselsdk.Peaksel class - just use its methods to work with Injections, Batches, Substances (analytes), Peaks, etc.

  • XxxClient are classes to communicate with the app API, they are created and returned by Peaksel entrypoint
  • Classes like User, Org, Injection capture the actual requests and responses
    • Fields are camelCased to match the JSON structure
    • The JSON's id is actually stored in eid (aka entity id) in the classes. Because id has special meaning in Python.
    • Every __init__() has **kwargs param that is ignored. This is needed to simplify parsing of response JSONs, as we always keep the names in the classes and JSONs the same, so when passing those as dict into the constructor, the corresponding fields are set. But it's possible that in Peaksel we add a new param, and this would break dict->DTO conversion as the param will be unknown. So to be forward-compatible, we add **kwargs to capture all the unknown fields.

Working with source code

  1. Install uv build tool and run: uv venv && uv sync && uv build
  2. In PyCharm mark src as Sources Root and test as Test Sources Root
  3. To run the tests ./test.sh

Metadata

Release files for elsci-peaksel-sdk 1.9.0

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

Source distribution (sdist)

Source distribution for elsci-peaksel-sdk 1.9.0
File Size Uploaded Provenance Actions
elsci_peaksel_sdk-1.9.0.tar.gz 20.7 kB With provenance Details for elsci_peaksel_sdk-1.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for elsci-peaksel-sdk 1.9.0
File Interpreter ABI Platform Actions
elsci_peaksel_sdk-1.9.0-py3-none-any.whl Python 3 none any Details for elsci_peaksel_sdk-1.9.0-py3-none-any.whl

Total release size: 50.8 kB

Release files / elsci_peaksel_sdk-1.9.0.tar.gz

Download URL elsci_peaksel_sdk-1.9.0.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
43a8d88495327f63042d2b8a1dec87dd49972845bb776d4999e924651c52bcaa
BLAKE2b-256 checksum
How to use checksums
6146a50f7cc1e4ef0abed80ed835985bbaaa2152cf5619ea3188df554173c760
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / elsci_peaksel_sdk-1.9.0-py3-none-any.whl

Download URL elsci_peaksel_sdk-1.9.0-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
135154ef8da8f41adeb7318737ee51bdfc6dfbf272aac9077cdddd57135e0edf
BLAKE2b-256 checksum
How to use checksums
1f628556cfc2caa53b176077644ff28de682c791200e25f3348d91b9720202fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for elsci-peaksel-sdk 1.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for elsci_peaksel_sdk-1.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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