bedops bedmap operation in python
1
0
Entering edit mode
2.5 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 • 902 views
ADD COMMENT
4
Entering edit mode
2.5 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: 2781 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