-1

I am working on the TxDb.Hsapiens.UCSC.hg19.knownGene data. I found that the length of the largest exon is 205012. How can I proceed to find the genomic coordinate of that exon?

Vincent Guillemot
  • 3,394
  • 14
  • 21
Chris7
  • 11
  • 1

1 Answers1

1

You can use which.max() on the Granges, something like below:

library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb = TxDb.Hsapiens.UCSC.hg19.knownGene
ex = exons(txdb)
ex$len = width(ex)
ex[which.max(ex$len)]

GRanges object with 1 range and 2 metadata columns:
      seqnames              ranges strand |   exon_id       len
         <Rle>           <IRanges>  <Rle> | <integer> <integer>
  [1]    chr12 102591363-102796374      + |    164764    205012
  -------
  seqinfo: 93 sequences (1 circular) from hg19 genome
StupidWolf
  • 45,075
  • 17
  • 40
  • 72