Are you using the latest version of samtools and HTSlib? If not, please specify.
Yes, 1.20.
Please describe your environment.
- OS: Linux 5.16.2-051602-generic
- machine architecture: x86_64
- compiler: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Please specify the steps taken to generate the issue, the command you are running and the relevant output.
An interleaved FASTQ file was mapped using bwa mem -p -c 250 -M -t 9 hg19.fa in.bam mapped.bam. The following lines appear next to each other in the output, and the flags (73, 133) are correct, valid and complementary (sequences and quality scores removed for readability):
A01174:196:HGKFNDSX2:4:1651:6433:35336:TCA_TCA 73 chrM 8481 21 3S143M = 8481 0 NM:i:3 MD:Z:115A20A2C3 AS:i:131 XS:i:121 XA:Z:chr1,+569030,3S143M,5;
A01174:196:HGKFNDSX2:4:1651:6433:35336:TCA_TCA 133 chrM 8481 0 * = 8481 0 MC:Z:3S143M AS:i:0 XS:i:0
After running samtools collate -@ 1 -O -u mapped.bam 2> map.log | samtools fixmate -Mrcm - out.bam, only the first of these is retained (sequences match), and the SAM flag is now invalid (72: mate unmapped, first in pair, but paired bit not set):
A01174:196:HGKFNDSX2:4:1651:6433:35336:TCA_TCA 72 chrM 8481 21 3S143M = 8481 0 NM:i:3 MD:Z:115A20A2C3 AS:i:131 XS:i:121 XA:Z:chr1,+569030,3S143M,5; MC:Z:* ms:i:2872
This creates downstream problems with fgbio GroupReadsByUMI for me:
Exception in thread "main" htsjdk.samtools.SAMFormatException: SAM validation error: ERROR::INVALID_FLAG_MATE_UNMAPPED:Record 1248, Read name A01174:196:HGKFNDSX2:4:1651:6433:35336, Mate unmapped flag should not be set for unpaired read.
Picard complains about a 72 flag as well: https://broadinstitute.github.io/picard/explain-flags.html
Are you using the latest version of samtools and HTSlib? If not, please specify.
Yes, 1.20.
Please describe your environment.
Please specify the steps taken to generate the issue, the command you are running and the relevant output.
An interleaved FASTQ file was mapped using
bwa mem -p -c 250 -M -t 9 hg19.fa in.bam mapped.bam. The following lines appear next to each other in the output, and the flags (73, 133) are correct, valid and complementary (sequences and quality scores removed for readability):A01174:196:HGKFNDSX2:4:1651:6433:35336:TCA_TCA 73 chrM 8481 21 3S143M = 8481 0 NM:i:3 MD:Z:115A20A2C3 AS:i:131 XS:i:121 XA:Z:chr1,+569030,3S143M,5;
A01174:196:HGKFNDSX2:4:1651:6433:35336:TCA_TCA 133 chrM 8481 0 * = 8481 0 MC:Z:3S143M AS:i:0 XS:i:0
After running
samtools collate -@ 1 -O -u mapped.bam 2> map.log | samtools fixmate -Mrcm - out.bam, only the first of these is retained (sequences match), and the SAM flag is now invalid (72: mate unmapped, first in pair, but paired bit not set):A01174:196:HGKFNDSX2:4:1651:6433:35336:TCA_TCA 72 chrM 8481 21 3S143M = 8481 0 NM:i:3 MD:Z:115A20A2C3 AS:i:131 XS:i:121 XA:Z:chr1,+569030,3S143M,5; MC:Z:* ms:i:2872
This creates downstream problems with fgbio GroupReadsByUMI for me:
Picard complains about a 72 flag as well: https://broadinstitute.github.io/picard/explain-flags.html