Beispiel #1
0
def gene_families(ctx, enrich_authors, use_edge_store, debug):
    """Caches the HGNC Gene Family memberships"""
    set_debug_param(debug)
    graph = from_url(GENE_FAMILIES, manager=ctx.obj)
    if enrich_authors:
        fix_pubmed_citations(graph)
    ctx.obj.insert_graph(graph, store_parts=use_edge_store)
Beispiel #2
0
def named_complexes(ctx, enrich_authors, use_edge_store, debug):
    """Caches GO Named Protein Complexes memberships"""
    set_debug_param(debug)
    graph = from_url(NAMED_COMPLEXES, manager=ctx.obj)
    if enrich_authors:
        fix_pubmed_citations(graph)
    ctx.obj.insert_graph(graph, store_parts=use_edge_store)
Beispiel #3
0
 def ensure_large_corpus():
     """Parses the large corpus"""
     graph = from_url(LARGE_CORPUS_URL,
                      manager=manager,
                      citation_clearing=False,
                      allow_nested=True)
     return try_insert_graph(manager, graph, api)
Beispiel #4
0
 def ensure_small_corpus():
     """Parses and stores the small corpus"""
     graph = from_url(SMALL_CORPUS_URL,
                      manager=manager,
                      citation_clearing=False,
                      allow_nested=True)
     return try_insert_graph(manager, graph, api)
Beispiel #5
0
 def ensure_abstract3():
     """Parses and stores Selventa Example 3"""
     url = 'http://resources.openbel.org/belframework/20150611/knowledge/full_abstract3.bel'
     graph = from_url(url,
                      manager=manager,
                      citation_clearing=False,
                      allow_nested=True)
     return try_insert_graph(manager, graph, api)
Beispiel #6
0
def large_corpus(ctx, enrich_authors, use_edge_store, debug):
    """Caches the Selventa Large Corpus"""
    set_debug_param(debug)
    graph = from_url(LARGE_CORPUS_URL,
                     manager=ctx.obj,
                     citation_clearing=False,
                     allow_nested=True)
    if enrich_authors:
        fix_pubmed_citations(graph)
    ctx.obj.insert_graph(graph, store_parts=use_edge_store)
Beispiel #7
0
def help_ensure(debug, url, enrich_authors, manager):
    set_debug_param(debug)
    from pybel import from_url
    graph = from_url(SMALL_CORPUS_URL,
                     manager=manager,
                     citation_clearing=False,
                     allow_nested=True)
    if enrich_authors:
        from .mutation.metadata import enrich_pubmed_citations
        enrich_pubmed_citations(graph, manager=manager)
    manager.insert_graph(graph, store_parts=True)
Beispiel #8
0
    def setUpClass(cls):
        """Set up this class with several pre-loaded BEL graphs."""
        super(TestInterchange, cls).setUpClass()

        with mock_bel_resources:
            cls.thorough_graph = from_path(test_bel_thorough,
                                           manager=cls.manager,
                                           allow_nested=True)
            cls.slushy_graph = from_path(test_bel_slushy, manager=cls.manager)
            cls.simple_graph = from_url(Path(test_bel_simple).as_uri(),
                                        manager=cls.manager)
            cls.isolated_graph = from_path(test_bel_isolated,
                                           manager=cls.manager)
            cls.misordered_graph = from_path(test_bel_misordered,
                                             manager=cls.manager,
                                             citation_clearing=False)
Beispiel #9
0
    def setUp(self):
        if 'PYBEL_BASE' in os.environ:
            test_bel_simple_path = os.path.join(os.environ['PYBEL_BASE'], 'tests', 'bel', 'test_bel.bel')
            self.graph = pybel.from_path(test_bel_simple_path)
        else:
            test_bel_simple_url = 'https://raw.githubusercontent.com/pybel/pybel/develop/tests/bel/test_bel.bel'
            self.graph = pybel.from_url(test_bel_simple_url)

        infer_central_dogma(self.graph)

        n1 = GENE, 'HGNC', 'AKT1'
        n2 = RNA, 'HGNC', 'EGFR'

        n3 = GENE, 'HGNC', 'DUMMY1'
        self.graph.add_simple_node(*n3)

        n4 = GENE, 'HGNC', 'DUMMY2'
        self.graph.add_simple_node(*n4)

        self.graph.add_edge(n1, n3)
        self.graph.add_edge(n2, n4)
Beispiel #10
0
def main(connection):
    """Parse a network, load it to the database, then test how fast it drops."""
    manager = pybel.Manager(connection)

    if os.path.exists(PICKLE):
        print(f'opening from {PICKLE}')
        graph = pybel.from_pickle(PICKLE)
    else:
        with time_me(f'opening from {SMALL_CORPUS_URL}'):

            graph = pybel.from_url(SMALL_CORPUS_URL, manager=manager, use_tqdm=True, citation_clearing=False)

        pybel.to_pickle(graph, PICKLE)

    n = 1
    # FIXME this fails if you do it with the same manager

    times = [
        get_numbers(graph, manager)
        for _ in range(n)
    ]

    print(times)
    print(sum(times) / n)
Beispiel #11
0
 def get_simple_graph(mock_get):
     return from_url(Path(test_bel_simple).as_uri(),
                     manager=cls.manager)
Beispiel #12
0
 def ensure_gfam():
     """Parses and stores the HGNC Gene Family Definitions"""
     graph = from_url(FRAUNHOFER_RESOURCES + 'gfam_members.bel',
                      manager=manager)
     return try_insert_graph(manager, graph, api)
Beispiel #13
0
 def ensure_simple():
     """Parses and stores the PyBEL Test BEL Script"""
     url = 'https://raw.githubusercontent.com/pybel/pybel/develop/tests/bel/test_bel.bel'
     graph = from_url(url, manager=manager)
     return try_insert_graph(manager, graph, api)