Dear all,
I am trying to read bam file line by line by using ruby scripts. Although there is ruby gem bio-samtools(http://rubygems.org/gems/bio-samtools), I don't find a way to read the whole bam file line by line(can get the alignments for given genomic regions). Any suggestion will be appreciated.
BTW, I have used IO.open("samtools view sample1.bam").each do {|x| ...}
, however it will put the whole bam file into the memory first.
Really? At least in C, the whole idea of popen() is NOT to read the whole file into memory.