I am working with paired-end Illumina Hiseq data. My goal is to create a new set of fastq files containing only paired reads that do not map to an E. coli reference.
I created an alignment to an E. coli reference, then extracted unmapped paired reads to a new file:
samtools view -u -f 12 ecoli_sam.sam > unmapped.bam
I sorted to maintain the order of paired reads
samtools sort -n unmapped.bam sorted_unmapped
And converted to fastq
bamToFastq -useTags -bam sorted_unmapped.bam -fq1 unmappedR1.fastq -fq2 unmappedR2.fastq
When I view the resulting fastq files, the first file looks normal (unmappedR1.fastq), but the paired file (unmappedR2.fastq) has only the read headers but not sequence. An example is below.
Can someone tell me where I'm going wrong?