page

Sep 24, 2020

[bam_rmdup_core] inconsistent BAM file for pair

 https://github.com/samtools/samtools/issues/359

rmdup with no option (neither -s nor -S) expects alignment pairs with alternating +/- TLEN values. It is a special-purpose tool for removing PCR duplicates which conform to that pattern.

The warning is issued for consecutive positive TLEN values. A simple contrived example:

cat rmdupExample.sam
@SQ SN:c2   LN:9
s1  67  c2  1   0   9M  =   1   30  CTAATAATC   XXXXXXXXX   RG:Z:1st
s1  67  c2  1   0   9M  =   1   -30 CTAATAATC   XXXXXXXXX   RG:Z:1st
s1  259 c2  1   0   9M  =   1   30  CTAATAATC   YXXXXXXXX   RG:Z:2nd
s1  131 c2  1   0   9M  =   1   30  CTAATAATC   XXXXXXXXX   RG:Z:3rd
s1  131 c2  1   0   9M  =   1   -30 CTAATAATC   XXXXXXXXX   RG:Z:3rd

./samtools view -b -o /tmp/rmdupExample.bam /tmp/rmdupExample.sam
../samtools-0.1.19/samtools rmdup /tmp/rmdupExample.bam /tmp/test_input_1_rmdup.bam
[bam_rmdup_core] processing reference c2...
[bam_rmdup_core] inconsistent BAM file for pair 's1'. Continue anyway.
[bam_rmdup_core] 2 / 3 = 0.6667 in library '    '
./samtools view /tmp/test_input_1_rmdup.bam
s1  67  c2  1   0   9M  =   1   -30 CTAATAATC   XXXXXXXXX   RG:Z:1st
s1  259 c2  1   0   9M  =   1   30  CTAATAATC   YXXXXXXXX   RG:Z:2nd