Metadata-Version: 2.4
Name: gwaslab-alphagenome
Version: 0.1.0
Summary: AlphaGenome data extraction for GWASLab panel plots
Author: Yunye He
License: MIT
Project-URL: Repository, https://github.com/Cloufield/gwaslab-alphagenome
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gwaslab>=4.1.6
Requires-Dist: alphagenome>=0.6.0
Requires-Dist: numpy
Requires-Dist: pandas
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Provides-Extra: bigwig
Requires-Dist: pyBigWig; extra == "bigwig"
Dynamic: license-file

# gwaslab-alphagenome

Data-only bridge between [AlphaGenome](https://www.alphagenomedocs.com/) and [GWASLab](https://github.com/Cloufield/gwaslab). Fetches predictions and converts them to GWASLab track bundles. **No plotting** — use `gl.plot_panels` in GWASLab.

## Install

```bash
pip install gwaslab gwaslab-alphagenome
export ALPHA_GENOME_API_KEY=your_key
```

## Usage

```python
import gwaslab as gl
import gwaslab_alphagenome as glag

region = (1, 156538803, 157538803)  # hg38

panels = [
    gl.Panel(
        "ag_tracks",
        region=region,
        ag_spec=glag.Spec("RNA_SEQ", ontology_terms=["UBERON:0002048"]),
        filled=True,
    ),
    gl.Panel(
        "ag_tracks",
        region=region,
        ag_spec=glag.Spec("ATAC", ontology_terms=["UBERON:0002048"]),
    ),
]

fig, axes = gl.plot_panels(panels, region=region, save="locus.png")
```

`gl.plot_panels` calls `glag.extract_batch()` automatically when panels use `ag_spec=`.

### LD reference + variant effect (linked SNP)

```python
ctx = glag.resolve_variant(mysumstats.data, region_ref="rs429358", build="38")

panels = [
    gl.Panel("ag_overlay", region=region, variant_context=ctx,
             ag_spec=glag.Spec("RNA_SEQ", mode="overlay", ontology_terms=["UBERON:0002107"])),
    mysumstats.Panel("region", region=region, region_ref=ctx.region_ref,
                     vcf_path="ld.vcf.gz", build="38"),
]
gl.plot_panels(panels, region=region, variant_positions=[ctx.pos])
```

## API

| Function | Role |
|----------|------|
| `glag.Spec(...)` | Describe output type, mode, ontology |
| `glag.resolve_variant(sumstats, region_ref)` | Link GWAS lead SNP to overlay fetch |
| `glag.extract_batch(region, specs, ...)` | Batched fetch + bundle conversion |
| `glag.extract(region, spec, ...)` | Single-spec extract |

## Requirements

- hg38 harmonized sumstats for variant-linked plots
- `ALPHA_GENOME_API_KEY` environment variable
