I want to align PE Illumina reads (FastQ) onto very short reference (mitochondrial). I'm not interested in reads that didn't align...
Do you know any short read aligner that can output BAM file? Or how to limit SAM output to aligned sequences only?
I want to align PE Illumina reads (FastQ) onto very short reference (mitochondrial). I'm not interested in reads that didn't align...
Do you know any short read aligner that can output BAM file? Or how to limit SAM output to aligned sequences only?
Please refer to this question
Any aligner will probably send alignments to stdout, so you can do something like
aligner input.fastq ... | samtools view -SF 0x04 -b - > only.aligned.bam
(And use -f 0x02
to require properly paired reads).
Where the -F
flag removes unaligned reads. See the manual.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Often it is counterproductive to filter the output right away. You may need the information on unaligned/unpaired reads at some point. Usually it is better to first generate the full SAM file, then filter it as the answers below show it.