Beispiel #1
0
    def test_indel(self):
        """Test indel not used in onp combination no matter what the phasing info"""
        mut1 = MutationData(chr=1,start=100, end=100, ref_allele="G", alt_allele="A")
        mut1.createAnnotation("phasing_id", "value1", "INPUT")
        mut1.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut2 = MutationData(chr=1,start=101, end=101, ref_allele="C", alt_allele="T")
        mut2.createAnnotation("phasing_id", "value1", "INPUT")
        mut2.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut3 = MutationData(chr=1,start=102, end=102, ref_allele="C", alt_allele="T")
        mut3.createAnnotation("phasing_id", "value1", "INPUT")
        mut3.createAnnotation("phasing_genotype", "0|1", "INPUT")

        # Indel
        mut4 = MutationData(chr=1,start=103, end=104, ref_allele="-", alt_allele="TT")
        mut4.createAnnotation("phasing_id", "value1", "INPUT")
        mut4.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut5 = MutationData(chr=1, start=104, end=104, ref_allele="C", alt_allele="T")
        mut5.createAnnotation("phasing_id", "value1", "INPUT")
        mut5.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut6 = MutationData(chr=1, start=105, end=105, ref_allele="C", alt_allele="T")
        mut6.createAnnotation("phasing_id", "value1", "INPUT")
        mut6.createAnnotation("phasing_genotype", "0|1", "INPUT")

        gt_alts = ["ATT", "TT", "TT"]
        mutations = [mut1, mut2, mut3, mut4, mut5, mut6]
        mdf = MutationDataFactory()
        queue = OnpQueue(mutations, mdf)

        for i, mut in enumerate(queue.get_combined_mutations()):
            self.assertTrue(gt_alts[i] == mut.alt_allele)
Beispiel #2
0
 def _onp_ordered_combiner_test(self, inputs, expected):
     input_muts = iter(self._tuples_to_MutationData(inputs))
     expected_muts = self._tuples_to_MutationData(expected)
     mut_factory = MutationDataFactory()
     combiner = OnpQueue(input_muts, mut_factory)
     results = list(combiner.get_combined_mutations())
     self._assert_mutation_lists_equal(expected_muts, results)
Beispiel #3
0
    def test_tnp_blank_snp(self):
        """Test a harder scenario for ONP combination"""
        mut1 = MutationData(chr=1,start=100, end=100, ref_allele="G", alt_allele="A")
        mut1.createAnnotation("phasing_id", "value1", "INPUT")
        mut1.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut2 = MutationData(chr=1,start=101, end=101, ref_allele="C", alt_allele="T")
        mut2.createAnnotation("phasing_id", "value1", "INPUT")
        mut2.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut3 = MutationData(chr=1,start=102, end=102, ref_allele="C", alt_allele="T")
        mut3.createAnnotation("phasing_id", "value1", "INPUT")
        mut3.createAnnotation("phasing_genotype", "0|1", "INPUT")

        # Note the differing ID in mut4
        mut4 = MutationData(chr=1,start=103, end=103, ref_allele="C", alt_allele="T")
        mut4.createAnnotation("phasing_id", "value2", "INPUT")
        mut4.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut5 = MutationData(chr=1,start=104, end=104, ref_allele="C", alt_allele="T")
        mut5.createAnnotation("phasing_id", "value1", "INPUT")
        mut5.createAnnotation("phasing_genotype", "0|1", "INPUT")

        # Note separate chromosome for mut6
        mut6 = MutationData(chr=2,start=105, end=105, ref_allele="C", alt_allele="T")
        mut6.createAnnotation("phasing_id", "value1", "INPUT")
        mut6.createAnnotation("phasing_genotype", "0|1", "INPUT")

        gt_alts = ["ATT", "T", "T", "T"]
        mutations = [mut1, mut2, mut3, mut4, mut5, mut6]
        mdf = MutationDataFactory()
        queue = OnpQueue(mutations, mdf)

        for i, mut in enumerate(queue.get_combined_mutations()):
            self.assertTrue(gt_alts[i] == mut.alt_allele)
Beispiel #4
0
 def _onp_ordered_combiner_test(self,inputs, expected):
     input_muts = iter(self._tuples_to_MutationData(inputs))
     expected_muts = self._tuples_to_MutationData(expected)
     mut_factory = MutationDataFactory()
     combiner = OnpQueue(input_muts, mut_factory)
     results = list(combiner.get_combined_mutations())
     self._assert_mutation_lists_equal(expected_muts, results)
