read_fastq <- function(file) {
assertthat::assert_that(assertthat::is.readable(file))
assertthat::assert_that(assertthat::has_extension(file,"fq"))
base::scan(file, character()) -> file.lines
file.lines[c(T,F,F,F)] -> ids
file.lines[c(F,T,F,F)] -> sequences
file.lines[c(F,F,F,T)] -> qualities
if (!all(base::startsWith(ids,"@"))) {
base::stop("Some ID lines didn't start with @")
}
stringr::str_sub(ids,2) -> ids
if (!base::all(base::nchar(sequences)==base::nchar(qualities))) {
base::stop("Some sequences were a different length to the qualities")
}
if (any(base::duplicated(ids))) {
base::stop("Some IDs are duplicated")
}
tibble::tibble(
ID = ids,
Bases=sequences,
Qualities=qualities,
GC=gc_content(sequences)
) %>%
return()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.