Skip to content

Instantly share code, notes, and snippets.

@mikelove
Created June 8, 2016 19:36
Show Gist options
  • Save mikelove/86301abb21aa0e9fce2567d1245dcd16 to your computer and use it in GitHub Desktop.
Save mikelove/86301abb21aa0e9fce2567d1245dcd16 to your computer and use it in GitHub Desktop.
human and mouse GC distn
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
library(TxDb.Mmusculus.UCSC.mm10.knownGene)
hs <- TxDb.Hsapiens.UCSC.hg19.knownGene
mm <- TxDb.Mmusculus.UCSC.mm10.knownGene
library(BSgenome.Hsapiens.UCSC.hg19)
library(BSgenome.Mmusculus.UCSC.mm10)
hstx <- extractTranscriptSeqs(Hsapiens, exonsBy(hs, by="tx"))
mmtx <- extractTranscriptSeqs(Mmusculus, exonsBy(mm, by="tx"))
hstx2 <- hstx[width(hstx) > 100]
mmtx2 <- mmtx[width(mmtx) > 100]
hsstart <- round(runif(length(hstx2), 1, width(hstx2)-100))
mmstart <- round(runif(length(mmtx2), 1, width(mmtx2)-100))
hsgc <- letterFrequency(subseq(hstx2,hsstart,hsstart+100), "GC", as.prob=TRUE)
mmgc <- letterFrequency(subseq(mmtx2,mmstart,mmstart+100), "GC", as.prob=TRUE)
plot(density(hsgc), xlab="", main="", lwd=3, ylim=c(0,6))
lines(density(mmgc), col="red", lwd=3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment