Metadata-Version: 2.5
Name: altar-opentargets-e2g
Version: 0.2.1
Summary: Open Targets ENCODE-rE2G binding for Altar's variant-gene link contract
Project-URL: Documentation, https://kundajelab.github.io/altar/
Author: Riya Sinha
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: altar<0.3,>=0.2.1
Provides-Extra: test
Requires-Dist: pytest-asyncio>=0.24; extra == 'test'
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

# altar-opentargets-e2g

This binding normalizes the Open Targets Platform `enhancer_to_gene` dataset (ENCODE-rE2G evidence) into
Altar's public `VariantGeneLinkSource` relation.

The package owns Open Targets schema and provenance semantics, but not storage. Convert source rows to
`OpenTargetsE2GRow`, stream them through `OpenTargetsE2GImporter`, and query the published generation with
`OpenTargetsE2GSource`. Both operate on Altar's generic `VariantGeneLinkStore`; no Open Targets × PostgreSQL,
Parquet, DuckDB, or service-specific class is required.

```python
from altar.sources import InMemoryVariantGeneLinkStore
from altar_opentargets_e2g import (
    OpenTargetsE2GImportConfig,
    OpenTargetsE2GImporter,
    OpenTargetsE2GSource,
)

store = InMemoryVariantGeneLinkStore()
await OpenTargetsE2GImporter(store).ingest(
    rows,
    OpenTargetsE2GImportConfig(
        data_release="25.12",
        score_threshold=0.6,
        threshold_applied=True,
    ),
    generation_id="sha256-of-the-source-asset",
)
source = OpenTargetsE2GSource(store)
```

The importer accepts an iterable so operators can read large upstream Parquet datasets in bounded batches.
`OpenTargetsE2GRow.from_source_mapping()` accepts the official camelCase `enhancer_to_gene` Parquet fields;
the binding intentionally does not require a particular Parquet engine. See the
[Open Targets dataset documentation](https://platform-docs.opentargets.org/data-access/datasets) and
[rE2G documentation](https://platform-docs.opentargets.org/gentropy/enhancer-to-gene) for acquisition and
upstream transformations.

The Open Targets pipeline currently filters released rE2G output at `score >= 0.6`. Pass the threshold and
whether it was applied in `OpenTargetsE2GImportConfig`; Altar retains those semantics in every `LinkScore`
rather than treating the released table as unthresholded raw predictions.

The caller supplies a generation identifier for the exact extraction; partial generations stay hidden,
exact replay is idempotent, and publication happens only after the iterable completes. Use
`VariantGeneLinkQuery.data_releases` when a store contains more than one Open Targets release.

The contract is imported from `altar`; the binding is independently versioned and tested against the public
Altar conformance suite.
