def deps(self): longorfs = which('TransDecoder.LongOrfs') if longorfs is None: raise InstallationError('TransDecoder.LongOrfs not found.') if self.logger: self.logger.debug('TransDecoder.LongOrfs:' + longorfs) return longorfs
def deps(self): cmscan = which('cmscan') if cmscan is None: raise InstallationError('cmscan not found.') if self.logger: self.logger.debug('cmscan:' + cmscan) return cmscan
def deps(self): cmpress = which('cmpress') if cmpress is None: raise InstallationError('cmpress not found.') if self.logger: self.logger.debug('cmpress:' + cmpress) return cmpress
def deps(self): hmmpress = which('hmmpress') if hmmpress is None: raise InstallationError('hmmpress not found.') if self.logger is not None: self.logger.debug('hmmpress:' + hmmpress) return hmmpress
def deps(self): predict = which('TransDecoder.Predict') if predict is None: raise InstallationError('TransDecoder.Predict not found.') else: if self.logger: logger.debug('TransDecoder.Predict:' + predict) return predict
def deps(self): buscov2 = which('BUSCO.py') buscov3 = which('run_BUSCO.py') tblastn = which('tblastn') makeblastdb = which('makeblastdb') if buscov2 is None and buscov3 is None: raise InstallationError('BUSCO not found. NOTE: '\ 'dammit 1.0 requires BUSCO v2 or greater') if tblastn is None: raise InstallationError('tblastn not found, required for BUSCO.') if makeblastdb is None: raise InstallationError( 'makeblastdb not found, required for BUSCO.') if self.logger: logger.debug('BUSCO:' + busco) return buscov3 if buscov3 is not None else buscov2
def deps(self): lastal = which('lastdb') if lastal is None: raise InstallationError('lastal not found.') version = check_version(lastal) if version < 600: raise InstallationError('lastal version {0} < 600, please'\ ' update'.format(version)) if self.logger: self.logger.debug('lastal:' + lastal) return lastal
def check_parallel(logger=None): parallel = which('parallel') if parallel is None: raise InstallationError('parallel not found.') else: try: version_string = subprocess.check_output(['parallel', '--version']) except subprocess.CalledProcessError as e: raise InstallationError('Error checking parallel '\ 'version: [{0}] {1}'.format(e.returncode, e.output)) except OSError as e: raise InstallationError('Error checking parallel version: '\ '[{0}] {1}'.format(e.errno, str(e))) else: version = version_string.strip().split()[2] if logger: logger.debug('parallel version:{0}'.format(version)) if int(version) < 20150000: raise InstallationError('parallel version {0} < 20150000, '\ 'please update'.format(version)) if logger: logger.debug('parallel:' + parallel) return parallel
def parallel_fasta(input_filename, output_filename, command, n_jobs, sshloginfile=None, check_dep=True, logger=None): '''Given an input FASTA source, target, shell command, and number of jobs, construct a gnu-parallel command to act on the sequences. Args: input_filename (str): The source FASTA. output_filename (str): The target. command (list): The shell command (in subprocess format). n_jobs (int): Number of cores or nodes to split to. sshloginfile (str): Path to file with node addresses. check_dep (bool): If True, check for the gnu-parallel executable. logger (logging.Logger): A logger to use. Returns: str: The constructed shell command. ''' exc = which('parallel') if not check_dep else check_parallel(logger=logger) cmd = [ 'cat', input_filename, '|', exc, '--round-robin', '--pipe', '-L', 2, '-N', 10000, '--gnu' ] if sshloginfile is not None: cmd.extend(['--sshloginfile', sshloginfile, '--workdir $PWD']) else: cmd.extend(['-j', n_jobs]) cmd.extend(['-a', input_filename]) if isinstance(command, list): command = ' '.join(command) cmd.extend([command, '>', output_filename]) return ' '.join(map(str, cmd))