Beispiel #5
0
    def test_tnp_blank_snp(self):
        """Test a harder scenario for ONP combination"""
        mut1 = MutationData(chr=1,
                            start=100,
                            end=100,
                            ref_allele="G",
                            alt_allele="A")
        mut1.createAnnotation("phasing_id", "value1", "INPUT")
        mut1.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut2 = MutationData(chr=1,
                            start=101,
                            end=101,
                            ref_allele="C",
                            alt_allele="T")
        mut2.createAnnotation("phasing_id", "value1", "INPUT")
        mut2.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut3 = MutationData(chr=1,
                            start=102,
                            end=102,
                            ref_allele="C",
                            alt_allele="T")
        mut3.createAnnotation("phasing_id", "value1", "INPUT")
        mut3.createAnnotation("phasing_genotype", "0|1", "INPUT")

        # Note the differing ID in mut4
        mut4 = MutationData(chr=1,
                            start=103,
                            end=103,
                            ref_allele="C",
                            alt_allele="T")
        mut4.createAnnotation("phasing_id", "value2", "INPUT")
        mut4.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut5 = MutationData(chr=1,
                            start=104,
                            end=104,
                            ref_allele="C",
                            alt_allele="T")
        mut5.createAnnotation("phasing_id", "value1", "INPUT")
        mut5.createAnnotation("phasing_genotype", "0|1", "INPUT")

        # Note separate chromosome for mut6
        mut6 = MutationData(chr=2,
                            start=105,
                            end=105,
                            ref_allele="C",
                            alt_allele="T")
        mut6.createAnnotation("phasing_id", "value1", "INPUT")
        mut6.createAnnotation("phasing_genotype", "0|1", "INPUT")

        gt_alts = ["ATT", "T", "T", "T"]
        mutations = [mut1, mut2, mut3, mut4, mut5, mut6]
        mdf = MutationDataFactory()
        queue = OnpQueue(mutations, mdf)

        for i, mut in enumerate(queue.get_combined_mutations()):
            self.assertTrue(gt_alts[i] == mut.alt_allele)
Beispiel #6
0
 def _onp_unordered_combiner_test(self,inputs, expected):
     """Convert input and expected tuples into MutationData objects, then run the inputs through the ONP combiner on
     the inputs and compare to the expected"""
     input_muts = iter(self._tuples_to_MutationData(inputs))
     expected = self._tuples_to_MutationData(expected)
     combiner = OnpQueue(input_muts)
     results = list(combiner.get_combined_mutations())
     self.assert_mutations_match_expected(expected, results)
Beispiel #7
0
    def test_indel(self):
        """Test indel not used in onp combination no matter what the phasing info"""
        mut1 = MutationData(chr=1,
                            start=100,
                            end=100,
                            ref_allele="G",
                            alt_allele="A")
        mut1.createAnnotation("phasing_id", "value1", "INPUT")
        mut1.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut2 = MutationData(chr=1,
                            start=101,
                            end=101,
                            ref_allele="C",
                            alt_allele="T")
        mut2.createAnnotation("phasing_id", "value1", "INPUT")
        mut2.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut3 = MutationData(chr=1,
                            start=102,
                            end=102,
                            ref_allele="C",
                            alt_allele="T")
        mut3.createAnnotation("phasing_id", "value1", "INPUT")
        mut3.createAnnotation("phasing_genotype", "0|1", "INPUT")

        # Indel
        mut4 = MutationData(chr=1,
                            start=103,
                            end=104,
                            ref_allele="-",
                            alt_allele="TT")
        mut4.createAnnotation("phasing_id", "value1", "INPUT")
        mut4.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut5 = MutationData(chr=1,
                            start=104,
                            end=104,
                            ref_allele="C",
                            alt_allele="T")
        mut5.createAnnotation("phasing_id", "value1", "INPUT")
        mut5.createAnnotation("phasing_genotype", "0|1", "INPUT")

        mut6 = MutationData(chr=1,
                            start=105,
                            end=105,
                            ref_allele="C",
                            alt_allele="T")
        mut6.createAnnotation("phasing_id", "value1", "INPUT")
        mut6.createAnnotation("phasing_genotype", "0|1", "INPUT")

        gt_alts = ["ATT", "TT", "TT"]
        mutations = [mut1, mut2, mut3, mut4, mut5, mut6]
        mdf = MutationDataFactory()
        queue = OnpQueue(mutations, mdf)

        for i, mut in enumerate(queue.get_combined_mutations()):
            self.assertTrue(gt_alts[i] == mut.alt_allele)
Beispiel #8
0
 def _onp_unordered_combiner_test(self,inputs, expected):
     """Convert input and expected tuples into MutationData objects, then run the inputs through the ONP combiner on
     the inputs and compare to the expected"""
     input_muts = iter(self._tuples_to_MutationData(inputs))
     expected = self._tuples_to_MutationData(expected)
     mdf = MutationDataFactory()
     combiner = OnpQueue(input_muts, mdf)
     results = list(combiner.get_combined_mutations())
     self.assert_mutations_match_expected(expected, results)
Beispiel #9
0
    def createMutations(self):
        mutations = self.input_creator.createMutations()
        queue = OnpQueue(mutations)

        for mut in queue.get_combined_mutations():
            yield mut
Beispiel #10
0
    def createMutations(self):
        mutations = self.input_creator.createMutations()
        queue = OnpQueue(mutations, self._mutation_data_factory)

        for mut in queue.get_combined_mutations():
            yield mut