Public Repository

Last pushed: a year ago
Short Description
Convert a .bam file to 2 .fastq files for pair-end read sequences.
Full Description

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.

Set a sample file prefix

export SM=mysample

Sort .bam file by their read names

$ samtools sort -n ${SM}.bam -o ${SM}.sort.bam --output-fmt bam

Split sorted .bam file in two FASTQ files for pair-end sequences

$ bedtools bamtofastq -i ${SM}.sort.bam \
-fq ${SM}.illumina.sort.pe1.fastq \
-fq2 ${SM}.illumina.sort.pe2.fastq

Docker Pull Command
Owner
j5kim

Comments (0)