sprime 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sprime-0.1.0/.github/workflows/deploy-api-docs.yml +59 -0
- sprime-0.1.0/.github/workflows/publish-pypi.yml +44 -0
- sprime-0.1.0/.gitignore +18 -0
- sprime-0.1.0/.pre-commit-config.yaml +12 -0
- sprime-0.1.0/LICENSE +23 -0
- sprime-0.1.0/PKG-INFO +440 -0
- sprime-0.1.0/README.md +410 -0
- sprime-0.1.0/docs/README_4PL_Dose_Response.md +240 -0
- sprime-0.1.0/docs/background_and_concepts.md +240 -0
- sprime-0.1.0/docs/development.md +66 -0
- sprime-0.1.0/docs/usage/basic_usage_guide.md +1079 -0
- sprime-0.1.0/docs/usage/demo.py +269 -0
- sprime-0.1.0/docs/usage/demo_data_delta.csv +3 -0
- sprime-0.1.0/docs/usage/demo_data_precalc.csv +4 -0
- sprime-0.1.0/docs/usage/demo_data_raw_list.csv +2 -0
- sprime-0.1.0/docs/usage/demo_data_s_prime.csv +2 -0
- sprime-0.1.0/docs/usage/hill_curve_fitting_configuration.md +374 -0
- sprime-0.1.0/docs/usage/template_precalc.csv +2 -0
- sprime-0.1.0/docs/usage/template_raw.csv +2 -0
- sprime-0.1.0/docs/usage/template_raw_list.csv +2 -0
- sprime-0.1.0/pdoc_html/sprime/hill_fitting.html +287 -0
- sprime-0.1.0/pdoc_html/sprime/index.html +5166 -0
- sprime-0.1.0/pdoc_html/sprime/reporting.html +809 -0
- sprime-0.1.0/pdoc_html/sprime/sprime.html +3945 -0
- sprime-0.1.0/pyproject.toml +53 -0
- sprime-0.1.0/scripts/build_docs_precommit.py +13 -0
- sprime-0.1.0/src/sprime/__init__.py +65 -0
- sprime-0.1.0/src/sprime/_version.py +34 -0
- sprime-0.1.0/src/sprime/hill_fitting.py +274 -0
- sprime-0.1.0/src/sprime/reporting.py +351 -0
- sprime-0.1.0/src/sprime/sprime.py +2233 -0
- sprime-0.1.0/tests/test_hill_fitting.py +276 -0
- sprime-0.1.0/tests/test_integration.py +775 -0
- sprime-0.1.0/tests/test_reporting.py +617 -0
- sprime-0.1.0/tests/test_sprime.py +764 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Build pdoc API docs and deploy to GitHub Pages (single copy).
|
|
2
|
+
# Updates on push to main or tag push (v*). No versioned paths.
|
|
3
|
+
# Pages: https://mocomakers.github.io/sprime/
|
|
4
|
+
|
|
5
|
+
name: Deploy API docs
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main]
|
|
10
|
+
tags: ["v*"]
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
pages: write
|
|
15
|
+
id-token: write
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: "pages"
|
|
19
|
+
cancel-in-progress: false
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
build:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout
|
|
26
|
+
uses: actions/checkout@v4
|
|
27
|
+
with:
|
|
28
|
+
ref: ${{ github.ref }}
|
|
29
|
+
|
|
30
|
+
- name: Set up Python
|
|
31
|
+
uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: "3.11"
|
|
34
|
+
|
|
35
|
+
- name: Install package and pdoc3
|
|
36
|
+
run: |
|
|
37
|
+
python -m pip install -U pip
|
|
38
|
+
pip install -e .
|
|
39
|
+
pip install pdoc3
|
|
40
|
+
|
|
41
|
+
- name: Build API docs
|
|
42
|
+
run: pdoc --html --output-dir build sprime
|
|
43
|
+
# Output: build/sprime/ (not pdoc_html). pdoc_html is for local preview only.
|
|
44
|
+
|
|
45
|
+
- name: Upload GitHub Pages artifact
|
|
46
|
+
uses: actions/upload-pages-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
path: build/sprime
|
|
49
|
+
|
|
50
|
+
deploy:
|
|
51
|
+
needs: build
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
environment:
|
|
54
|
+
name: github-pages
|
|
55
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
56
|
+
steps:
|
|
57
|
+
- name: Deploy to GitHub Pages
|
|
58
|
+
id: deployment
|
|
59
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Publish sprime to PyPI when a GitHub Release is published.
|
|
2
|
+
# Uses Trusted Publishing (OIDC): no API token needed.
|
|
3
|
+
# Setup: Add a pending publisher at https://pypi.org/manage/account/publishing/
|
|
4
|
+
# (owner/repo, workflow publish-pypi.yml, environment pypi).
|
|
5
|
+
# See: https://docs.pypi.org/trusted-publishers/
|
|
6
|
+
# https://github.com/pypa/gh-action-pypi-publish
|
|
7
|
+
|
|
8
|
+
name: Publish to PyPI
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
release:
|
|
12
|
+
types: [published]
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
pypi-publish:
|
|
16
|
+
name: Publish to PyPI
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
environment:
|
|
19
|
+
name: pypi
|
|
20
|
+
url: https://pypi.org/p/sprime
|
|
21
|
+
permissions:
|
|
22
|
+
id-token: write
|
|
23
|
+
contents: read
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout
|
|
26
|
+
uses: actions/checkout@v4
|
|
27
|
+
with:
|
|
28
|
+
fetch-depth: 0
|
|
29
|
+
|
|
30
|
+
- name: Set up Python
|
|
31
|
+
uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: "3.11"
|
|
34
|
+
|
|
35
|
+
- name: Install build dependencies
|
|
36
|
+
run: |
|
|
37
|
+
python -m pip install --upgrade pip
|
|
38
|
+
pip install build
|
|
39
|
+
|
|
40
|
+
- name: Build package
|
|
41
|
+
run: python -m build
|
|
42
|
+
|
|
43
|
+
- name: Publish to PyPI
|
|
44
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
sprime-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
docs/temp-docs-for-ai/
|
|
3
|
+
venv/
|
|
4
|
+
.pytest_cache/
|
|
5
|
+
delta_s_prime_table.csv
|
|
6
|
+
master_s_prime_table.csv
|
|
7
|
+
.cursor/
|
|
8
|
+
src/sprime/_version.py
|
|
9
|
+
|
|
10
|
+
# Build and distribution
|
|
11
|
+
dist/
|
|
12
|
+
build/
|
|
13
|
+
*.egg-info/
|
|
14
|
+
*.egg
|
|
15
|
+
|
|
16
|
+
# Coverage
|
|
17
|
+
htmlcov/
|
|
18
|
+
.coverage
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Optional: run `pre-commit install` to rebuild and stage pdoc_html before each commit
|
|
2
|
+
# when Python sources change. Requires: pip install -e ".[dev]"
|
|
3
|
+
|
|
4
|
+
repos:
|
|
5
|
+
- repo: local
|
|
6
|
+
hooks:
|
|
7
|
+
- id: pdoc
|
|
8
|
+
name: Build pdoc HTML (pdoc_html) and stage for commit
|
|
9
|
+
entry: python scripts/build_docs_precommit.py
|
|
10
|
+
language: system
|
|
11
|
+
pass_filenames: false
|
|
12
|
+
files: \.py$
|
sprime-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MoCo Maker Labs LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
|
sprime-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sprime
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A biomedical library for screening high-throughput screening data in preclinical drug studies
|
|
5
|
+
Project-URL: Homepage, https://github.com/mocomakers/sprime
|
|
6
|
+
Project-URL: Documentation, https://github.com/mocomakers/sprime#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/mocomakers/sprime
|
|
8
|
+
Project-URL: Issues, https://github.com/mocomakers/sprime/issues
|
|
9
|
+
Author-email: Matthew Zamora <matt@mocomakers.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: biomedical,drug-screening,high-throughput-screening,preclinical
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Requires-Dist: numpy<3.0,>=1.20.0
|
|
23
|
+
Requires-Dist: scipy>=1.7.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pdoc3; extra == 'dev'
|
|
26
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# sprime
|
|
32
|
+
|
|
33
|
+
[](https://www.python.org/downloads/)
|
|
34
|
+
[](https://opensource.org/licenses/MIT)
|
|
35
|
+
[](https://github.com/MoCoMakers/sprime)
|
|
36
|
+
|
|
37
|
+
**sprime** (S' or S prime) is a Python library for analyzing quantitative high-throughput screening (qHTS) data in preclinical drug discovery studies. The library provides tools for processing dose-response curves, fitting Hill equations, and calculating S' values—a single metric that summarizes a drug's dose-response profile relative to a cell line and assay.
|
|
38
|
+
|
|
39
|
+
## Overview
|
|
40
|
+
|
|
41
|
+
sprime enables researchers to:
|
|
42
|
+
|
|
43
|
+
- **Process qHTS data**: Load and analyze dose-response data from screening campaigns
|
|
44
|
+
- **Fit Hill curves**: Automatically fit four-parameter logistic (4PL) models to dose-response data
|
|
45
|
+
- **Calculate S' values**: Compute S' (S prime) metrics that combine potency and efficacy into a single score
|
|
46
|
+
- **Compare cell lines**: Use delta S' (ΔS') to identify compounds with selective activity between reference and test cell lines
|
|
47
|
+
- **Rank compounds**: Systematically prioritize drug candidates based on their dose-response profiles
|
|
48
|
+
|
|
49
|
+
## About S' (S Prime)
|
|
50
|
+
|
|
51
|
+
S' is a single value score that summarizes a drug's dose-response curve. The metric is calculated from Hill curve parameters using the formula:
|
|
52
|
+
|
|
53
|
+
**S' = asinh((Upper - Lower) / EC50)**
|
|
54
|
+
|
|
55
|
+
This is equivalent to:
|
|
56
|
+
|
|
57
|
+
$$S' = \ln\left(\frac{\text{Upper} - \text{Lower}}{\text{EC50}} + \sqrt{\left(\frac{\text{Upper} - \text{Lower}}{\text{EC50}}\right)^2 + 1}\right)$$
|
|
58
|
+
|
|
59
|
+
Where:
|
|
60
|
+
- **Upper** = Upper asymptote of the dose-response curve
|
|
61
|
+
- **Lower** = Lower asymptote of the dose-response curve
|
|
62
|
+
- **EC50** = Half-maximal effect concentration
|
|
63
|
+
|
|
64
|
+
Higher S' values indicate stronger drug responses (higher efficacy and/or potency). See [Background and Concepts](docs/background_and_concepts.md#the-s-s-prime-metric) for detailed information.
|
|
65
|
+
|
|
66
|
+
### Delta S' and Comparative Analysis
|
|
67
|
+
|
|
68
|
+
**Delta S'** (ΔS') enables quantitative comparison of drug responses between different cell lines within a single assay:
|
|
69
|
+
|
|
70
|
+
**ΔS' = S'(reference cell line) - S'(test cell line)**
|
|
71
|
+
|
|
72
|
+
This metric allows researchers to:
|
|
73
|
+
- Compare drug effects across cell lines
|
|
74
|
+
- Rank compounds by selectivity
|
|
75
|
+
- Prioritize drug candidates for further investigation
|
|
76
|
+
|
|
77
|
+
For detailed information and examples, see [Delta S' for Comparative Analysis](docs/background_and_concepts.md#delta-s-for-comparative-analysis).
|
|
78
|
+
|
|
79
|
+
This library implements **Generation 2** of the S' methodology, which evolved from the original S metric. See the [Citation](#citation) section below for references.
|
|
80
|
+
|
|
81
|
+
## Installation
|
|
82
|
+
|
|
83
|
+
### Requirements
|
|
84
|
+
|
|
85
|
+
- Python 3.8 or higher
|
|
86
|
+
- numpy >= 1.20.0, < 3.0
|
|
87
|
+
- scipy >= 1.7.0
|
|
88
|
+
|
|
89
|
+
### Install from PyPI
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pip install sprime
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Install from Source
|
|
96
|
+
|
|
97
|
+
For development or to get the latest version:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Clone the repository
|
|
101
|
+
git clone https://github.com/MoCoMakers/sprime.git
|
|
102
|
+
cd sprime
|
|
103
|
+
|
|
104
|
+
# Install in editable mode
|
|
105
|
+
pip install -e .
|
|
106
|
+
|
|
107
|
+
# Or install with development dependencies
|
|
108
|
+
pip install -e ".[dev]"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Development Setup
|
|
112
|
+
|
|
113
|
+
To set up a development environment:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/MoCoMakers/sprime.git
|
|
117
|
+
cd sprime
|
|
118
|
+
python -m venv venv
|
|
119
|
+
source venv/bin/activate # Windows: venv\Scripts\activate
|
|
120
|
+
pip install -e ".[dev]"
|
|
121
|
+
pytest tests/
|
|
122
|
+
pre-commit install # optional: rebuild + stage pdoc_html on commit when .py changes
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
See **[Development guide](docs/development.md)** for full setup, pre-commit, API docs, and CI.
|
|
126
|
+
|
|
127
|
+
## Quick Start
|
|
128
|
+
|
|
129
|
+
The basic workflow in sprime is: **Load** raw data from CSV → **Process** (fit curves, calculate S') → **Analyze** (e.g. delta S' for comparative analysis).
|
|
130
|
+
|
|
131
|
+
**Three ways to load data:**
|
|
132
|
+
|
|
133
|
+
| Path | `values_as` | Your data | Required columns | What sprime does |
|
|
134
|
+
|------|-------------|-----------|------------------|------------------|
|
|
135
|
+
| **A — Raw (columns)** | `"columns"` | `DATA0`..`DATAN`, `CONC0`..`CONCN` (one column per value) | `Cell_Line`, `Compound_ID`, `Concentration_Units` | Fits Hill equation coefficients and stats → AC50, Upper, Lower, Hill Slope, r² → S' |
|
|
136
|
+
| **A — Raw (list)** | `"list"` | `Responses`, `Concentrations` (comma-separated in one cell each) | `Cell_Line`, `Compound_ID`, `Concentration_Units` | Same as above |
|
|
137
|
+
| **B — Pre-calculated** | N/A | `AC50`, `Upper`, `Lower` (optional: Hill Slope, r2, S', etc.) | `Cell_Line`, `Compound_ID` | Uses params as-is; always computes S' (warns if S' was provided) |
|
|
138
|
+
|
|
139
|
+
Use **Path A (columns)** by default (`values_as="columns"`). Use **Path A (list)** with `sp.load(..., values_as="list")` when your data has `Responses` and `Concentrations` as comma-separated values. For list format, if the CSV is comma-delimited, quote those cells (e.g. `"4000,300,2"`). Any non-reserved columns in your CSV (e.g. MOA, assay_timescale) propagate forward by default into S' output and the master CSV export.
|
|
140
|
+
|
|
141
|
+
### Path A — Raw data
|
|
142
|
+
|
|
143
|
+
**Templates:** [template_raw.csv](https://raw.githubusercontent.com/MoCoMakers/sprime/refs/heads/main/docs/usage/template_raw.csv) (columns), [template_raw_list.csv](https://raw.githubusercontent.com/MoCoMakers/sprime/refs/heads/main/docs/usage/template_raw_list.csv) (list). See [Required headings](#required-headings) below.
|
|
144
|
+
|
|
145
|
+
The **load** call changes with format; **process** does not. You must pass `values_as="columns"` (default) or `values_as="list"` — format is not auto-detected from headings.
|
|
146
|
+
|
|
147
|
+
Run from the directory containing the demo CSVs (e.g. `docs/usage/`), or use paths like `docs/usage/demo_data_s_prime.csv`.
|
|
148
|
+
|
|
149
|
+
**Option 1 — Columns** (DATA0..N, CONC0..N)
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from sprime import SPrime as sp
|
|
153
|
+
|
|
154
|
+
# Download (columns), then save locally:
|
|
155
|
+
# https://raw.githubusercontent.com/MoCoMakers/sprime/refs/heads/main/docs/usage/demo_data_s_prime.csv
|
|
156
|
+
# https://raw.githubusercontent.com/MoCoMakers/sprime/refs/heads/main/docs/usage/demo_data_delta.csv
|
|
157
|
+
# Demo files include both raw DATA/CONC and pre-calc params; refit from raw.
|
|
158
|
+
|
|
159
|
+
raw_data, _ = sp.load("demo_data_s_prime.csv", values_as="columns")
|
|
160
|
+
screening_data, _ = sp.process(raw_data, allow_overwrite_hill_coefficients=True)
|
|
161
|
+
screening_data.export_to_csv("master_s_prime_table.csv")
|
|
162
|
+
results = screening_data.to_dict_list()
|
|
163
|
+
for profile in results:
|
|
164
|
+
print(f"{profile['compound_name']} vs {profile['cell_line']}: S' = {profile['s_prime']:.2f}")
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Option 2 — List** (Responses, Concentrations as comma-separated per cell)
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from sprime import SPrime as sp
|
|
171
|
+
|
|
172
|
+
# Download (list), then save locally:
|
|
173
|
+
# https://raw.githubusercontent.com/MoCoMakers/sprime/refs/heads/main/docs/usage/demo_data_raw_list.csv
|
|
174
|
+
|
|
175
|
+
raw_data, _ = sp.load("demo_data_raw_list.csv", values_as="list")
|
|
176
|
+
screening_data, _ = sp.process(raw_data)
|
|
177
|
+
screening_data.export_to_csv("master_s_prime_table.csv")
|
|
178
|
+
results = screening_data.to_dict_list()
|
|
179
|
+
for profile in results:
|
|
180
|
+
print(f"{profile['compound_name']} vs {profile['cell_line']}: S' = {profile['s_prime']:.2f}")
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Path B — Pre-calculated
|
|
184
|
+
|
|
185
|
+
**Sample file:** [demo_data_precalc.csv](https://raw.githubusercontent.com/MoCoMakers/sprime/refs/heads/main/docs/usage/demo_data_precalc.csv)
|
|
186
|
+
**Template:** [template_precalc.csv](https://raw.githubusercontent.com/MoCoMakers/sprime/refs/heads/main/docs/usage/template_precalc.csv)
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from sprime import SPrime as sp
|
|
190
|
+
|
|
191
|
+
# Download, then save locally:
|
|
192
|
+
# https://raw.githubusercontent.com/MoCoMakers/sprime/refs/heads/main/docs/usage/demo_data_precalc.csv
|
|
193
|
+
|
|
194
|
+
raw_data, _ = sp.load("demo_data_precalc.csv")
|
|
195
|
+
screening_data, _ = sp.process(raw_data)
|
|
196
|
+
screening_data.export_to_csv("master_s_prime_table.csv")
|
|
197
|
+
results = screening_data.to_dict_list()
|
|
198
|
+
for profile in results:
|
|
199
|
+
print(f"{profile['compound_name']} vs {profile['cell_line']}: S' = {profile['s_prime']:.2f}")
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Delta S' example
|
|
203
|
+
|
|
204
|
+
Compare drug responses between reference and test cell lines (e.g. non-tumor vs tumor). Delta S' = S'(reference) − S'(test); more negative = more effective in test tissue.
|
|
205
|
+
|
|
206
|
+
**Demo CSV (two cell lines):** [demo_data_delta.csv](https://raw.githubusercontent.com/MoCoMakers/sprime/refs/heads/main/docs/usage/demo_data_delta.csv)
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
from sprime import SPrime as sp, ScreeningDataset
|
|
210
|
+
|
|
211
|
+
# Download, then save locally:
|
|
212
|
+
# https://raw.githubusercontent.com/MoCoMakers/sprime/refs/heads/main/docs/usage/demo_data_delta.csv
|
|
213
|
+
|
|
214
|
+
raw_data, _ = sp.load("demo_data_delta.csv", values_as="columns")
|
|
215
|
+
screening_data, _ = sp.process(raw_data, allow_overwrite_hill_coefficients=True)
|
|
216
|
+
screening_data.export_to_csv("master_s_prime_table.csv")
|
|
217
|
+
|
|
218
|
+
delta_results = screening_data.calculate_delta_s_prime(
|
|
219
|
+
reference_cell_lines=["ipnf05.5 mc"], # e.g. non-tumor; list supports multiple
|
|
220
|
+
test_cell_lines=["ipNF96.11C"] # e.g. tumor; list supports multiple
|
|
221
|
+
)
|
|
222
|
+
# Opt-in: add compound-level columns (1:1 in ref & test) to delta output and export:
|
|
223
|
+
# headings_one_to_one_in_ref_and_test=["assay_timescale"], # etc.
|
|
224
|
+
# source_profile="test", # "ref" or "test" — which profile to use for those values
|
|
225
|
+
# Pass the same list to export_delta_s_prime_to_csv(..., headings_one_to_one_in_ref_and_test=[...])
|
|
226
|
+
ScreeningDataset.export_delta_s_prime_to_csv(delta_results, "delta_s_prime_table.csv")
|
|
227
|
+
|
|
228
|
+
for ref_cl, comparisons in delta_results.items():
|
|
229
|
+
for c in comparisons:
|
|
230
|
+
print(f"{c['compound_name']}: Delta S' = {c['delta_s_prime']:.2f}")
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Required headings
|
|
234
|
+
|
|
235
|
+
- **All paths:** `Cell_Line`; and `Compound_ID`. (`NCGCID` is optional pass-through per compound.)
|
|
236
|
+
- **Path A (raw):** **`Concentration_Units`** (required). Either **(columns)** `DATA0`..`DATA N`, `CONC0`..`CONC N` (same N), or **(list)** `Responses` and `Concentrations` (comma-separated values in one cell each). Use `values_as="columns"` (default) or `values_as="list"`. See [Supported concentration units](#supported-concentration-units) below.
|
|
237
|
+
- **Path B (pre-calc):** `AC50` (or `ec50`), `Upper` (or `Infinity`), `Lower` (or `Zero`). Optional: `Hill_Slope`, `r2`, `S'`.
|
|
238
|
+
|
|
239
|
+
Template files list the exact headers (required columns first); your CSV should match those. Column order in the file does not matter—matching is by header name only.
|
|
240
|
+
|
|
241
|
+
### Supported concentration units
|
|
242
|
+
|
|
243
|
+
For Path A (raw), `Concentration_Units` must be present. All values are converted to **microM** internally. Supported units (case-insensitive), smallest to largest: **fM** (`fm`, `femtom`); **pM** (`pm`, `picom`); **nM** (`nm`, `nanom`); **microM** (`µM`, `um`, `microm`, `micro`); **mM** (`mm`, `millim`); **M** (`m`, `mol`).
|
|
244
|
+
|
|
245
|
+
### Next steps
|
|
246
|
+
|
|
247
|
+
- **Format details:** [Basic Usage Guide](docs/usage/basic_usage_guide.md)
|
|
248
|
+
- **Run all scenarios:** [Demo](docs/usage/demo.py)
|
|
249
|
+
- **Individual profiles & pre-calculated parameters:** [Basic Usage Guide](docs/usage/basic_usage_guide.md) (*Processing Individual Profiles*, *Creating dose-response profiles from scratch*, *Working with Pre-calculated Hill Parameters*)
|
|
250
|
+
|
|
251
|
+
## Key Features
|
|
252
|
+
|
|
253
|
+
- **Automatic Curve Fitting**: Fits four-parameter logistic (Hill) curves to dose-response data
|
|
254
|
+
- **Flexible Input**: Supports raw dose-response data or pre-calculated Hill parameters. When both exist, use `allow_overwrite_hill_coefficients=True` to refit from raw; overwrites are logged as warnings.
|
|
255
|
+
- **CSV Loading**: Handles common screening data formats; rows are literal (empty = null, no forward-filling)
|
|
256
|
+
- **Delta S' Analysis**: Compare drug responses across cell lines within a single assay
|
|
257
|
+
- **CSV Export**: Built-in methods to export results and delta S' comparisons to CSV
|
|
258
|
+
- **In-Memory Processing**: Process data directly from list of dictionaries without CSV files
|
|
259
|
+
- **Metadata Support**: Extracts and preserves metadata (MOA, drug targets) from CSV files
|
|
260
|
+
- **Type-Safe**: Uses Python dataclasses and type hints throughout
|
|
261
|
+
- **Comprehensive Documentation**: Includes guides for users and detailed technical documentation
|
|
262
|
+
|
|
263
|
+
## Documentation
|
|
264
|
+
|
|
265
|
+
### Getting Started
|
|
266
|
+
|
|
267
|
+
- **[API Reference](https://mocomakers.github.io/sprime/)** - API documentation (generated from docstrings)
|
|
268
|
+
- **[Basic Usage Guide](docs/usage/basic_usage_guide.md)** - Comprehensive step-by-step guide to using sprime with your data, including advanced usage patterns and testing
|
|
269
|
+
|
|
270
|
+
### Core Concepts
|
|
271
|
+
|
|
272
|
+
- **[Background and Concepts](docs/background_and_concepts.md)** - Introduction to qHTS, assays, S' metric, and key terminology
|
|
273
|
+
- **[Understanding 4PL Dose-Response Curves](docs/README_4PL_Dose_Response.md)** - Detailed explanation of the Hill equation model
|
|
274
|
+
|
|
275
|
+
### Technical Documentation
|
|
276
|
+
|
|
277
|
+
- **[Hill Curve Fitting Configuration](docs/usage/hill_curve_fitting_configuration.md)** - Technical details on curve fitting parameters and configuration options
|
|
278
|
+
- **[Development guide](docs/development.md)** - Dev setup, tests, pre-commit, API docs, CI (for contributors)
|
|
279
|
+
|
|
280
|
+
### Examples
|
|
281
|
+
|
|
282
|
+
- **[Demo Script](docs/usage/demo.py)** - Consolidated demo: S' only (raw -> Hill -> S'), pre-calc only (bypass raw data), and Delta S' (raw -> Hill -> S' -> delta, export tables)
|
|
283
|
+
|
|
284
|
+
## Requirements
|
|
285
|
+
|
|
286
|
+
### Runtime Dependencies
|
|
287
|
+
|
|
288
|
+
- **numpy** >= 1.20.0, < 3.0 - Numerical computing (compatible with numpy 1.x and 2.x)
|
|
289
|
+
- **scipy** >= 1.7.0 - Scientific computing and curve fitting
|
|
290
|
+
|
|
291
|
+
### Development Dependencies
|
|
292
|
+
|
|
293
|
+
Development dependencies are optional and only needed if you plan to contribute to sprime or run the test suite:
|
|
294
|
+
|
|
295
|
+
- **pytest** >= 7.0.0 - Testing framework for running the comprehensive test suite
|
|
296
|
+
- Used to execute unit tests, integration tests, and edge case tests
|
|
297
|
+
- Provides test discovery, fixtures, and assertion utilities
|
|
298
|
+
- Required for: `pytest tests/` commands
|
|
299
|
+
|
|
300
|
+
- **pytest-cov** >= 4.0.0 - Coverage reporting plugin for pytest
|
|
301
|
+
- Generates code coverage reports to identify untested code
|
|
302
|
+
- Used with: `pytest --cov=src/sprime --cov-report=html`
|
|
303
|
+
- Helps ensure comprehensive test coverage during development
|
|
304
|
+
|
|
305
|
+
- **pdoc3** - Generates API docs from docstrings into `pdoc_html/`
|
|
306
|
+
- **pre-commit** - Optional; rebuilds `pdoc_html` before each commit when `.py` files change
|
|
307
|
+
|
|
308
|
+
**Install development dependencies:**
|
|
309
|
+
```bash
|
|
310
|
+
pip install -e ".[dev]"
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
These dependencies are not required for normal usage of sprime - only for development and testing.
|
|
314
|
+
|
|
315
|
+
## Testing
|
|
316
|
+
|
|
317
|
+
sprime includes a comprehensive test suite. To run tests:
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
# Install development dependencies
|
|
321
|
+
pip install -e ".[dev]"
|
|
322
|
+
|
|
323
|
+
# Run all tests
|
|
324
|
+
pytest tests/
|
|
325
|
+
|
|
326
|
+
# Run with coverage
|
|
327
|
+
pytest tests/ --cov=src/sprime --cov-report=html
|
|
328
|
+
|
|
329
|
+
# Run specific test files
|
|
330
|
+
pytest tests/test_sprime.py
|
|
331
|
+
pytest tests/test_hill_fitting.py
|
|
332
|
+
pytest tests/test_integration.py
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
See the [Basic Usage Guide](docs/usage/basic_usage_guide.md#running-the-test-suite) for more testing information.
|
|
336
|
+
|
|
337
|
+
### API docs (pdoc_html)
|
|
338
|
+
|
|
339
|
+
API docs live in `pdoc_html/` in the repo and are built from docstrings. The [API Reference](https://mocomakers.github.io/sprime/) on GitHub Pages is deployed from CI. Build locally: `python -m pdoc --html --output-dir pdoc_html --force sprime`. Optional: `pre-commit install` rebuilds and stages `pdoc_html` on commit when `.py` files change. See [Development guide](docs/development.md) for details.
|
|
340
|
+
|
|
341
|
+
## Project Status
|
|
342
|
+
|
|
343
|
+
This project is currently in **active development** (Alpha status). Features and API may change.
|
|
344
|
+
|
|
345
|
+
### Current Version
|
|
346
|
+
|
|
347
|
+
The package uses semantic versioning. Version is derived from **Git tags** (via [hatch-vcs](https://github.com/ofek/hatch-vcs)); `src/sprime/_version.py` is generated at build/install time and is not committed. Check the installed version:
|
|
348
|
+
|
|
349
|
+
```python
|
|
350
|
+
import sprime
|
|
351
|
+
print(sprime.__version__)
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
**Tagging releases:** Create a Git tag (e.g. `v0.1.0`) and push it. The version used in built packages and on PyPI comes from that tag.
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
git tag v0.1.0
|
|
358
|
+
git push origin v0.1.0
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## Contributing
|
|
362
|
+
|
|
363
|
+
Contributions are welcome! We appreciate your help in making sprime better.
|
|
364
|
+
|
|
365
|
+
### How to Contribute
|
|
366
|
+
|
|
367
|
+
1. **Fork the repository** on GitHub
|
|
368
|
+
2. **Create a feature branch** (`git checkout -b feature/amazing-feature`)
|
|
369
|
+
3. **Set up dev environment** — venv, `pip install -e ".[dev]"`, `pytest tests/`, optionally `pre-commit install`. See [Development guide](docs/development.md).
|
|
370
|
+
4. **Make your changes** and add tests if applicable
|
|
371
|
+
5. **Run the test suite** — `pytest tests/`
|
|
372
|
+
6. **Commit your changes** (`git commit -m 'Add amazing feature'`). If you use pre-commit, the pdoc hook will rebuild and stage `pdoc_html` when you change `.py` files.
|
|
373
|
+
7. **Push to the branch** (`git push origin feature/amazing-feature`)
|
|
374
|
+
8. **Open a Pull Request**
|
|
375
|
+
|
|
376
|
+
### Development Guidelines
|
|
377
|
+
|
|
378
|
+
- Follow PEP 8 style guidelines
|
|
379
|
+
- Add tests for new features
|
|
380
|
+
- Update documentation as needed
|
|
381
|
+
- Ensure all tests pass before submitting
|
|
382
|
+
|
|
383
|
+
### Reporting Issues
|
|
384
|
+
|
|
385
|
+
If you find a bug or have a feature request, please open an issue on GitHub:
|
|
386
|
+
- [Issue Tracker](https://github.com/MoCoMakers/sprime/issues)
|
|
387
|
+
|
|
388
|
+
### Questions
|
|
389
|
+
|
|
390
|
+
For questions or support, please reach out via:
|
|
391
|
+
- [MoCo Makers Contact](https://www.mocomakers.com/contact/)
|
|
392
|
+
- Open a GitHub Discussion
|
|
393
|
+
|
|
394
|
+
## Repository
|
|
395
|
+
|
|
396
|
+
- **GitHub**: [https://github.com/MoCoMakers/sprime](https://github.com/MoCoMakers/sprime)
|
|
397
|
+
- **Issues**: [https://github.com/MoCoMakers/sprime/issues](https://github.com/MoCoMakers/sprime/issues)
|
|
398
|
+
|
|
399
|
+
## Citation
|
|
400
|
+
|
|
401
|
+
If you use sprime in your research, please cite:
|
|
402
|
+
|
|
403
|
+
### Generation 2 (S') Methodology
|
|
404
|
+
|
|
405
|
+
New citations introducing Generation 2 (S') are forthcoming. Please check back for updated citation information.
|
|
406
|
+
|
|
407
|
+
### Original S Metric
|
|
408
|
+
|
|
409
|
+
This library implements **Generation 2** of the S' methodology, which evolved from the original S metric described in:
|
|
410
|
+
|
|
411
|
+
> Zamora PO, Altay G, Santamaria U, Dwarshuis N, Donthi H, Moon CI, Bakalar D, Zamora M. Drug Responses in Plexiform Neurofibroma Type I (PNF1) Cell Lines Using High-Throughput Data and Combined Effectiveness and Potency. *Cancers (Basel)*. 2023 Dec 12;15(24):5811. doi: [10.3390/cancers15245811](https://doi.org/10.3390/cancers15245811). PMID: 38136356; PMCID: PMC10742026.
|
|
412
|
+
|
|
413
|
+
### Hill Curve Fitting Implementation
|
|
414
|
+
|
|
415
|
+
The Hill curve fitting implementation in sprime is inspired by the four parameter logistic regression work by Giuseppe Cardillo:
|
|
416
|
+
|
|
417
|
+
> Giuseppe Cardillo (2025). Four parameters logistic regression - There and back again (https://github.com/dnafinder/logistic4), GitHub. Retrieved December 24, 2025
|
|
418
|
+
|
|
419
|
+
## Acknowledgments
|
|
420
|
+
|
|
421
|
+
This library was developed by the **Computational Biology Working Group** at [DMV Petri Dish](https://compbio.dmvpetridish.com/) with support from the nonprofit [DMV Petri Dish](https://www.dmvpetridish.com/).
|
|
422
|
+
|
|
423
|
+
We're also part of the DIY tech/science community at [MoCo Makers](https://www.mocomakers.com/).
|
|
424
|
+
|
|
425
|
+
## License
|
|
426
|
+
|
|
427
|
+
This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
|
|
428
|
+
|
|
429
|
+
Copyright (C) 2026 MoCo Maker Labs LLC
|
|
430
|
+
|
|
431
|
+
## Support
|
|
432
|
+
|
|
433
|
+
- **Documentation**: See the [docs](docs/) directory for comprehensive guides
|
|
434
|
+
- **Issues**: Report bugs or request features on [GitHub Issues](https://github.com/MoCoMakers/sprime/issues)
|
|
435
|
+
- **Contact**: Reach out via [MoCo Makers Contact](https://www.mocomakers.com/contact/)
|
|
436
|
+
|
|
437
|
+
## Related Projects
|
|
438
|
+
|
|
439
|
+
- [DMV Petri Dish Computational Biology](https://compbio.dmvpetridish.com/) - Computational biology research group
|
|
440
|
+
- [MoCo Makers](https://www.mocomakers.com/) - DIY tech/science community
|