Question: Extracting only paired reads from .bam
gravatar for MS485
4.3 years ago by
MS4850 wrote:


I have the unmapped reads from a RNAseq experiement (unmapped.bam) and I want to try and map these to a different genome. I have sorted my unmapped.bam using

samtools view -n unmapped.bam unmappedsorted.bam

I have checked the files have the same number of reads. I then wanted to convert the unmappedsorted.bam to fastq format so that I may use tophat to map the 'unmappedsorted' to the other genome. I tried:

bedtools bamtofastq -i unmappedsorted.bam -fq unmappedsorted1.fq -fq2 unmappedsorted2.fq

But this gives an error something like: ... is marked as paired and the mate does not occur next to it. skipping.

Is there a way I can extract only the paired reads from my unmappedsorted.bam file to convert to fastq? Or is there something up with the unmappedsorted.bam that I'm misssing here?

Thanks in advance!


P.S. I am very new to linux/rna-seq analysis

rna-seq • 1.8k views
ADD COMMENTlink modified 4.3 years ago by geek_y11k • written 4.3 years ago by MS4850
gravatar for geek_y
4.3 years ago by
geek_y11k wrote:

Your command to sort the bam file is wrong. Use samtools sort. Anyway, I don't see any problem here. There could be singletons in the unmapped bam. So its skipping those reads. Whats the output of

samtools flagstat in.bam

Have a look at Picard's SamToFastq which is very elegant.

ADD COMMENTlink modified 4.3 years ago • written 4.3 years ago by geek_y11k

I have tried using sort -n rather than view -n. This results in the same error.

ADD REPLYlink written 4.3 years ago by MS4850
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 740 users visited in the last hour