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

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to