I have four BED files with data from different conditions (let's say A B C and D). I want to make a file (using bedtools subtract) that have those regions specific to A. Since bedtools subtract works pairwise, I should do (manual example):
bedtools subtract -a A.bed –b B.bed > temp1.bed
bedtools subtract -a temp1.bed –b C.bed > temp2.bed
bedtools subtract -a temp2.bed –b D.bed > only_A.bed
By any chance bedtools has a way of doing it for multiple files? such as
bedtools subtract -a A.bed –b B.bed C.bed D.bed > only_A.bed
On its manual entry is not very clear, but they have done it for other tools such as intersect. Thank you !
Thank you for your answer! Yes, I had a typo in temp2.bed, I just edited it. The hyphen and paragraph dash thing might be because I wrote this on a Word document where I keep record of what I do and then copied from there and pasted it here.. sometimes when you copy and paste stuff to programs such as Word some of these things change automatically, but I use hyphens for the parameters. I did not notice they appeared different when I posted this.. And yes, I can try it myself but I figured to write here in case there's someone that did it before and has some important observations about it. I will do it now.