def test_sequence_to_alig_coord(self):
    """Test converting sequence coords into alig. coords."""
    # CGTAGC---CGC
    # CGTAGCTAGCGC
    self.assertEqual(self.pa1.sequence_to_alignment_coords("s1", 103, 112),
                     [(5, 11), (14, 17)])
    # 977 --> G---CGAT <-- 972
    self.assertEqual(self.pa2.sequence_to_alignment_coords("s3", 972, 977),
                     [(27, 31), (23, 24)])
    # should throw an exception if we give coordinates that extend outside the
    # sequence...
    self.assertRaises(InvalidSequenceCoordinatesError,
                      self.pa1.sequence_to_alignment_coords, "s1", 95, 112)
    # .. but not if we ask them to be trimmed ...
    r = self.pa1.sequence_to_alignment_coords("s1", 95, 112, trim=True)
    self.assertEqual(r, [(2, 11), (14, 17)])
    # .. but still if they fall entirely outside the sequence ..
    self.assertRaises(InvalidSequenceCoordinatesError,
                      self.pa1.sequence_to_alignment_coords, "s1", 95, 99)
    # test lifting over coordinates that overlaps the end of the alignement
    r = self.pa1.sequence_to_alignment_coords("s1", 124, 130, trim=True)
    self.assertEqual(r, [(30, 31), (32, 36)])
def test_sequence_to_alig_coord ( self ) : self . assertEqual ( self . pa1 . sequence_to_alignment_coords ( "s1" , 103 , 112 ) , [ ( 5 , 11 ) , ( 14 , 17 ) ] ) self . assertEqual ( self . pa2 . sequence_to_alignment_coords ( "s3" , 972 , 977 ) , [ ( 27 , 31 ) , ( 23 , 24 ) ] ) self . assertRaises ( InvalidSequenceCoordinatesError , self . pa1 . sequence_to_alignment_coords , "s1" , 95 , 112 ) r = self . pa1 . sequence_to_alignment_coords ( "s1" , 95 , 112 , trim = True ) self . assertEqual ( r , [ ( 2 , 11 ) , ( 14 , 17 ) ] ) self . assertRaises ( InvalidSequenceCoordinatesError , self . pa1 . sequence_to_alignment_coords , "s1" , 95 , 99 ) r = self . pa1 . sequence_to_alignment_coords ( "s1" , 124 , 130 , trim = True ) self . assertEqual ( r , [ ( 30 , 31 ) , ( 32 , 36 ) ] )
Test converting sequence coords into alig. coords.