Esempio n. 1
0
 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')])
Esempio n. 2
0
 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')])
Esempio n. 3
0
 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)
Esempio n. 4
0
 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')])
Esempio n. 5
0
 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')
Esempio n. 6
0
 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             ')])
Esempio n. 7
0
 def testStr(self):
     s = strand.Strand('ACGT')
     self.assertEqual('Strand("ACGT")', str(s))
Esempio n. 8
0
 def testSaneCreation(self):
     for length in range(4):
         for tup in itertools.product('ACGT', repeat=length):
             string = ''.join(tup)
             s = strand.Strand(string)
             self.assertEqual(''.join(s.units), string)
Esempio n. 9
0
 def testCorrectCreation(self):
     """Strand should contain correct string"""
     s = strand.Strand('ACGT')
     self.assertEqual('ACGT', ''.join(s.units))