bedops bedmap operation in python
1
0
Entering edit mode
3.4 years ago

I noticed there is a conda version of bedops bedmap function available. I've been struggling to use it though. Could someone refer me to any documentation of it's usage in a python script please. Have a great day. Thanks in advance.

python bedops bedmap • 1.3k views
ADD COMMENT
0
Entering edit mode

Uday Rangaswamy

Please do not delete posts that have received feedback/been solved. This one has an accepted answer, and is a valuable resource that should not be deleted.

ADD REPLY
4
Entering edit mode
3.4 years ago

Hi- I'm not sure if there is a python API for bedops (similar to pybedtools, if this is what you mean). However, in a python script you can use the subprocess library to execute external commands. E.g. something like (see also check_call):

import subprocess

p= subprocess.Popen("bedmap ... > out.bed", shell= True, stdout= subprocess.PIPE, stderr= subprocess.PIPE)
stdout, stderr= p.communicate()
if p.returncode != 0:
    print(stderr)
    print('Exit code %s' %(p.returncode))
    sys.exit(1)
ADD COMMENT
0
Entering edit mode

There is no Python API but subprocess is the way to go if you run BEDOPS tools in a Python script. The better way is to use the command line interface.

ADD REPLY

Login before adding your answer.

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