[Biopython-dev] curious error from HMM unit test

Peter biopython at maubp.freeserve.co.uk
Mon Jan 17 13:54:32 UTC 2011


Hi all,

There was a curious failure under one of the buildslaves running
Jython 2.5.2rc3 on 64bit Linux:
http://events.open-bio.org:8010/builders/Linux%2064%20-%20Jython%202.5.2/builds/6/steps/shell/logs/stdio

======================================================================
ERROR: test_HMMCasino
----------------------------------------------------------------------
Traceback (most recent call last):
  File "run_tests.py", line 314, in runTest
    suite = unittest.TestLoader().loadTestsFromName(name)
  File "/home/buildslave/jython2.5.2rc3/Lib/unittest.py", line 533, in
loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/home/buildslave/jython2.5.2rc3/Lib/unittest.py", line 533, in
loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/home/buildslave/BuildBot/jython252lin64/build/Tests/test_HMMCasino.py",
line 180, in <module>
    trained_mm = trainer.train([training_seq], stop_training)
  File "/home/buildslave/BuildBot/jython252lin64/build/Bio/HMM/Trainer.py",
line 212, in train
    emission_count = self.update_emissions(emission_count,
  File "/home/buildslave/BuildBot/jython252lin64/build/Bio/HMM/Trainer.py",
line 332, in update_emissions
    expected_times += (forward_vars[(k, i)] *
UnboundLocalError: local variable 'k' referenced before assignment
----------------------------------------------------------------------

The error message is rather odd, since k is defined as the outer loop
variable, see:
https://github.com/biopython/biopython/blob/master/Bio/HMM/Trainer.py

This is in the HMM code, so due to the stochastic nature we expect
each run of test may take slightly different branches through the
code. We haven't altered this code for a while, so this is either a
long standing issue, or perhaps indicative of a problem in Jython
2.5.2rc3 instead (although I don't see any open bugs relevant). I've
logged into the buildslave and re-run test_HMMCasino.py under Jython
about 30 times - all fine. Rerunning the build also came up clear.

Has anyone got any insight into what might be going on? Unless it
happens again maybe it was a fluke (cosmic ray, bad ram, etc).

Peter



More information about the Biopython-dev mailing list