Skip to content

Instantly share code, notes, and snippets.

@mikelove
Created July 25, 2022 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikelove/a9fe0ac515b5e282db2f05d0750274bd to your computer and use it in GitHub Desktop.
Save mikelove/a9fe0ac515b5e282db2f05d0750274bd to your computer and use it in GitHub Desktop.
Silly way to count intronic basepair fraction
library(magrittr)
library(purrr)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
txdb %>%
{ list(e=exons(.), g=genes(.)) } %>%
map(GenomicRanges::reduce) %>%
map(~sum(width(.x))) %>%
{ diff(unname(unlist(.))) / sum(seqlengths(txdb)) }
## [1] 0.4007753
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment