Hello,
I'd like to read in paired end alignments from multiple samples and have them automatically paired by read id using the scanBam function from the Rsamtools package.
In Rsamtools I see two different S4 classes that serve as BAM file pointers for the scanBam function: BamViews and BamFileList. I may be wrong, but it seems only BamFileList gives the option of pairing mates, with the argument "asMates". I don't believe BamViews allow this to be set.
My problem is I can only get read in of all samples at once with BamViews. Alternatively, I can use BiocGenerics::lapply to apply scanBam to each element of the BamFileList; but in this case I get no mate pairing due to the sequential read in of samples.
Has anyone use the scanBam functionality for simultaneously pairing mates during read in of multiple samples? Currently my work around is to manually pair mates using data.table::merge, which works sufficiently well but makes the code less clean and is probably less efficient.
Any help is appreciated; session info will be supplied upon request.
Thanks!
I'd like to read in paired end alignments from multiple samples and have them automatically paired by read id using the scanBam function from the Rsamtools package.
In Rsamtools I see two different S4 classes that serve as BAM file pointers for the scanBam function: BamViews and BamFileList. I may be wrong, but it seems only BamFileList gives the option of pairing mates, with the argument "asMates". I don't believe BamViews allow this to be set.
My problem is I can only get read in of all samples at once with BamViews. Alternatively, I can use BiocGenerics::lapply to apply scanBam to each element of the BamFileList; but in this case I get no mate pairing due to the sequential read in of samples.
Has anyone use the scanBam functionality for simultaneously pairing mates during read in of multiple samples? Currently my work around is to manually pair mates using data.table::merge, which works sufficiently well but makes the code less clean and is probably less efficient.
Any help is appreciated; session info will be supplied upon request.
Thanks!