def _seed(self, trys): """BLAST seedsize sequences together, align and return True if successful""" self.minlen = min([self.seqstore[e][1] for e in self.seqstore.keys()]) sequences = self.seqstore.start(self.seedsize) # make sure there are enough seqs for alignment if len(sequences) >= self.minseedsize: command = version(sequences, self.type) try: alignment, seconds = timeit( func=align, command=command, sequences=sequences, logger=self.logger, wd=self.wd, threads=self.threads, timeout=self._getTimeout(sequences), ) except MafftError: self.logger.debug("MAFTT error raised") success = False else: success = self._check(alignment) else: success = False # add to trys if unsuccessful or sequences are fewer than # seedsize trys += self._calcSeedsize(success and len(sequences) == self.seedsize) if success: self._calcTimeout(seconds, alignment) self.store.append(alignment) return success, trys
def _seed(self, trys): """BLAST seedsize sequences together, align and return True if successful""" self.minlen = min([self.seqstore[e][1] for e in self.seqstore.keys()]) sequences = self.seqstore.start(self.seedsize) # make sure there are enough seqs for alignment if len(sequences) >= self.minseedsize: command = version(sequences, self.type) try: alignment, seconds = timeit( func=align, command=command, sequences=sequences, logger=self.logger, wd=self.wd, threads=self.threads, timeout=self._getTimeout(sequences)) except MafftError: self.logger.debug('MAFTT error raised') success = False else: success = self._check(alignment) else: success = False # add to trys if unsuccessful or sequences are fewer than # seedsize trys += self._calcSeedsize(success and len(sequences) == self.seedsize) if success: self._calcTimeout(seconds, alignment) self.store.append(alignment) return success, trys
def _add(self, trys, limit=None): """Add sequence to alignment, return True if successful""" alignment = self.store[-1] self.minlen = min([self.seqstore[e][1] for e in self.seqstore.keys()]) if len(self.seqstore.sppool) == 0: return True, trys else: sequence = self.seqstore.next(alignment, limit=limit) if not sequence: # if no sequence is returned, nothing more can be # added self.logger.debug("No new sequence added") return True, trys try: new_alignment, seconds = timeit( func=add, alignment=alignment, sequence=sequence, logger=self.logger, wd=self.wd, threads=self.threads, timeout=self._getTimeout(alignment, sequence), ) except MafftError: self.logger.debug("MAFFT error raised") success = False else: success = self._check(new_alignment) if success: self._calcTimeout(seconds, alignment, align=False) self.store.append(new_alignment) else: trys += 1 sequence = self.seqstore.back(alignment) if not sequence: # here a species has been dropped and now all # species are present return True, trys return False, trys
def _add(self, trys, limit=None): """Add sequence to alignment, return True if successful""" alignment = self.store[-1] self.minlen = min([self.seqstore[e][1] for e in self.seqstore.keys()]) if len(self.seqstore.sppool) == 0: return True, trys else: sequence = self.seqstore.next(alignment, limit=limit) if not sequence: # if no sequence is returned, nothing more can be # added self.logger.debug('No new sequence added') return True, trys try: new_alignment, seconds = timeit(func=add, alignment=alignment, sequence=sequence, logger=self.logger, wd=self.wd, threads=self.threads, timeout=self._getTimeout( alignment, sequence)) except MafftError: self.logger.debug('MAFFT error raised') success = False else: success = self._check(new_alignment) if success: self._calcTimeout(seconds, alignment, align=False) self.store.append(new_alignment) else: trys += 1 sequence = self.seqstore.back(alignment) if not sequence: # here a species has been dropped and now all # species are present return True, trys return False, trys