def __init__(self, mothurExe, commands, stdout=None, stderr=None): # Validate the supplied Mothur executable try: assert is_executable(mothurExe) self._mothur = mothurExe except AssertionError: raise ValueError("Mothur executable is not valid!") # Validate the supplied Mothur commands self._commands = [] for command in commands: try: assert isinstance(command, MothurCommand) self._commands.append( command ) except: raise ValueError("Argument is not a MothurCommand!") self.stdout = stdout self.stderr = stderr
def validateSettings(self): # Search for Mothur executable if not supplied if self.mothurExe is None: self.mothur = which('mothur') if self.mothur is None: raise OSError('Mothur executable not found!') # If an argument was given, check that it's executable elif is_executable( self.mothurExe ): self.mothur = self.mothurExe else: raise OSError('Supplied Mothur executable not valid!') # Validate the Num_Processes argument try: assert self.numProc >= 1 except AssertionError: raise ValueError("Number of processes must be >= 1!") self.numProc = str(self.numProc)