Unable to intersect BAM file with bedtools
1
0
Entering edit mode
6.0 years ago

Hi everyone, I'm trying to use bedtools intersect to check the number of mapped reads in target regions (in a .bed file) originated by targeted bisulfite sequencing experiment (EpiSeq Roche).

I used the following command.

./bedtools intersect -bed -abam sample2.bam -b 
 ~/Data/MethylSeq/dataset/Agesmoke_dataset/AgeSmkSop_all_primary_targets.bed

The program terminate with the following message and no result at all.

* WARNING: File sample2.bam has inconsistent naming convention for record:
NC_000016.9  24163386  24163537  M03971:33:000000000-BN5NL:1:2114:12003:16132/1  255  +

* WARNING: File sample2.bam has inconsistent naming convention for record:
NC_000016.9  24163386  24163537  M03971:33:000000000-BN5NL:1:2114:12003:16132/1  255  +

I tried to modify the original SAM file removing the read that cause the problem (that was the first read in the SAM file) and the problem persists with the second read. I tried also the option -nonamecheck with no results.

Can someone help us? Thank you.
Nicola

bedtools • 2.9k views
ADD COMMENT
1
Entering edit mode

Is that line starting with NC_000016.9 supposed to be from the .bam file?

ADD REPLY
0
Entering edit mode

Hi, the problem was that in the .bed file chromosome's names was like "chr1, chr2...", while the .bam files use the "NCBI names" (NC_000001.10 etc). I resolved the issue renaming chromosomes in .bed file!

ADD REPLY
1
Entering edit mode
6.0 years ago

Here's another option, using BEDOPS bedmap and bam2bed:

$ bedmap --echo --count --delim '\t' regions.bed <(bam2bed < reads.bam) > answer.bed

The last column in answer.bed will contain the number of reads in reads.bam that overlap each region in regions.bed by one or more bases.

ADD COMMENT

Login before adding your answer.

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