本文へスキップ
Skillpedia
分析とスプレッドシート51k · #3467

genomic-coordinates

できること

このツールは、ゲノム上の遺伝子の位置情報が正確で一貫しているかを確認するのに役立ちます。形式を変換したり、遺伝子変異の表記を統一したり、染色体名や配列名が一致しているかを確認したりします。これにより、誤りが分析結果を狂わせる前に防げます。

使う場面

  • ✓ゲノムファイルの形式を切り替えるとき(例:BEDからGFFへ)。
  • ✓異なるゲノムのバージョンのデータを使うとき(例:GRCh37からGRCh38へ)。
  • ✓異なる情報源の遺伝情報を比較したり、統合したりするとき。

スキルのリンク

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/genomic-coordinates/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/genomic-coordinates/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“ゲノム座標 chr7:5,530,601-5,530,625 を、UCSC形式からBED形式に変換してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、座標の数え方(0から始まるか1から始まるか)や、ファイル形式の違いを変換することで動作します。また、遺伝子変異の記述を統一して正しく比較できるようにし、ゲノムの各部分の名前が一致しているかを確認します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Genomic Coordinates

When to use

Any time a coordinate crosses a boundary: between two file formats, between two tools, between two assemblies, or between the genome and a transcript.

The rule

A coordinate is three facts, not one: the number, the convention it is written in, and the assembly it was measured against. Carry all three or the number is not interpretable.

Coordinate errors are the quietest class of bug in genomics. An off-by-one BED file parses, sorts, and intersects without complaint. A GRCh37 VCF joined against a GRCh38 annotation returns rows. A right-shifted indel simply fails to match its entry in ClinVar, and the result is a variant reported as novel. Nothing raises an error; the answer is just wrong, and it is wrong in a direction that looks plausible.

So: convert with the table, not from memory, and verify against the reference whenever a reference is available.

The two conversions

1-based inclusive  ->  0-based half-open :  start - 1,  end
0-based half-open  ->  1-based inclusive :  start + 1,  end

These formulas apply to nonempty spans on the same reference and strand. They do not encode insertions, circular wraparound, liftover, or transcript mapping.

Which format is which

0-based, half-open 1-based, inclusive
BED, bedGraph, bigWig, narrowPeak GFF3, GTF, VCF
BAM (binary POS), BCF (binary POS) SAM text POS, CRAM absolute alignment start
PSL, genePred, refFlat WIG, Picard interval_list
MAF (UCSC multiple alignment) MAF (TCGA mutation annotation)
PyRanges, pybedtools GRanges/IRanges, samtools & UCSC & Ensembl region strings

Both "MAF" formats exist, they mean different things, and they disagree. UCSC serves 0-based files through a 1-based browser box. references/format-conventions.md has the full table with per-format detail.

cd skills/genomic-coordinates/scripts

python3 convert_coords.py --list                          # the table
python3 convert_coords.py --from bed --to gff chr1 999 1000
python3 convert_coords.py --from ucsc --to bed "chr7:5,530,601-5,530,625"
python3 convert_coords.py --from granges --to pyranges --input regions.tsv
contig  input                 output           length  status  detail
chr7    chr7:5530601-5530625  5530600-5530625  25      ok

Zero-length BED features (chromStart == chromEnd, a legal insertion point) are reported as unrepresentable for an inclusive target because the converter lacks feature semantics. GFF3 can encode insertion sites with equal endpoints and a feature type; that is different from an ordinary single-base interval. Exit code is 1 for invalid or unrepresentable output; valid zero-length half-open output exits 0. Output is a diagnostic TSV/JSON table, not a rewritten GFF/VCF.

--input parses BED/bedGraph, GFF/GTF, literal-allele VCF REF spans, explicit region strings, and three-column GRanges/PyRanges/Python TSVs. Other table rows are conventions only: extract an interval with a native parser and pass a triple. All bundled text readers expect uncompressed files.

Variants are not intervals

For a simple VCF indel, POS normally identifies the unchanged padding base before the event. At contig position 1 the padding can follow the event. Complex substitutions need not have an unchanged anchor. And the same change can be written many ways: chr1:7:CAC:C, chr1:3:CAC:C and chr1:2:GCA:G are one deletion. Joining, deduplicating, or looking up variants before normalising loses real matches silently, and it loses them preferentially in repeats, where indels concentrate.

Normalise — trim to parsimony, then left-align against the reference — before any comparison:

python3 normalize_variant.py --fasta ref.fa chr1 7 CAC C
python3 normalize_variant.py --fasta ref.fa --split --input cohort.vcf
python3 normalize_variant.py --fasta ref.fa --compare chr1:7:CAC:C chr1:2:GCA:G
input         normalized    type      pos_shift  ref_check  changed
chr1:7:CAC:C  chr1:2:GCA:G  deletion  5          ok         yes

Literal alleles are checked against the FASTA using exact contig names. A MISMATCH can indicate an assembly, sequence, strand, or coordinate error; stop and investigate with check_contigs.py and sequence provenance. The helper rejects unsplit ALT lists: use --split for independently normalized allele keys. Its TSV discards genotypes and annotations; use bcftools norm for production

…

よくある質問

「0始まり半開区間」と「1始まり閉区間」とはどういう意味ですか?

どちらもゲノム上の位置の表し方です。「1始まり閉区間」は1から数え、開始位置と終了位置の両方を含みます。「0始まり半開区間」は0から数え、開始位置は含みますが終了位置は含みません。

染色体名や contig 名を確認することが重要なのはなぜですか?

研究やデータベースによって、同じゲノム部分でも名前がわずかに異なることがあります。名前が一致しないと、ツールは別の染色体を分析していると判断し、誤った結果につながる可能性があります。

このツールで、データファイルの誤りを修正できますか?

不整合を見つけて変換する手助けはしますが、元のファイルを編集することはありません。修正内容や比較結果を出力するので、その情報を使ってデータを修正したり、分析を進めたりできます。

詳細

作者による元の説明

Converts genomic intervals between coordinate conventions, normalises and compares variant representations, and detects assembly or contig-naming mismatches before they corrupt an analysis. Used whenever coordinates cross a format, tool, or assembly boundary - converting between BED, GFF/GTF, VCF, SAM/BAM, WIG, PSL, genePred, Picard interval_list, or region strings; reconciling 0-based half-open w

repo: K-Dense-AI/scientific-agent-skills

人気

GitHubのスター
51k
ランキング
#3467
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル