def testTotalCreation(self): """Enzyme is created with all possible commands""" commands = [ 'cut', 'dlt', 'swi', 'mvr', 'mvl', 'cop', 'off', 'ina', 'inc', 'ing', 'itt', 'rpy', 'rpu', 'lpy', 'lpu' ] e = enzyme.Enzyme(commands, 'A') self.assertEquals(e.commands, commands)
def testASimpleTranslation(self): string = 'TAGATCCAGTCCATCGA' s = strand.Strand(string) e = enzyme.Enzyme(['rpu', 'inc'], 'G') locus = 1 e.attach(s, locus) self.assertEquals(e.locus, 8) result = next(e.translate()) self.assertEquals(result, [list('TAGATCCAGTCCACTCGA')])
def testASimplestTranslation(self): """Strand is translated by enzyme to produce set of new strands""" string = 'ACA' s = strand.Strand(string) e = enzyme.Enzyme(['dlt', 'mvr', 'itt'], 'A') locus = 0 e.attach(s, locus) result = next(e.translate()) self.assertEquals(result, [list('CAT')])
def testIncorrectRun(self): """Invalid attachment should raise exception""" string = 'TAGATCCATCCATCA' # Only one 'G' s = strand.Strand(string) binding = 'G' e = enzyme.Enzyme(['itt'], binding) d = utility.string_chars_indices(string) locus = 1 # Sets index of unit to bind to; second 'G' assumed self.assertRaises(enzyme.InvalidLocus, e.attach, s, locus)
def testASimpleCopyingTranslation(self): string = 'ACGT' s = strand.Strand(string) e = enzyme.Enzyme([ 'cop', 'rpy', 'rpy', 'mvl', 'mvl', 'mvl', 'off', 'ina'], 'A') locus = 0 e.attach(s, locus) result = next(e.translate()) self.assertEquals(result, [list('AACGT'), list('T GCA')])
def testCorrectRun(self): """Successfull attachment should set strand and locus""" string = 'TAGATCCAGTCCATGCA' s = strand.Strand(string) binding = 'G' e = enzyme.Enzyme(['itt'], binding) d = utility.string_chars_indices(string) locus = 1 # Sets index of unit to bind to e.attach(s, locus) self.assertEquals(e.locus, d[binding][locus]) self.assertEquals(e.strand, s) self.assertEquals(e.status, 'attached')
def testCorrectTranslation(self): """Strand is translated by enzyme to produce set of new strands""" string = 'TAGATCCAGTCCATCGA' s = strand.Strand(string) e = enzyme.Enzyme([ 'rpu', 'inc', 'cop', 'mvr', 'mvl', 'swi', 'lpu', 'itt'], 'G') locus = 1 e.attach(s, locus) self.assertEquals(e.locus, 8) result = next(e.translate()) self.assertEquals(result, [list('AGCTACACCTGACCTAGAT'), list(' ATG ')])
def testNotAttachedTranslation(self): """When enzyme isn't attached, it can't translate""" e = enzyme.Enzyme(['rpu'], 'A') i = e.translate() self.assertRaises(enzyme.NotAttached, next, i)
def testCorrectCreation(self): """Enzyme is created from an iterable with commands""" commands = ['cut', 'dlt', 'swi'] e = enzyme.Enzyme(commands, 'A') self.assertEquals(e.commands, commands)