How to pass shell script's arguments when calling BBMap from Python?
1
0
Entering edit mode
8.9 years ago
elvissober ▴ 20

How to pass shell script's arguments when calling BBMap from Python? Trying to call BBMap from Python 2.7. There are subprocess and os modules for that. All efforts are wrong.

Here is some code:

import os
import subprocess

os.chdir(r"/home/user/Documents/bbmap") # changing the directory to run subsequent scripts
os.system("bbmap.sh ref=fake.fa") # 1st way
process=subprocess.Popen(['bbmap.sh',str(ref=fake.fa),shell=True,stdin=PIPE,stderr=PIPE) # 2 attempt
subprocess.call('bbmap.sh, ref=fake.fa') # 3hrd way

What code can do this job?

python shell sequencing bash • 2.2k views
ADD COMMENT
0
Entering edit mode
8.9 years ago

The syntax for the 2nd and 3rd way is wrong and you'll get an error. Unless you care what it write to stdout or stderr then just use subprocess.call()

BTW, this is just a python question, you might try a python forum next time.

ADD COMMENT
0
Entering edit mode

what arguments to pass to subprocess.call()? thx

ADD REPLY

Login before adding your answer.

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