Skip to contents

This function will output a tibble with the required chrom, start, and end columns, as well as other columns depending on content in GTF/GFF file.

Usage

read_gtf(path, zero_based = TRUE)

Arguments

path

path to gtf or gff file

zero_based

if TRUE, convert to zero based

Examples


gtf <- read_gtf(valr_example("hg19.gencode.gtf.gz"))
head(gtf)
#> # A tibble: 6 × 26
#>   chrom    start      end width strand source type        score phase gene_id   
#>   <chr>    <int>    <int> <int> <chr>  <chr>  <chr>       <dbl> <int> <chr>     
#> 1 chr2  43449540 43453748  4208 -      HAVANA gene           NA    NA ENSG00000…
#> 2 chr2  43449540 43453748  4208 -      HAVANA transcript     NA    NA ENSG00000…
#> 3 chr2  43453403 43453748   345 -      HAVANA exon           NA    NA ENSG00000…
#> 4 chr2  43453403 43453454    51 -      HAVANA CDS            NA     0 ENSG00000…
#> 5 chr2  43453451 43453454     3 -      HAVANA start_codon    NA     0 ENSG00000…
#> 6 chr2  43449540 43452891  3351 -      HAVANA exon           NA    NA ENSG00000…
#> # ℹ 16 more variables: transcript_id <chr>, gene_type <chr>, gene_status <chr>,
#> #   gene_name <chr>, transcript_type <chr>, transcript_status <chr>,
#> #   transcript_name <chr>, level <chr>, havana_gene <chr>, protein_id <chr>,
#> #   tag <chr>, ccdsid <chr>, havana_transcript <chr>, exon_number <chr>,
#> #   exon_id <chr>, ont <chr>