makeGRangesFromGFF: Make GRanges from a GFF/GTF file

Description Usage Arguments Details Value Functions Recommendations GFF/GTF specification Feature type Supported sources Ensembl GENCODE vs. Ensembl RefSeq UCSC Example URLs Note See Also Examples

View source: R/makeGRangesFromGFF.R

Description

Make GRanges from a GFF/GTF file

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
makeGRangesFromGFF(
  file,
  level = c("genes", "transcripts"),
  ignoreTxVersion = TRUE,
  .checkAgainstTxDb = FALSE
)

makeGRangesFromGTF(
  file,
  level = c("genes", "transcripts"),
  ignoreTxVersion = TRUE,
  .checkAgainstTxDb = FALSE
)

Arguments

file

character(1). File path.

level

character(1). Return as genes or transcripts.

ignoreTxVersion

logical(1). Don't the include the transcript version in the identifier. Only applies when level = "transcripts". This simplifies identifier matching when generating a tx2gene file.

.checkAgainstTxDb

logical(1). Enable strict mode, intended for development and unit testing only. Generate an internal TxDb using GenomicFeatures::makeTxDbFromGRanges() and check that the ranges(), seqnames(), and identifiers defined in names() are identical. Doesn't work for all GFF/GTF files due to some current limitations in the GenomicFeatures package, so this is disabled by default. Generally, GenomicFeatures parses GTF files better than GFF files. However, it's a useful sanity check and should be enabled if possible.

Details

Remote URLs and compressed files are supported.

Value

GRanges.

Functions

Recommendations

GFF/GTF specification

The GFF (General Feature Format) format consists of one line per feature, each containing 9 columns of data, plus optional track definition lines.

The GTF (General Transfer Format) format is identical to GFF version 2.

The UCSC website has detailed conventions on the GFF3 format, including the metadata columns.

Feature type

See also:

Supported sources

Currently makeGRangesFromGFF() supports genomes from these sources:

Ensembl

Note that makeGRangesFromEnsembl() offers native support for Ensembl genome builds and returns additional useful metadata that isn't defined inside a GFF/GTF file.

If you must load a GFF/GTF file directly, then use makeGRangesFromGFF().

GENCODE vs. Ensembl

Annotations available from Ensembl and GENCODE are very similar.

The GENCODE annotation is made by merging the manual gene annotation produced by the Ensembl-Havana team and the Ensembl-genebuild automated gene annotation. The GENCODE annotation is the default gene annotation displayed in the Ensembl browser. The GENCODE releases coincide with the Ensembl releases, although GENCODE can skip an Ensembl release if there is no update to the annotation with respect to the previous release. In practical terms, the GENCODE annotation is essentially identical to the Ensembl annotation.

However, GENCODE handles pseudoautosomal regions (PAR) differently than Ensembl. The Ensembl GTF file only includes this annotation once, for chromosome X. However, GENCODE GTF/GFF3 files include the annotation in the PAR regions of both chromosomes. You'll see these genes contain a "_PAR_Y" suffix.

Additionally, GENCODE GFF/GTF files import with a gene identifier containing a suffix, which differs slightly from the Ensembl GFF/GTF spec (e.g. GENCODE: ENSG00000000003.14; Ensembl: ENSG00000000003).

The GENCODE FAQ has additional details.

RefSeq

Refer to the current RefSeq spec for details.

See also:

UCSC

Loading UCSC genome annotations from a GFF/GTF file are intentionally not supported by this function.

We recommend using a pre-built TxDb package from Bioconductor instead. For example, load TxDb.Hsapiens.UCSC.hg38.knownGene for hg38.

For reference, note that UCSC doesn't provide direct GFF/GTF file downloads. Use of the hgTables table browser is required in a web browser.

Select the following options to download hg38:

Related URLs:

Example URLs

Note

Updated 2019-09-04.

See Also

Examples

1
2
3
4
5
6
7
8
9
file <- pasteURL(freerangeTestsURL, "ensembl.gtf", protocol = "none")

## Genes
x <- makeGRangesFromGFF(file = file, level = "genes")
summary(x)

## Transcripts
x <- makeGRangesFromGFF(file = file, level = "transcripts")
summary(x)

acidgenomics/freerange documentation built on Jan. 8, 2020, 3:45 a.m.