## path to a convenient fastq file
sp <- SolexaPath(system.file('extdata', package='ShortRead'))
fl <- file.path(analysisPath(sp), "s_1_sequence.txt")
## filter reads to keep those with GC < 0.7
fun <- function(x) {
gc <- alphabetFrequency(sread(x), baseOnly=TRUE)[,c("G", "C")]
x[rowSums(gc) / width(x) < .7]
}
filterFastq(fl, tempfile(), filter=fun)
## trimEnds,character-method uses filterFastq internally
trimEnds(fl, "V", destinations=tempfile())
Run the code above in your browser using DataLab