[BioC] IRanges : Strange behavior subsetting an IntervalTree with an indexing variable from within a function
Steve Lianoglou
mailinglist.honeypot at gmail.com
Wed Sep 9 19:03:28 CEST 2009
Hmm ... continuing from the previous email, switching the code out of
lapply and into a for loop seems to fix.
So, instead of:
dist <- lapply(range.list, function(rl) {
hits <- subjectHits(overlap(ir, rl))
browser() # The debug calls below start from here
if (length(hits) > 1) {
diff(start(ir[hits]))
} else {
NA
}
})
do this:
dist <- list()
for (idx in seq(range.list)) {
hits <- subjectHits(overlap(ir, range.list[[idx]]))
dist[[idx]] <- if (length(hits) > 1) {
diff(start(ir[hits]))
} else {
NA
}
}
That works. Weird, no?
Of course, I forgot to mention sessionInfo() -- sorry.
R> > sessionInfo()
R version 2.10.0 Under development (unstable) (2009-09-07 r49613)
x86_64-apple-darwin9.8.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RSQLite_0.7-2 DBI_0.2-4 ShortRead_1.3.33
lattice_0.17-25 BSgenome_1.13.11 doMC_1.1.1 multicore_0.1-3
[8] foreach_1.2.1 codetools_0.2-2 iterators_1.0.2
Biostrings_2.13.36 IRanges_1.3.69 ARE.utils_0.1.0
loaded via a namespace (and not attached):
[1] Biobase_2.5.5 grid_2.10.0 hwriter_1.1 tools_2.10.0
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the Bioconductor
mailing list