BAM to Fastq
4
0
Entering edit mode
2.9 years ago
Qboy ▴ 10

Hello everyone,

I would like to ask a question. I have BAM files for each hg19 chromosome, but I need to create a fastq.gz file, so I can realign the reads to hg38 again. The SRA for the dataset I am interested in doesn't exist, but only already aligned ones. I wanted to ask if anyone has done it before and how to create one pair of paired-end fastq.gz files out of 23 BAM files. Do I need to convert first to Fastq eahc BAM file separately and then combine corresponding fastq1 and fast2 for PE reads?

Thank you,

fastq bam • 3.2k views
ADD COMMENT
1
Entering edit mode

This tutorial shows how to easily convert a BAM file into FASTA https://onestopdataanalysis.com/convert-bam-to-fasta/

ADD REPLY
2
Entering edit mode
2.9 years ago
Raman2 ▴ 30

You can merge all the bam files, sort them (samtools) and convert is to fastq (samtools or bedtools)

ADD COMMENT
1
Entering edit mode

Important: Sort by name, not position.

ADD REPLY
1
Entering edit mode

This answer is subject to caveat that I had noted in my answer. Otherwise there can be serious duplication of data.

ADD REPLY
1
Entering edit mode
2.9 years ago
GenoMax 147k

If reads have been aligned to each chromosome separately then you may have the entire dataset in just one BAM file, assuming unaligned reads are included. Then you may need to convert just one file.

If unaligend reads are not included then you will need to do the conversion for each BAM file and then merge the reads. Make sure there are no duplicates. Passing the end result through repair.sh from BBMap suite will ensure that reads in R1/R2 files will be in sync.

ADD COMMENT
1
Entering edit mode
2.9 years ago
xiaoguang ▴ 160

how about this java software : https://github.com/ssadedin/bazam

ADD COMMENT
1
Entering edit mode
2.9 years ago
Gordon Smyth ★ 7.7k

The Subread aligner can take the BAM files directly as input, so there is no need to re-construct FASTQ files to re-align the reads.

ADD COMMENT

Login before adding your answer.

Traffic: 1315 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6