error with number of fields in bedtools
1
0
Entering edit mode
7.7 years ago

I have two files, file A and file B. File A looks like this

3R  26969363  26969744  
3R  27596423  27598953  
3R  27596424  27597575  
3R  27598277  27598952  
3R 27598951   27601828  
3R 27601079   27601205    
4  44758        45814  
4  44758        45814  
4  329255      329453  
4  547084      548882

File B looks like this:

3R      27446370        27448445        Unspecified_VT48351  
3R      27449778        27452027        Unspecified_VT48353  
3R      27451198        27451698        Unspecified_STARR-OSC-3001  
3R      27455002        27457116        Unspecified_VT48356  
3R      27462241        27462741        Unspecified_STARR-OSC-1147  
3R      27504391        27504891        Unspecified_STARR-OSC-3255  
3R      27505415        27505915        Unspecified_STARR-S2-4346  
3R      27556636        27557136        Unspecified_STARR-OSC-2452  
3R      27566429        27568568        Unspecified_VT48413  
3R      27569900        27571995        Unspecified_VT48415  
3R      27570524        27571024        Unspecified_STARR-OSC-1831  
3R      27570564        27571064        Unspecified_STARR-S2-2753  
3R      27571446        27573714        Unspecified_VT48416  
3R      27574983        27577188        Unspecified_VT48418

I need to remove the overlapping regions from file B, so that file B no longer has overlapping regions of file A. I used bedtools subtract for this.

bedtools subtract -a fileb -b filea

it threw an error: line number 5 of filea has 4 fields, but three were expected. But the file has only three columns. Both the files, filea and fileb are tab-delimited

genome • 3.1k views
ADD COMMENT
0
Entering edit mode

Have you checked that there is no "invisible" tabulation at the end of some lines of filea (such as line 5) ?

ADD REPLY
2
Entering edit mode
7.7 years ago

You could try bedops:

$ bedops --not-element-of -1 B.bed A.bed > answer.bed
ADD COMMENT

Login before adding your answer.

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