Hello,

The cause of this issue is an error in function bam_get_seq(),
or to be more precise, function's implementation for non-intel architectures.

Function bam_get_seq is used for reading data from alignment blocks
in BAM files, block by block.
In special cases, when the alignment block being read is the last block in BAM 
file,
and the block has no cigar operations and segment sequence stored inside of it,
function incorrectly detects end-of-file.
In that case,
block has actually been successfully read,
but because of erroneous end-of-file detection,
it isn't written to output file in SAM format.

Attached patch fixes this issue.
It is tested on mips, mipsel and powerpc.

Best Regards
Aleksandar Zlicic
--- a/io_lib/bam.c
+++ b/io_lib/bam.c
@@ -1636,7 +1636,7 @@
     /* The remainder, word aligned */
     blk_size = blk_ret;
     
-    if ((blk_ret = bam_read(b, (char *)bam_cigar(bs), blk_size+4)) == 0)
+    if (((blk_ret = bam_read(b, (char *)bam_cigar(bs), blk_size+4)) == 0) && blk_size!=0)
 	return 0;
 
     if (blk_size+4 != blk_ret) {

Reply via email to