Learn R Programming

Rsubread (version 1.22.2)

createAnnotationFile: Create an annotation file from a GRanges object, suitable for featureCounts()

Description

Any of rtracklayer::import.bed('samplesubjunc.bed'), unlist(spliceGraph(TxDb)), transcripts(TxDb), exons(TxDb), or features(FDB) will produce a GRanges object containing usable features for read counting.

This function converts a suitably streamlined GRanges object into annotations which can then be used by featureCounts() to quickly count aligned reads.

The GRanges object must contain an elementMetadata column named 'id'.

Usage

createAnnotationFile(GR) write.Rsubread(GR)

Arguments

GR
The GRanges object to convert to an Rsubread annotation file

Value

A data frame with five columns named GeneID, Chr, Start, End and Strand.

Examples

Run this code
## Not run: 
#   library(TxDb.Hsapiens.UCSC.hg19.lincRNAsTranscripts)
#   hg19LincRNAs <- transcripts(TxDb.Hsapiens.UCSC.hg19.lincRNAsTranscripts)
#   names(values(hg19LincRNAs)) <- gsub('tx_id','id',names(values(hg19LincRNAs)))
#   annot_for_featureCounts <- createAnnotationFile(hg19LincRNAs)
# ## End(Not run)

Run the code above in your browser using DataLab