Last active
January 9, 2018 04:58
-
-
Save GuangchuangYu/b331b39fc1207c091f9b76e308cffa96 to your computer and use it in GitHub Desktop.
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
qbar <- function(x, verbose=TRUE) { | |
enc = encoding(quality(x)) | |
qual <- sapply(seq_along(x), function(i) enc[to_char_vector(x[i])]) | |
mq <- rowMeans(qual) | |
if (verbose) { | |
names(mq) <- NULL | |
print(mq) | |
} | |
pillar:::spark_bar(mq/max(enc)) | |
} | |
to_char_vector <- function(x) { | |
toString(x@quality@quality) %>% strsplit(split='') %>% unlist | |
} | |
require(ShortRead) | |
x <- readFastq(system.file('extdata/E-MTAB-1147/ERR127302_1_subset.fastq.gz', package='ShortRead')) | |
qbar(x[1:50]) |
Author
GuangchuangYu
commented
Jun 2, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment