Metadata-Version: 2.4
Name: globaltestpy
Version: 0.1.0
Summary: Prototype Python implementation of the Global Test for groups of features.
Author: Daniel Ferrer-Vinals
Maintainer: globaltestpy contributors
License-Expression: MIT
Project-URL: Homepage, https://github.com/ferrervi/globaltestpy
Project-URL: Issues, https://github.com/ferrervi/globaltestpy/issues
Project-URL: Changelog, https://github.com/ferrervi/globaltestpy/blob/main/CHANGELOG.md
Keywords: statistics,global-test,score-test,bioinformatics,scientific-python
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23
Requires-Dist: scipy>=1.9
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: pandas>=1.5; extra == "dev"
Provides-Extra: validation
Requires-Dist: pandas>=1.5; extra == "validation"
Dynamic: license-file

# globaltestpy

`globaltestpy` is a prototype scientific Python package that implements the Global Test score test for assessing whether a group of alternative features is associated with a response while adjusting for optional null covariates.

The implementation currently supports:

- continuous responses with a linear null model;
- binary responses with a logistic null model;
- Satterthwaite and Imhof-style asymptotic p-values;
- permutation p-values for exchangeable residual settings;
- deterministic validation datasets for comparison against the R `globaltest` package.

This repository is intended as a clean starting point for an installable open-source package. The numerical implementation should continue to be reviewed against primary Global Test references and independent implementations before production use.

## Installation

Install the package in editable mode from the repository root:

```bash
python -m pip install -e ".[dev]"
```

## Quick Start

```python
import numpy as np

from globaltestpy import GlobalTest

rng = np.random.default_rng(42)
y = rng.normal(size=60)
x = rng.normal(size=(60, 20))

test = GlobalTest(response=y, alternative_features=x, model_type="linear").fit()

print(test.Q)
print(test.p_value_asymptotic(method="satterthwaite"))
```

For logistic models, pass a binary response and `model_type="logistic"`.

## Repository Layout

```text
globaltestpy/
├── src/globaltestpy/        # importable package
├── tests/                   # unit and regression tests
├── scripts/                 # validation helper scripts
└── validation/globaltest/   # deterministic validation data and R workflow notes
```

## Validation

Run Python-side validation from the repository root:

```bash
python scripts/run_python_globaltest_validation.py
```

The validation data in `validation/globaltest/` is preserved as CSV/JSON files. The R workflow template in the same directory can be used to compare against the R `globaltest` package.

## Development

Run the test suite:

```bash
python -m pytest
```

See `CONTRIBUTING.md` for development guidelines.
