I have tried using sort -n rather than view -n. This results in the same error.
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
1 answer
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.
Log in to answer this question.