Question: Why I'm getting an error when using ShortRead package's FastqStreamerList function?
gravatar for simonas.juzenas
3.2 years ago by
simonas.juzenas10 wrote:

Hi all,

I don't understand why I'm getting this error, when using ShortRead package' s FastqStreamerList function.

My code:

fql<-FastqStreamerList(c("a.fastq.gz", "b.fastq.gz"), n=1e6)
while(length(object <- yield(fql))) {
  writeFastq(object, "pooled.fastq.gz", "a", compress=TRUE)

Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘yield’ for signature ‘"FastqStreamerList"’

It says that "FastqStreamerList" its not inherited method for "yield" function whereas, in ShortRead's Vignette "FastqStreamerList" usage is described like this:

## FastqSampler and FastqStreamer
FastqSampler(con, n=1e6, readerBlockSize=1e8, verbose=FALSE,ordered = FALSE)
FastqSamplerList(..., n=1e6, readerBlockSize=1e8, verbose=FALSE,ordered = FALSE)
FastqStreamer(con, n, readerBlockSize=1e8, verbose=FALSE)
FastqStreamerList(..., n, readerBlockSize=1e8, verbose=FALSE)
yield(x, ...)

So where is the problem?

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=lt_LT.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=lt_LT.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=lt_LT.UTF-8       LC_NAME=C                 

attached base packages:
[1] stats4    parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] ShortRead_1.26.0        GenomicAlignments_1.4.1 Rsamtools_1.20.4        GenomicRanges_1.20.5    GenomeInfoDb_1.4.2     
 [6] Biostrings_2.36.3       XVector_0.8.0           IRanges_2.2.7           S4Vectors_0.6.3         BiocParallel_1.2.20    
[11] BiocGenerics_0.14.0    

loaded via a namespace (and not attached):
 [1] lattice_0.20-33      bitops_1.0-6         grid_3.2.2           futile.options_1.0.0 zlibbioc_1.14.0      hwriter_1.3.2       
 [7] latticeExtra_0.6-26  futile.logger_1.4.1  RColorBrewer_1.1-2   lambda.r_1.1.7       tools_3.2.2          Biobase_2.28.0
ADD COMMENTlink modified 3.2 years ago by Martin Morgan ♦♦ 22k • written 3.2 years ago by simonas.juzenas10
gravatar for Martin Morgan
3.2 years ago by
Martin Morgan ♦♦ 22k
United States
Martin Morgan ♦♦ 22k wrote:

I guess you mean the reference manual page ?FastqStreamerList rather than vignette. The manual page is documenting several functions together; it doesn't imply that all functions work with one another. You could write the while() loop as

fsl <- FastqStreamerList(c("a.fastq.gz", "b.fastq.gz"), n=1e6)

repeat {
    s1 = yield(fsl[[1]])
    if (length(s1) == 0)
    s2 = yield(fsl[[2]])
    cat("lengths:", length(s1), length(s2), "\n")

I'm not sure what you want to do to create 'pooled', concatenate chunks with append(s1, s2). Or maybe you're trying to concatenate? Then something like

fsl <- FastqStreamerList(c("a.fastq.gz", "b.fastq.gz"), n=100)
for (i in seq_along(fsl)) {
    fs = fsl[[i]]
    repeat {
        s = yield(fs)
        if (length(s) == 0)
        ## writeFastq(...)



ADD COMMENTlink modified 3.2 years ago • written 3.2 years ago by Martin Morgan ♦♦ 22k

Thank you for help, Martin! Yes, I was trying to concatenate .fasta.gz files. Usually I'm using this code:

fq<-readFastq(c("a.fastq.gz", "b.fastq.gz"))
writeFastq(fq, "pooled.fastq.gz", mode="a", compress=TRUE)

It works fine but it takes a lot of time to concatenate some files, so I was looking for better option to do this using R.

ADD REPLYlink written 3.2 years ago by simonas.juzenas10
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: 245 users visited in the last hour