Question: Bed File Bedpe Format
1
gravatar for Assa Yeroslaviz
7.7 years ago by
Assa Yeroslaviz1.2k
Munich
Assa Yeroslaviz1.2k wrote:

Hi,

I'm having trouble with converting the bam file into bed -bedpe using the bedtools.

workflow:
samtools sort -n mut.bam mut.Namesorted
bamTobed -i mut.Namesorted.bam -bedpe > dilpMerged_bedpe.bed

After sorting the file by read name (option -n) I run the bamTobed command. but it gives me an error message after running a few lines:

*ERROR: -bedpe requires BAM to be sorted/grouped by query name.

What am I doing wrong here?

Thanks

A.

bedtools bed bam conversion • 5.6k views
ADD COMMENTlink modified 12 months ago by Biostar ♦♦ 20 • written 7.7 years ago by Assa Yeroslaviz1.2k
2
gravatar for iw9oel_ad
7.7 years ago by
iw9oel_ad6.0k
iw9oel_ad6.0k wrote:

I suspect that one of two things is happening: either a) your SAM header (which will be unchanged by samtools) says that your BAM file is coordinate sorted (or unsorted) after your sort procedure and BEDTools is noticing this or 2) you have orphan (i.e. unpaired reads) and BEDTools is using a naive pairwise iteration that does not account for intervening orphans.

I can discount 1) by looking at the source (confirmed by experiment).

I can confirm 2) by experiment. I removed a single member of a pair of reads in a name-sorted BAM file and obtained the same error message from bamToBed as you did.

So I suspect that you have orphans that you need to remove.

ADD COMMENTlink modified 7.7 years ago • written 7.7 years ago by iw9oel_ad6.0k

That's right, the current version expects alignments to come in pairs. I've not yet implemented logic for interleaved orphans.

ADD REPLYlink written 7.5 years ago by Aaronquinlan10k
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: 2121 users visited in the last hour