Ejemplo n.º 1
0
    def test_extract_mutations_from_lines_to_dict_w_spans(self):
        """extract_mutations_from_lines_to_dict: functions with spans """
        expected = dict([('id1',{PointMutation(64,'A','G'):[(4,24)]}),\
           ('id2',{PointMutation(42,'W','A'):[(15,19),(21,29)],\
                   PointMutation(88,'G','Y'):[(35,39),(41,49)]}),\
           ('id3',{}),('id4',{}),('id5',{})]) 
        actual = extract_mutations_from_lines_to_dict(\
            self.fake_input_file,self.mf,store_spans=True)
        self.assertEqual(actual,expected)

        # Test with empty list passed in
        self.assertEqual({},extract_mutations_from_lines_to_dict([],self.mf))
Ejemplo n.º 2
0
    def test_extract_mutations_from_lines_to_dict(self):
        """extract_mutations_from_lines_to_dict: functions w/o spans """
        expected = dict([('id1',{PointMutation(64,'A','G'):1}),\
           ('id2',{PointMutation(42,'W','A'):2,\
                   PointMutation(88,'G','Y'):2}),\
           ('id3',{}),('id4',{}),('id5',{})]) 
        actual = extract_mutations_from_lines_to_dict(\
            self.fake_input_file,self.mf,store_spans=False)
        self.assertEqual(actual,expected)

        # Test with empty list passed in
        self.assertEqual({},extract_mutations_from_lines_to_dict([],self.mf))
Ejemplo n.º 3
0
    def test_extract_mutations_from_lines_to_dict(self):
        """extract_mutations_from_lines_to_dict: functions w/o spans """
        expected = dict(
            [
                ("id1", {PointMutation(64, "A", "G"): 1}),
                ("id2", {PointMutation(42, "W", "A"): 2, PointMutation(88, "G", "Y"): 2}),
                ("id3", {}),
                ("id4", {}),
                ("id5", {}),
            ]
        )
        actual = extract_mutations_from_lines_to_dict(self.fake_input_file, self.mf, store_spans=False)
        self.assertEqual(actual, expected)

        # Test with empty list passed in
        self.assertEqual({}, extract_mutations_from_lines_to_dict([], self.mf))
Ejemplo n.º 4
0
    def test_extract_mutations_from_lines_to_dict_w_spans(self):
        """extract_mutations_from_lines_to_dict: functions with spans """
        expected = dict(
            [
                ("id1", {PointMutation(64, "A", "G"): [(4, 24)]}),
                (
                    "id2",
                    {
                        PointMutation(42, "W", "A"): [(15, 19), (21, 29)],
                        PointMutation(88, "G", "Y"): [(35, 39), (41, 49)],
                    },
                ),
                ("id3", {}),
                ("id4", {}),
                ("id5", {}),
            ]
        )
        actual = extract_mutations_from_lines_to_dict(self.fake_input_file, self.mf, store_spans=True)
        self.assertEqual(actual, expected)

        # Test with empty list passed in
        self.assertEqual({}, extract_mutations_from_lines_to_dict([], self.mf))