Question: Unable to intersect BAM file with bedtools
0
gravatar for nicola.licheri
14 months ago by
nicola.licheri0 wrote:

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 • 719 views
ADD COMMENTlink modified 14 months ago by Alex Reynolds28k • written 14 months ago by nicola.licheri0
1

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

ADD REPLYlink written 14 months ago by swbarnes26.0k

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 REPLYlink written 14 months ago by nicola.licheri0
1
gravatar for Alex Reynolds
14 months ago by
Alex Reynolds28k
Seattle, WA USA
Alex Reynolds28k wrote:

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 COMMENTlink modified 14 months ago • written 14 months ago by Alex Reynolds28k
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: 1578 users visited in the last hour