示例#1
0
    def test_gap_fill_greater_than_threshold(self):
        """
        Test the gap fill function, with a set of scores where the gaps are
        greater than threshold to apply gap filling
        """

        key_reactions = ["A", "B", "C", "D", "E", "G"]
        reaction_scores = {"A": 1, "B": 2, "C": 2, "D": 1}

        gap_filled_reaction_scores = modules.gap_fill(key_reactions,
                                                      reaction_scores)

        self.assertDictEqual(gap_filled_reaction_scores, reaction_scores)
示例#2
0
    def test_gap_fill_all_required_two_lowest_scores(self):
        """
        Test the gap fill function, with a set of scores of all required reactions
        Test the lowest score is boosted
        Test the two lowest scores are unchanged
        """

        key_reactions = ["A", "B", "C", "D", "E"]
        reaction_scores = {"A": 1, "B": 2, "C": 2, "D": 0.1, "E": 0.1}

        gap_filled_reaction_scores = modules.gap_fill(key_reactions,
                                                      reaction_scores)

        self.assertDictEqual(gap_filled_reaction_scores, reaction_scores)
示例#3
0
    def test_gap_fill_equal_threshold(self):
        """
        Test the gap fill function, with a set of scores where the gaps equal the
        threshold to apply gap filling
        """

        key_reactions = ["A", "B", "C", "D", "E"]
        reaction_scores = {"A": 1, "B": 2, "C": 2, "D": 1}

        expected_result = {"A": 1, "B": 2, "C": 2, "D": 1, "E": 1}

        gap_filled_reaction_scores = modules.gap_fill(key_reactions,
                                                      reaction_scores)

        self.assertDictEqual(gap_filled_reaction_scores, expected_result)
示例#4
0
    def test_gap_fill_zero_gaps(self):
        """
        Test the gap fill function, with a set of scores that do not have gaps
        Test for boost of lowest score
        """

        key_reactions = ["A", "B"]
        reaction_scores = {"A": 1, "B": 2}

        gap_filled_reaction_scores = modules.gap_fill(key_reactions,
                                                      reaction_scores)
        expected_gap_filled_reaction_scores = {"A": 2, "B": 2}

        self.assertDictEqual(gap_filled_reaction_scores,
                             expected_gap_filled_reaction_scores)
示例#5
0
    def test_gap_fill_optional_reactions_greater_than_threshold(self):
        """
        Test the gap fill function, with a set of scores that include optional reactions
        where just considering the required reactions the gaps are greater than the threshold
        for gap filling
        Test with a minimum score lower for all reactions that the required reactions
        """

        key_reactions = ["A", "B", "C", "D", "E", "G"]
        reaction_scores = {"A": 1, "B": 2, "C": 2, "D": 1, "F": 0.1}

        gap_filled_reaction_scores = modules.gap_fill(key_reactions,
                                                      reaction_scores)

        self.assertDictEqual(gap_filled_reaction_scores, reaction_scores)
示例#6
0
    def test_gap_fill_optional_reactions_zero_gaps(self):
        """
        Test the gap fill function, with a set of scores that include optional reactions
        where just considering the required reactions it does not require gap filling
        Test boost lowest abundance score of key reactions
        """

        key_reactions = ["A", "B"]
        reaction_scores = {"A": 1, "B": 2, "E": 0.1}

        gap_filled_reaction_scores = modules.gap_fill(key_reactions,
                                                      reaction_scores)
        expected_gap_filled_reaction_scores = {"A": 2, "B": 2, "E": 0.1}

        self.assertDictEqual(gap_filled_reaction_scores,
                             expected_gap_filled_reaction_scores)
示例#7
0
    def test_gap_fill_all_required_reactions_one_optional(self):
        """
        Test the gap fill function, with a set of scores of all required reactions
        Test the lowest score is boosted
        Test the optional reaction is not boosted
        """

        key_reactions = ["A", "B", "C", "D", "E"]
        reaction_scores = {"A": 1, "B": 2, "C": 2, "D": 1, "E": 0.1, "F": 0.1}

        gap_filled_reaction_scores = modules.gap_fill(key_reactions,
                                                      reaction_scores)

        expected_reaction_scores = {
            "A": 1,
            "B": 2,
            "C": 2,
            "D": 1,
            "E": 1,
            "F": 0.1
        }

        self.assertDictEqual(gap_filled_reaction_scores,
                             expected_reaction_scores)