コード例 #1
0
    def test_composite(self, mock):
        interleukin_23_complex = NamedComplexAbundance(
            'GO', 'interleukin-23 complex')
        il6 = hgnc(name='IL6')
        interleukin_23_and_il6 = CompositeAbundance(
            [interleukin_23_complex, il6])

        self._help_reconstitute(interleukin_23_and_il6, 3, 2)
コード例 #2
0
    def test_component_list(self):
        s = 'complex(SCOMP:"C1 Complex") hasComponents list(p(HGNC:C1QB), p(HGNC:C1S))'
        result = self.parser.relation.parseString(s)

        expected_result_list = [[COMPLEX, 'SCOMP', 'C1 Complex'],
                                'hasComponents',
                                [[PROTEIN, 'HGNC', 'C1QB'],
                                 [PROTEIN, 'HGNC', 'C1S']]]
        self.assertEqual(expected_result_list, result.asList())

        sub = named_complex_abundance('SCOMP', 'C1 Complex')
        self.assert_has_node(sub)
        child_1 = hgnc('C1QB')
        self.assert_has_node(child_1)
        self.assert_has_edge(sub, child_1, **{RELATION: HAS_COMPONENT})
        child_2 = hgnc('C1S')
        self.assert_has_node(child_2)
        self.assert_has_edge(sub, child_2, **{RELATION: HAS_COMPONENT})
コード例 #3
0
    def test_component_list(self):
        s = 'complex(FPLX:C1) hasComponents list(p(HGNC:C1QB), p(HGNC:C1S))'
        result = self.parser.relation.parseString(s)

        expected_result_list = [[COMPLEX, ['FPLX', 'C1']], 'hasComponents',
                                [
                                    [PROTEIN, ['HGNC', 'C1QB']],
                                    [PROTEIN, ['HGNC', 'C1S']],
                                ]]
        self.assertEqual(expected_result_list, result.asList())

        sub = named_complex_abundance('FPLX', 'C1')
        self.assert_has_node(sub)
        child_1 = hgnc(name='C1QB')
        self.assert_has_node(child_1)
        self.assert_has_edge(child_1, sub, **{RELATION: PART_OF})
        child_2 = hgnc(name='C1S')
        self.assert_has_node(child_2)
        self.assert_has_edge(child_2, sub, **{RELATION: PART_OF})
コード例 #4
0
ファイル: constants.py プロジェクト: ZeroDesigner/pybel
test_citation_dict = {
    CITATION_TYPE: 'PubMed',
    CITATION_NAME: 'TestName',
    CITATION_REFERENCE: '1235813'
}
SET_CITATION_TEST = 'SET Citation = {{"{type}","{name}","{reference}"}}'.format(
    **test_citation_dict)
test_evidence_text = 'I read it on Twitter'
test_set_evidence = 'SET Evidence = "{}"'.format(test_evidence_text)

HGNC_KEYWORD = 'HGNC'
HGNC_URL = hbp_namespace('hgnc')
MESH_DISEASES_KEYWORD = 'MeSHDisease'
MESH_DISEASES_URL = OPENBEL_ANNOTATION_RESOURCES + "mesh-diseases.belanno"

akt1 = hgnc(name='AKT1')
egfr = hgnc(name='EGFR')
fadd = hgnc(name='FADD')
casp8 = hgnc(name='CASP8')


def update_provenance(control_parser: ControlParser) -> None:
    """Put a default evidence and citation in a BEL parser."""
    control_parser.citation.update(test_citation_dict)
    control_parser.evidence = test_evidence_text


def assert_has_node(self: unittest.TestCase, node: BaseEntity, graph: BELGraph,
                    **kwargs):
    """Check if a node with the given properties is contained within a graph."""
    self.assertIsInstance(node, BaseEntity)
コード例 #5
0
    METADATA_NAME: "PyBEL Test Thorough",
    METADATA_DESCRIPTION: "Statements made up to contain many conceivable variants of nodes from BEL",
    METADATA_VERSION: "1.0.0",
    METADATA_COPYRIGHT: "Copyright (c) Charles Tapley Hoyt. All Rights Reserved.",
    METADATA_AUTHORS: "Charles Tapley Hoyt",
    METADATA_LICENSES: "WTF License",
    METADATA_CONTACT: "*****@*****.**",
}

citation_1 = citation_dict(db=CITATION_TYPE_PUBMED, db_id='123455')
citation_2 = citation_dict(db=CITATION_TYPE_PUBMED, db_id='123456')

