def test_rvd_invalid_input(self): """ Don't accept invalid RVD sequences. """ with self.assertRaises(ValueError): pfusx.rvd_to_tal("This is not valid input.") with self.assertRaises(ValueError): pfusx.rvd_to_tal("atatatagatataga") # DNA and not RVD
def test_fusx_query(self): """ Query FusX database to find the well positions of necessary plasmids. """ # Example from the FusX PHP script at <http://talendesign.org>. rvd = pfusx.rvd_to_tal('NI NG NI HD HD NN NG HD NG NG NI NG NG NG NG') sequences = pfusx.tal_to_codons(rvd) result = pfusx.get_fusx_locations(sequences) expected = [ ('pFX1', 'E2'), ('pFX2', 'G3'), ('pFX3', 'H7'), ('pFX4', 'D7'), ('pB2/B3', 'H12') ] self.assertEqual(result, expected)
def test_rvd_to_tal(self): """ Translate RVD2 to TAL2. """ # Various input formats. stripped = 'NIHDNGNNNN' slashes = 'NI/HD/NG/NN/NN' spaces = 'NI HD NG NN NN' dashes = 'NI-HD-NG-NN-NN' commas = 'NI,HD,NG,NN,NN' space_commas = 'NI, HD, NG, NN, NN' # Uniform output. expected = 'ACTGG' self.assertEqual(pfusx.rvd_to_tal(stripped), expected) self.assertEqual(pfusx.rvd_to_tal(slashes), expected) self.assertEqual(pfusx.rvd_to_tal(spaces), expected) self.assertEqual(pfusx.rvd_to_tal(dashes), expected) self.assertEqual(pfusx.rvd_to_tal(commas), expected) self.assertEqual(pfusx.rvd_to_tal(space_commas), expected)