Metadata-Version: 2.4
Name: kmeggie-plus
Version: 0.1.0
Summary: Transparent, local FASTQ validation and sequencing quality control
Author: Kmeggie+ contributors
Maintainer-email: Kmeggie+ <hello@kmeggieplus.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://kmeggieplus.com
Project-URL: Documentation, https://kmeggieplus.com/docs
Keywords: bioinformatics,fastq,quality-control,genomics,sequencing
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: click<9,>=8.1
Provides-Extra: pdf
Requires-Dist: reportlab<5,>=4; extra == "pdf"
Provides-Extra: dev
Requires-Dist: build<2,>=1.2; extra == "dev"
Requires-Dist: pytest<9,>=8; extra == "dev"
Requires-Dist: pytest-cov<7,>=5; extra == "dev"
Requires-Dist: ruff<1,>=0.9; extra == "dev"
Dynamic: license-file

# Kmeggie+

Transparent, local FASTQ validation and sequencing quality control for laboratories that
need auditable results on modest hardware.

> **Alpha release:** version 0.1.0 establishes the public engine contract. It is research
> software, has not completed a public FastQC concordance study, and is not a diagnostic
> device.

## What works now

- Plain and gzip-compressed FASTQ detection
- Strict conventional four-line FASTQ validation
- Phred+33 and Phred+64 quality handling with explicit ambiguity warnings
- Read counts, base counts, length distribution, GC distribution, and ambiguous-base rate
- Per-base mean quality, Q20/Q30 fractions, and base composition
- Deterministic first-N duplication and adapter sampling
- Configurable, fully reported pass/warn/fail thresholds
- Self-contained JSON and HTML reports
- Optional PDF reports
- A Click-based command-line interface and importable Python API

All FASTQ processing is local. This package has no upload, messaging, account, telemetry,
analytics, billing, or multi-tenant functionality.

## Quick start from source

Python 3.10 or newer is required.

```bash
python -m venv .venv
```

Activate the environment:

```bash
# Linux or macOS
source .venv/bin/activate

# Windows PowerShell
.venv\Scripts\Activate.ps1
```

Install and run:

```bash
python -m pip install --upgrade pip
python -m pip install -e ".[pdf]"
kmeggie validate tests/fixtures/valid.fastq
kmeggie qc tests/fixtures/valid.fastq --output-dir kmeggie-reports
```

The default QC command creates:

```text
kmeggie-reports/
├── valid.qc.json
└── valid.qc.html
```

Request PDF output explicitly:

```bash
kmeggie qc reads.fastq.gz --format json --format html --format pdf
```

## Decision transparency

Every report contains:

- the engine and result-schema versions;
- the input filename, size, and optional SHA-256 checksum;
- the requested, detected, and actually used quality encoding;
- every metric value;
- every warn and fail threshold;
- each rule's status and the overall status;
- deterministic sampling limits; and
- known limitations.

The defaults are generic starting points, not validated assay specifications. Override them
with a reviewed JSON file:

```bash
kmeggie qc reads.fastq.gz --thresholds examples/thresholds.json
```

See [docs/methodology.md](docs/methodology.md) before interpreting a result.

## Python API

```python
from kmeggie.pipeline import run_qc_suite
from kmeggie.qc import DecisionThresholds

result = run_qc_suite(
    "reads.fastq.gz",
    thresholds=DecisionThresholds(minimum_q30_fraction_warn=0.80),
)
print(result["summary"]["status"])
```

The hosted Kmeggie+ runner should import this API and pin an exact released version. It must
not copy or privately patch the QC implementation.

## Free engine and hosted service

The QC engine is free and open source. Anyone may inspect it, run it locally, and verify how
a result was produced.

Kmeggie+ may also offer a hosted service with messaging integrations, managed execution,
multi-lab history, institutional administration, support, and service-level commitments.
Those operational systems are separate and fund continued development of the public engine.

See [docs/open-core-boundary.md](docs/open-core-boundary.md) for the enforceable repository
boundary and the current browser-engine limitation.

## Validation and FastQC comparison

The comparison utility reads a Kmeggie+ JSON report and FastQC's `fastqc_data.txt`:

```bash
python benchmarks/compare_fastqc.py \
  --kmeggie results/sample.qc.json \
  --fastqc results/sample_fastqc/fastqc_data.txt \
  --output results/sample-comparison.md
```

No concordance percentage is currently claimed. The required study protocol and result
status are in [benchmarks/RESULTS.md](benchmarks/RESULTS.md).

## Development

```bash
python -m pip install -e ".[dev,pdf]"
ruff check .
pytest
python -m build
```

Tiny synthetic fixtures are deliberately committed. Do not contribute real patient,
participant, or controlled sequence data.

## Security and responsible use

Read [SECURITY.md](SECURITY.md) before reporting a vulnerability. Do not attach sensitive
laboratory data to a public issue. Kmeggie+ reports are quality-control aids; they do not
diagnose disease or provide clinical variant interpretation.

## Licence and name

The software is licensed under the [Apache License 2.0](LICENSE). The licence does not grant
permission to imply endorsement or use Kmeggie+ branding as your own product identity. See
[TRADEMARKS.md](TRADEMARKS.md).

Copyright 2026 Kmeggie+ contributors.
