def test_is_compound_pair_cnv_maternal(self):
        """ check that is_compound_pair() includes pairs with CNVs
        """

        # generate a test variant
        chrom = "1"
        position = "60000"
        extra = [('CIFER_INHERITANCE', 'maternal')]
        child = create_cnv("F",
                           "maternal",
                           chrom=chrom,
                           pos=position,
                           format=extra)
        mom = create_cnv("F", "unknown", chrom=chrom, pos=position)
        dad = create_cnv("M", "unknown", chrom=chrom, pos=position)

        cnv = TrioGenotypes(chrom, position, child, mom, dad)

        # set some variants, so we can alter them later
        snv = self.create_variant(chrom="1",
                                  position="150",
                                  sex="F",
                                  cq="stop_gained")
        snv = self.set_compound_het_var(snv, "101")

        # check that these variants are compound hets, no matter which order
        # they are given as.
        self.assertTrue(self.inh.is_compound_pair(cnv, snv))

        # check that if the SNV is inherited from the same parent as the CNV,
        # then the pair isn't a compound het.
        snv = self.set_compound_het_var(snv, "110")
        self.assertFalse(self.inh.is_compound_pair(cnv, snv))
 def test_is_compound_pair_cnv_maternal(self):
     """ check that is_compound_pair() includes pairs with CNVs
     """
     
     # generate a test variant
     chrom = "1"
     position = "60000"
     extra = [('CIFER_INHERITANCE', 'maternal')]
     child = create_cnv("F", "maternal", chrom=chrom, pos=position, format=extra)
     mom = create_cnv("F", "unknown", chrom=chrom, pos=position)
     dad = create_cnv("M", "unknown", chrom=chrom, pos=position)
     
     cnv = TrioGenotypes(chrom, position, child, mom, dad)
     
     # set some variants, so we can alter them later
     snv = self.create_variant(chrom="1", position="150", sex="F", cq="stop_gained")
     snv = self.set_compound_het_var(snv, "101")
     
     # check that these variants are compound hets, no matter which order
     # they are given as.
     self.assertTrue(self.inh.is_compound_pair(cnv, snv))
     
     # check that if the SNV is inherited from the same parent as the CNV,
     # then the pair isn't a compound het.
     snv = self.set_compound_het_var(snv, "110")
     self.assertFalse(self.inh.is_compound_pair(cnv, snv))
Exemple #3
0
    def test_is_compound_pair_cnv_de_novo(self):
        """ check that is_compound_pair() includes pairs with CNVs
        """
        chrom = "1"
        position = "60000"
        extra = [('CIFER_INHERITANCE', 'not_inherited')]
        child = create_cnv("F",
                           "maternal",
                           chrom=chrom,
                           pos=position,
                           format=extra)
        mom = create_cnv("F", "unknown", chrom=chrom, pos=position)
        dad = create_cnv("M", "unknown", chrom=chrom, pos=position)

        cnv = TrioGenotypes(chrom, position, child, mom, dad)

        # set some variants, so we can alter them later
        snv = self.create_variant(chrom="1",
                                  position="150",
                                  sex="F",
                                  cq="stop_gained")
        snv = self.set_compound_het_var(snv, "101")
        snv.child.format.pop("PP_DNM")

        # check that these variants are compound hets, no matter which order
        # they are given as.
        self.assertTrue(self.inh.is_compound_pair(cnv, snv))
        self.assertTrue(self.inh.is_compound_pair(snv, cnv))

        #check the snv can also be maternal
        snv = self.set_compound_het_var(snv, "110")
        snv.child.format.pop("PP_DNM")
        self.assertTrue(self.inh.is_compound_pair(snv, cnv))
    def test_check_homozygous_with_cnv(self):
        """ test that check_homozygous() works correctly for variant lists with CNVs
        """

        # generate a test variant
        chrom = "1"
        position = "60000"
        child = create_cnv("F", "unknown", chrom=chrom, pos=position)
        mom = create_cnv("F", "unknown", chrom=chrom, pos=position)
        dad = create_cnv("M", "unknown", chrom=chrom, pos=position)

        cnv = TrioGenotypes(chrom, position, child, mom, dad)
        var = self.variants[0]

        # check for trio = 200, which is non-mendelian
        self.set_trio_genos(var, "200")
        self.assertEqual(self.inh.check_homozygous("Biallelic"), "nothing")
        self.assertEqual(self.inh.log_string, "non-mendelian trio")

        # check when a CNV is in the variants list
        self.inh.variants.append(cnv)
        self.assertEqual(self.inh.check_homozygous("Biallelic"),
                         "compound_het")
        self.assertEqual(self.inh.log_string,
                         "non-mendelian, but CNV might affect call")