evidence_1 = "Evidence 1"
dummy_evidence = 'These are mostly made up'

akt1 = hgnc(name='AKT1')
egfr = hgnc(name='EGFR')
fadd = hgnc(name='FADD')
casp8 = hgnc(name='CASP8')
mia = hgnc(name='MIA')

il6 = Protein('HGNC', 'IL6')

adgrb1 = Protein(namespace='HGNC', name='ADGRB1')
adgrb2 = Protein(namespace='HGNC', name='ADGRB2')
adgrb_complex = ComplexAbundance([adgrb1, adgrb2])
achlorhydria = Pathology(namespace='MESHD', name='Achlorhydria')

akt1_rna = akt1.get_rna()
akt1_gene = akt1_rna.get_gene()
akt_methylated = akt1_gene.with_variants(GeneModification('Me'))
コード例 #6
0
from pybel.testing.cases import FleetingTemporaryCacheMixin, TemporaryCacheClsMixin, TemporaryCacheMixin
from pybel.testing.constants import test_bel_simple
from pybel.testing.mocks import mock_bel_resources
from pybel.testing.utils import make_dummy_annotations, make_dummy_namespaces, n
from tests.constants import (
    BelReconstitutionMixin,
    akt1,
    casp8,
    egfr,
    expected_test_simple_metadata,
    fadd,
    test_citation_dict,
    test_evidence_text,
)

fos = hgnc(name='FOS')
jun = hgnc(name='JUN')
mirna_1 = mirbase(name=n())
mirna_2 = mirbase(name=n())
pathology_1 = Pathology('DO', n())
ap1_complex = ComplexAbundance([fos, jun])

egfr_dimer = ComplexAbundance([egfr, egfr])

yfg_data = hgnc(name='YFG')
e2f4_data = hgnc(name='E2F4')
bound_ap1_e2f4 = ComplexAbundance([ap1_complex, e2f4_data])

superoxide = chebi(name='superoxide')
hydrogen_peroxide = chebi(name='hydrogen peroxide')
oxygen = chebi(name='oxygen')
コード例 #7
0
from pybel.testing.cases import FleetingTemporaryCacheMixin, TemporaryCacheClsMixin, TemporaryCacheMixin
from pybel.testing.constants import test_bel_simple
from pybel.testing.mocks import mock_bel_resources
from pybel.testing.utils import make_dummy_annotations, make_dummy_namespaces, n
from tests.constants import (
    BelReconstitutionMixin,
    akt1,
    casp8,
    egfr,
    expected_test_simple_metadata,
    fadd,
    test_citation_dict,
    test_evidence_text,
)

fos = hgnc('FOS')
jun = hgnc('JUN')
mirna_1 = mirbase(n())
mirna_2 = mirbase(n())
pathology_1 = Pathology('DO', n())
ap1_complex = ComplexAbundance([fos, jun])

egfr_dimer = ComplexAbundance([egfr, egfr])

yfg_data = hgnc('YFG')
e2f4_data = hgnc('E2F4')
bound_ap1_e2f4 = ComplexAbundance([ap1_complex, e2f4_data])

superoxide = chebi('superoxide')
hydrogen_peroxide = chebi('hydrogen peroxide')
oxygen = chebi('oxygen')
コード例 #8
0
ファイル: test_mapping.py プロジェクト: pybel/pybel-tools
# -*- coding: utf-8 -*-

import unittest

from pybel import BELGraph
from pybel.dsl import ComplexAbundance, Fragment, Protein
from pybel.dsl.namespaces import hgnc
from pybel_tools.selection.group_nodes import get_mapped_nodes

ccl2 = hgnc(name='CCL2')
ccr2 = hgnc(name='CCR2')
ccl2_mgi = Protein('MGI', 'Ccl2')
ccl2_ccr2_complex = ComplexAbundance([ccl2, ccr2])
chemokine_family = Protein('FPLX', 'chemokine protein family')

HGNC = 'hgnc'


class TestMapping(unittest.TestCase):
    def test_variants_mapping(self):
        graph = BELGraph()

        app = Protein(HGNC, 'APP')
        app_fragment = app.with_variants(Fragment('1_49'))
        graph.add_node_from_data(app_fragment)

        mapped_nodes = get_mapped_nodes(graph, HGNC, {'APP'})

        self.assertEqual(1, len(mapped_nodes))
        self.assertIn(app, mapped_nodes)
        self.assertEqual({app_fragment}, mapped_nodes[app])