Question: 'Error: Unable to open file test1.bed. Exiting' , Bedtools help
0
gravatar for reece
8 days ago by
reece0
reece0 wrote:

Hi everyone,

I am very new to all of this so I apologise for any simple mistakes. Today I have been trying to merge 2 files at 500bp using Bedtools. I have both files in the format of:

chr1    812283  812293
chr1    812566  812576
chr1    811236  811246

As far as I'm aware each column is separated by tabs, and I have tried using test .bed files with only a few rows. When using: bedtools merge -i test1.bed test2.bed -d 500 < sorted.bed or even just trying to access the bed files using a different command (bedtools merge -i test1.bed), I am receiving 'Error: Unable to open the test1.bed. exiting.'

Does anyone know why this could be happening? Any help is greatly appreciated.

mergebed .bed bedtools • 94 views
ADD COMMENTlink modified 8 days ago by ATpoint11k • written 8 days ago by reece0
1
Bedtools merge -i test1.bed test2.bed -d 500 < sorted.bed

This cannot work as bedtools merge expect exact one bed file as input. You have three (test1.bed, test2.bed and as a stream from sorted.bed

'Error: Unable to open the test1.bed. exiting

This message appears also if bedtools cannot find the files. So check if you are in the correct folder from where you start bedtools merge. The correct syntax should be $ bedtools merge -i test1.bed -d 500.

fin swimmer

ADD REPLYlink written 8 days ago by finswimmer7.9k

I didn't realise this, I will give it a go. Thank you!

Edit - Unfortunately still no joy, grateful for the help though

ADD REPLYlink modified 8 days ago • written 8 days ago by reece0

Most likely either there's a typo in the command (you mistyped the file name) or the user you're running bedtools with doesn't have read permission.

ADD REPLYlink written 8 days ago by Devon Ryan86k

Hi, I've just checked and I believe the input to be correct and I am running as administrator. Do I need to store the .bed file anywhere specifically for it to work? Thank you for the feedback!

ADD REPLYlink written 8 days ago by reece0

Either you specify the full path to the bed file, or you make sure it's in your current working directory.

ADD REPLYlink written 8 days ago by WouterDeCoster35k
0
gravatar for ATpoint
8 days ago by
ATpoint11k
Germany
ATpoint11k wrote:

Bedtools complaining about files is 99.9% the case when the delimiter is not tab but something else like tab-whitespace, whitespace-tab or anything which is not exactly tab. Given your files were truely tab-delimited:

cat test1.bed test2.bed (...) testn.bed | sort k1,1 -k2,2n | bedtools merge -i - -d 500 > merged.bed
ADD COMMENTlink modified 8 days ago • written 8 days ago by ATpoint11k
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: 1635 users visited in the last hour