Exemple #1
0
    def test_increases(self):
        """Test composite in subject. See BEL 2.0 specification
        `3.1.1 <http://openbel.org/language/web/version_2.0/bel_specification_version_2.0.html#Xincreases>`_
        """
        statement = 'composite(p(HGNC:CASP8),p(HGNC:FADD),a(CHEBI:"Abeta_42")) -> bp(GO:"neuron apoptotic process")'
        result = self.parser.relation.parseString(statement)

        expected = [[
            COMPOSITE, [PROTEIN, ['HGNC', 'CASP8']],
            [PROTEIN, ['HGNC', 'FADD']], [ABUNDANCE, ['CHEBI', 'Abeta_42']]
        ], INCREASES, [BIOPROCESS, ['GO', 'neuron apoptotic process']]]
        self.assertEqual(expected, result.asList())

        sub_member_1 = protein('HGNC', 'CASP8')
        self.assert_has_node(sub_member_1)

        sub_member_2 = protein('HGNC', 'FADD')
        self.assert_has_node(sub_member_2)

        sub_member_3 = abundance('CHEBI', 'Abeta_42')
        self.assert_has_node(sub_member_3)

        sub = composite_abundance([sub_member_1, sub_member_2, sub_member_3])
        self.assert_has_node(sub)

        self.assert_has_edge(sub_member_1, sub, relation=PART_OF)
        self.assert_has_edge(sub_member_2, sub, relation=PART_OF)
        self.assert_has_edge(sub_member_3, sub, relation=PART_OF)

        obj = bioprocess('GO', 'neuron apoptotic process')
        self.assert_has_node(obj)

        self.assert_has_edge(sub, obj, relation=INCREASES)
Exemple #2
0
    def test_rateLimitingStepOf_subjectActivity(self):
        """3.1.5 http://openbel.org/language/web/version_2.0/bel_specification_version_2.0.html#_ratelimitingstepof"""
        statement = 'act(p(HGNC:HMGCR), ma(cat)) rateLimitingStepOf bp(GO:"cholesterol biosynthetic process")'
        result = self.parser.relation.parseString(statement)

        expected_dict = {
            SOURCE: {
                MODIFIER: ACTIVITY,
                FUNCTION: PROTEIN,
                CONCEPT: {
                    NAMESPACE: 'HGNC',
                    NAME: 'HMGCR',
                },
                EFFECT: activity_mapping['cat'],
            },
            RELATION: RATE_LIMITING_STEP_OF,
            TARGET: {
                FUNCTION: BIOPROCESS,
                CONCEPT: {
                    NAMESPACE: 'GO',
                    NAME: 'cholesterol biosynthetic process',
                },
            }
        }
        self.assertEqual(expected_dict, result.asDict())

        sub = protein('HGNC', 'HMGCR')
        self.assert_has_node(sub)

        obj = bioprocess('GO', 'cholesterol biosynthetic process')
        self.assert_has_node(obj)

        self.assert_has_edge(sub, obj, relation=expected_dict[RELATION])
Exemple #3
0
    def test_multiple(self):
        """Test building a node predicate with multiple functions."""
        f = function_inclusion_filter_builder([GENE, PROTEIN])

        p1 = protein(n(), n())
        g1 = gene(n(), n())
        b1 = bioprocess(n(), n())

        g = BELGraph()
        g.add_node_from_data(p1)
        g.add_node_from_data(g1)
        g.add_node_from_data(b1)

        self.assertIn(p1, g)
        self.assertIn(g1, g)
        self.assertIn(b1, g)

        self.assertTrue(f(g, p1))
        self.assertTrue(f(g, g1))
        self.assertFalse(f(g, b1))

        f = invert_node_predicate(f)

        self.assertFalse(f(g, p1))
        self.assertFalse(f(g, g1))
        self.assertTrue(f(g, b1))
