This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Downloading BAM files and converting to fastq

I'm trying to download fastq files and managed fine before. However, for one study the samples are saved as BAM files. Is it possible to still download the BAM files and convert them to fastq files? What took can I use for the conversion if so?

The study is on ebi https://www.ebi.ac.uk/ena/data/view/PRJNA470834

rna-seq fastq bam ebi

1 answer

For sure, see the bamtofastq tool from bedtools:

https://bedtools.readthedocs.io/en/latest/content/tools/bamtofastq.html

$ bedtools bamtofastq -i NA18152.bam -fq NA18152.fq

To get paired-end fastq files (requires sorting):

$ samtools sort -n aln.bam aln.qsort

$ bedtools bamtofastq -i aln.qsort.bam \
                      -fq aln.end1.fq \
                      -fq2 aln.end2.fq

Also, it seems like your dataset has an SRP under secondary accession (SRP145274), so presumably you should be able to get the fastq files from SRA.

Example: GSM3138950 from this project has the following sequencing run: SRR7142657

And the .sra file from the SRA FTP server:
https://ftp-trace.ncbi.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR714/SRR7142657/

You can extract fastq files from .sra files using fastq-dump.

Thank you! This seems to work.

lamia_203 : Don't forget to follow up on your threads.

If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one if they work.
Upvote|Bookmark|Accept

Log in to answer this question.