Question: bedops closest problem running
0
gravatar for yasjas
4.0 years ago by
yasjas70
United Kingdom
yasjas70 wrote:

Hi all,

I have problem when running bedtools closest and dont know why?!

I am running the following command:

bedtools closest -a gene_final.bed -b rmpk.bed > closest_file

and give me this error : Error: unable to open file or unable to determine types for file gene_final.bed

my file(gene_final.bed) looks like that

chr1 169818772 169863408
 chr1 169631245 169823221
  chr1  27938575  27961788
  chr1 196621008 196716634
  chr1  24742284  24799466
  chr1  33473585  33546597

and the repeatmasker file like:

chr1 10000 10468 (CCCTAA)n Simple_repeat
 chr1 10468 11447      TAR1     Satellite
 chr1 11503 11675      L1MC          LINE
 chr1 11677 11780     MER5B           DNA
 chr1 15264 15355      MIR3          SINE
 chr1 16712 16749    (TGG)n Simple_repeat

 does anyone has an idea on why it doesnt work?

 

 

R bedtools • 1.3k views
ADD COMMENTlink modified 4.0 years ago by Alex Reynolds28k • written 4.0 years ago by yasjas70

a. Does the actual BED file have blank spaces in line beginnings as shown here?

b. Does the file have the necessary read permissions?

c. Why does the post have an 'R' tag?

ADD REPLYlink written 4.0 years ago by RamRS21k

yasjas, to check if your bed file is ok, you can try bedtools sort on it. BTW, this is a required by bedtools closest. Try something like this:

bedtools closest -a <(bedtools sort -i gene_final.bed) -b <(bedtools sort -i RptM.bed) 

If you get error message from sort, then there is something wrong with your bed file.

Edit

And why is your question about bedops?

ADD REPLYlink modified 4.0 years ago • written 4.0 years ago by PoGibas4.8k
0
gravatar for Alex Reynolds
4.0 years ago by
Alex Reynolds28k
Seattle, WA USA
Alex Reynolds28k wrote:

Prep your files with BEDOPS sort-bed:

$ sort-bed gene_final.bed > gene_final.sorted.bed
$ sort-bed rmpk.bed > rmpk.sorted.bed

Run the op with BEDOPS closest-features:

$ closest-features gene_final.sorted.bed rmpk.sorted.bed > answer.bed

The closest-features tool offers some additional options. Take a look at the docs for more info.

Some Bedtools operations can now take advantage of the sorting benefit in BEDOPS tools, so if you use Bedtools, you might look into sorting your data before using that.

ADD COMMENTlink modified 4.0 years ago • written 4.0 years ago by Alex Reynolds28k

Hi all,

everytime I try to run sort -bed it gives me an error saying 

Non-numeric start coordinate.  See line 1 in gene_final.bed.

(remember that chromosome names should not contain spaces.)

but I can see a space in the chromosome name?!

 

ADD REPLYlink written 4.0 years ago by yasjas70

Make sure that your chromosome names have no spaces, that all fields are tab-delimited, and that the second and third fields are numeric. You might take a look at line 1 with a text editor or cat -t to make sure it contains tabs.

ADD REPLYlink written 4.0 years ago by Alex Reynolds28k

thanks Alex

ADD REPLYlink written 4.0 years ago by yasjas70
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: 923 users visited in the last hour