[Biopython-dev] [Bug 2804] Clustalw subprocess hangs when large stdout returned

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Apr 1 22:05:40 UTC 2009


http://bugzilla.open-bio.org/show_bug.cgi?id=2804





------- Comment #2 from biopython-bugzilla at maubp.freeserve.co.uk  2009-04-01 18:05 EST -------
It is great that you've found a simple and reproduceable test case.  I can
confirm this problem on a Linux machine with Python 2.4.3 (what version of
python do you have?)

(In reply to comment #1)
> Created an attachment (id=1272)
 --> (http://bugzilla.open-bio.org/attachment.cgi?id=1272&action=view) [details]
> clustalw subprocess patch

Unfortunately the patch is flawed here:

    status = child_process.communicate()[1]

We want to get the return code (a numerical error value), but the communicate
method returns two strings giving the contents of stdout and strerr, i.e.

...
 CLUSTAL W (1.83) Multiple Sequence Alignments
...
Sequence format is Pearson
Sequence 1: HLA_HLA00401      366 aa
Sequence 2: HLA_HLA00402      366 aa
...
Group 109: Sequences:   3      Score:6519
Group 110: Sequences: 111      Score:4464
Alignment Score 8299041
CLUSTAL-Alignment file created  [temp.aln]

for stdout, and an empty string for stderr.  Doing this seems to work on Linux
with python 2.4.3,

    child_process.communicate() #ignore the stdout and stderr data!
    child_process.stdin.close()
    child_process.stdout.close()
    child_process.stderr.close()
    status = child_process.returncode

However, I have only tested this one example far, and not on Windows or the Mac
yet.  It would be a good idea to extend test_Clustalw_tool.py to cover some
deliberate failures to check we can read the error level (return code) ClustalW
gives back.  Of course, this will need testing with both clustalw 1.x and 2.x
to be safe.

Note that the original code using os.popen still works fine for this example. 
We switched to subprocess because os.popen* are being deprecated on Python 2.6,
and didn't work well with names with spaces as I recall.


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list