Exemple #5
0
    def create_variant(self, sex):
        """ creates a TrioGenotypes variant
        """

        chrom = '1'
        position = '150'
        info = 'CNS=3;CALLSOURCE=aCGH'
        format = [('CIFER_INHERITANCE', 'uncertain')]

        # generate a test variant
        child = create_cnv(sex, "unknown", extra_info=info, format=format)
        mom = create_cnv("F", "unknown", extra_info=info, format=format)
        dad = create_cnv("M", "unknown", extra_info=info, format=format)

        return TrioGenotypes(chrom, position, child, mom, dad)
 def create_variant(self, sex):
     """ creates a TrioGenotypes variant
     """
     
     chrom = '1'
     position = '150'
     info = 'CNS=3;CALLSOURCE=aCGH'
     format = [('CIFER_INHERITANCE', 'uncertain')]
     
     # generate a test variant
     child = create_cnv(sex, "unknown", extra_info=info, format=format)
     mom = create_cnv("F", "unknown", extra_info=info, format=format)
     dad = create_cnv("M", "unknown", extra_info=info, format=format)
     
     return TrioGenotypes(chrom, position, child, mom, dad)
Exemple #7
0
    def setUp(self):
        """ define a default VcfInfo object
        """

        extra = "HGNC=OR5A1;CQ=missense_variant;CONVEX;RC50INTERNALFREQ=0.005;COMMONFORWARDS=0.000;MEANLR2=0.5;MADL2R=0.02"
        cnv = create_cnv('F', 'deNovo', extra_info=extra)

        self.var = ExomeCNV(cnv)
    def setUp(self):
        """ define a default VcfInfo object
        """

        extra = 'OR5A1;CNSOLIDATE;WSCORE=0.5;CALLP=0.000;COMMONFORWARDS=0.000;MEANLR2=0.5;MADL2R=0.02;'
        cnv = create_cnv('F', 'deNovo', extra_info=extra)

        self.var = ACGH_CNV(cnv)
Exemple #9
0
 def setUp(self):
     """ define a default VcfInfo object
     """
     
     extra = "OR5A1;CQ=missense_variant;CONVEX;RC50INTERNALFREQ=0.005;COMMONFORWARDS=0.000;MEANLR2=0.5;MADL2R=0.02"
     cnv = create_cnv('F', 'deNovo', extra_info=extra)
     
     self.var = ExomeCNV(cnv)
 def setUp(self):
     """ define a default VcfInfo object
     """
     
     extra = 'OR5A1;CNSOLIDATE;WSCORE=0.5;CALLP=0.000;COMMONFORWARDS=0.000;MEANLR2=0.5;MADL2R=0.02;'
     cnv = create_cnv('F', 'deNovo', extra_info=extra)
     
     self.var = ACGH_CNV(cnv)
 def test_check_if_any_variant_is_cnv(self):
     """ test if check_if_any_variant_is_cnv() works correctly
     """
     
     # generate a test variant
     chrom = "1"
     position = "60000"
     child = create_cnv("F", "unknown", chrom=chrom, pos=position)
     mom = create_cnv("F", "unknown", chrom=chrom, pos=position)
     dad = create_cnv("M", "unknown", chrom=chrom, pos=position)
     
     cnv_var = TrioGenotypes(chrom, position, child, mom, dad)
     
     # check that all variants=SNV returns False
     self.assertFalse(self.inh.check_if_any_variant_is_cnv())
     
     # add a CNV to the variants, then check that we find a CNV
     self.inh.variants.append(cnv_var)
     self.assertTrue(self.inh.check_if_any_variant_is_cnv())
