def test_transform(self): wk = SequenceIterator(['aattgg'], transform=self.rev_f) wk.state = self.seqqual_ok.copy() self.assertEqual(wk.state['Sequence'], self.seqqual_ok['Sequence']) wk.transform() self.assertEqual(wk.state['Sequence'], self.seqqual_ok['Sequence'][::-1]) self.assertTrue((wk.state['Qual'] == self.seqqual_ok['Qual'][::-1]).all())
def test_transform(self): wk = SequenceIterator(['aattgg'], transform=self.rev_f) wk.state = self.seqqual_ok.copy() self.assertEqual(wk.state['Sequence'], self.seqqual_ok['Sequence']) wk.transform() self.assertEqual(wk.state['Sequence'], self.seqqual_ok['Sequence'][::-1]) self.assertTrue( (wk.state['Qual'] == self.seqqual_ok['Qual'][::-1]).all())
def test_validate_lengths_false(self): wk = SequenceIterator(['aattgg'], valid_length=False) wk.state = self.seq_ok.copy() wk.valid_lengths() self.assertFalse(wk.failed) wk.state = self.seqqual_ok.copy() wk.valid_lengths() self.assertFalse(wk.failed) wk.state = self.seqqual_bad_qual.copy() wk.valid_lengths() self.assertFalse(wk.failed)
def test_validate_ids_true(self): wk = SequenceIterator(['aattgg'], valid_id=True) wk.state = self.seq_ok.copy() wk.validate_ids() self.assertFalse(wk.failed) wk.state = self.seqqual_ok.copy() wk.validate_ids() self.assertFalse(wk.failed) wk.state = self.seqqual_bad_id.copy() wk.validate_ids() self.assertTrue(wk.failed)
def test_validate_lengths_true(self): wk = SequenceIterator(['aattgg'], valid_length=True) wk.state = self.seq_ok.copy() wk.valid_lengths() self.assertFalse(wk.failed) wk.state = self.seqqual_ok.copy() wk.valid_lengths() self.assertFalse(wk.failed) wk.state = self.seqqual_bad_qual.copy() wk.valid_lengths() self.assertTrue(wk.failed)
def test_validate_ids_false(self): wk = SequenceIterator(['aattgg'], valid_id=False) wk.state = self.seq_ok.copy() wk.validate_ids() self.assertFalse(wk.failed) wk.state = self.seqqual_ok.copy() wk.validate_ids() self.assertFalse(wk.failed) wk.state = self.seqqual_bad_id.copy() wk.validate_ids() self.assertFalse(wk.failed)
def test_passing_none_for_seqs(self): with self.assertRaises(ValueError): SequenceIterator(None)