Back to index

python-biopython  1.60
Classes | Functions | Variables
test_Mafft_tool Namespace Reference

Classes

class  MafftApplication

Functions

def check_mafft_version

Variables

 mafft_exe = None
tuple output = commands.getoutput("mafft -help")
tuple runner = unittest.TextTestRunner(verbosity = 2)

Function Documentation

Definition at line 34 of file test_Mafft_tool.py.

00034 
00035 def check_mafft_version(mafft_exe):
00036     child = subprocess.Popen("%s --help" % mafft_exe,
00037                              stdout=subprocess.PIPE,
00038                              stderr=subprocess.PIPE,
00039                              universal_newlines=True,
00040                              shell=(sys.platform!="win32"))
00041     stdoutdata, stderrdata = child.communicate()
00042     output = stdoutdata + "\n" + stderrdata
00043     return_code = child.returncode
00044     del child
00045     if "correctly installed?" in output \
00046     or "mafft binaries have to be installed" in output:
00047         raise MissingExternalDependencyError(
00048             "MAFFT does not seem to be correctly installed.")
00049 
00050     #e.g. "MAFFT version 5.732 (2005/09/14)\n"
00051     #e.g. "  MAFFT v6.717b (2009/12/03)\n"
00052     for marker in ["MAFFT version", "MAFFT v"]:
00053         index = output.find(marker)
00054         if index == -1:
00055             continue
00056         version = output[index+len(marker):].strip().split(None,1)[0]
00057         if int(version.split(".",1)[0]) < 6:
00058             raise MissingExternalDependencyError("Test requires MAFFT v6 or "
00059                                                  "later (found %s)." % version)
00060         return True
00061     raise MissingExternalDependencyError("Couldn't determine MAFFT version.")
00062 
00063 #This also checks it actually runs!
00064 check_mafft_version(mafft_exe)


Variable Documentation

Definition at line 22 of file test_Mafft_tool.py.

tuple test_Mafft_tool.output = commands.getoutput("mafft -help")

Definition at line 27 of file test_Mafft_tool.py.

tuple test_Mafft_tool.runner = unittest.TextTestRunner(verbosity = 2)

Definition at line 140 of file test_Mafft_tool.py.