Error when computing bedtools bamtobed -bedpe
1
0
Entering edit mode
10 days ago
María José ▴ 10

Hi,

We're working with an aligned BAM file and initially sorted it by read name, in order to bedtools bamtobed could correctly associate mate information and avoid warning messages.

However, we noticed that not all alignments are being exported after this step. We found that running samtools fixmate after name sorting is recommended to properly fill in mate-pair information.

So, we implement the following code obtained from a forum to our data. However, even after this, bamtobed still seems unable to export the genomic coordinates of all alignments. It only exports warning messages.

samtools sort -@ 10 -n -o ./${file}_bwa_sorted_names_rep_18M.bam ./${file}_bwa_sorted_rep_18M.bam
samtools fixmate -@ 10 ./${file}_bwa_sorted_names_rep_18M.bam ./${file}_bwa_sorted_names_rep_18M_fixed.bam
samtools sort -@ 10 ${file}_bwa_sorted_names_rep_18M_fixed.bam -o ${file}_bwa_sorted_rep_18M_fixed.bam

bedtools bamtobed -bedpe -i ./${file}_bwa_sorted_rep_18M_fixed.bam > ${file}_bwa_sorted_names_rep_18M_paired_fixed.bed

WARNING: Query LH00587:112:22LM2WLT4:1:2392:34049:7079 is marked as paired, but its mate does not occur next to it in your BAM file.  Skipping.
human bedtools libraries illumina bamtobed • 388 views
ADD COMMENT
0
Entering edit mode
10 days ago
ATpoint 88k

Please read manuals of tools you use first.


Tool:    bedtools bamtobed (aka bamToBed)
Version: v2.30.0
Summary: Converts BAM alignments to BED6 or BEDPE format.

Usage:   bedtools bamtobed [OPTIONS] -i <bam>

Options:
        -bedpe  Write BEDPE format.
                - Requires BAM to be grouped or sorted by query.

tl_dr, remove the last sort step.

ADD COMMENT

Login before adding your answer.

Traffic: 2532 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