Content
Summary
Genomic data relies on specific coordinate systems and file formats, primarily distinguished by whether they use 0-based or 1-based indexing. Key formats include BED for genomic locations, GFF/GTF for gene annotations, and SAM/BAM for sequence alignments, each with distinct structural requirements and coordinate conventions.
Intuition
Understanding genomic data requires navigating two main challenges: coordinate indexing and file structure. Biologists typically count from 1, while computer scientists often count from 0, leading to 'off-by-one' errors if formats are mixed. For instance, BED files use 0-based starts and 1-based exclusive ends, whereas GFF and SAM use 1-based inclusive coordinates. Additionally, data is stored in various formats depending on the need: BED for simple regions, GFF/GTF for detailed gene annotations, and SAM/BAM for aligning sequencing reads, with BAM offering binary compression and indexing for efficiency.
Derivation
- Genomic coordinates are defined by chromosome, start, stop, and strand.
- Indexing systems differ: 1-based (biological, start=1) vs. 0-based (CS, start=0).
- BED format uses 0-based start and 1-based exclusive end.
- GFF/GTF formats use 1-based inclusive start and end.
- SAM format uses 1-based POS for alignment positions.
- BAM is the binary, indexed version of SAM for efficient access.
Worked example
A researcher has a feature in a BED file at chromStart=100, chromEnd=200. What is the 1-based inclusive start position if this feature were converted to GFF format?
- Identify the BED start position: 100 (0-based).
- Convert 0-based start to 1-based by adding 1: 100 + 1 = 101.
- The GFF start position is 1-based and inclusive.
- Therefore, the corresponding 1-based start position is 101.
Answer 101
Common mistakes
- Confusing 0-based and 1-based indexing systems, leading to off-by-one errors.
- Assuming BED end positions are inclusive; they are exclusive.
- Using SAM text files for large datasets without realizing BAM is more efficient due to indexing.
- Ignoring strand information (+/-) which is critical for orientation.