Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
chrom file format problem with bedtools genomecov ykdang Bioinformatics 3 04-04-2014 06:17 PM
Problem running bedtools (fastFromBed) NGS_New_User Bioinformatics 2 03-18-2014 11:06 AM
counting reads per user-defined region. Bedtools intersect? mcnach Bioinformatics 6 02-18-2014 12:41 AM
BEDtools intersect output is BED instead of BAM syfo Bioinformatics 1 12-18-2012 04:26 AM
Overlap number discrepancy between VCFTools and BEDTools zxyeo Bioinformatics 2 12-27-2011 04:36 PM

Thread Tools
Old 05-31-2014, 10:44 PM   #1
Junior Member
Location: Moscow

Join Date: May 2014
Posts: 3
Default bedtools intersect - problem with chromosomes with number >=10?


I have an alignment (.bam) of reads to mm9 genome. I sorted it with samtools sort, so that later I can use -sorted key with bedtools. I also created a .bed-file with regions of interest, in which I want to count number of reads, that mapped to them, and sorted it with command-line sort. I tried this: converted .bam to .bed with bedtools bamtobed and then intersected them counting number of reads:
bedtools intersect -a regions_of_interest.bed -b alignment_sorted.bed -c -sorted  > Neg2H_counts.bedgraph
The problem is, it looks fine for all chromosomes with numbers from 0 to 9 (and X), but all counts for all regions of interest of chromosomes with higher number (chr10, chr11, etc) are 0. There is no biological reason for that, in fact the highest signal should be on chr11. What could be wrong here? I am fairly new to all these tools.

I tried to do the same intersection with bedmap and the result is identical... So there probably is something wrong with my files - what could it be?
I also tried sorting the alignment-derived bed-file in the same way, as I did with the files with regions of interest and it doesn't help.

Last edited by Phlya; 06-01-2014 at 02:43 AM.
Phlya is offline   Reply With Quote
Old 06-01-2014, 05:36 AM   #2
Senior Member
Location: Montreal

Join Date: May 2013
Posts: 367

It could be that the sorting order is not correct in one, or both of the files.
You could just check the chromosomal order in both your BED files.
You could also try the following sort command on both BED files.

sort -k1,1 -k2,2n regions_of_interest.bed > regions_of_interest_sorted2.bed
sort -k1,1 -k2,2n alignment_sorted.bed > alignment_sorted2.bed
bedtools intersect -a regions_of_interest_sorted2.bed -b alignment_sorted2.bed -c -sorted  > Neg2H_counts_sorted2.bedgraph
blancha is offline   Reply With Quote
Old 06-02-2014, 12:15 AM   #3
Junior Member
Location: Moscow

Join Date: May 2014
Posts: 3

Thank you! It seems that it doesn't expect the file to be sorted as chr1, chr2, chr3, but rather as chr1, chr10, chr11, etc. I was sorting them to get the first, logical order, but after sorting as you suggested it worked!
Phlya is offline   Reply With Quote

bedtools, intersect, samtools

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 05:57 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO