How to use the pybel.dsl.Protein function in pybel

To help you get started, we’ve selected a few pybel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pybel / pybel / tests / test_struct / test_filters / test_struct_filters.py View on Github external
def test_all_filter_no_query(self):
        """Test that the all filter returns true when there's no argument"""
        graph = BELGraph()
        graph.add_increases(Protein(n(), n()), Protein(n(), n()), citation=n(), evidence=n())
        self.assertEqual(1, count_passed_edge_filter(graph, build_annotation_dict_all_filter({})))
github pybel / pybel / tests / test_dsl.py View on Github external
def test_missing_information(self):
        """Test that entity and abundance functions raise on missing name/identifier."""
        with self.assertRaises(ValueError):
            Entity(namespace='test')

        with self.assertRaises(ValueError):
            Protein(namespace='test')

        with self.assertRaises(ValueError):
            Protein(namespace='')

        with self.assertRaises(TypeError):
            Protein(namespace='uniprot', name=1234)

        with self.assertRaises(TypeError):
            Protein(namespace='uniprot', identifier=1234)

        with self.assertRaises(ValueError):
            Protein(namespace='uniprot', name='')

        with self.assertRaises(ValueError):
            Protein(namespace='uniprot', identifier='')

        with self.assertRaises(ValueError):
            Protein(namespace='uniprot', identifier='12345', name='')

        with self.assertRaises(ValueError):
            Protein(namespace='uniprot', identifier='', name='123')
github pybel / pybel / tests / constant_helper.py View on Github external
),
    Abundance('CHEBI', '(3S)-3-hydroxy-3-methylglutaryl-CoA'),
    Abundance('CHEBI', 'NADPH'),
    Abundance('CHEBI', 'hydron'),
    Abundance('CHEBI', 'mevalonate'),
    Abundance('CHEBI', 'NADP(+)'),
    Abundance('CHEBI', 'nitric oxide'),
    ComplexAbundance([
        Protein('HGNC', 'ITGAV'),
        Protein('HGNC', 'ITGB3')
    ]),
    Protein('HGNC', 'ITGAV'),
    Protein('HGNC', 'ITGB3'),
    Protein('HGNC', 'FADD'),
    Abundance('TESTNS2', 'Abeta_42'),
    Protein('TESTNS2', 'GSK3 Family'),
    Protein('HGNC', 'PRKCA'),
    Protein('HGNC', 'CDK5'),
    Protein('HGNC', 'CASP8'),
    Protein('HGNC', 'AKT1',
            variants=ProteinModification(namespace='TESTNS2', name='PhosRes', code='Ser', position=473)),
    Protein('HGNC', 'HRAS', variants=ProteinModification('Palm')),
    BiologicalProcess('GO', 'apoptotic process'),
    CompositeAbundance([
        Abundance('TESTNS2', 'Abeta_42'),
        Protein('HGNC', 'CASP8'),
        Protein('HGNC', 'FADD')
    ]),
    Reaction(
        reactants=[Protein('HGNC', 'CDK5R1')],
        products=[Protein('HGNC', 'CDK5')],
    ),
github pybel / pybel / tests / constant_helper.py View on Github external
CompositeAbundance([
        Abundance('TESTNS2', 'Abeta_42'),
        Protein('HGNC', 'CASP8'),
        Protein('HGNC', 'FADD')
    ]),
    Reaction(
        reactants=[Protein('HGNC', 'CDK5R1')],
        products=[Protein('HGNC', 'CDK5')],
    ),
    Protein('HGNC', 'PRKCB'),
    NamedComplexAbundance('TESTNS2', 'AP-1 Complex'),
    Protein('HGNC', 'PRKCE'),
    Protein('HGNC', 'PRKCD'),
    Protein('TESTNS2', 'CAPN Family'),
    Gene('TESTNS2', 'AKT1 ortholog'),
    Protein('HGNC', 'HRAS'),
    Protein('HGNC', 'CDK5R1'),
    Protein('TESTNS2', 'PRKC'),
    BiologicalProcess('GO', 'neuron apoptotic process'),
    Protein('HGNC', 'MAPT', variants=ProteinModification('Ph')),
    Protein('HGNC', 'MAPT'),
    Gene('HGNC', 'ARRDC2'),
    Gene('HGNC', 'ARRDC3'),
    Gene('dbSNP', 'rs123456')
}

