R ShortRead : Merge list of ShortReadQ object
Hi,
I've a list of ShortReadQ object. Each object representing a subset of a fastq file :
r1[1:3]
$`42`
class: ShortReadQ
length: 1 reads; width: 102 cycles
$`123`
class: ShortReadQ
length: 1 reads; width: 112 cycles
$`124`
class: ShortReadQ
length: 1 reads; width: 112 cycles
is(r1.consensus)
[1] "list" "vector" "AssayData" "vector_OR_factor"
I'm struggling to concatenate them into one ShortReadQ object. I tried do.call(c,r1) but it didn't work.. Any advice ?
Thanks
• 3,446 views
•
link
2 answers
You can try using the append() method on the list e.g.
## List of two ShortReadQ objects with different widths
> fq
[[1]]
class: ShortReadQ
length: 256 reads; width: 36 cycles
[[2]]
class: ShortReadQ
length: 256 reads; width: 30 cycles
## Combine to a single ShortReadQ
> do.call('append', fq)
class: ShortReadQ
length: 512 reads; width: 30 36 cycles
• 0 views
•
link
This proved to be quite a riddle. You can try something like (this worked for me):
sr <- c(sread(r[[1]]),sread(r[[2]]),sread(r[[3]]))
qu <- Reduce("append",c(quality(r[[1]]),quality(r[[2]]),quality(r[[3]])))
id <- c(id(r[[1]]),id(r[[2]]),id(r[[3]]))
concShortRead <- ShortReadQ(sr,qu,id)
Hope this helps someone, as the post is getting old.
• 0 views
•
link
Log in to answer this question.