<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Loading BEL Documents
We'll always start by importing pybel.
Step1:  First, we'll download and parse a BEL document from the Human Brain Pharmacome project describing the 2018 paper from Boland et al., "Promoting the clearance of neurotoxic proteins in neurodegenerative disorders of ageing".
Step2:  A BEL document can be downloaded and parsed from a URL using pybel.from_bel_script_url. Keep in mind, the first time we load a given BEL document, various BEL resources that are referenced in the document must be cached. Be patient - this can take up to ten minutes.
Step3:  The graph is loaded into an instance of the pybel.BELGraph class. We can use the pybel.BELGraph.summarize() to print a brief summary of the graph.
Step4:  Next, we'll open and parse a BEL document from the Human Brain Pharmacome project describing the 2018 paper from Cabellero et al., "Interplay of pathogenic forms of human tau with different autophagic pathways". This example uses urlretrieve() to download the file locally to demonstrate how to load from a local file path.
Step5:  A BEL document can also be parsed from a path to a file using pybel.from_bel_script. Like before, we will summarize the graph after parsing it.
Step6:  We can combine two or more graphs in a list using pybel.union.
<ASSISTANT_TASK:>
Python Code:
import os
from urllib.request import urlretrieve
import pybel
import logging
logging.getLogger('pybel').setLevel(logging.DEBUG)
logging.basicConfig(level=logging.DEBUG)
logging.getLogger('urllib3').setLevel(logging.WARNING)
print(pybel.get_version())
DESKTOP_PATH = os.path.join(os.path.expanduser('~'), 'Desktop')
manager = pybel.Manager(f'sqlite:///{DESKTOP_PATH}/pybel_example_database.db')
Explanation: Loading BEL Documents
We'll always start by importing pybel.
End of explanation
url = 'https://raw.githubusercontent.com/pharmacome/conib/master/hbp_knowledge/tau/boland2018.bel'
Explanation: First, we'll download and parse a BEL document from the Human Brain Pharmacome project describing the 2018 paper from Boland et al., "Promoting the clearance of neurotoxic proteins in neurodegenerative disorders of ageing".
End of explanation
boland_2018_graph = pybel.from_bel_script_url(url, manager=manager)
pybel.to_database(boland_2018_graph, manager=manager)
Explanation: A BEL document can be downloaded and parsed from a URL using pybel.from_bel_script_url. Keep in mind, the first time we load a given BEL document, various BEL resources that are referenced in the document must be cached. Be patient - this can take up to ten minutes.
End of explanation
boland_2018_graph.summarize()
Explanation: The graph is loaded into an instance of the pybel.BELGraph class. We can use the pybel.BELGraph.summarize() to print a brief summary of the graph.
End of explanation
url = 'https://raw.githubusercontent.com/pharmacome/conib/master/hbp_knowledge/tau/caballero2018.bel'
path = os.path.join(DESKTOP_PATH, 'caballero2018.bel')
if not os.path.exists(path):
    urlretrieve(url, path)
Explanation: Next, we'll open and parse a BEL document from the Human Brain Pharmacome project describing the 2018 paper from Cabellero et al., "Interplay of pathogenic forms of human tau with different autophagic pathways". This example uses urlretrieve() to download the file locally to demonstrate how to load from a local file path.
End of explanation
cabellero_2018_graph = pybel.from_bel_script(path, manager=manager)
cabellero_2018_graph.summarize()
pybel.to_database(cabellero_2018_graph, manager=manager)
Explanation: A BEL document can also be parsed from a path to a file using pybel.from_bel_script. Like before, we will summarize the graph after parsing it.
End of explanation
combined_graph = pybel.union([boland_2018_graph, cabellero_2018_graph])
combined_graph.summarize()
Explanation: We can combine two or more graphs in a list using pybel.union.
End of explanation
<END_TASK>