Exemple #4
0
    def test_subProcessOf(self):
        """
        3.4.6 http://openbel.org/language/web/version_2.0/bel_specification_version_2.0.html#_subprocessof
        """
        statement = 'rxn(reactants(a(CHEBI:"(S)-3-hydroxy-3-methylglutaryl-CoA"),a(CHEBI:NADPH), \
            a(CHEBI:hydron)),products(a(CHEBI:mevalonate), a(CHEBI:"CoA-SH"), a(CHEBI:"NADP(+)"))) \
            subProcessOf bp(GO:"cholesterol biosynthetic process")'

        result = self.parser.relation.parseString(statement)
        expected_result = [
            [
                REACTION,
                [
                    [
                        ABUNDANCE,
                        ['CHEBI', '(S)-3-hydroxy-3-methylglutaryl-CoA']
                    ],
                    [ABUNDANCE, ['CHEBI', 'NADPH']],
                    [ABUNDANCE, ['CHEBI', 'hydron']],
                ],
                [
                    [ABUNDANCE, ['CHEBI', 'mevalonate']],
                    [ABUNDANCE, ['CHEBI', 'CoA-SH']],
                    [ABUNDANCE, ['CHEBI', 'NADP(+)']],
                ],
            ],
            SUBPROCESS_OF,
            [BIOPROCESS, ['GO', 'cholesterol biosynthetic process']],
        ]
        self.assertEqual(expected_result, result.asList())

        sub_reactant_1 = abundance('CHEBI',
                                   '(S)-3-hydroxy-3-methylglutaryl-CoA')
        sub_reactant_2 = abundance('CHEBI', 'NADPH')
        sub_reactant_3 = abundance('CHEBI', 'hydron')
        sub_product_1 = abundance('CHEBI', 'mevalonate')
        sub_product_2 = abundance('CHEBI', 'CoA-SH')
        sub_product_3 = abundance('CHEBI', 'NADP(+)')

        self.assert_has_node(sub_reactant_1)
        self.assert_has_node(sub_reactant_2)
        self.assert_has_node(sub_reactant_3)
        self.assert_has_node(sub_product_1)
        self.assert_has_node(sub_product_2)
        self.assert_has_node(sub_product_3)

        sub = reaction([sub_reactant_1, sub_reactant_2, sub_reactant_3],
                       [sub_product_1, sub_product_2, sub_product_3])

        self.assert_has_edge(sub, sub_reactant_1, relation=HAS_REACTANT)
        self.assert_has_edge(sub, sub_reactant_2, relation=HAS_REACTANT)
        self.assert_has_edge(sub, sub_reactant_3, relation=HAS_REACTANT)
        self.assert_has_edge(sub, sub_product_1, relation=HAS_PRODUCT)
        self.assert_has_edge(sub, sub_product_2, relation=HAS_PRODUCT)
        self.assert_has_edge(sub, sub_product_3, relation=HAS_PRODUCT)

        obj = bioprocess('GO', 'cholesterol biosynthetic process')
        self.assert_has_node(obj)

        self.assert_has_edge(sub, obj, **{RELATION: SUBPROCESS_OF})
Exemple #5
0
def map_to_bel_node(graph, node):
    """Create a biological process BEL node.

    :param pybel.BELGraph graph: BEL Graph
    :param graph: BELGraph
    :param dict node: dictionary of node attributes
    :return: corresponding BEL node
    :rtype: pybel.dsl.BaseEntity
    """
    for attribute in node:
        name = attribute['map_name']
        identifier = attribute[KEGG_ID]

        if not name:
            logger.debug(
                f"KEGG API does not provide information about {node}. Using identifier."
            )
            name = identifier

        if name.startswith('TITLE:'):
            name = name[len('TITLE:'):]

        bio_process = bioprocess(namespace=KEGG.upper(),
                                 name=name,
                                 identifier=identifier)
        graph.add_node_from_data(bio_process)
        return bio_process
Exemple #6
0
    def test_simple(self):
        graph = pybel.BELGraph()

        key = 'DGXP'

        a = protein('HGNC', 'A')
        b = protein('HGNC', 'B')
        c = protein('HGNC', 'c')
        d = bioprocess('GOBP', 'D')

        graph.add_node_from_data(a)
        graph.add_node_from_data(b)
        graph.add_node_from_data(c)
        graph.add_node_from_data(d)

        graph.nodes[a][key] = 2
        graph.nodes[b][key] = -1
        graph.nodes[c][key] = 1

        graph.add_increases(a, b, citation=n(), evidence=n())
        graph.add_decreases(b, d, citation=n(), evidence=n())
        graph.add_increases(a, c, citation=n(), evidence=n())
        graph.add_increases(c, d, citation=n(), evidence=n())

        candidate_mechanisms = generate_bioprocess_mechanisms(graph, key)

        self.assertEqual(1, len(candidate_mechanisms))
        self.assertIn(d, candidate_mechanisms)
