Sign inSign up

j5kim/bam2fastq

By j5kim

•Updated over 10 years ago

Convert a .bam file to 2 .fastq files for pair-end read sequences.

Image
0

803

j5kim/bam2fastq repository overview

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

Tag summary

Content type

Image

Digest

Size

266.4 MB

Last updated

over 10 years ago

docker pull j5kim/bam2fastq:v1