I would like to convert .bam files to fq.gz (zipped fasta files) for paired reads.
bedtools bamtofastq seems to be a commonly recommended method, I have also seen samtools fastq as a possible alternative.
bedtools bamtofastq -i inputfile.bam -fq outputR1.fq -fq2 outputR2.fq
samtools fastq -@ 8 unmapped_sorted.bam \
-1 outputR1.fastq.gz \
-2 outputR2.fastq.gz \
-0 /dev/null -s /dev/null -n
It seems for bedtools bamtofastq it is not possible to output zipped fasta files.
Is samtools fastq a good alternative?