Metadata-Version: 2.4
Name: mitochontrol
Version: 0.1.0
Summary: Adaptive mitochondrial filtering for robust single-cell RNA sequencing quality control
Author-email: Strassburg <cms496@pitt.edu>
License: BSD 3-Clause License
        
        Copyright (c) 2026 Uttam Lab
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Homepage, https://github.com/uttamLab/mitochontrol
Project-URL: Documentation, https://github.com/uttamLab/mitochontrol#readme
Project-URL: Issues, https://github.com/uttamLab/mitochontrol/issues
Keywords: single-cell,scRNA-seq,mitochondrial RNA,quality control,thresholding,clustering
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
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 :: Bio-Informatics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<2,>=1.26
Requires-Dist: scipy<1.15,>=1.14
Requires-Dist: pandas<2.3,>=2.2
Requires-Dist: matplotlib<3.10,>=3.9
Requires-Dist: seaborn<0.14,>=0.13
Requires-Dist: scikit-learn<1.6,>=1.5
Requires-Dist: anndata<0.11,>=0.10
Requires-Dist: scanpy<1.11,>=1.10
Requires-Dist: python-igraph<0.12,>=0.11
Requires-Dist: leidenalg
Requires-Dist: umap-learn
Requires-Dist: gseapy<1.2,>=1.1
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Dynamic: license-file

# MitoChontrol

Clustering-aware mitochondrial RNA thresholding for single-cell RNA-seq
quality control.

MitoChontrol uses per-cluster naive Bayes modeling to identify
tissue- and cell-type-specific mtRNA thresholds, replacing the
conventional fixed 10 % cutoff with data-driven, probability-based
filtering.

## Installation

```bash
pip install mitochontrol
```

Or install from source:

```bash
git clone https://github.com/uttamLab/mitochontrol.git
cd mitochontrol
pip install -e .
```

## Quick start

### Cluster-aware pipeline

The recommended workflow clusters the data first, then applies
per-cluster thresholds:

```python
import scanpy as sc
from mitochontrol import clustering, mtctrl_with_clustering

adata = sc.read_h5ad("sample.h5ad")

# Step 1 — cluster
result = clustering(adata, label="Sample1", outdir="output")

# Step 2 — threshold per cluster
thresholds = mtctrl_with_clustering(
    adatas={"Sample1": result},
    outdir="output",
    threshold_probs=(0.8,),
)

adata_out = thresholds["Sample1"]["adata"]
```

### Single-cluster pipeline

For pre-isolated populations or quick exploration:

```python
from mitochontrol import mtctrl_without_clustering

stats = mtctrl_without_clustering(
    adata,
    sample_id="Sample1",
    outdir="output",
)
```

### Optional cell-type annotation

If marker genes are available, `clustering()` can assign cell types
automatically:

```python
result = clustering(
    adata,
    label="Sample1",
    outdir="output",
    marker_genes="markers.csv",   # or a {celltype: [genes]} dict
)
```

## Output layout

Both pipelines write results under `outdir`:

```
outdir/
├── clustered/
│   ├── adata/Sample1.h5ad
│   ├── umap/Sample1.pdf
│   ├── res_selection/Sample1.pdf
│   ├── DEG/Sample1.csv
│   └── celltype_labels/Sample1.csv
└── mitochontrol/
    ├── adata/Sample1.h5ad
    ├── cluster_overlays/Sample1.pdf
    ├── threshold/Sample1_cluster0_0.8.pdf
    ├── enrichment/Sample1_cluster0_0.8.pdf
    ├── filtered_umap/Sample1_cluster0_0.8.pdf
    └── threshold_stats.csv
```

The single-sample pipeline ``mtctrl_without_clustering`` does not write
cluster overlays or filtered UMAPs; it saves mt-vs-UMI scatters under
``mitochontrol/scatter/`` (initial plot plus one threshold-colored file per
probability).

## Tutorial

A step-by-step Jupyter notebook is included in
[`MitoChontrol_tut.ipynb`](MitoChontrol_tut.ipynb),
demonstrating both the clustered and single-cluster workflows with
heuristic overrides and result visualization.

## Citation

If you use MitoChontrol in your research, please cite the associated
publication:

> Strassburg *et al.* (2026). MitoChontrol: Adaptive mitochondrial filtering for robust single-cell RNA sequencing quality control.
> *Journal*, **volume**, pages. doi:XXXX

BibTeX:

```bibtex
@article{strauss2026mitochontrol,
  title   = {MitoChontrol: Adaptive mitochondrial filtering for 
             robust single-cell RNA sequencing quality control},
  author  = {Strassburg, C. M. and others},
  journal = {Journal},
  year    = {2026},
  doi     = {XXXX}
}
```

## License

BSD 3-Clause License. See [LICENSE](LICENSE) for details.
