How to solve the error 'ERROR::MATE_NOT_FOUND:Found xxx unpaired mates' when run SamToFastq
1
0
Entering edit mode
6 months ago
Lila M ★ 1.3k

Good morning,

I aim to chop an already aligned bam file based on different regions of a gene as follow:

samtools view -b -o out.bam -L  regions.bed origin.bam

samtools sort -o  out.sort.bam out.bam

samtools index 

Then I want to convert the out.bam into two unaligned FASTQ files (each member of the read pair parsed to one of the two files) using SamToFastq:

java -jar picard.jar SamToFastq I=out.sort.bam  F=out.sort.bam_R1.fastq F2=out.sort.bam_R2.fastq

at this point I get the error: SAM validation error: ERROR::MATE_NOT_FOUND:Found 227 unpaired mates

see below output from java -Xmx10g -jar picard.jar ValidateSamFile I=out.sort.bam O=out_file.log

ERROR::MATE_NOT_FOUND:Read name xxxx, Mate not found for paired read

I've also tried samtools fixmate -r out.sort.bam out.sort.bam_fixmate.bam but doesn't work.

Any suggestions about how to fix this or an alternative way to do it?

Thank you!

samtofasq picard validatesamfile • 4.9k views
ADD COMMENT
3
Entering edit mode
6 months ago

faster use samtools collate+ fastq

samtools collate -uOn128 in.bam TMPDIR | samtools fastq  -1 R1.fq.gz -2 R2.fq.gz -s Rx.fq.gz -0 R0.fq.gz
ADD COMMENT
0
Entering edit mode

Thank you for the feedback! I already used just the samtools fastq -1 R1.fq.gz -2 R2.fq.gz -s Rx.fq.gz -0 R0.fq.gz. Could you please explain what the collate does? Thank you!

ADD REPLY
1
Entering edit mode

could you please explain what the collate does?

http://www.htslib.org/doc/samtools-collate.html

ADD REPLY

Login before adding your answer.

Traffic: 2761 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6