[Bioc-devel] FastqStreamer error in function context

Thomas Girke thomas.girke at ucr.edu
Thu May 10 06:53:22 CEST 2012


When FastqStreamer or FastqSampler are called within another function in
combination with a writeFastq step then this usually returns an error.
However, the same code runs just fine outside of a function.  Below is
an example to reproduce this error. 

A small feature request for FastqStreamer would be an option to return 
the total number of reads stored in a fastq file as well as an option
for accessing specific records by passing on an index vector. 

Best,

Thomas


Here is an example:

library(ShortRead)
sp <- SolexaPath(system.file('extdata', package='ShortRead'))
fl <- file.path(analysisPath(sp), "s_1_sequence.txt")

## Some function using FastqStreamer
test <- function(x=fl) {
        f <- FastqStreamer(x, 5)
        while (length(fq <- yield(f))) {
                fqsub <- fq[1:2]
                writeFastq(fqsub, "test.fastq", mode="a")
        }
        close(f)
}
test(x=fl)

Error in .IRanges.checkAndTranslateSingleBracketSubscript(x, i) : 
  subscript contains NAs or out of bounds indices


sessionInfo()
R version 2.15.0 alpha (2012-03-05 r58604)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] ShortRead_1.14.3    latticeExtra_0.6-19 RColorBrewer_1.0-5 
[4] Rsamtools_1.8.4     lattice_0.20-6      Biostrings_2.24.1  
[7] GenomicRanges_1.8.4 IRanges_1.14.2      BiocGenerics_0.2.0 

loaded via a namespace (and not attached):
[1] Biobase_2.16.0 bitops_1.0-4.1 grid_2.15.0    hwriter_1.3    stats4_2.15.0 
[6] tools_2.15.0   zlibbioc_1.2.0



More information about the Bioc-devel mailing list