Question: calling bedtools from R
4
gravatar for yasjas
3.8 years ago by
yasjas70
United Kingdom
yasjas70 wrote:

good morning,

is there any function to call bedtools from R rather than do it from the shell and then bring the files to R?

Thanks

R bedtools • 3.5k views
ADD COMMENTlink modified 3.8 years ago by Irsan6.8k • written 3.8 years ago by yasjas70
4
Instead of using bedtools you could also have a look into the GenomicRanges bioconductor library.
ADD REPLYlink written 3.8 years ago by Irsan6.8k
8
gravatar for PoGibas
3.8 years ago by
PoGibas4.7k
Vilnius
PoGibas4.7k wrote:

Yes, there are many ways.

You can invoke system commands using system. Or you can use fread from data.table package (adding my simple example).

 

library(data.table)
cmd <- "bedtools closest -a FileA -b FileB"
df <- fread(cmd)

 

ADD COMMENTlink modified 3.8 years ago • written 3.8 years ago by PoGibas4.7k
3

pipe() is useful too. 

ADD REPLYlink modified 3.8 years ago • written 3.8 years ago by Neilfws48k
2

Thank you for your replies it worked!!!!!

ADD REPLYlink written 3.8 years ago by yasjas70
1

I had no idea one could use fread for that. Thanks!

ADD REPLYlink written 3.8 years ago by A. Domingues1.8k
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: 1469 users visited in the last hour