Filtering reads on the go!
What if, from all of the reads in a file, you are only interested in some of those reads? You can use a filter!
Let's say that you are interested only in those reads that start with the pattern "ATGCA". A tiny filtering function can do the job, making use of the srFilter() function:
myStartFilter <- srFilter(function(x) substr(sread(x), 1, 5) == "ATGCA")
This function, which has been created for you, takes a ShortRead derived object as an input and outputs the reads starting with the pattern "ATGCA". Let's put this function to use!
Latihan ini adalah bagian dari kursus
Introduction to Bioconductor in R
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Load package ShortRead
library(ShortRead)
# Check class of fqsample
___
# Filter reads into selectedReads using myStartFilter
selectedReads <- fqsample[___(___)]
# Check class of selectedReads
___