Convert a .bam file to 2 .fastq files for pair-end read sequences.
803
Convert a .bam file to 2 .fastq files for pair-end read sequences.
First sort the bam file by read names using 'samtools sort' to create a sorted .bam file, then 'bedtools bamtofastq' to split this output into 2 .fastq files.
export SM=mysample
$ samtools sort -n ${SM}.bam -o ${SM}.sort.bam --output-fmt bam
$ bedtools bamtofastq -i ${SM}.sort.bam
-fq ${SM}.illumina.sort.pe1.fastq
-fq2 ${SM}.illumina.sort.pe2.fastq
Content type
Image
Digest
Size
266.4 MB
Last updated
over 10 years ago
docker pull j5kim/bam2fastq:v1