Ejemplo n.º 1
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)
Ejemplo n.º 2
0
 def passes_filters(self):
     """Checks whether a VCF variant passes user defined criteria.
     
     Returns:
         boolean value for whether the variant passes the filters
     """
     
     # some CNVs are on female Y chrom, which give errors, fail those CNVs
     try:
         self.set_genotype()
     except ValueError:
         return False
     
     # we rely on the CALLSOURCE field to inform us what the CNV has been
     # called by. Raise an error if this is not present.
     assert "CALLSOURCE" in self.info
     
     track_variant = False
     if self.get_chrom() == self.debug_chrom and self.get_position() == self.debug_pos:
         track_variant = True
     
     passes = True
     if "aCGH" in self.info["CALLSOURCE"]:
         filt = ACGH_CNV(self)
         passes = filt.filter_cnv(track_variant)
     elif "EXOME" in self.info["CALLSOURCE"]:
         # currently return false for all exome-only CNVs, undergoing testing
         filt = ExomeCNV(self)
         passes = filt.filter_cnv(track_variant)
     else:
         if track_variant:
             print("CNV is not an aCGH or exome CNV")
         passes = False
     
     return passes
Ejemplo n.º 3
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
     """
     
     chrom = "1"
     pos = "15000000"
     snp_id = "."
     ref = "A"
     alt = "<DUP>"
     filt = "PASS"
     
     # set up a SNV object, since SNV inherits VcfInfo
     cnv = CNV(chrom, pos, snp_id, ref, alt, filt)
     self.var = ExomeCNV(cnv)
     
     info = "HGNC=TEST;HGNC_ALL=TEST,OR5A1;CQ=missense_variant;CONVEX;RC50INTERNALFREQ=0.005;COMMONFORWARDS=0.000;MEANLR2=0.5;MADL2R=0.02"
     format_keys = "inheritance:DP"
     sample_values = "deNovo:50"
     
     self.var.cnv.add_info(info)
     self.var.cnv.add_format(format_keys, sample_values)
     self.var.cnv.set_gender("F")
Ejemplo n.º 5
0
    def passes_filters(self):
        """Checks whether a VCF variant passes user defined criteria.
        
        Returns:
            boolean value for whether the variant passes the filters
        """

        # some CNVs are on female Y chrom, which give errors, fail those CNVs
        try:
            self.set_genotype()
        except ValueError:
            return False

        track_variant = False
        if self.get_chrom() == self.debug_chrom and self.get_position(
        ) == self.debug_pos:
            track_variant = True

        passes = True
        if "CONVEX" in self.info and "CNSOLIDATE" not in self.info:
            # currently return false for all exome-only CNVs, undergoing testing
            filt = ExomeCNV(self)
            # passes = filt.filter_cnv(track_variant)
            passes = False
        elif "CNSOLIDATE" in self.info:
            filt = ACGH_CNV(self)
            passes = filt.filter_cnv(track_variant)
        elif "BREAKDANCER" in self.info:
            filt = BreakdancerCNV(self)
            passes = filt.filter_cnv(track_variant)
        else:
            if track_variant:
                print("CNV is not an aCGH or exome CNV")
            passes = False

        return passes
Ejemplo n.º 6
0
class TestExomeCnvPy(unittest.TestCase):
    """ test the Exome CNV filters
    """
    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 test_add_cns_state(self):
        """ test that add_cns_state() works correctly
        """

        # meanl2r > 0 gives cns of 3
        self.var.cnv.info["MEANLR2"] = "1"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "3")

        self.var.cnv.info["MEANLR2"] = "0"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "3")

        self.var.cnv.info["MEANLR2"] = "-0.1"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "1")

        self.var.cnv.info["MEANLR2"] = "-2"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "1")

        self.var.cnv.info["MEANLR2"] = "-2.1"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "0")

    def test_fails_mad_ratio(self):
        """ test that fails_mad_ratio() works correctly
        """

        # check that var passes when MAD ratio > 5
        self.var.cnv.info["MEANLR2"] = "0.5"
        self.var.cnv.info["MADL2R"] = "0.02"
        self.assertFalse(self.var.fails_mad_ratio())

        # check that var passes when MAD ratio == 5
        self.var.cnv.info["MEANLR2"] = "0.1"
        self.var.cnv.info["MADL2R"] = "0.01"
        self.assertFalse(self.var.fails_mad_ratio())

        # check that var fails when MAD ratio < 5
        self.var.cnv.info["MEANLR2"] = "0.09"
        self.var.cnv.info["MADL2R"] = "0.01"
        self.assertTrue(self.var.fails_mad_ratio())

        # check that var fails when trying to divide by zero
        self.var.cnv.info["MEANLR2"] = "0.2"
        self.var.cnv.info["MADL2R"] = "0"
        self.assertTrue(self.var.fails_mad_ratio())

    def test_fails_meanlr2(self):
        """ test that fails_meanlr2() works correctly
        """

        # below the DUP threshold
        self.var.cnv.genotype = 'DUP'
        self.var.cnv.info["MEANLR2"] = "0.399"
        self.assertTrue(self.var.fails_meanlr2())

        # at the DUP threshold
        self.var.cnv.info["MEANLR2"] = "0.4"
        self.assertFalse(self.var.fails_meanlr2())

        # above the DUP threshold
        self.var.cnv.info["MEANLR2"] = "0.41"
        self.assertFalse(self.var.fails_meanlr2())

        # above the DEL threshold
        self.var.cnv.genotype = 'DEL'
        self.var.cnv.info["MEANLR2"] = "-0.4999"
        self.assertTrue(self.var.fails_meanlr2())

        # at the DEL threshold
        self.var.cnv.info["MEANLR2"] = "-0.5"
        self.assertFalse(self.var.fails_meanlr2())

        # below the DEL threshold
        self.var.cnv.info["MEANLR2"] = "-0.51"
        self.assertFalse(self.var.fails_meanlr2())

    def test_fails_population_frequency(self):
        """ test that fails_population_frequency() works correctly
        """

        # check that var passes when RC50INTERNALFREQ < 0.01
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.005"
        self.assertFalse(self.var.fails_population_frequency())

        # check that var passes when RC50INTERNALFREQ == 0.1
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.01"
        self.assertFalse(self.var.fails_population_frequency())

        # check that var fails when RC50INTERNALFREQ > 0.1
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.02"
        self.assertTrue(self.var.fails_population_frequency())

    def test_fails_convex_score(self):
        """ test that fails_convex_score() works correctly
        """

        # check that var passes when CONVEXSCORE > 7
        self.var.cnv.info["CONVEXSCORE"] = "8"
        self.assertFalse(self.var.fails_convex_score())

        # check that var fails when CONVEXSCORE == 7
        self.var.cnv.info["CONVEXSCORE"] = "7"
        self.assertTrue(self.var.fails_convex_score())

        # check that var fails when CONVEXSCORE < 7
        self.var.cnv.info["CONVEXSCORE"] = "6"
        self.assertTrue(self.var.fails_convex_score())

    def test_fails_commmon_forwards(self):
        """ test that fails_commmon_forwards() works correctly
        """

        # check that var passes when COMMONFORWARDS < 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.0"
        self.assertFalse(self.var.fails_commmon_forwards())

        # check that var fails when COMMONFORWARDS == 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.8"
        self.assertFalse(self.var.fails_commmon_forwards())

        # check that var fails when COMMONFORWARDS > 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.9"
        self.assertTrue(self.var.fails_commmon_forwards())

    def test_fails_no_exons(self):
        """ test that fails_no_exons() works correctly
        """

        self.var.cnv.info["NUMBEREXONS"] = "1"
        self.assertFalse(self.var.fails_no_exons())

        self.var.cnv.info["NUMBEREXONS"] = "0"
        self.assertTrue(self.var.fails_no_exons())

    def test_fails_x_lr2(self):
        """test that fails_x_lr2() works correctly
        """
        self.var.cnv.chrom = "X"
        self.var.cnv.sum_x_lr2 = "-6000"
        self.assertTrue(self.var.fails_x_lr2())

        self.var.cnv.sum_x_lr2 = "8000"
        self.assertTrue(self.var.fails_x_lr2())

        self.var.cnv.sum_x_lr2 = "2000"
        self.assertFalse(self.var.fails_x_lr2())

    def test_fails_additional_filters(self):
        """test that fails_additional_filters() works correctly
        """
        self.var.cnv.genotype = "DUP"
        self.var.cnv.format["CIFER_INHERITANCE"] = "maternal_inh"
        self.var.cnv.info["MEANLR2"] = "-2"
        self.var.cnv.info["CONVEXSCORE"] = "10"
        self.var.cnv.info["MADL2R"] = "0.2"
        self.assertFalse(self.var.fails_additional_filters())

        self.var.cnv.genotype = "DEL"
        self.assertFalse(self.var.fails_additional_filters())

        self.var.cnv.format["CIFER_INHERITANCE"] = "not_inherited"
        self.assertTrue(self.var.fails_additional_filters())

        self.var.cnv.info["MADL2R"] = "0.1"
        self.assertTrue(self.var.fails_additional_filters())

        self.var.cnv.info["MEANLR2"] = "-1"
        self.assertFalse(self.var.fails_additional_filters())

        self.var.cnv.info["CONVEXSCORE"] = "20"
        self.assertFalse(self.var.fails_additional_filters())

    def test_fails_cifer_inh(self):
        """test that CNVs in non-trios aren't filtered out on cifer false pos
        but those in trios are filtered out
        """
        self.var.cnv.has_parents = True
        self.var.cnv.format["CIFER_INHERITANCE"] = "false_positive"
        self.assertTrue(self.var.fails_cifer_inh())

        self.var.cnv.has_parents = False
        self.var.cnv.format["CIFER_INHERITANCE"] = "false_positive"
        self.assertFalse(self.var.fails_cifer_inh())
Ejemplo n.º 7
0
class TestExomeCnvPy(unittest.TestCase):
    """ test the Exome CNV filters
    """
    
    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 test_add_cns_state(self):
        """ test that add_cns_state() works correctly
        """
        
        # meanl2r > 0 gives cns of 3
        self.var.cnv.info["MEANLR2"] = "1"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "3")
        
        self.var.cnv.info["MEANLR2"] = "0"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "3")
        
        self.var.cnv.info["MEANLR2"] = "-0.1"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "1")
        
        self.var.cnv.info["MEANLR2"] = "-2"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "1")
        
        self.var.cnv.info["MEANLR2"] = "-2.1"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "0")
    
    def test_fails_mad_ratio(self):
        """ test that fails_mad_ratio() works correctly
        """
        
        # check that var passes when MAD ratio > 5
        self.var.cnv.info["MEANLR2"] = "0.5"
        self.var.cnv.info["MADL2R"] = "0.02"
        self.assertFalse(self.var.fails_mad_ratio())
        
        # check that var passes when MAD ratio == 5
        self.var.cnv.info["MEANLR2"] = "0.1"
        self.var.cnv.info["MADL2R"] = "0.02"
        self.assertFalse(self.var.fails_mad_ratio())
        
        # check that var fails when MAD ratio < 5
        self.var.cnv.info["MEANLR2"] = "0.09"
        self.var.cnv.info["MADL2R"] = "0.02"
        self.assertTrue(self.var.fails_mad_ratio())
        
        # check that var fails when trying to divide by zero
        self.var.cnv.info["MEANLR2"] = "0.2"
        self.var.cnv.info["MADL2R"] = "0"
        self.assertTrue(self.var.fails_mad_ratio())
    
    def test_fails_population_frequency(self):
        """ test that fails_population_frequency() works correctly
        """
        
        # check that var passes when RC50INTERNALFREQ < 0.01
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.005"
        self.assertFalse(self.var.fails_population_frequency())
        
        # check that var passes when RC50INTERNALFREQ == 0.1
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.01"
        self.assertFalse(self.var.fails_population_frequency())
        
        # check that var fails when RC50INTERNALFREQ > 0.1
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.02"
        self.assertTrue(self.var.fails_population_frequency())
    
    def test_fails_convex_score(self):
        """ test that fails_convex_score() works correctly
        """
        
        # check that var passes when CONVEXSCORE > 7
        self.var.cnv.info["CONVEXSCORE"] = "8"
        self.assertFalse(self.var.fails_convex_score())
        
        # check that var fails when CONVEXSCORE == 7
        self.var.cnv.info["CONVEXSCORE"] = "7"
        self.assertTrue(self.var.fails_convex_score())
        
        # check that var fails when CONVEXSCORE < 7
        self.var.cnv.info["CONVEXSCORE"] = "6"
        self.assertTrue(self.var.fails_convex_score())
    
    def test_fails_commmon_forwards(self):
        """ test that fails_commmon_forwards() works correctly
        """
        
        # check that var passes when COMMONFORWARDS < 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.0"
        self.assertFalse(self.var.fails_commmon_forwards())
        
        # check that var fails when COMMONFORWARDS == 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.8"
        self.assertFalse(self.var.fails_commmon_forwards())
        
        # check that var fails when COMMONFORWARDS > 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.9"
        self.assertTrue(self.var.fails_commmon_forwards())
    
    def test_fails_no_exons(self):
        """ test that fails_no_exons() works correctly
        """
        
        self.var.cnv.info["NUMBEREXONS"] = "1"
        self.assertFalse(self.var.fails_no_exons())

        self.var.cnv.info["NUMBEREXONS"] = "0"
        self.assertTrue(self.var.fails_no_exons())
class TestExomeCnvPy(unittest.TestCase):
    """ test the Exome CNV filters
    """
    
    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 test_add_cns_state(self):
        """ test that add_cns_state() works correctly
        """
        
        # meanl2r > 0 gives cns of 3
        self.var.cnv.info["MEANLR2"] = "1"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "3")
        
        self.var.cnv.info["MEANLR2"] = "0"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "3")
        
        self.var.cnv.info["MEANLR2"] = "-0.1"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "1")
        
        self.var.cnv.info["MEANLR2"] = "-2"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "1")
        
        self.var.cnv.info["MEANLR2"] = "-2.1"
        self.var.cnv.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "0")
    
    def test_fails_mad_ratio(self):
        """ test that fails_mad_ratio() works correctly
        """
        
        # check that var passes when MAD ratio > 5
        self.var.cnv.info["MEANLR2"] = "0.5"
        self.var.cnv.info["MADL2R"] = "0.02"
        self.assertFalse(self.var.fails_mad_ratio())
        
        # check that var passes when MAD ratio == 5
        self.var.cnv.info["MEANLR2"] = "0.1"
        self.var.cnv.info["MADL2R"] = "0.01"
        self.assertFalse(self.var.fails_mad_ratio())
        
        # check that var fails when MAD ratio < 5
        self.var.cnv.info["MEANLR2"] = "0.09"
        self.var.cnv.info["MADL2R"] = "0.01"
        self.assertTrue(self.var.fails_mad_ratio())
        
        # check that var fails when trying to divide by zero
        self.var.cnv.info["MEANLR2"] = "0.2"
        self.var.cnv.info["MADL2R"] = "0"
        self.assertTrue(self.var.fails_mad_ratio())
    
    def test_fails_meanlr2(self):
        """ test that fails_meanlr2() works correctly
        """
        
        # below the DUP threshold
        self.var.cnv.genotype = 'DUP'
        self.var.cnv.info["MEANLR2"] = "0.399"
        self.assertTrue(self.var.fails_meanlr2())
        
        # at the DUP threshold
        self.var.cnv.info["MEANLR2"] = "0.4"
        self.assertFalse(self.var.fails_meanlr2())
        
        # above the DUP threshold
        self.var.cnv.info["MEANLR2"] = "0.41"
        self.assertFalse(self.var.fails_meanlr2())
        
        # above the DEL threshold
        self.var.cnv.genotype = 'DEL'
        self.var.cnv.info["MEANLR2"] = "-0.4999"
        self.assertTrue(self.var.fails_meanlr2())
        
        # at the DEL threshold
        self.var.cnv.info["MEANLR2"] = "-0.5"
        self.assertFalse(self.var.fails_meanlr2())
        
        # below the DEL threshold
        self.var.cnv.info["MEANLR2"] = "-0.51"
        self.assertFalse(self.var.fails_meanlr2())
    
    def test_fails_population_frequency(self):
        """ test that fails_population_frequency() works correctly
        """
        
        # check that var passes when RC50INTERNALFREQ < 0.01
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.005"
        self.assertFalse(self.var.fails_population_frequency())
        
        # check that var passes when RC50INTERNALFREQ == 0.1
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.01"
        self.assertFalse(self.var.fails_population_frequency())
        
        # check that var fails when RC50INTERNALFREQ > 0.1
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.02"
        self.assertTrue(self.var.fails_population_frequency())
    
    def test_fails_convex_score(self):
        """ test that fails_convex_score() works correctly
        """
        
        # check that var passes when CONVEXSCORE > 7
        self.var.cnv.info["CONVEXSCORE"] = "8"
        self.assertFalse(self.var.fails_convex_score())
        
        # check that var fails when CONVEXSCORE == 7
        self.var.cnv.info["CONVEXSCORE"] = "7"
        self.assertTrue(self.var.fails_convex_score())
        
        # check that var fails when CONVEXSCORE < 7
        self.var.cnv.info["CONVEXSCORE"] = "6"
        self.assertTrue(self.var.fails_convex_score())
    
    def test_fails_commmon_forwards(self):
        """ test that fails_commmon_forwards() works correctly
        """
        
        # check that var passes when COMMONFORWARDS < 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.0"
        self.assertFalse(self.var.fails_commmon_forwards())
        
        # check that var fails when COMMONFORWARDS == 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.8"
        self.assertFalse(self.var.fails_commmon_forwards())
        
        # check that var fails when COMMONFORWARDS > 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.9"
        self.assertTrue(self.var.fails_commmon_forwards())
    
    def test_fails_no_exons(self):
        """ test that fails_no_exons() works correctly
        """
        
        self.var.cnv.info["NUMBEREXONS"] = "1"
        self.assertFalse(self.var.fails_no_exons())

        self.var.cnv.info["NUMBEREXONS"] = "0"
        self.assertTrue(self.var.fails_no_exons())

    def test_fails_x_lr2(self):
        """test that fails_x_lr2() works correctly
        """
        self.var.cnv.chrom = "X"
        self.var.cnv.sum_x_lr2 = "-6000"
        self.assertTrue(self.var.fails_x_lr2())

        self.var.cnv.sum_x_lr2 = "8000"
        self.assertTrue(self.var.fails_x_lr2())

        self.var.cnv.sum_x_lr2 = "2000"
        self.assertFalse(self.var.fails_x_lr2())

    def test_fails_additional_filters(self):
        """test that fails_additional_filters() works correctly
        """
        self.var.cnv.genotype = "DUP"
        self.var.cnv.format["CIFER_INHERITANCE"] = "maternal_inh"
        self.var.cnv.info["MEANLR2"] = "-2"
        self.var.cnv.info["CONVEXSCORE"] = "10"
        self.var.cnv.info["MADL2R"] = "0.2"
        self.assertFalse(self.var.fails_additional_filters())

        self.var.cnv.genotype = "DEL"
        self.assertFalse(self.var.fails_additional_filters())

        self.var.cnv.format["CIFER_INHERITANCE"] = "not_inherited"
        self.assertTrue(self.var.fails_additional_filters())

        self.var.cnv.info["MADL2R"] = "0.1"
        self.assertTrue(self.var.fails_additional_filters())

        self.var.cnv.info["MEANLR2"] = "-1"
        self.assertFalse(self.var.fails_additional_filters())

        self.var.cnv.info["CONVEXSCORE"] = "20"
        self.assertFalse(self.var.fails_additional_filters())

    def test_fails_cifer_inh(self):
        """test that CNVs in non-trios aren't filtered out on cifer false pos
        but those in trios are filtered out
        """
        self.var.cnv.has_parents = True
        self.var.cnv.format["CIFER_INHERITANCE"] = "false_positive"
        self.assertTrue(self.var.fails_cifer_inh())

        self.var.cnv.has_parents = False
        self.var.cnv.format["CIFER_INHERITANCE"] = "false_positive"
        self.assertFalse(self.var.fails_cifer_inh())
class TestExomeCnvPy(unittest.TestCase):
    """ test the Exome CNV filters
    """
    
    def setUp(self):
        """ define a default VcfInfo object
        """
        
        chrom = "1"
        pos = "15000000"
        snp_id = "."
        ref = "A"
        alt = "<DUP>"
        filt = "PASS"
        
        # set up a SNV object, since SNV inherits VcfInfo
        cnv = CNV(chrom, pos, snp_id, ref, alt, filt)
        self.var = ExomeCNV(cnv)
        
        info = "HGNC=TEST;HGNC_ALL=TEST,OR5A1;CQ=missense_variant;CONVEX;RC50INTERNALFREQ=0.005;COMMONFORWARDS=0.000;MEANLR2=0.5;MADL2R=0.02"
        format_keys = "inheritance:DP"
        sample_values = "deNovo:50"
        
        self.var.cnv.add_info(info)
        self.var.cnv.add_format(format_keys, sample_values)
        self.var.cnv.set_gender("F")
    
    def test_add_cns_state(self):
        """ test that add_cns_state() works correctly
        """
        
        # meanl2r > 0 gives cns of 3
        self.var.cnv.info["MEANLR2"] = "1"
        self.var.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "3")
        
        self.var.cnv.info["MEANLR2"] = "0"
        self.var.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "3")
        
        self.var.cnv.info["MEANLR2"] = "-0.1"
        self.var.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "1")
        
        self.var.cnv.info["MEANLR2"] = "-2"
        self.var.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "1")
        
        self.var.cnv.info["MEANLR2"] = "-2.1"
        self.var.add_cns_state()
        self.assertEqual(self.var.cnv.info["CNS"], "0")
    
    def test_fails_mad_ratio(self):
        """ test that fails_mad_ratio() works correctly
        """
        
        # check that var passes when MAD ratio > 5
        self.var.cnv.info["MEANLR2"] = "0.5"
        self.var.cnv.info["MADL2R"] = "0.02"
        self.assertFalse(self.var.fails_mad_ratio())
        
        # check that var passes when MAD ratio == 5
        self.var.cnv.info["MEANLR2"] = "0.1"
        self.var.cnv.info["MADL2R"] = "0.02"
        self.assertFalse(self.var.fails_mad_ratio())
        
        # check that var fails when MAD ratio < 5
        self.var.cnv.info["MEANLR2"] = "0.09"
        self.var.cnv.info["MADL2R"] = "0.02"
        self.assertTrue(self.var.fails_mad_ratio())
        
        # check that var fails when trying to divide by zero
        self.var.cnv.info["MEANLR2"] = "0.2"
        self.var.cnv.info["MADL2R"] = "0"
        self.assertTrue(self.var.fails_mad_ratio())
    
    def test_fails_population_frequency(self):
        """ test that fails_population_frequency() works correctly
        """
        
        # check that var passes when RC50INTERNALFREQ < 0.01
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.005"
        self.assertFalse(self.var.fails_population_frequency())
        
        # check that var passes when RC50INTERNALFREQ == 0.1
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.01"
        self.assertFalse(self.var.fails_population_frequency())
        
        # check that var fails when RC50INTERNALFREQ > 0.1
        self.var.cnv.info["RC50INTERNALFREQ"] = "0.02"
        self.assertTrue(self.var.fails_population_frequency())
    
    def test_fails_convex_score(self):
        """ test that fails_convex_score() works correctly
        """
        
        # check that var passes when CONVEXSCORE > 7
        self.var.cnv.info["CONVEXSCORE"] = "8"
        self.assertFalse(self.var.fails_convex_score())
        
        # check that var fails when CONVEXSCORE == 7
        self.var.cnv.info["CONVEXSCORE"] = "7"
        self.assertTrue(self.var.fails_convex_score())
        
        # check that var fails when CONVEXSCORE < 7
        self.var.cnv.info["CONVEXSCORE"] = "6"
        self.assertTrue(self.var.fails_convex_score())
    
    def test_fails_commmon_forwards(self):
        """ test that fails_commmon_forwards() works correctly
        """
        
        # check that var passes when COMMONFORWARDS < 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.0"
        self.assertFalse(self.var.fails_commmon_forwards())
        
        # check that var fails when COMMONFORWARDS == 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.8"
        self.assertFalse(self.var.fails_commmon_forwards())
        
        # check that var fails when COMMONFORWARDS > 0.8
        self.var.cnv.info["COMMONFORWARDS"] = "0.9"
        self.assertTrue(self.var.fails_commmon_forwards())
    
    def test_fails_no_exons(self):
        """ test that fails_no_exons() works correctly
        """
        
        self.var.cnv.info["NUMBEREXONS"] = "1"
        self.assertFalse(self.var.fails_no_exons())

        self.var.cnv.info["NUMBEREXONS"] = "0"
        self.assertTrue(self.var.fails_no_exons())