Bamtobed paired mate error
Hi I am trying to make a -bedpe file using bedtools bamtobed and am running into a problem. I get many of the following error messages after this command.
bedtools bamtobed -bedpe -i male_1_sorted_rmdup.bam > male_1_sorted_rmdup.bed
Errors:
*****WARNING: Query NB551387:262:H3FMVBGXC:3:21408:20039:5256 is marked as paired, but its mate does not occur next to it in your BAM file. Skipping.
If I run samtools flagstat on the bam file input it appears that the mates are properly paired. These are sorted bam files from which I have removed the duplicates Picard. They are otherwise not processed, made with Bowtie2.
samtools flagstat male_1_sorted_rmdup.bam
21276014 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 duplicates
21276014 + 0 mapped (100.00%:-nan%)
21276014 + 0 paired in sequencing
10638007 + 0 read1
10638007 + 0 read2
21276014 + 0 properly paired (100.00%:-nan%)
21276014 + 0 with itself and mate mapped
0 + 0 singletons (0.00%:-nan%)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
Wondering why this may be happening? Thanks!
• 4,382 views
•
link
1 answer
You have to sort by query name samtools sort -nfor paired-end data as bedtools required mate reads directly adjacent to each other. It is recommended to read the help messages of the tools you use before running it:
bedtools bamtobed --help
(...)
-bedpe Write BEDPE format.
- Requires BAM to be grouped or sorted by query.
• 0 views
•
link
Log in to answer this question.
The post calls it an
Errorbut the tool says it's aWarning. Warnings can be ignored (for the moment at least). The situation is definitely interesting though, I'm curious what the reasoning behind this warning could be.Yes you are correct it is a warning however still would like to figure out a fix as its severely reducing the bedpe information I get.