Skip to contents

Pure.

Usage

ensembl_parse_gene_model(record)

Arguments

record

A parsed lookup/id response fetched with expand=1.

Value

A list of transcript, strand, region, gene_start, gene_end, and exons, a tibble of start, end, and number sorted by start. NULL when the record carries no transcript with exons.

Exon numbering follows the strand

Exons are sorted by genomic coordinate and then numbered in transcription order. On the minus strand that means the highest-coordinate exon is exon 1. Numbering by coordinate alone would put exon 1 at the wrong end of every minus-strand gene.

Examples

record <- list(
  seq_region_name = "17", start = 1, end = 900,
  Transcript = list(list(
    id = "ENST1", is_canonical = 1, strand = -1,
    Exon = list(list(start = 800, end = 900), list(start = 1, end = 100))
  ))
)
ensembl_parse_gene_model(record)$exons
#> # A tibble: 2 × 3
#>   start   end number
#>   <dbl> <dbl>  <int>
#> 1     1   100      2
#> 2   800   900      1