[Bioc-devel] Rsamtools: How to import only the first 1000 or so reads

Christian Arnold christian.arnold at embl.de
Thu Jan 21 14:31:03 CET 2016


Dear Bioc-Community,

I was wondering if it is currently possible to only import the first X 
reads rather than all reads from an arbitrary BAM file into a list using 
Rsamtools with scanBam? I did not find any parameter in scanBamParam 
that seems to capture what I need. Specifically, I do not want to 
specify genomic regions because for arbitrary BAM files, there might not 
be any read overlapping. Command-line solutions are also not an option 
here because I want to integrate this into the SNPhood package and it 
should run on Windows too.

The reason for this task is that I want to automatically determine the 
read length from a BAM file, and my currently favoured strategy is to 
import the first 1000 reads or so and then determine the maximum length 
of the sequence, which should be a good proxy for the real read length.

Thanks for suggestions,
Christian



More information about the Bioc-devel mailing list