This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to pass shell script's arguments when calling BBMap from Python?

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

1 answer

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.

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

Log in to answer this question.