Metadata-Version: 2.4
Name: bootstrap2-sc
Version: 0.1.0
Summary: Subject-aware two-level hierarchical bootstrap for single-cell differential expression
Author: ZW.G
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: anndata<1,>=0.10
Requires-Dist: joblib<2,>=1.3
Requires-Dist: numpy<3,>=1.24
Requires-Dist: pandas<4,>=2
Requires-Dist: scipy<2,>=1.10

# BOOTSTRAP2

Two-level hierarchical bootstrap for single-cell differential expression.

## Installation

Python 3.10 or newer is required. Install with:

```sh
python -m pip install bootstrap2-sc
```

For installation from a local source checkout:

```sh
python -m pip install .
```

## Input

Provide an AnnData object containing raw counts in `adata.X`.

| `adata.obs` field | Description |
| --- | --- |
| `Sample` | Globally unique biological subject identifier |
| `Condition` | Exactly two comparison groups |
| `Batch` | Batch identifier; optional for a single-batch design |

Each subject must belong to one condition and one batch. The method supports
the nested batch--subject design, not general covariate adjustment,
paired/repeated subjects or condition-batch confounding.

## Python API

```python
import anndata as ad
from bootstrap2 import bootstrap2h

adata = ad.read_h5ad("counts.h5ad")
result = bootstrap2h(
    adata,
    condition=("SLE", "Control"),
    n_bootstraps=10000,
    n_jobs=4,
    seed=0,
    lfc=0.0,
)
result.to_csv("results.tsv", sep="\t")
```

The input AnnData is not modified. Use `layer="counts"` to select a raw-count
layer in the API.

| Parameter | Default | Description |
| --- | --- | --- |
| `n_bootstraps` | 10000 | Number of bootstrap iterations |
| `n_jobs` | 4 | Worker processes; -1 uses available CPUs |
| `seed` | 0 | Random seed |
| `lfc` | 0 | Nonnegative log2 threshold; 0 gives the point null |
| `condition` | First-appearance order | Numerator then denominator condition |

With `condition=("SLE", "Control")`, a positive LFC indicates higher expression
in SLE. Use `condition_col`, `sample_col` and `batch_col` for alternative
metadata field names.

## Output

Returns a DataFrame indexed by gene, with `p_val` and `lfc` columns.

