R ShortRead : Merge list of ShortReadQ object
2
0
Entering edit mode
6.8 years ago

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

ShortRead R fastq • 2.5k views
ADD COMMENT
0
Entering edit mode
6.2 years ago

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.

ADD COMMENT
0
Entering edit mode
6.2 years ago
Mike Smith ★ 2.0k

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
ADD COMMENT

Login before adding your answer.

Traffic: 1758 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6