Example #1
0
 def test_gene_fusion(self):
     """Test serialization of a gene fusion to BEL with a explicit fusion ranges."""
     dsl = gene_fusion(gene('HGNC', 'TMPRSS2'), gene('HGNC', 'ERG'),
                       fusion_range('c', 1, 79),
                       fusion_range('c', 312, 5034))
     self.assertEqual(
         'g(fus(HGNC:TMPRSS2, "c.1_79", HGNC:ERG, "c.312_5034"))',
         dsl.as_bel())
Example #2
0
 def test_rna_fusion_specified(self):
     node = rna_fusion(partner_5p=rna(namespace='HGNC', name='TMPRSS2'),
                       range_5p=fusion_range('r', 1, 79),
                       partner_3p=rna(namespace='HGNC', name='ERG'),
                       range_3p=fusion_range('r', 312, 5034))
     self.assertEqual(
         'r(fus(HGNC:TMPRSS2, "r.1_79", HGNC:ERG, "r.312_5034"))',
         str(node))
Example #3
0
    def test_names_fusions(self):
        """Test that names inside fusions are still found by the iterator."""
        graph = BELGraph()
        graph.namespace_url['HGNC'] = 'http://dummy'

        node = protein_fusion(partner_5p=protein(name='A', namespace='HGNC'),
                              range_5p=fusion_range('p', 1, 15),
                              partner_3p=protein(name='B', namespace='HGNC'),
                              range_3p=fusion_range('p', 1, 100))

        graph.add_node_from_data(node)

        result = {
            'A': 1,
            'B': 1,
        }

        self.assertEqual(set(result), get_names_by_namespace(graph, 'HGNC'))
        self.assertEqual(result, count_names_by_namespace(graph, 'HGNC'))
Example #4
0
 def test_canonicalize_fusion_range_dsl(self):
     """Test canonicalization of enumerated fusion ranges."""
     self.assertEqual('p.1_15', str(fusion_range('p', 1, 15)))
     self.assertEqual('p.*_15', str(fusion_range('p', '*', 15)))