def test_known_vals(self): """Composition should return precalculated elements for known cases""" self.assertEqual(len(Composition(5,1,"ACGU")), 969) self.assertEqual(len(Composition(5,0,"ACGU")), 1771) as_list = list(Composition(5,1,"ACGU")) self.assertEqual(as_list[0], Freqs('A'*17+'CGU')) self.assertEqual(as_list[-1], Freqs('U'*17+'ACG'))
def setUp(self): """Define a few standard compositions.""" self.bases_10pct = Composition(10, 0, "ACGU") self.bases_5pct = Composition(5, 1, "ACGU") self.bases_extra = Composition(10, 0, "CYGEJ") self.small = Composition(20, 0, "xy") self.unique = Composition(20, 1, "z")
def test_updating(self): """Composition updates should reset frequencies correctly.""" exp_list = list(Composition(5, 1, "GCAUN")) self.bases_10pct.Spacing = 5 self.bases_10pct.Alphabet = "GCAUN" self.bases_10pct.MinOccupancy = 1 self.assertEqual(list(self.bases_10pct), exp_list)
def setUp(self): """Define a few standard compositions.""" self.bases_10pct = Composition(10, 0, "ACGU")