def getPermutated(self, skip_weight_check=False): shuffle_list = [] for i, item in enumerate(self.seqList): if skip_weight_check or self.seqList[i][3] > 0: shuffle_list.append(i) new_list = UtilityFunctions.shuffle_list(shuffle_list) permutated_list = [] for i, item in enumerate(new_list): name = self.seqList[item][0] path = self.seqList[item][1] myClass = self._getClass(name, path) if myClass is not None: if issubclass(myClass, Sequence): key = name + path if key not in self.seqDict: mySeq = self._generateSeqInstance(myClass) self.seqDict[key] = mySeq permutated_list.append(mySeq) else: permutated_list.append(self.seqDict[key]) elif issubclass(myClass, SequenceLibrary): seq_lib = self._generateSeqLibInstance(myClass) for seq in seq_lib.getPermutated(skip_weight_check): yield seq for seq in permutated_list: yield seq
def shuffleList(self, myList): warnings.warn( "Sequence.shuffleList() is deprecated; please use UtilityFunctions.shuffle_list()", DeprecationWarning, ) return UtilityFunctions.shuffle_list(myList)
def getPermutated(self, skip_weight_check=False): filtered_list = self.seqList if not skip_weight_check: filtered_list = filter(lambda item: item[3] > 0, filtered_list) shuffled_list = UtilityFunctions.shuffle_list(filtered_list) for item in shuffled_list: name = item[0] path = item[1] yield from self._getPermutatedFromName(name, path, skip_weight_check)