Exemple #12
0
    def test_check_if_any_variant_is_cnv(self):
        """ test if check_if_any_variant_is_cnv() works correctly
        """

        # generate a test variant
        chrom = "1"
        position = "60000"
        child = create_cnv("F", "unknown", chrom=chrom, pos=position)
        mom = create_cnv("F", "unknown", chrom=chrom, pos=position)
        dad = create_cnv("M", "unknown", chrom=chrom, pos=position)

        cnv_var = TrioGenotypes(chrom, position, child, mom, dad)

        # check that all variants=SNV returns False
        self.assertFalse(self.inh.check_if_any_variant_is_cnv())

        # add a CNV to the variants, then check that we find a CNV
        self.inh.variants.append(cnv_var)
        self.assertTrue(self.inh.check_if_any_variant_is_cnv())
    def test_get_parental_var_cnv(self):
        ''' check that get_parental_var() works correctly for CNVs
        '''

        sex = 'F'
        var = create_cnv(sex, 'deNovo')
        mom = Person('fam_id', 'mom', '0', '0', 'F', '1', '/PATH')
        parental_vars = []

        self.assertEqual(
            get_parental_var(var, parental_vars, mom),
            CNV(chrom="1",
                position=150,
                id=".",
                ref="A",
                alts="<REF>",
                qual='1000',
                filter="PASS",
                info=str(var.info),
                format='INHERITANCE',
                sample='uncertain',
                gender="female",
                mnv_code=None))

        # check that even if a CNV exist in the parent at a matching site, we
        # still create a new CNV objectr for the parent
        mother_var = create_cnv(sex, 'uncertain')
        self.assertEqual(
            get_parental_var(var, [mother_var], mom),
            CNV(chrom="1",
                position=150,
                id=".",
                ref="A",
                alts="<REF>",
                qual='1000',
                filter="PASS",
                info=str(var.info),
                format='INHERITANCE',
                sample='uncertain',
                gender="female",
                mnv_code=None))
Exemple #14
0
 def test_get_parental_var_cnv(self):
     ''' check that get_parental_var() works correctly for CNVs
     '''
     
     sex = 'F'
     var = create_cnv(sex, 'deNovo')
     mom = Person('fam_id', 'mom', '0', '0', 'F', '1', '/PATH')
     parental_vars = []
     
     self.assertEqual(self.vcf_loader.get_parental_var(var, parental_vars,
         mom), CNV(chrom="1", position=150, id=".", ref="A",
             alts="<REF>", filter="PASS", info=var.get_info_as_string(),
             format='INHERITANCE', sample='uncertain', gender="female",
             mnv_code=None))
     
     # check that even if a CNV exist in the parent at a matching site, we
     # still create a new CNV objectr for the parent
     mother_var = create_cnv(sex, 'uncertain')
     self.assertEqual(self.vcf_loader.get_parental_var(var, [mother_var],
         mom), CNV(chrom="1", position=150, id=".", ref="A",
             alts="<REF>", filter="PASS", info=var.get_info_as_string(),
             format='INHERITANCE', sample='uncertain', gender="female",
             mnv_code=None))
 def test_check_homozygous_with_cnv(self):
     """ test that check_homozygous() works correctly for variant lists with CNVs
     """
     
     # generate a test variant
     chrom = "1"
     position = "60000"
     child = create_cnv("F", "unknown", chrom=chrom, pos=position)
     mom = create_cnv("F", "unknown", chrom=chrom, pos=position)
     dad = create_cnv("M", "unknown", chrom=chrom, pos=position)
     
     cnv = TrioGenotypes(chrom, position, child, mom, dad)
     var = self.variants[0]
     
     # check for trio = 200, which is non-mendelian
     self.set_trio_genos(var, "200")
     self.assertEqual(self.inh.check_homozygous("Biallelic"), "nothing")
     self.assertEqual(self.inh.log_string, "non-mendelian trio")
     
     # check when a CNV is in the variants list
     self.inh.variants.append(cnv)
     self.assertEqual(self.inh.check_homozygous("Biallelic"), "compound_het")
     self.assertEqual(self.inh.log_string, "non-mendelian, but CNV might affect call")
Exemple #16
0
 def test_get_parental_var_cnv_maternally_inherited(self):
     ''' test that we can construct a maternally inherited CNV
     '''
     
     sex = 'F'
     mom = Person('fam_id', 'mom', '0', '0', 'F', '1', '/PATH')
     
     # check that even if a CNV exist in the parent at a matching site, we
     # still create a new CNV object for the parent
     var = create_cnv(sex, 'maternal')
     self.assertEqual(get_parental_var(var, [], mom),
         CNV(chrom="1", position=150, id=".", ref="A",
             alts="<DUP>", qual='1000',filter="PASS", info=str(var.info),
             format='INHERITANCE', sample='uncertain', gender="female",
             mnv_code=None))
Exemple #17
0
 def test_get_parental_var_cnv_maternally_inherited(self):
     '''
     '''
     
     sex = 'F'
     mom = Person('fam_id', 'mom', '0', '0', 'F', '1', '/PATH')
     
     # check that even if a CNV exist in the parent at a matching site, we
     # still create a new CNV object for the parent
     var = create_cnv(sex, 'maternal')
     self.assertEqual(self.vcf_loader.get_parental_var(var, [], mom),
         CNV(chrom="1", position=150, id=".", ref="A",
             alts="<DUP>", filter="PASS", info=var.get_info_as_string(),
             format='INHERITANCE', sample='uncertain', gender="female",
             mnv_code=None))