[Bioc-devel] Missing seqinfo method for BamFileList?
Ryan C. Thompson
rct at thompsonclan.org
Sat Apr 26 00:58:04 CEST 2014
Hi all,
I noticed that the seqinfo works on BamFile objects, but not on
BamFileList objects. For BamFileList, it does not throw an error, but
rather uses the inherited method for "List", which does not return a
useful result for BamFileList. I suggest the following implementation of
a useful seqinfo function for BamFileList, along with some code
demonstrating the problem:
fl <- BamFile(system.file("extdata", "ex1.bam", package="Rsamtools",
mustWork=TRUE))
# This works.
seqinfo(fl)
fll <- BamFileList(fl, fl)
## This works, but it uses the generic for "List" which gives a useless
result.
seqinfo(fll)
## Now add a method
setMethod("seqinfo", signature=list(x="BamFileList"), function (x)
{
Reduce(merge, lapply(x, seqinfo))
}
)
## Now this returns a good result
seqinfo(fll)
## So does this
seqlengths(fll)
-Ryan Thompson
More information about the Bioc-devel
mailing list