Exemple #7
0
    def test_nested_lenient(self):
        """Test nested statement (3.1)."""
        self.parser.disallow_nested = False
        statement = 'p(HGNC:CAT) -| (a(CHEBI:"hydrogen peroxide") -> bp(GO:"apoptotic process"))'
        self.parser.relation.parseString(statement)

        cat = protein('HGNC', 'CAT')
        h2o2 = abundance('CHEBI', "hydrogen peroxide")
        apoptosis = bioprocess('GO', "apoptotic process")

        self.assert_has_edge(cat, h2o2)
        self.assert_has_edge(h2o2, apoptosis)
        self.assertEqual(1, len(self.parser.metagraph))
Exemple #8
0
def node_to_bel(node: Dict, hgnc_manager: Manager, pathway_id) -> BaseEntity:
    """Create a BEL node."""
    node_types = node['node_types']
    uri_id = node['uri_id']

    # Get identifier from if exists else use uri_id as identifier
    if 'identifier' in node:
        identifier = node['identifier']
    else:
        identifier = uri_id

    identifier = check_multiple(identifier, 'identifier', pathway_id)

    uri_id = check_multiple(uri_id, 'uri_id', pathway_id)
    _, _, namespace, _ = parse_id_uri(uri_id)

    name = check_multiple(node['name'], 'name', pathway_id)

    # Get dictinoary of multiple identifiers
    if 'identifiers' in node:
        node_ids_dict = node['identifiers']
    else:
        node_ids_dict = node

    if any(node_type in node_types for node_type in ('Protein', 'Rna', 'GeneProduct')):
        namespace, name, identifier = get_valid_gene_identifier(node_ids_dict, hgnc_manager, pathway_id)
        if 'Protein' in node_types:
            return protein(namespace=namespace.upper(), name=name, identifier=identifier)
        elif 'Rna' in node_types:
            return rna(namespace=namespace.upper(), name=name, identifier=identifier)
        else:  # 'GeneProduct' in node_types
            return gene(namespace=HGNC, name=name, identifier=identifier)

    elif 'Metabolite' in node_types:
        # Parse URI to get namespace
        _, _, namespace, _ = parse_id_uri(uri_id)
        return abundance(namespace=namespace.upper(), name=name, identifier=identifier)

    elif '/wikipathways/WP' in str(uri_id) and {'DataNode'} == node_types:
        # Check the uri_id if is a Pathway
        _, _, namespace, _ = parse_id_uri(uri_id)
        return bioprocess(namespace=namespace.upper(), name=name, identifier=identifier)

    elif 'DataNode' in node_types:
        # Parse URI to get namespace
        _, _, namespace, _ = parse_id_uri(uri_id)
        return abundance(namespace=namespace.upper(), name=name, identifier=identifier)

    else:
        logger.debug('Unknown %s [pathway=%s]', node_types, pathway_id)
def test_no_activity_on_bioprocess():
    yfg_agent = Agent('PPP1R13L', db_refs={'HGNC': id('PPP1R13L')})
    apoptosis_agent = Agent('apoptotic process', db_refs={'GO': 'GO:0006915'})

    stmt = Activation(yfg_agent, apoptosis_agent)
    pba = pa.PybelAssembler([stmt])

    belgraph = pba.make_model()
    assert len(belgraph) == 2
    assert belgraph.number_of_edges() == 1

    yfg_pybel = protein('HGNC', 'PPP1R13L')
    apoptosis_pybel = bioprocess('GO', 'GO:0006915')
    assert yfg_pybel in belgraph
    assert apoptosis_pybel in belgraph

    _, _, e = list(belgraph.edges(data=True))[0]
    assert pc.OBJECT not in e
