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

Hi,

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!

M

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

rna-seq • 1.3k views
ADD COMMENTlink modified 3.3 years ago by geek_y9.8k • written 3.3 years ago by MS4850
0
gravatar for geek_y
3.3 years ago by
geek_y9.8k
Barcelona
geek_y9.8k 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 3.3 years ago • written 3.3 years ago by geek_y9.8k

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

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

Help
Access

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