Hello!
I having some difficulties to convert a S4 vector to a vector in the shortRead package.
I simply would like to trim the sequences contained in a shortReadQ object and their associated quality scores based on a vector (filterTable$start).
Such as:
# Read the fastq file fq <- readFastq(fastq, as.string=TRUE) # Trim the Sequences sequences<- substr(sread(fq), start=1, stop=filterTable$start) # Trim the quality scores qualities <- substr(quality(fq), start=1, stop=filterTable$start) # Save the file ShortReadQ(DNAStringSet(sequences),BStringSet(qualities),BStringSet(id(fq)))
It is perfectly working for the sequences but not for the qualities. I tried different approaches to trim them, but I'm always stopped by a "Cannot convert S4 vector to vector".
Does someone know the right approach to transform the quality into a vector?
Thanks in advance!
Thanks!
Exactly what I was looking for.