Ah indeed, that was it. All I remember that it drove me nuts when the reads got out of sync and for a time I couldn't quite figure out why.
I am converting some .bam files into .fastq with
samtools bam2fq
The reads inside the resulting .fastq files have a suffix:
@HISEQ02:451:150310_HWI-D00446_0451_C5FG0ACXX:4:2310:2367:65733/2
65733/2
Will bwa mem understand this as paired-end .fastq or do I have to split the files into R1/R2 first?
Thanks
2 answers
BWA does not understand the /1 and /2 suffixes on read names.
It can use "interleaved" format - that is where the file alternates between read1 and read2. However samtools fastq doesn't guarentee that the reads will be output in exactly interleaved order. For a start, the bam must be read name ordered. Even then you can have situations where read1 is mapped, and therefore in the bam, and read2 isn't, and therefore is excluded from the BAM, or where a read has multiple alignments that can mess up the ordering.
Does your bam file include both mapped and unmapped reads?
As far as I know samtools does not have bam2fq subcommand . It does have a fastq subcommand that will generate fastq files.
When it comes to mapping use two different files rather than an interleaved one.
I will also mention that the way the fastq command works for when producing a single file has many gotcha's, the records that get written can be affected by other parameters, leading to unexpected behaviors.
Log in to answer this question.