Created
July 25, 2022 01:37
-
-
Save mikelove/a9fe0ac515b5e282db2f05d0750274bd to your computer and use it in GitHub Desktop.
Silly way to count intronic basepair fraction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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