Metadata-Version: 2.4
Name: credtools
Version: 0.9.2
Summary: multi-ancestry fine-mapping pipeline.
Project-URL: Homepage, https://github.com/Jianhua-Wang/credtools
Project-URL: Repository, https://github.com/Jianhua-Wang/credtools
Author-email: Jianhua Wang <jianhua.mert@gmail.com>
License: MIT
License-File: LICENSE
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Requires-Python: <3.13,>=3.9
Requires-Dist: cojopy>=0.1.4
Requires-Dist: matplotlib>=3.9.2
Requires-Dist: numba>=0.60.0
Requires-Dist: numpy>=1.21.2
Requires-Dist: pandas>=1.3.3
Requires-Dist: rich>=12.4.0
Requires-Dist: scikit-learn>=1.5.2
Requires-Dist: scipy>=1.7.3
Requires-Dist: seaborn>=0.11.0
Requires-Dist: tqdm>=4.66.5
Requires-Dist: typer>=0.9.0
Requires-Dist: upsetplot>=0.6.0
Provides-Extra: dev
Requires-Dist: black>=23.9.1; extra == 'dev'
Requires-Dist: bump2version>=1.0.1; extra == 'dev'
Requires-Dist: flake8-docstrings>=1.7.0; extra == 'dev'
Requires-Dist: flake8>=5.1.0; extra == 'dev'
Requires-Dist: isort>=5.12.0; extra == 'dev'
Requires-Dist: jupyter>=1.0.0; extra == 'dev'
Requires-Dist: mkdocs-autorefs>=0.5.0; extra == 'dev'
Requires-Dist: mkdocs-include-markdown-plugin>=6.0.1; extra == 'dev'
Requires-Dist: mkdocs-material-extensions>=1.2; extra == 'dev'
Requires-Dist: mkdocs-material>=9.4.2; extra == 'dev'
Requires-Dist: mkdocs>=1.5.3; extra == 'dev'
Requires-Dist: mkdocstrings-python>=1.7.0; extra == 'dev'
Requires-Dist: mypy>=1.5.1; extra == 'dev'
Requires-Dist: pip>=23.2.1; extra == 'dev'
Requires-Dist: pre-commit>=3.4.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=7.4.2; extra == 'dev'
Requires-Dist: toml>=0.10.2; extra == 'dev'
Requires-Dist: tox>=4.11.3; extra == 'dev'
Requires-Dist: twine>=4.0.2; extra == 'dev'
Requires-Dist: virtualenv>=20.24.5; extra == 'dev'
Description-Content-Type: text/markdown

# CREDTOOLS

[![pypi](https://img.shields.io/pypi/v/credtools.svg)](https://pypi.org/project/credtools/)
[![python](https://img.shields.io/pypi/pyversions/credtools.svg)](https://pypi.org/project/credtools/)
[![Build Status](https://github.com/Jianhua-Wang/credtools/actions/workflows/dev.yml/badge.svg)](https://github.com/Jianhua-Wang/credtools/actions/workflows/dev.yml)
[![codecov](https://codecov.io/gh/Jianhua-Wang/credtools/branch/main/graphs/badge.svg)](https://codecov.io/github/Jianhua-Wang/credtools)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

CREDTOOLS is a command-line and Python toolkit for GWAS fine-mapping workflows.
It helps you standardize summary statistics, define loci, prepare LD-backed
locus files, run QC, combine cohorts, and run fine-mapping tools from one
repeatable interface.

Documentation: <https://Jianhua-Wang.github.io/credtools>

## What It Does

- Standardizes raw GWAS summary statistics with `credtools munge`.
- Finds and chunks loci from genome-wide summary statistics with
  `credtools chunk`.
- Prepares locus-level summary statistics, LD matrices, and LD maps.
- Runs meta-analysis with `meta_all`, `meta_by_population`, or `no_meta`.
- Runs QC for LD and summary-statistic consistency.
- Runs fine-mapping with SuSiE, FINEMAP, ABF, CARMA, SuSiEx, MultiSuSiE,
  MESuSiE, and RSparsePro wrappers.
- Writes PIP tables, credible set summaries, causal-variant tables, logs, and
  plots.

## Install

```bash
python -m pip install credtools
credtools --version
```

CREDTOOLS supports Python `>=3.9,<3.13`.

Some workflows need external tools:

| Workflow | Extra dependency |
| --- | --- |
| LD extraction in `chunk` | PLINK |
| `--tool finemap` | FINEMAP executable |
| `--tool susiex` | SuSiEx executable |
| `--tool susie_ash` or `susie_inf` | Rscript and `susieR >= 0.16.1` |
| `--tool carma` | Rscript and `CARMA` |
| `--tool mesusie` | Rscript and `MESuSiE` |

See the [external tools guide](https://Jianhua-Wang.github.io/credtools/guides/external-tools/)
for setup checks.

## Quick Start

Start from a population config:

```text
popu	cohort	sample_size	path	ld_ref
EUR	UKBB	400000	/data/EUR.sumstats.gz	/ref/EUR
AFR	MVP	90000	/data/AFR.sumstats.gz	/ref/AFR
```

Run the workflow:

```bash
credtools munge population_config.tsv work/munged
credtools chunk work/munged/sumstat_info_updated.txt work/chunks
credtools pipeline work/chunks/loci_list.txt work/results \
  --tool susie \
  --meta-method meta_all \
  --max-causal 5
```

Before a full run, inspect `work/chunks/loci_list.txt`. If `chunk` wrote a
placeholder `sample_size` or cohort label, edit it before fine-mapping.

## Main Commands

| Command | Use it for |
| --- | --- |
| `credtools munge` | clean and standardize summary statistics |
| `credtools chunk` | find loci, create chunks, and prepare LD-backed files |
| `credtools prepare` | build LD-backed locus files from chunked sumstats and genotype references |
| `credtools meta` | combine cohorts before QC or fine-mapping |
| `credtools qc` | check summary-statistic and LD consistency |
| `credtools finemap` | run fine-mapping only |
| `credtools pipeline` | run meta-analysis, QC, and fine-mapping together |
| `credtools plot` | create QC and fine-mapping plots |

## Key Input

Most downstream commands use a `loci_list.txt`:

```text
locus_id	chr	start	end	popu	cohort	sample_size	prefix
locus_1	1	50000000	50500000	EUR	UKBB	400000	data/EUR_UKBB_locus_1
```

Each `prefix` should point to:

```text
{prefix}.sumstats.gz
{prefix}.ld.npz
{prefix}.ldmap.gz
```

See the [file schema reference](https://Jianhua-Wang.github.io/credtools/reference/file-schemas/)
for exact columns and accepted file names.

## Development

```bash
git clone https://github.com/Jianhua-Wang/credtools.git
cd credtools
uv sync
uv run pytest
uv run mkdocs serve
```

## Links

- Documentation: <https://Jianhua-Wang.github.io/credtools>
- GitHub: <https://github.com/Jianhua-Wang/credtools>
- PyPI: <https://pypi.org/project/credtools/>
- License: MIT
