Generate a data.frame mapping transcript IDs to gene IDs, based on a GRangesList object generated by getFeatureRanges.

getTx2Gene(grl, filepath = NULL)

Arguments

grl

GRangesList object, typically generated by getFeatureRanges

filepath

Either NULL or the path to a file where the transcript-to-gene mapping will be written

Value

Invisibly returns a data.frame with the transcript-to-gene mapping.

Author

Charlotte Soneson

Examples

  ## Get feature ranges
  grl <- getFeatureRanges(
    gtf = system.file("extdata/small_example.gtf", package = "eisaR"),
    featureType = c("spliced", "intron"),
    intronType = "separate",
    flankLength = 5L,
    joinOverlappingIntrons = FALSE,
    verbose = TRUE
  )
#> Import genomic features from the file as a GRanges object ... 
#> OK
#> Prepare the 'metadata' data frame ... 
#> OK
#> Make the TxDb object ... 
#> OK
#> 'select()' returned 1:1 mapping between keys and columns
#> Extracting spliced transcript features
#> Extracting introns using the separate approach
  
  ## Get transcript-to-gene mapping
  t2g <- getTx2Gene(grl = grl)
  t2g
#>            transcript_id gene_id
#> tx1.3              tx1.3      g1
#> tx1.2              tx1.2      g1
#> tx1.1              tx1.1      g1
#> tx2.1-I          tx2.1-I    g2-I
#> tx2.2-U          tx2.2-U    g2-I
#> tx3.3              tx3.3    g3-U
#> tx3.1              tx3.1    g3-U
#> tx3.2              tx3.2    g3-U
#> tx1.2-I          tx1.2-I    g1-I
#> tx1.2-I1        tx1.2-I1    g1-I
#> tx1.1-I          tx1.1-I    g1-I
#> tx2.1-I-I      tx2.1-I-I  g2-I-I
#> tx2.2-U-I      tx2.2-U-I  g2-I-I
#> tx2.2-U-I1    tx2.2-U-I1  g2-I-I
#> tx3.1-I          tx3.1-I  g3-U-I
#> tx3.2-I          tx3.2-I  g3-U-I
#> tx3.2-I1        tx3.2-I1  g3-U-I