본문으로 건너뛰기
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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/genomic-coordinates/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 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부터 세며 시작은 포함하지만 끝은 포함하지 않습니다.

염색체나 콘티그 이름을 확인하는 것이 왜 중요한가요?

연구나 데이터베이스마다 같은 게놈 부분을 조금씩 다른 이름으로 부를 수 있습니다. 이름이 맞지 않으면 도구가 다른 염색체를 분석한다고 착각해 잘못된 결과가 나올 수 있습니다.

이 도구가 제 데이터 파일의 오류를 고칠 수 있나요?

불일치를 찾아 변환하는 데 도움을 주지만, 원본 파일을 편집하지는 않습니다. 수정이나 비교 결과를 보여 주는 출력을 만들어, 사용자가 이를 참고해 데이터를 고치거나 분석을 진행할 수 있게 합니다.

상세 정보

작성자의 원본 설명

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

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