BAM to FASTQ (BAM2FASTQ) – Short and Sweet

by:

Bioinformatics

This short tutorial teaches two ways, using samtools or bedtools, on how to convert a BAM to FASTQ.

BAM2FASTQ Using Samtools

You can use samtools to convert a BAM file to FASTQ.

$ samtools bam2fq ${YOUR_BAM_FILE}.bam > ${OUTPUT_FILE}.fastq

If you don’t know how to install, you can do it using Bioconda by calling:

$ conda install samtools

BAM to FASTQ Using Bedtools

Moreover, you can use bedtools to convert a BAM file2FASTQ.

$ bedtools bamtofastq -i ${YOUR_BAM_FILE}.bam -fq ${OUTPUT_FILE}.fastq

If you don’t know how to install, you can do it using Bioconda by calling:

$ conda install bedtools

More Resources

Here are three of my favorite Python Bioinformatics Books in case you want to learn more about it.

Related Posts