BEL_THOROUGH_EDGES = [
    (Gene('HGNC', 'AKT1', variants=Hgvs('p.Phe508del')), akt1, {
        EVIDENCE: dummy_evidence,
        CITATION: citation_1,
        RELATION: DIRECTLY_DECREASES,
    }),
github pybel / pybel / tests / test_io / test_cx / examples.py View on Github external
from pybel import BELGraph
from pybel.constants import CITATION_TYPE_OTHER, HAS_VARIANT
from pybel.dsl import (
    ComplexAbundance, Protein, abundance, activity, bioprocess, gene, gmod, named_complex_abundance, pathology, pmod,
    protein_fusion, protein_substitution, reaction, rna,
)
from pybel.language import citation_dict

example_graph = BELGraph()

ptk2 = Protein(namespace='hgnc', name='PTK2', variants=pmod('Ph', 'Tyr', 925))
mapk1 = Protein(namespace='hgnc', name='MAPK1')
mapk3 = Protein(namespace='hgnc', name='MAPK3')
grb2 = Protein(namespace='hgnc', name='GRB2')
sos1 = Protein(namespace='hgnc', name='SOS1')
ptk2_rgb2_sos1 = ComplexAbundance([mapk1, grb2, sos1])

ras_family = Protein(namespace='fplx', name='RAS')
pi3k_complex = named_complex_abundance(namespace='fplx', name='p85/p110 PI3Kinase Complex')

kinase_activity = activity('kin')
catalytic_activity = activity('cat')
gtp_activity = activity('gtp')

c1 = '10446041'
e1 = "FAK also combines with, and may activate, phosphoinositide 3-OH kinase (PI 3-kinase), either directly or " \
     "through the Src kinase (13). Finally, there is evidence that Src phosphorylates FAK at Tyr925, creating a" \
     " binding site for the complex of the adapter Grb2 and Ras guanosine 5'-triphosphate exchange factor mSOS (10)." \
     " These interactions link FAK to signaling pathways that modify the cytoskeleton and activate mitogen-activated" \
     " protein kinase (MAPK) cascades (Fig. 3A)."
github pybel / pybel / tests / constant_helper.py View on Github external
},
    }),
    (RnaFusion(Rna('HGNC', 'CHCHD4'), Rna('HGNC', 'AIFM1'), ),
     ComplexAbundance([Protein('HGNC', 'FOS'), Protein('HGNC', 'JUN')]),
     {
         EVIDENCE: dummy_evidence,
         CITATION: citation_1,
         RELATION: INCREASES,
     }),
    (CompositeAbundance([interleukin_23_complex, il6]),
     BiologicalProcess('GO', 'cell cycle arrest'), {
         EVIDENCE: dummy_evidence,
         CITATION: citation_1,
         RELATION: DECREASES,
     }),
    (Protein('HGNC', 'CAT'), hydrogen_peroxide, {
        EVIDENCE: 'These were all explicitly stated in the BEL 2.0 Specification',
        CITATION: citation_2,
        RELATION: DIRECTLY_DECREASES,
        SUBJECT: {LOCATION: {NAMESPACE: 'GO', NAME: 'intracellular'}},
    }),
    (Gene('HGNC', 'CAT'), hydrogen_peroxide, {
        EVIDENCE: 'These were all explicitly stated in the BEL 2.0 Specification',
        CITATION: citation_2,
        RELATION: DIRECTLY_DECREASES,
        SUBJECT: {LOCATION: {NAMESPACE: 'GO', NAME: 'intracellular'}},
    }),
    (Protein('HGNC', 'HMGCR'), BiologicalProcess('GO', 'cholesterol biosynthetic process'), {
        EVIDENCE: 'These were all explicitly stated in the BEL 2.0 Specification',
        CITATION: citation_2,
        RELATION: RATE_LIMITING_STEP_OF,
        SUBJECT: {MODIFIER: ACTIVITY, EFFECT: {NAMESPACE: BEL_DEFAULT_NAMESPACE, NAME: 'cat'}},
github pybel / pybel / tests / test_manager / test_manager_graph.py View on Github external
def test_subject_activity_custom(self, mock):
        p1_name = n()
        p2_name = n()
        dummy_activity_namespace = n()
        dummy_activity_name = n()

        self.graph.add_increases(
            Protein(name=p1_name, namespace='HGNC'),
            Protein(name=p2_name, namespace='HGNC'),
            evidence=n(),
            citation=n(),
            source_modifier=activity(name=dummy_activity_name, namespace=dummy_activity_namespace),
        )

        make_dummy_namespaces(self.manager, self.graph)

        network = self.manager.insert_graph(self.graph)
        self.assertEqual(2, network.nodes.count())
        self.assertEqual(1, network.edges.count())

        kin_list = self.manager.session.query(NamespaceEntry).filter(NamespaceEntry.name == dummy_activity_name).all()
        self.assertEqual(1, len(kin_list))

        kin = list(kin_list)[0]
github pybel / pybel / tests / test_io / test_cx / examples.py View on Github external
# -*- coding: utf-8 -*-

"""Example BEL graphs for testing PyBEL-CX."""

from pybel import BELGraph
from pybel.constants import CITATION_TYPE_OTHER, HAS_VARIANT
from pybel.dsl import (
    ComplexAbundance, Protein, abundance, activity, bioprocess, gene, gmod, named_complex_abundance, pathology, pmod,
    protein_fusion, protein_substitution, reaction, rna,
)
from pybel.language import citation_dict

example_graph = BELGraph()

ptk2 = Protein(namespace='hgnc', name='PTK2', variants=pmod('Ph', 'Tyr', 925))
mapk1 = Protein(namespace='hgnc', name='MAPK1')
mapk3 = Protein(namespace='hgnc', name='MAPK3')
grb2 = Protein(namespace='hgnc', name='GRB2')
sos1 = Protein(namespace='hgnc', name='SOS1')
ptk2_rgb2_sos1 = ComplexAbundance([mapk1, grb2, sos1])

ras_family = Protein(namespace='fplx', name='RAS')
pi3k_complex = named_complex_abundance(namespace='fplx', name='p85/p110 PI3Kinase Complex')

kinase_activity = activity('kin')
catalytic_activity = activity('cat')
gtp_activity = activity('gtp')

c1 = '10446041'
e1 = "FAK also combines with, and may activate, phosphoinositide 3-OH kinase (PI 3-kinase), either directly or " \
     "through the Src kinase (13). Finally, there is evidence that Src phosphorylates FAK at Tyr925, creating a" \
     " binding site for the complex of the adapter Grb2 and Ras guanosine 5'-triphosphate exchange factor mSOS (10)." \
github pybel / pybel / tests / test_manager / test_manager_graph.py View on Github external
def test_mixed_1(self):
        """Test mixed having location and something else."""
        self.graph.add_increases(
            Protein(namespace='HGNC', name='CDC42'),
            Protein(namespace='HGNC', name='PAK2'),
            evidence="""Summary: PAK proteins, a family of serine/threonine p21-activating kinases, include PAK1, PAK2,
         PAK3 and PAK4. PAK proteins are critical effectors that link Rho GTPases to cytoskeleton reorganization
         and nuclear signaling. They serve as targets for the small GTP binding proteins Cdc42 and Rac and have
         been implicated in a wide range of biological activities. PAK4 interacts specifically with the GTP-bound
         form of Cdc42Hs and weakly activates the JNK family of MAP kinases. PAK4 is a mediator of filopodia
         formation and may play a role in the reorganization of the actin cytoskeleton. Multiple alternatively
         spliced transcript variants encoding distinct isoforms have been found for this gene.""",
            citation={NAMESPACE: "Online Resource", IDENTIFIER: "PAK4 Hs ENTREZ Gene Summary"},
            annotations={'Species': '9606'},
            source_modifier=activity('gtp'),
            target_modifier=activity('kin'),
        )

        make_dummy_namespaces(self.manager, self.graph)
        make_dummy_annotations(self.manager, self.graph)
github pybel / pybel / tests / test_io / test_hipathia / test_export.py View on Github external
import unittest
from typing import Tuple

import pandas as pd

from pybel import BELGraph
from pybel.dsl import ComplexAbundance, Protein
from pybel.io.hipathia import ATT_COLS, to_hipathia_dfs
from pybel.testing.utils import n

PROTEIN_NAMESPACE = 'ncbigene'
FAMILY_NAMESPACE = 'hipathia.family'
a = Protein(namespace='ncbigene', identifier='P001', name='A')
b_family = Protein(namespace='hipathia.family', identifier='F001', name='B_Family')
b1 = Protein(namespace='ncbigene', identifier='P002', name='B1')
b2 = Protein(namespace='ncbigene', identifier='P003', name='B2')
c_family = Protein(namespace='hipathia.family', identifier='F002', name='C_Family')
c1 = Protein(namespace='ncbigene', identifier='P004', name='C1')
c2 = Protein(namespace='ncbigene', identifier='P005', name='C2')
d = Protein(namespace='ncbigene', identifier='P006', name='D')
c_d = ComplexAbundance([c_family, d])
e = Protein(namespace='ncbigene', identifier='P007', name='E')
f = Protein(namespace='ncbigene', identifier='P008', name='F')
e_f = ComplexAbundance([e, f])

name = 'test'


class TestExportHipathia(unittest.TestCase):
    """Test Hipathia."""