Question: Shortread convert S4 vector qualityScore to vector
gravatar for Radek
2.1 years ago by
Radek40 wrote:


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


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!

ADD COMMENTlink modified 2.1 years ago by Martin Morgan ♦♦ 22k • written 2.1 years ago by Radek40
gravatar for Martin Morgan
2.1 years ago by
Martin Morgan ♦♦ 22k
United States
Martin Morgan ♦♦ 22k wrote:

For a repeatable example, I ran


I then have an object rfq, which I trimmed with

> end = sample(20:36, 256, TRUE)
> trimmed = narrow(rfq, 1, end)
> trimmed
class: ShortReadQ
length: 256 reads; width: 20..36 cycles

The help page ?filterFastq might suggest another approach.


ADD COMMENTlink written 2.1 years ago by Martin Morgan ♦♦ 22k


Exactly what I was looking for. 

ADD REPLYlink written 2.1 years ago by Radek40
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 280 users visited in the last hour