Exemple #10
0
bp(GOBP:"inflammatory response") increases rxn(reactants(p(HGNC:KNG1)),products(a(SCHEM:Kallidin)))
path(SDIS:"tissue damage") increases rxn(reactants(p(HGNC:KNG1)),products(a(SCHEM:Kallidin)))
a(SCHEM:Kallidin) increases cat(p(HGNC:BDKRB1))
cat(p(HGNC:BDKRB1)) increases cat(p(SFAM:"PLA2 Family"))
"""

c4 = {
    CITATION_TYPE: CITATION_TYPE_OTHER,
    CITATION_REFERENCE: 'Genstruct Reference',
}
e4 = '% Entrez Gene summary: Rat: SUMMARY: precursor protein of kinin which is found in plasma; cysteine protease inhibitor and a major acute phase reactant [RGD] OMIM summary: (summary is not available from this source) kininogens; Endogenous peptides present in most body fluids. Certain enzymes convert them to active kinins which are involved in inflammation, blood clotting, complement reactions, etc. Kininogens belong to the cystatin superfamily. They are cysteine proteinase inhibitors. High-molecular-weight kininogen (hmwk) is split by plasma kallikrein to produce bradykinin. Low-molecular-weight kininogen (lmwk) is split by tissue kallikrein to produce kallidin. kinins; Inflammatory mediators that cause dilation of blood vessels and altered vascular permeability.  Kinins are small peptides produced from kininogen by kallikrein and are broken down by kininases. Act on phospholipase and increase arachidonic acid release and thus prostaglandin (PGE2) production. bradykinin; Vasoactive nonapeptide (RPPGFSPFR) formed by action of proteases on kininogens. Very similar to kallidin (which has the same sequence but with an additional N terminal lysine). Bradykinin is a very potent vasodilator and increases permeability of post capillary venules, it acts on endothelial cells to activate phospholipase A2. It is also spasmogenic for some smooth muscle and will cause pain. kallidin; Decapeptide (lysyl bradykinin, amino acid sequence KRPPGFSPFR) produced in kidney. Like bradykinin, an inflammatory mediator (a kinin), causes dilation of renal blood vessels and increased water excretion.'
e4 = str(hash(e4))

bdkrb1 = protein('HGNC', 'BDKRB1')
inflammatory_process = bioprocess('GO', 'inflammatory process')
kng1 = protein('HGNC', 'KNG1')
kallidin = abundance('CHEBI', 'Kallidin')
pla2_family = protein('SFAM', 'PLA2 Family')
kng1_to_kallidin = reaction(reactants=[kng1], products=[kallidin])

example_graph.add_increases(inflammatory_process, kng1_to_kallidin, citation=c4, evidence=e4)
example_graph.add_increases(kallidin, bdkrb1, citation=c4, evidence=e4, object_modifier=catalytic_activity)
example_graph.add_increases(bdkrb1, pla2_family, citation=c4, evidence=e4, subject_modifier=catalytic_activity,
                            object_modifier=catalytic_activity)

c5 = '10866298'
e5 = 'We found that PD180970 inhibited in vivo tyrosine phosphorylation of p210Bcr-Abl (IC50 = 170 nM) and the p210BcrAbl substrates Gab2 and CrkL (IC50 = 80 nM) in human K562 chronic myelogenous leukemic cells. In vitro, PD180970 potently inhibited autophosphorylation of p210Bcr-Abl (IC50 = 5 nM) and the kinase activity of purified recombinant Abl tyrosine kinase (IC50 = 2.2 nM).'

"""
SET Species = 9606
Exemple #11
0
 def test_bioprocess(self):
     node = bioprocess(namespace='GO', name='apoptosis')
     self.assertEqual('bp(GO:apoptosis)', str(node))
Exemple #12
0
    def test_enrich_go_identifier(self):
        """Test lookup by identifier."""
        self.graph.add_node_from_data(
            bioprocess(namespace='GO', identifier='GO:0008283'))

        self.help_test_cell_proliferation(self.graph)
Exemple #13
0
            protein_pathway_url=test_proteins_path,
        )

    @classmethod
    def tearDownClass(cls):
        """Close the connection in the manager and deletes the temporary database."""
        cls.manager.drop_all()
        cls.manager.session.close()
        super().tearDownClass()


protein_a = protein(namespace=HGNC, identifier='4458', name='GPI')
protein_b = protein(namespace=HGNC, identifier='8878', name='PFKP')
gene_c = gene(namespace=HGNC, identifier='8903', name='PGLS')
pathway_a = bioprocess(namespace=KEGG,
                       identifier='hsa00030',
                       name='Pentose phosphate pathway - H**o sapiens (human)')


def enrichment_graph() -> BELGraph:
    """Build a test graph with 2 proteins, one gene, and one kegg pathway all contained in HGNC."""
    graph = BELGraph(
        name='My test graph for enrichment',
        version='0.0.1',
    )
    graph.add_directly_increases(protein_a,
                                 protein_b,
                                 citation='1234',
                                 evidence='asgag')
    graph.add_decreases(protein_b, gene_c, citation='1234', evidence='asgag')
    graph.add_part_of(gene_c, pathway_a)
Exemple #14
0
        # PyBEL manager
        cls.pybel_manager = pybel.Manager(engine=cls.engine, session=cls.session)
        cls.pybel_manager.create_all()

    @classmethod
    def tearDownClass(cls):
        """Close the connection in the manager and deletes the temporary database."""
        cls.session.close()
        super().tearDownClass()


