Exemplo n.º 1
0
    def testRetrievePrecedingBaseFromAnnotationForDeletions(self):
        chrom = "1"
        start = 1234568
        end = 1234569  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "GTC"
        alt_allele = "G"
        build = "19"
        mut = MutationDataFactory.default_create(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME, annotationValue=preceding_bases)
        updated_ref_allele, updated_alt_allele, updated_start = \
            MutUtils.retrievePrecedingBaseFromAnnotationForDeletions(mut)
        self.assertTrue(updated_start == start, "Mut start should be %s but was %s." % (start, updated_start))
        self.assertTrue(updated_ref_allele == ref_allele, "Ref allele should be %s but was %s."
                                                          % (ref_allele, updated_ref_allele))
        self.assertTrue(updated_alt_allele == alt_allele, "Alt allele should be %s but was %s." % (alt_allele, updated_alt_allele))

        chrom = "1"
        start = 1234567
        end = 1234567  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "GTCT"
        alt_allele = "GTC"
        build = "19"
        mut = MutationDataFactory.default_create(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME, annotationValue=preceding_bases)
        updated_ref_allele, updated_alt_allele, updated_start = \
            MutUtils.retrievePrecedingBaseFromAnnotationForDeletions(mut)
        self.assertTrue(updated_start == start, "Mut start should be %s but was %s." % (start, updated_start))
        self.assertTrue(updated_ref_allele == ref_allele, "Ref allele should be %s but was %s."
                                                          % (ref_allele, updated_ref_allele))
        self.assertTrue(updated_alt_allele == alt_allele, "Alt allele should be %s but was %s."
                                                          % (alt_allele, updated_alt_allele))

        chrom = "1"
        start = 152497145
        end = 152497145  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "CCCGAGCTGCTTACGATAGCCTTCTT"
        alt_allele = "C"
        build = "19"
        mut = MutationDataFactory.default_create(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME, annotationValue=preceding_bases)
        updated_ref_allele, updated_alt_allele, updated_start = \
            MutUtils.retrievePrecedingBaseFromAnnotationForDeletions(mut)
        self.assertTrue(updated_start == start, "Mut start should be %s but was %s." % (start, updated_start))
        self.assertTrue(updated_ref_allele == ref_allele, "Ref allele should be %s but was %s."
                                                          % (ref_allele, updated_ref_allele))
        self.assertTrue(updated_alt_allele == alt_allele, "Alt allele should be %s but was %s."
                                                          % (alt_allele, updated_alt_allele))
