genomic-coordinates

Convert genomic intervals between coordinate conventions and normalize variant representations across assemblies.

41.1k|3.8k|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill genomic-coordinates
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: genomic-coordinates
Source: https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/genomic-coordinates
Command: npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill genomic-coordinates

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Genomic coordinate errors are silent: a BED file holding 1-based data parses and intersects cleanly while every result shifts by one base, and a GRCh37 VCF joined against GRCh38 annotation returns plausible but wrong rows. This Skill converts intervals between coordinate conventions, normalizes variants, and detects assembly or contig-naming mismatches before they corrupt an analysis.

Core Features & Use Cases

  • Coordinate Conversion: Convert intervals between BED, GFF/GTF, VCF, SAM, WIG, PSL, genePred, Picard interval_list, and region strings, reconciling 0-based half-open with 1-based inclusive conventions.
  • Variant Normalization: Trim and left-align indels against a reference FASTA, split multi-allelic records, and check whether two variant records describe the same change.
  • Assembly Auditing: Identify GRCh37 vs hg19 vs GRCh38 vs T2T from contig lengths, detect chr-prefix mismatches, and audit BED/GTF/VCF files for convention violations with CI-friendly exit codes.
  • Use Case: Before joining a cohort VCF against a GENCODE annotation, run the contig check to confirm both files use the same assembly and naming scheme, then normalize the variants so ClinVar lookups match real entries.

Quick Start

Ask the agent to convert chr7:5,530,601-5,530,625 from UCSC browser coordinates to BED format and verify which genome assembly your VCF file uses.

Frequently Asked Questions about genomic-coordinates

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert between BED and GFF coordinate systems?

BED is 0-based half-open and GFF is 1-based inclusive, so converting BED to GFF means start + 1 with the end unchanged. Run convert_coords.py with --from bed --to gff followed by contig, start, and end to get the converted interval.

How to normalize VCF indels before comparing variants?

Normalize VCF indels by trimming shared bases and left-aligning against the reference, the same procedure bcftools norm implements. Run normalize_variant.py with --fasta ref.fa and the variant, splitting multi-allelic records with --split first.

What is the difference between GRCh37 and hg19?

GRCh37 and hg19 differ only in the mitochondrion: hg19 uses the 16,571 bp NC_001807 sequence while GRCh37 uses the 16,569 bp rCRS. Nuclear coordinates are identical, so mixed pipelines run fine and only mitochondrial results are wrong.

Does this skill require third-party Python packages?

No third-party packages are required; the scripts use only the Python 3.11+ standard library and no network access. Variant normalization needs a reference FASTA file and uses its .fai index when one is present.

Why do variant lookups fail even when coordinates look correct?

Lookups fail because the same change has many valid representations, such as chr1:7:CAC:C and chr1:2:GCA:G describing one deletion. Comparing records before trimming and left-aligning loses real matches, preferentially in repeat regions where indels concentrate.

Can I audit a BED or VCF file for coordinate convention errors?

Yes, audit_intervals.py checks BED, GTF, GFF3, and VCF files for convention violations like start_below_one in GFF, zero-length BED features, and coordinates past contig ends. It exits with code 1 on fatal findings, so it works as a CI gate.