This is a test version of Biostars. For the public version, visit https://www.biostars.org.
python subprocesses and wrappers for Jce tool

Hi everyone,

I'm fairly new to Biopython, I'm interested in the tool Jce (protein structure alignment by combinatorial extensions) provided at http://source.rcsb.org/jfatcatserver/. Now the online application works perfectly fine, however I need to implement this tool in my code, possibly using wrappers or python subprocess module. However by my lack of knowledge about these modules I'm unable to find a way to give input to this tool (i.e. two sequences in fasta format and get the output as provided by the tool). Can anyone guide me through this? thank you.

python alignment biopython

1 answer

This post might be off-topic for Biostars. See http://stackoverflow.com/questions/89228/calling-an-external-command-in-python/89243#89243 and https://docs.python.org/2/library/subprocess.html.

That being said, this is how I implemented something similar in a recent project:

import subprocess
import shlex

command_line = "samtools depth -r " + regions[key][0] + " " + bamfile
shell_args = shlex.split(command_line)
p = subprocess.Popen(shell_args, stdout=subprocess.PIPE)
for line in p.stdout:
        #Do something

Log in to answer this question.