jianhong / ATACseqQC

ATAC-seq Quality Control

Home Page:https://jianhong.github.io/ATACseqQC/articles/ATACseqQC.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request: Supporting BamFile and BamFileList as `bamFiles` arg

PeteHaitch opened this issue · comments

Would you consider supporting BamFile and BamFileList objects (from the Rsamtools package), in addition to character vectors, as the bamFiles argument to functions in this package? This actually almost works with the current code, so I don't think it will require many changes to be made.

A concrete example of where this is useful: I have a bunch of ATAC-seq BAM files where the (.bam, .bai) pair are of the form (file.bam, file.bai). Right now, I have to create a symbolic link from file.bai to file.bam.bai because this is the format ATACseqQC expects. With this suggested change, I could instead do bfl <- Rsamtools::BamFileList("file1.bam", "file2.bam"), which automatically picks up the file1.bai and file2.bai indices, and all the Rsamtools and GenomicAlignments functions used by ATACseqQC would immediately work with these BamFile and BamFileList objects.

Thanks, Jianhong. How can I specify the index file to a function? For example, I can't see how to do this for the fragSizeDist() function.

For what it's worth, switching to BamFile and BamFileList may enable some additional control over memory usage via the yieldSize argument to the BamFile() and BamFileList() constructors.