Пример #1
0
    def test_import_causal(self):
        """Check a directly increases."""
        bel_graph = BELGraph()
        bel_graph.add_directly_increases(A,
                                         B,
                                         citation=TEST_CITATION,
                                         evidence=TEST_EVIDENCE)
        bel_graph.add_directly_decreases(B,
                                         C,
                                         citation=TEST_CITATION,
                                         evidence=TEST_EVIDENCE)
        bel_graph.add_negative_correlation(A,
                                           C,
                                           citation=TEST_CITATION,
                                           evidence=TEST_EVIDENCE)
        bel_graph.add_association(A,
                                  D,
                                  citation=TEST_CITATION,
                                  evidence=TEST_EVIDENCE)

        expected = NxMixedGraph.from_edges(
            directed=[
                ('A', 'B'),
                ('B', 'C'),
            ],
            undirected=[
                ('A', 'C'),
            ],
        )
        self.nxmg_equal(expected,
                        bel_to_nxmg(bel_graph, include_associations=False))

        expected = NxMixedGraph.from_edges(
            directed=[
                ('A', 'B'),
                ('B', 'C'),
            ],
            undirected=[
                ('A', 'C'),
                ('A', 'D'),
            ],
        )
        self.nxmg_equal(expected,
                        bel_to_nxmg(bel_graph, include_associations=True))
Пример #2
0
def test_gap():
    sos = protein(name='RASA1', namespace='HGNC')
    kras = protein(name='KRAS', namespace='HGNC')
    g = BELGraph()
    g.add_directly_decreases(sos, kras,
                             subject_modifier=activity(name='activity'),
                             object_modifier=activity(name='gtp'),
                             evidence="Some evidence.", citation='123456')
    pbp = bel.process_pybel_graph(g)
    assert pbp.statements
    assert len(pbp.statements) == 1
    stmt = pbp.statements[0]
    assert isinstance(stmt, Gap)
    assert stmt.gap.name == 'RASA1'
    assert stmt.ras.name == 'KRAS'
    assert stmt.gap.activity.activity_type == 'activity'
    assert stmt.gap.activity.is_active is True
    assert stmt.ras.activity is None
    assert len(pbp.statements[0].evidence) == 1
Пример #3
0
 def _add_to_graph(self, graph: BELGraph, source: pybel.dsl.MicroRna, target: pybel.dsl.Rna) -> str:
     """Add this edge to the BEL graph and return the ket for that edge."""
     return graph.add_directly_decreases(
         source,
         target,
         evidence=str(self.support),
         citation=str(self.reference),
         annotations={
             'Experiment': str(self.experiment),
             'SupportType': str(self.support),
         }
     )
    def test_convert_dephosphorylates(self):
        """Test the conversion of a BEL statement like ``act(p(X)) -| p(Y, pmod(Ph))."""
        bel_graph = BELGraph()
        bel_graph.add_directly_decreases(
            cdk5,
            p_tau,
            evidence=n(),
            citation=n(),
            subject_modifier=activity('kin'),
        )

        r_edge = 0
        expected_reified_graph = self.help_make_simple_expected_graph(
            cdk5,
            p_tau,
            PHOSPHORYLATES,
            r_edge,
            self.help_causal_decreases,
        )

        reified_graph = reify_bel_graph(bel_graph)
        self.help_test_graphs_equal(expected_reified_graph, reified_graph)