def generateCorrectSequences(groups: int, samples: int, length: int): # correct sequences # powtórz względem ilości grup assert samples >= 2 result = [] for i in range(groups): # wygeneruj sample -1 losowo rows = generateSequences(samples - 1, length) # sprawdz czekerem gdzie jest False checker = checkAlgorithm(rows, True) # losuj slowo last_row = generateSequences(1, length)[0] # na false zamień na 'A' for j in range(length): if not checker[j]: s = ''.join(r[j] for r in rows) if s.__contains__('T'): letter = 'C' elif s.__contains__('C'): letter = 'T' else: letter = 'A' last_row = last_row[:j] + letter + last_row[min(j+1,length):] rows += [last_row] result += rows # przelosuj kolejność random.shuffle(result) return result
def _checkGroup(self, group): converted = [] for sample in group: txt = self.content['i7'][sample[0]] if self.i5 is not None: txt += self.content['i5'][sample[1]] converted.append(txt) return ac.checkAlgorithm(converted)
def test_CT_valid(self): self.assertTrue(checkAlgorithm(['C', 'T']))
def test_A_valid(self): self.assertTrue(checkAlgorithm('A'))
def test_illumina_example_not_extra_data(self): self.assertEqual( checkAlgorithm(['GCTACGCT', 'GTAGAGGA', 'GGAGCTAC'], True), [False, True, True, True, True, False, True, True])
def test_illumina_example_extra_data(self): self.assertEqual( checkAlgorithm(['ATTCAGAA', 'GAATTCGT', 'AGCGATAG'], True), [True, True, True, True, True, True, True, True])
def test_CT_extra_data(self): self.assertEqual(checkAlgorithm(['C', 'T'], True), [True])
def test_A_extra_data(self): self.assertEqual(checkAlgorithm('A', True), [True])
def test_illumina_example_not_valid(self): self.assertFalse(checkAlgorithm(['GCTACGCT', 'GTAGAGGA', 'GGAGCTAC']))
def test_illumina_example_valid(self): self.assertTrue(checkAlgorithm(['ATTCAGAA', 'GAATTCGT', 'AGCGATAG']))