I'm getting an error when I try to pair my reads using bwa (version 0.7.10-r789). Here's my pipeline:
Trim for quality using fastx fastq_quality_trimmer
fastq_quality_trimmer -t 20 -l 30 -Q33 -i for.fastq -o for_trimmed.fastq
fastq_quality_trimmer -t 20 -l 30 -Q33 -i rev.fastq -o rev_trimmed.fastq
Align forward and reverse reads to reference
bwa index ref.fa
bwa aln ref.fa for_trimmed.fastq > for.sai
bwa aln ref.fa rev_trimmed.fastq > rev.sai
Pair reads, for which I get the error in the following output:
bwa sampe for.sai rev.sai for_trimmed.fastq rev_trimmed.fastq > sample.sam
[bwa_sai2sam_pe_core] convert to sequence coordinate...
[infer_isize] fail to infer insert size: too few good pairs
[bwa_sai2sam_pe_core] time elapses: 0.14 sec
[bwa_sai2sam_pe_core] changing coordinates of 0 alignments.
[bwa_sai2sam_pe_core] align unmapped mate...
[bwa_sai2sam_pe_core] time elapses: 0.00 sec
[bwa_sai2sam_pe_core] refine gapped alignments... 0.07 sec
[bwa_sai2sam_pe_core] print alignments... [bwa_sai2sam_pe_core] paired reads have different names: "HWI-D00306:565:C6NPTANXX:8:1101:9745:2553", "HWI-D00306:565:C6NPTANXX:8:1101:9672:2717"
Any suggestions on how to fix this problem or remove the offending reads?
Thanks! I used cutadapt to trim the paired reads, and that solved the problem. I really appreciate the help!
As Daniel suggested that you should retrim the fastq reads using a trimmer that maintains the order of reads in the two fastq files. Trimmomatic is another paired-end aware trimmer. Alternatively, you can remove orphan reads as described here: Combining The Paired Reads From Illumina Run