protein_a = protein(namespace=HGNC, name='DNMT1')
protein_b = protein(namespace=HGNC, name='POLA1')
gene_c = gene(namespace=HGNC, name='PGLS')
pathway_a = bioprocess(namespace=WIKIPATHWAYS, name='Codeine and Morphine Metabolism')


def get_enrichment_graph():
    """Build a simple test graph with 2 proteins, one gene, and one kegg pathway all contained in HGNC."""
    graph = BELGraph(
        name='My test graph for enrichment',
        version='0.0.1'
    )

    protein_a_tuple = graph.add_node_from_data(protein_a)
    protein_b_tuple = graph.add_node_from_data(protein_b)
    gene_c_tuple = graph.add_node_from_data(gene_c)
    pathway_a_tuple = graph.add_node_from_data(pathway_a)

    graph.add_edge(protein_a_tuple, protein_b_tuple, attr_dict={
Exemple #15
0
    def test_get_nodes(self):
        """Test nodes."""
        glycolysis_genes, glycolysis_compounds, glycolysis_maps, glycolysis_orthologs = get_entity_nodes(
            tree=self.glycolysis_tree,
            hgnc_manager=self.hgnc_manager,
            chebi_manager=self.chebi_manager,
        )

        notch_genes, notch_compounds, notch_maps, notch_orthologs = get_entity_nodes(
            tree=self.notch_tree,
            hgnc_manager=self.hgnc_manager,
            chebi_manager=self.chebi_manager,
        )
        ppar_genes, ppar_compounds, ppar_maps, ppar_orthologs = get_entity_nodes(
            self.ppar_tree,
            self.hgnc_manager,
            self.chebi_manager,
        )

        glycolysis_nodes = xml_entities_to_bel(
            graph=self.glycolysis_empty_graph,
            genes_dict=glycolysis_genes,
            compounds_dict=glycolysis_compounds,
            maps_dict=glycolysis_maps,
            flattened=False,
        )
        flat_glycolysis_nodes = xml_entities_to_bel(
            graph=self.glycolysis_empty_flatten_graph,
            genes_dict=glycolysis_genes,
            compounds_dict=glycolysis_compounds,
            maps_dict=glycolysis_maps,
            flattened=True,
        )
        notch_nodes = xml_entities_to_bel(
            graph=self.notch_empty_graph,
            genes_dict=notch_genes,
            compounds_dict=notch_compounds,
            maps_dict=notch_maps,
            flattened=False,
        )
        flat_notch_nodes = xml_entities_to_bel(
            graph=self.notch_empty_flatten_graph,
            genes_dict=notch_genes,
            compounds_dict=notch_compounds,
            maps_dict=notch_maps,
            flattened=True,
        )
        ppar_nodes = xml_entities_to_bel(
            graph=self.ppar_empty_graph,
            genes_dict=ppar_genes,
            compounds_dict=ppar_compounds,
            maps_dict=ppar_maps,
            flattened=False,
        )
        flat_ppar_nodes = xml_entities_to_bel(
            graph=self.ppar_empty_flatten_graph,
            genes_dict=ppar_genes,
            compounds_dict=ppar_compounds,
            maps_dict=ppar_maps,
            flattened=True,
        )

        self.assertEqual(len(glycolysis_nodes), 73)
        self.assertEqual(len(flat_glycolysis_nodes), 73)
        self.assertEqual(len(notch_nodes), 24)
        self.assertEqual(len(flat_notch_nodes), 24)

        # Test un-flattened protein nodes
        self.assertEqual(
            glycolysis_nodes['53'],
            composite_abundance([
                protein(namespace=HGNC, name='PKLR', identifier='9020'),
                protein(namespace=HGNC, name='PKM', identifier='9021'),
            ]),
        )
        self.assertEqual(
            notch_nodes['22'],
            composite_abundance([
                protein(namespace=HGNC, name='NOTCH1', identifier='7881'),
                protein(namespace=HGNC, name='NOTCH2', identifier='7882'),
                protein(namespace=HGNC, name='NOTCH3', identifier='7883'),
                protein(namespace=HGNC, name='NOTCH4', identifier='7884'),
            ]),
        )

        # Test flattened list of protein nodes
        self.assertEqual(
            flat_glycolysis_nodes['53'],
            [
                protein(namespace=HGNC, name='PKLR', identifier='9020'),
                protein(namespace=HGNC, name='PKM', identifier='9021'),
            ],
        )
        self.assertEqual(
            flat_notch_nodes['22'],
            [
                protein(namespace=HGNC, name='NOTCH1', identifier='7881'),
                protein(namespace=HGNC, name='NOTCH2', identifier='7882'),
                protein(namespace=HGNC, name='NOTCH3', identifier='7883'),
                protein(namespace=HGNC, name='NOTCH4', identifier='7884'),
            ],
        )

        # Test pathway map nodes
        self.assertEqual(
            flat_glycolysis_nodes['54'],
            bioprocess(
                namespace=KEGG.upper(),
                name='Citrate cycle (TCA cycle)',
                identifier='path:hsa00020',
            ),
        )
        self.assertEqual(
            flat_notch_nodes['4'],
            bioprocess(namespace=KEGG.upper(),
                       name='MAPK signaling pathway',
                       identifier='path:hsa04010'),
        )

        # Test un-flattened compound nodes
        self.assertEqual(
            ppar_nodes['48'],
            composite_abundance([
                abundance(namespace=CHEBI.upper(),
                          name='9(S)-HODE',
                          identifier='	34496'),
                abundance(namespace=CHEBI.upper(),
                          name='13(S)-HODE',
                          identifier='34154'),
            ]),
        )

        # Test flattened compound nodes
        self.assertEqual(
            flat_ppar_nodes['48'],
            [
                abundance(namespace=CHEBI.upper(),
                          name='9(S)-HODE',
                          identifier='	34496'),
                abundance(namespace=CHEBI.upper(),
                          name='13(S)-HODE',
                          identifier='34154'),
            ],
        )
        self.assertEqual(
            flat_glycolysis_nodes['85'],
            abundance(namespace=CHEBI.upper(),
                      name='2-phospho-D-glyceric acid',
                      identifier='17835'),
        )
Exemple #16
0
    def test_enrich_go_identifier_missing_prefix(self):
        """Test lookup by identifier with a missing prefix."""
        self.graph.add_node_from_data(
            bioprocess(namespace='GO', identifier='0008283'))

        self.help_test_cell_proliferation(self.graph)
Exemple #17
0
def node_to_bel(node: Dict, graph, hgnc_manager: HgncManager,
                chebi_manager: ChebiManager, species) -> BaseEntity:
    """Convert node dictionary to BEL node object."""
    node_types = node['entity_type']

    identifier, name, namespace = get_valid_node_parameters(
        node, hgnc_manager, chebi_manager, species)
    members = set()

    if namespace == 'hgnc_multiple_entry':
        return composite_abundance(process_multiple_proteins(identifier))

    elif 'Protein' in node_types:
        return protein(namespace=namespace.upper(),
                       name=name,
                       identifier=identifier)

    elif 'Dna' in node_types:
        return gene(namespace=namespace.upper(),
                    name=name,
                    identifier=identifier)

    elif 'Rna' in node_types:
        return rna(namespace=namespace.upper(),
                   name=name,
                   identifier=identifier)

    elif 'SmallMolecule' in node_types:
        return abundance(namespace=namespace.upper(),
                         name=name,
                         identifier=identifier)

    elif 'PhysicalEntity' in node_types:
        return abundance(namespace=namespace.upper(),
                         name=name,
                         identifier=identifier)

    elif 'Complex' in node_types:
        complex_components = node.get('complex_components')

        if complex_components:
            for component in complex_components:
                bel_node = node_to_bel(component, graph, hgnc_manager,
                                       chebi_manager, species)

                members.add(bel_node)

        if members:
            return complex_abundance(name=node.get('display_name'),
                                     members=members,
                                     identifier=identifier,
                                     namespace=namespace.upper())
        else:
            return NamedComplexAbundance(name=node.get('display_name'),
                                         identifier=identifier,
                                         namespace=namespace.upper())

    elif 'Pathway' in node_types:
        bioprocess_node = bioprocess(identifier=identifier,
                                     name=name,
                                     namespace=namespace.upper())
        graph.add_node_from_data(bioprocess_node)
        return bioprocess_node
    else:
        log.warning('Entity type not recognized', node_types)
Exemple #18
0
    def test_enrich_gobp_name(self):
        """Test lookup by name with an alternative namespace."""
        self.graph.add_node_from_data(
            bioprocess(namespace='GOBP', name='cell proliferation'))

        self.help_test_cell_proliferation(self.graph)