Hi,
I have some fastq files which I mapped to the host genome and get a sam file with 80% mapping rate. Now how can I get the unmapped reads to a separate fastq or fasta file so I can play with that only? Thank you very much everybody!
Hi,
I have some fastq files which I mapped to the host genome and get a sam file with 80% mapping rate. Now how can I get the unmapped reads to a separate fastq or fasta file so I can play with that only? Thank you very much everybody!
Title of your question is different from content of question, anyways,
So you ran tophat, and got bam files , both mapped and unmapped.
and you want to extract reads from unmapped bam file in fastq format, you just run bamToFastq from bedtools
Here is description from their manual :
bedtools bamtofastq (aka bamToFastq)
Summary: Convert BAM alignments to FASTQ files.
Usage:
bamToFastq [OPTIONS] -i <BAM> -fq <FQ>
Options:
-fq2 FASTQ for second end. Used if BAM contains paired-end data.
BAM should be sorted by query name is creating paired FASTQ.
-tags Create FASTQ based on the mate info in the BAM R2 and Q2 tags.Tips:
If you want to create a single, interleaved FASTQ file for paired-end data, you can just write both to /dev/stdout:
bedtools bamtofastq -i x.bam -fq /dev/stdout -fq2 /dev/stdout > x.ilv.fq
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
I edited the title of post in case anyone is wondering about the comments/answers. Feel free to edit to be more appropriate.
It looks great now :)