{"data":{"slug":"github-aipoch-medical-research-skills-scientific-skills-data-analysis-gtars-2d2fe3a5ad2b","title":"Genomic Interval Analysis with gtars","summary":"Generate BED overlaps, WIG\/BigWig coverage tracks, and ML-ready tokenized genomic regions using the gtars toolkit with Python and CLI support.","url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-data-analysis-gtars-2d2fe3a5ad2b","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-aipoch-medical-research-skills-scientific-skills-data-analysis-gtars-2d2fe3a5ad2b","markdown_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-data-analysis-gtars-2d2fe3a5ad2b.md","download_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-data-analysis-gtars-2d2fe3a5ad2b\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"Install the Python package `gtars` and ensure the Rust toolchain (`cargo`) is available for CLI usage. For tokenization, prepare a BED file defining the training region universe.","instructions":"---\nname: gtars\ndescription: A high-performance Rust toolkit (with Python bindings and a CLI) for genomic interval analysis; use it when you need fast overlap queries, coverage track generation, genomic tokenization for ML, reference sequence verification, or fragment processing.\nlicense: MIT\nauthor: AIPOCH\n---\n> **Source**: [https:\/\/github.com\/aipoch\/medical-research-skills](https:\/\/github.com\/aipoch\/medical-research-skills)\n\n## When to Use\n\n- **Overlap and set operations on genomic intervals** (e.g., peak\/promoter overlap, variant annotation, shared-feature detection).\n- **Coverage track generation** from interval-like inputs (e.g., ATAC-seq\/ChIP-seq\/RNA-seq coverage for visualization in genome browsers).\n- **Machine-learning preprocessing** where genomic regions must be converted into discrete **tokens** (e.g., Transformer-style models, geniml-style pipelines).\n- **Reference sequence management and verification** (e.g., subsequence retrieval, digest calculation aligned with GA4GH refget concepts).\n- **Single-cell fragment workflows** (e.g., splitting fragments by barcode\/cluster, scoring fragments against reference region sets).\n\n## Key Features\n\n- **Rust performance** with low overhead; designed for large genomic datasets.\n- **Python bindings** for integration into analysis notebooks\/pipelines.\n- **CLI tooling** for batch processing and shell workflows.\n- **Fast overlap detection** via IGD-style indexing and interval operations.\n- **Coverage track generation** (WIG\/BigWig workflows via the `uniwig` functionality).\n- **Genomic tokenizers** for ML-ready representations of genomic regions.\n- **Reference sequence utilities** (FASTA-backed stores, subsequence retrieval, digesting).\n- **Fragment processing and scoring** for common single-cell genomics tasks.\n\n> Additional module-specific guidance may be available in: `references\/overlap.md`, `references\/coverage.md`, `references\/tokenizers.md`, `references\/refget.md`, `references\/python-api.md`, and `references\/cli.md`.\n\n## Dependencies\n\n- **Python package**: `gtars` (version not specified in the source document)\n- **Rust toolchain** (for CLI install): `cargo` (version not specified)\n- **Rust crate**: `gtars = \"0.1\"` (as shown in the example)\n\n## Example Usage\n\n### Python: overlap analysis workflow (runnable)\n\n```python\nimport gtars\n\n# Load two region sets\npeaks = gtars.RegionSet.from_bed(\"chip_peaks.bed\")\npromoters = gtars.RegionSet.from_bed(\"promoters.bed\")\n\n# Find overlaps (peaks that overlap promoters)\noverlapping_peaks = peaks.filter_overlapping(promoters)\n\n# Export results\noverlapping_peaks.to_bed(\"peaks_in_promoters.bed\")\n```\n\n### CLI: generate coverage tracks (runnable)\n\n```bash\n# Generate WIG coverage at a given resolution\ngtars uniwig generate --input atac_fragments.bed --output coverage.wig --resolution 10\n\n# Generate BigWig coverage for genome browser visualization\ngtars uniwig generate --input atac_fragments.bed --output coverage.bw --format bigwig\n```\n\n### Python: ML tokenization (runnable)\n\n```python\nimport gtars\nfrom gtars.tokenizers import TreeTokenizer\n\n# Load regions and build a tokenizer from BED\nregions = gtars.RegionSet.from_bed(\"training_peaks.bed\")\ntokenizer = TreeTokenizer.from_bed_file(\"training_peaks.bed\")\n\n# Tokenize each region into a discrete representation\ntokens = [tokenizer.tokenize(r.chromosome, r.start, r.end) for r in regions]\n\nprint(tokens[:5])\n```\n\n## Implementation Details\n\n- **Interval overlap & indexing**: Overlap queries are designed around an IGD-like index to accelerate repeated interval queries (build once, query many). Typical parameters are chromosome, start, end; results are overlapping intervals or derived set operations.\n- **Coverage generation (`uniwig`)**: Produces coverage tracks from interval\/fragments input. Common knobs include output format (e.g., WIG vs BigWig) and resolution\/binning for track granularity.\n- **Tokenization**: Tokenizers (e.g., `TreeTokenizer`) map genomic coordinates to discrete tokens suitable for ML pipelines. Token vocabularies are commonly derived from a BED-defined training region universe.\n- **Reference sequence store**: FASTA-backed reference access supports subsequence retrieval and digesting\/verification workflows aligned with refget-style usage.\n- **Fragment workflows**: Fragment splitting and scoring operate on fragment-like inputs (often TSV\/BED-style) and can be used for barcode\/cluster partitioning and enrichment-style scoring against reference region sets.","use_cases":["Overlap analysis between peaks and promoters","Generate WIG\/BigWig coverage tracks from BED files","Tokenize genomic regions for machine learning pipelines"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/aipoch\/medical-research-skills\/blob\/686e09dfdb45d9fa1a08664f06bb93769b3c9d91\/scientific-skills\/Data%20Analysis\/gtars\/SKILL.md","source_commit":"686e09dfdb45d9fa1a08664f06bb93769b3c9d91","license":"MIT","version":null,"listing_approved_at":"2026-11-24","created_at":"2026-11-23T11:39:34.000000Z","updated_at":"2026-11-24T07:14:56.000000Z","seo_title":"Genomic Interval Analysis with gtars","seo_description":"Efficient genomic interval analysis using gtars for overlap queries, coverage tracks, and ML tokenization.","seo_keywords":["genomic interval analysis","gtars overlap query","coverage track generation","genomic tokenization","BED file processing"]}}