Exemplo n.º 1
0
 def test_any_location_deletion(self):
     indel = {
         'TYPE': 'INDEL',
         'REGION': 'CODING',
         'IMPACT': {
             "INDEL_AMOUNT": -5,
             "START": "ANY"
         },
         "ZYGOSITY": "HETEROZYGOUS"
     }
     indel = Indel(indel, self.positive_transcript)
     deletion = indel.get_deletion()
     self.assertEqual(len(deletion["ref"]), 6)
     self.assertEqual(len(deletion["alt"]), 1)
Exemplo n.º 2
0
class InsersionMethodTesting(unittest.TestCase):
    time.sleep(2)
    indel_any = {
        'TYPE': 'INDEL',
        'REGION': 'INTRONIC',
        'IMPACT': {
            "INDEL_AMOUNT": 5,
            "START": "ANY"
        },
        "ZYGOSITY": "HETEROZYGOUS"
    }
    indel_spec = {
        'TYPE': 'INDEL',
        'REGION': 'CODING',
        'IMPACT': {
            "INDEL_AMOUNT": 8,
            "START": 129814200
        },
        "ZYGOSITY": "HETEROZYGOUS"
    }
    SOX9_uid = get_all_transcripts("SOX9", "grch38")[0]["qualifiers"]["uid"]
    positive_transcript = Transcript(SOX9_uid, "grch38")
    TOR1A_uid = get_all_transcripts("TOR1A", "grch38")[0]["qualifiers"]["uid"]
    negative_transcript = Transcript(TOR1A_uid, "grch38")
    indel_any = Indel(indel_any, positive_transcript)
    indel_spec = Indel(indel_spec, negative_transcript)

    # test 7

    def test_check_insertion_generation(self):
        self.assertEqual(len(self.indel_any.get_insertion_str(50)), 50)

    # test 8
    def test_get_insertion_any(self):
        insertion = self.indel_any.get_insertion()
        self.assertEqual(len(insertion["alt"]), 6)

    # test 9
    def test_get_insertion_spec(self):
        insertion = self.indel_spec.get_insertion()
        self.assertEqual(insertion["pos"], 129814199)
        self.assertEqual(len(insertion["alt"]), 9)

    # test 10
    def test_get_insertion_row(self):
        insertion = self.indel_spec.get_vcf_row()
        self.assertEqual(insertion['chrom'], "9")
        self.assertEqual(insertion['pos'], '129814200')
        self.assertEqual(len(insertion['alt']), 9)
        print(insertion)
Exemplo n.º 3
0
 def test_basic_deletion(self):
     indel = {
         'TYPE': 'INDEL',
         'REGION': 'CODING',
         'IMPACT': {
             "INDEL_AMOUNT": -5,
             "START": 72121500
         },
         "ZYGOSITY": "HETEROZYGOUS"
     }
     indel = Indel(indel, self.positive_transcript)
     deletion = indel.get_deletion()
     self.assertEqual(deletion["ref"], "TCGGGC")
     self.assertEqual(deletion["alt"], "T")
     self.assertEqual(deletion["pos"], 72121499)
Exemplo n.º 4
0
 def test_wrong_keys(self):
     indel = {
         "TYPE": "INDEL",
         "REGION": "INTRONIC",
         "check": 5,
         "ZYGOSITY": "HETEROZYGOUS"
     }
     with self.assertRaises(KeyError):
         Indel(indel, self.transcript)
Exemplo n.º 5
0
 def test_location_str(self):
     indel = {
         "TYPE": "INDEL",
         "REGION": "INTRONIC",
         "IMPACT": {
             "INDEL_AMOUNT": 5,
             "START": "four"
         },
         "ZYGOSITY": "HETEROZYGOUS"
     }
     with self.assertRaises(ValueError):
         Indel(indel, self.SOX18).get_vcf_row()
Exemplo n.º 6
0
 def test_type_value_indel(self):
     indel = {
         "TYPE": "SNV",
         "REGION": "INTRONIC",
         "IMPACT": {
             "INDEL_AMOUNT": 8332,
             "START": "ANY"
         },
         "ZYGOSITY": "HETEROZYGOUS"
     }
     with self.assertRaises(ValueError):
         Indel(indel, self.transcript)
Exemplo n.º 7
0
 def test_region_value(self):
     indel = {
         "TYPE": "INDEL",
         "REGION": "TEST",
         "IMPACT": {
             "INDEL_AMOUNT": 5,
             "START": "ANY"
         },
         "ZYGOSITY": "HETEROZYGOUS"
     }
     with self.assertRaises(ValueError):
         Indel(indel, self.transcript)
Exemplo n.º 8
0
 def test_raises_length_over_200(self):
     indel = {
         'TYPE': 'INDEL',
         'REGION': 'CODING',
         'IMPACT': {
             "INDEL_AMOUNT": 570,
             "START": "ANY"
         },
         "ZYGOSITY": "HETEROZYGOUS"
     }
     with self.assertRaises(ValueError):
         Indel(indel, self.positive_transcript).get_deletion()
Exemplo n.º 9
0
 def test_raises_length_greater_than_location(self):
     SOX18_uid = get_all_transcripts("SOX18",
                                     "grch38")[0]["qualifiers"]["uid"]
     SOX18 = Transcript(SOX18_uid, "grch38")
     indel = {
         'TYPE': 'INDEL',
         'REGION': 'INTRONIC',
         'IMPACT': {
             "INDEL_AMOUNT": -150,
             "START": 64049150
         },
         "ZYGOSITY": "HETEROZYGOUS"
     }
     with self.assertRaises(ValueError):
         indel = Indel(indel, SOX18)
Exemplo n.º 10
0
 def make_variant(self, var, transcript):
     if var == "None":
         return None
     var_type = var["TYPE"]
     if var_type == "SNV":
         variant = SNV(var, transcript)
     elif var_type == "INDEL":
         variant = Indel(var, transcript)
     elif var_type == "STR":
         variant = ShortTandemRepeat(var, transcript)
     elif var_type == "MEI":
         variant = MEI(var, transcript)
     elif var_type == "CLINVAR":
         variant = ClinVar(var, transcript)
     elif var_type == "CNV":
         variant = CopyNumberVariant(var, transcript)
     elif var_type == "CLINGEN":
         variant = CopyNumberVariant(var, transcript)
     else:
         variant = Variant(var, transcript)
     return variant