Exemplo n.º 2
0
    def testRetrievePrecedingBaseFromAnnotationForDeletions(self):
        chrom = "1"
        start = 1234568
        end = 1234569  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "GTC"
        alt_allele = "G"
        build = "19"
        mut = MutationData(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(
            annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME,
            annotationValue=preceding_bases)
        updated_ref_allele, updated_alt_allele, updated_start = \
            MutUtils.retrievePrecedingBaseFromAnnotationForDeletions(mut)
        self.assertTrue(
            updated_start == start,
            "Mut start should be %s but was %s." % (start, updated_start))
        self.assertTrue(
            updated_ref_allele == ref_allele,
            "Ref allele should be %s but was %s." %
            (ref_allele, updated_ref_allele))
        self.assertTrue(
            updated_alt_allele == alt_allele,
            "Alt allele should be %s but was %s." %
            (alt_allele, updated_alt_allele))

        chrom = "1"
        start = 1234567
        end = 1234567  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "GTCT"
        alt_allele = "GTC"
        build = "19"
        mut = MutationData(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(
            annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME,
            annotationValue=preceding_bases)
        updated_ref_allele, updated_alt_allele, updated_start = \
            MutUtils.retrievePrecedingBaseFromAnnotationForDeletions(mut)
        self.assertTrue(
            updated_start == start,
            "Mut start should be %s but was %s." % (start, updated_start))
        self.assertTrue(
            updated_ref_allele == ref_allele,
            "Ref allele should be %s but was %s." %
            (ref_allele, updated_ref_allele))
        self.assertTrue(
            updated_alt_allele == alt_allele,
            "Alt allele should be %s but was %s." %
            (alt_allele, updated_alt_allele))

        chrom = "1"
        start = 152497145
        end = 152497145  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "CCCGAGCTGCTTACGATAGCCTTCTT"
        alt_allele = "C"
        build = "19"
        mut = MutationData(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(
            annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME,
            annotationValue=preceding_bases)
        updated_ref_allele, updated_alt_allele, updated_start = \
            MutUtils.retrievePrecedingBaseFromAnnotationForDeletions(mut)
        self.assertTrue(
            updated_start == start,
            "Mut start should be %s but was %s." % (start, updated_start))
        self.assertTrue(
            updated_ref_allele == ref_allele,
            "Ref allele should be %s but was %s." %
            (ref_allele, updated_ref_allele))
        self.assertTrue(
            updated_alt_allele == alt_allele,
            "Alt allele should be %s but was %s." %
            (alt_allele, updated_alt_allele))
Exemplo n.º 3
0
    def testRetrievePrecedingBasesForDeletions(self):
        chrom = "1"
        start = 1234567
        end = 1234567  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "GTC"
        alt_allele = "G"
        build = "19"
        mut = MutationDataFactory.default_create(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME, annotationValue=preceding_bases)
        self.assertTrue("_preceding_bases" in mut, "_preceding_bases is missing in the mutation data.")
        self.assertTrue(mut.start == 1234568, "Mut start should be 1234568 but was %s." % mut.start)
        self.assertTrue(mut.end == 1234569, "Mut end should be 1234569 but was %s." % mut.end)
        self.assertTrue(mut.ref_allele == "TC", "Ref allele should be TC but was %s." % mut.ref_allele)
        self.assertTrue(mut.alt_allele == "-", "Alt allele should be - but was %s." % mut.alt_allele)

        chrom = "1"
        start = 1234567
        end = 1234567  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "GTCT"
        alt_allele = "GTC"
        build = "19"
        mut = MutationDataFactory.default_create(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME, annotationValue=preceding_bases)
        self.assertTrue("_preceding_bases" in mut, "_preceding_bases is missing in the mutation data.")
        self.assertTrue(mut.start == 1234570, "Mut start should be 1234570 but was %s." % mut.start)
        self.assertTrue(mut.end == 1234570, "Mut end should be 1234570 but was %s." % mut.end)
        self.assertTrue(mut.ref_allele == "T", "Ref allele should be T but was %s." % mut.ref_allele)
        self.assertTrue(mut.alt_allele == "-", "Alt allele should be - but was %s." % mut.alt_allele)

        chrom = "1"
        start = 152497145
        end = 152497145  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "CCCGAGCTGCTTACGATAGCCTTCTT"
        alt_allele = "C"
        build = "19"
        mut = MutationDataFactory.default_create(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME, annotationValue=preceding_bases)
        self.assertTrue("_preceding_bases" in mut, "_preceding_bases is missing in the mutation data.")
        self.assertTrue(mut.start == 152497146, "Mut start should be 1234570 but was %s." % mut.start)
        self.assertTrue(mut.end == 152497170, "Mut end should be 1234570 but was %s." % mut.end)
        self.assertTrue(mut.ref_allele == "CCGAGCTGCTTACGATAGCCTTCTT", "Ref allele should be T but was %s."
                                                                       % mut.ref_allele)
        self.assertTrue(mut.alt_allele == "-", "Alt allele should be - but was %s." % mut.alt_allele)
Exemplo n.º 4
0
    def testRetrievePrecedingBasesForDeletions(self):
        chrom = "1"
        start = 1234567
        end = 1234567  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "GTC"
        alt_allele = "G"
        build = "19"
        mut = MutationData(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(
            annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME,
            annotationValue=preceding_bases)
        self.assertTrue("_preceding_bases" in mut,
                        "_preceding_bases is missing in the mutation data.")
        self.assertTrue(mut.start == 1234568,
                        "Mut start should be 1234568 but was %s." % mut.start)
        self.assertTrue(mut.end == 1234569,
                        "Mut end should be 1234569 but was %s." % mut.end)
        self.assertTrue(mut.ref_allele == "TC",
                        "Ref allele should be TC but was %s." % mut.ref_allele)
        self.assertTrue(mut.alt_allele == "-",
                        "Alt allele should be - but was %s." % mut.alt_allele)

        chrom = "1"
        start = 1234567
        end = 1234567  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "GTCT"
        alt_allele = "GTC"
        build = "19"
        mut = MutationData(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(
            annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME,
            annotationValue=preceding_bases)
        self.assertTrue("_preceding_bases" in mut,
                        "_preceding_bases is missing in the mutation data.")
        self.assertTrue(mut.start == 1234570,
                        "Mut start should be 1234570 but was %s." % mut.start)
        self.assertTrue(mut.end == 1234570,
                        "Mut end should be 1234570 but was %s." % mut.end)
        self.assertTrue(mut.ref_allele == "T",
                        "Ref allele should be T but was %s." % mut.ref_allele)
        self.assertTrue(mut.alt_allele == "-",
                        "Alt allele should be - but was %s." % mut.alt_allele)

        chrom = "1"
        start = 152497145
        end = 152497145  # incorrect, but doesn't matter for the purposed of testing
        ref_allele = "CCCGAGCTGCTTACGATAGCCTTCTT"
        alt_allele = "C"
        build = "19"
        mut = MutationData(chrom, start, end, ref_allele, alt_allele, build)
        preceding_bases, updated_ref_allele, updated_start, updated_end = \
            MutUtils.retrievePrecedingBasesForDeletions(mut)
        mut.ref_allele = updated_ref_allele
        mut.alt_allele = "-"
        mut.start = updated_start
        mut.end = updated_end
        mut.createAnnotation(
            annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME,
            annotationValue=preceding_bases)
        self.assertTrue("_preceding_bases" in mut,
                        "_preceding_bases is missing in the mutation data.")
        self.assertTrue(mut.start == 152497146,
                        "Mut start should be 1234570 but was %s." % mut.start)
        self.assertTrue(mut.end == 152497170,
                        "Mut end should be 1234570 but was %s." % mut.end)
        self.assertTrue(mut.ref_allele == "CCGAGCTGCTTACGATAGCCTTCTT",
                        "Ref allele should be T but was %s." % mut.ref_allele)
        self.assertTrue(mut.alt_allele == "-",
                        "Alt allele should be - but was %s." % mut.alt_allele)