<jupyter_start><jupyter_text>Covid19 Knowlege graph summary<jupyter_code>import covid19kg
graph = covid19kg.get_graph()
graph.summarize()<jupyter_output>Covid19KG v0.0.1-dev
Number of Nodes: 3954
Number of Edges: 9484
Number of Citations: 185
Number of Authors: 950
Network Density: 6.07E-04
Number of Components: 29
Number of Warnings: 0<jupyter_text>PyBEL functions<jupyter_code>import pybel as pb
dir(pb)<jupyter_output><empty_output><jupyter_text>PyBEL graph methods<jupyter_code>dir(graph)<jupyter_output><empty_output><jupyter_text>BEL Nodes<jupyter_code>for node in graph.nodes:
    print(node)<jupyter_output>a(CHEBI:"(+)-Tetrandrine")
a(CHEBI:"(S)-verapamil")
a(CHEBI:"1-phenyl-1-cyclopentanecarboxylic acid 2-[2-(diethylamino)ethoxy]ethyl ester")
a(CHEBI:"3,3',5'-triiodothyronine")
a(CHEBI:"4'-epidoxorubicin")
a(CHEBI:"4-methylumbelliferone")
a(CHEBI:"5-aza-2'-deoxycytidine")
a(CHEBI:"6-methylprednisolone")
a(CHEBI:"6alpha-methylprednisolone")
a(CHEBI:"Angiotensin (1-9)")
a(CHEBI:"Angiotensin I")
a(CHEBI:"HIV protease inhibitor")
a(CHEBI:"Ile(5)-angiotensin II (1-7)")
a(CHEBI:"Interferon alfa-2a")
a(CHEBI:"Isoniazid pyruvate")
a(CHEBI:"N-benzyloxycarbonyl-L-leucyl-L-leucyl-L-leucinal")
a(CHEBI:"SB 203580")
a(CHEBI:"Sodium salicylate")
a(CHEBI:"Troponin I")
a(CHEBI:"adrenergic antagonist")
a(CHEBI:"allyl methyl disulfide")
a(CHEBI:"amino acid")
a(CHEBI:"ammonium chloride")
a(CHEBI:"angiotensin II")
a(CHEBI:"angiotensin receptor antagonist")
a(CHEBI:"anthra[1,9-cd]pyrazol-6(2H)-one")
a(CHEBI:"antihypertensive agent")
a(CHEBI:"antiviral agent")
a(CHEBI:"antiviral drug")
a(CHEBI:"bafilomycin A1[...]<jupyter_text>BEL Statements<jupyter_code>for item in graph.edges:
    temp = graph.get_edge_data(item[0],item[1],item[2])
    if 'crease' in temp['relation']:
        print(item[0])
        print(temp['relation'])
        print(item[1])
        print()<jupyter_output>a(CHEBI:"4'-epidoxorubicin")
decreases
p(ECCODE:"3.4.22.69")

a(CHEBI:"4-methylumbelliferone")
decreases
p(HGNC:HAS2)

a(CHEBI:"4-methylumbelliferone")
decreases
p(HGNC:HAS2)

a(CHEBI:"4-methylumbelliferone")
decreases
bp(GO:"inflammatory response")

a(CHEBI:"6-methylprednisolone")
decreases
path(DO:"COVID-19")

a(CHEBI:"6alpha-methylprednisolone")
decreases
path(DO:"COVID-19")

a(CHEBI:"6alpha-methylprednisolone")
decreases
path(DO:"COVID-19")

a(CHEBI:"6alpha-methylprednisolone")
decreases
path(MESH:Nausea)

a(CHEBI:"6alpha-methylprednisolone")
decreases
path(MESH:Vomiting)

a(CHEBI:"6alpha-methylprednisolone")
decreases
a(MESH:Cytokines)

a(CHEBI:"Ile(5)-angiotensin II (1-7)")
decreases
path(DO:atherosclerosis)

a(CHEBI:"Ile(5)-angiotensin II (1-7)")
increases
a(MESH:"Endothelial Cells")

a(CHEBI:"Interferon alfa-2a")
decreases
a(MESH:"RNA, Viral")

a(CHEBI:"Interferon alfa-2a")
decreases
bp(MESH:"Virus Replication")

a(CHEBI:"Interferon alfa-2a")
decreases
path(DO:"COVID-19")

a(CH[...]<jupyter_text>BEL to jgif<jupyter_code>pb.to_jgif_file(graph,'covid19kg.jgf')
pb.to_graphdati_file(graph, 'covid19kg.graphdati.json')<jupyter_output><empty_output><jupyter_text>BEL language specification<jupyter_code>import yaml
!wget -c https://raw.githubusercontent.com/belbio/bel_specifications/master/specifications/bel_v2_1_0.yaml
with open("bel_v2_1_0.yaml", 'r') as stream:
    try:
        bel_spec = yaml.safe_load(stream)
        print(bel_spec)
    except yaml.YAMLError as exc:
        print(exc)
from collections import defaultdict
function_categories = defaultdict(list)
info = bel_spec['functions']['info']
for func in info:
    for category in info[func]['categories']:
        function_categories[category].append(func)
function_categories<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15616512764801738, 'fraction_numerical': 0.03068984247691472, 'mean_word_length': 7.939320388349515, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '372334', 'license': 'CC0-1.0', 'n_tokens_mistral': 1703, 'n_tokens_neox': 1498, 'n_words': 215, 'path': 'Covid19kg.ipynb', 'repo_name': 'COVID-19-Causal-Reasoning/covid19kg', 'size': '3682'}