Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(plyr)
- library(Rsamtools)
- library(GenomicRanges)
- library(Biostrings)
- library(knitr)
- matcher <- function(pattern, x) {
- ind = gregexpr(pattern, x)[[1]]
- start = as.numeric(ind)
- end = start + attr(ind, "match.length")- 2
- apply(cbind(start,end), 1, function(y) substr(x, start=y[1], stop=y[2]));
- }
- doone <- function(c, cigar) {
- pat <- paste("\\d+", c , sep="")
- sum(as.numeric(matcher(pat, cigar)), na.rm=T)
- }
Add Comment
Please, Sign In to add comment