[Biopython] Subprocess:Clustalw

Alvaro F Pena Perea alvin at pasteur.edu.uy
Tue Jan 19 12:45:23 EST 2010


Hi all,
I'm new in Biopython and I am trying to learn how to use Bio.Align.
I have some doubts about running Clustalw within a python script.
I run this without problems:
###
from Bio.Align.Applications import ClustalwCommandline
import sys
import subprocess

STDO = open("stdo.txt", "w")
STDE = open("stde.txt", "w")
cline = ClustalwCommandline("clustalw2",infile="opuntia.fasta")

return_code = subprocess.call(str(cline), stderr = STDE,
shell=(sys.platform!="win32"))
print return_code
###
but he point is that I would like to choose my "infile" from argv. I mean,
something like this:

archive = open(sys.argv[1])
cline = ClustalwCommandline("clustalw2",infile=archive)

I realized that "str" in subprocess doesn't allow this
str(cline)
I wonder if it could be possible to run the algorithm from argv or any
handles .
Thanks in advance

Álvaro Pena



More information about the Biopython mailing list