Skip to content

odea-project/pints-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PINTS-Py

Python wrapper for PINTS (Pipelines for Non-Target Screening). This package provides Python APIs and a command-line interface (CLI) to manage and query PINTS databases based on the pints-core-sql schema.

Features

  • Initialize and seed a DuckDB with the PINTS Core schema
  • Add samples, runs, and features programmatically
  • Export tables to CSV for downstream analysis
  • Query using either the Python API or the CLI (pints ...)
  • Reuses the universal SQL definitions from pints-core-sql

Installation

Clone and install in editable mode:

git clone https://github.com/odea-project/pints-py.git
cd pints-py
python -m venv .venv                # For virtual environment
.venv/Scripts/Activate.ps1          # For virtual environment on Windows PowerShell
pip install -e .

This will also fetch the pints-core-sql submodule.

Update Submodules

To update the pints-core-sql submodule to the latest commit on its main branch:

cd extern/pints-plugins
git fetch origin
git checkout main        # oder dein Branchname
git pull origin main
cd ../..

Then commit the updated submodule reference in the main repo.

Quick Start

Using Python CLI

Initialize a new PINTS feature list:

pints init --db myFeatures.duckdb

Seed the feature list with the core schema:

pints seed --db myFeatures.duckdb

Add a sample:

pints add-sample --db myFeatures.duckdb --id S001 --type Sample --desc "River water"

Add a run linked to the sample:

pints add-run --db myFeatures.duckdb --id R001 --sample S001 --time "2025-09-12 09:00:00" --instrument QTOF-XYZ --method POS_5min --batch B01

Add a feature linked to the run:

pints add-feature --db myFeatures.duckdb --id R001_F0001 --run R001 --sample S001 --mz 301.123456 --rt 312.4 --area 154321.2

Export the features table to CSV:

pints export features --db myFeatures.duckdb --out features.csv

Check schema and vocabulary versions:

pints show-version --db myFeatures.duckdb

List all tables in the database:

pints list-tables --db myFeatures.duckdb

Using Plugins

The CLI supports plugins for extended functionality from pints-plugins (e.g., intra_run_components). To use plugins, install them in the same environment:

pints plugin install --db myFeatures.duckdb --name intra_run_components

Add data using plugin commands:

pints plugin insert --db myFeatures.duckdb --name intra_run_components --rows "R001,R001_F0001,C001" "R001,R001_F0002,C001" --materialize

Export plugin tables:

pints plugin export --db my.duckdb --name intra_run_components --out intra.csv

Development

This repo depends on pints-core-sql as a Git submodule. After cloning, make sure to initialize submodules:

git submodule update --init --recursive

The SQL files from pints-core-sql/sql are synced into pints/sql before packaging.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages