# htsget v1.3 Quickstart

## Installation

```bash
pip install "ai4gh[htsget]"
```

## Retrieve Reads

```python
import asyncio
from ai4gh.specs.htsget.client import HtsgetClient


async def main():
    async with HtsgetClient(base_url="https://htsget.example.org") as client:
        # Get reads for a genomic region
        ticket = await client.get_reads(
            id="sample123",
            reference_name="chr1",
            start=10000,
            end=20000,
            format="BAM",
        )
        print(f"Format: {ticket.format}")
        for url_obj in ticket.urls:
            print(f"  Fetch: {url_obj.url}")


asyncio.run(main())
```

## Retrieve Variants

```python
async with HtsgetClient(base_url="https://htsget.example.org") as client:
    ticket = await client.get_variants(
        id="sample456",
        reference_name="chr17",
        start=7500000,
        end=7700000,
    )
    print(f"Format: {ticket.format}")
```

## Compliance Testing

```bash
ai4gh test htsget https://htsget.example.org
```

## MCP Tool

```json
{
  "tool": "htsget_reads",
  "arguments": {
    "base_url": "https://htsget.example.org",
    "id": "sample123",
    "reference_name": "chr1",
    "start": 10000,
    "end": 20000
  }
}
```

## Data Models

```python
from ai4gh.specs.htsget.models import HtsgetTicket, HtsgetUrl
```
