MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / main

Function main

examples/python/sdk/drug_discovery.py:50–391  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48
49
50def main():
51 print("=== GraphLite High-Level SDK Drug Discovery Example ===\n")
52
53 # Step 1: Open database
54 print("1. Opening database...")
55 db_path = "./drug_discovery_highlevel_sdk_db"
56
57 # Clean up old database if exists
58 if os.path.exists(db_path):
59 shutil.rmtree(db_path)
60
61 try:
62 # Using high-level SDK: .open() static method
63 db = GraphLite.open(db_path)
64 print(" ✓ Database opened\n")
65
66 # Step 2: Create session
67 print("2. Creating session...")
68 # Using high-level SDK: returns Session object (not session ID)
69 session = db.session("researcher")
70 print(" ✓ Session created\n")
71
72 # Step 3: Setup schema and graph
73 print("3. Setting up schema and graph...")
74 # Using high-level SDK: execute() method on session object
75 session.execute("CREATE SCHEMA IF NOT EXISTS /drug_discovery")
76 session.execute("SESSION SET SCHEMA /drug_discovery")
77 session.execute("CREATE GRAPH IF NOT EXISTS pharma_research")
78 session.execute("SESSION SET GRAPH pharma_research")
79 print(" ✓ Schema and graph configured\n")
80
81 # Step 4: Insert data
82 print("4. Inserting pharmaceutical data...")
83
84 # Insert Proteins (Disease Targets)
85 print(" → Inserting target proteins...")
86 session.execute("""INSERT
87 (:Protein {
88 id: 'TP53',
89 name: 'Tumor Protein P53',
90 disease: 'Cancer',
91 function: 'Tumor suppressor',
92 gene_location: '17p13.1'
93 }),
94 (:Protein {
95 id: 'EGFR',
96 name: 'Epidermal Growth Factor Receptor',
97 disease: 'Cancer',
98 function: 'Cell growth and division',
99 gene_location: '7p11.2'
100 }),
101 (:Protein {
102 id: 'ACE2',
103 name: 'Angiotensin-Converting Enzyme 2',
104 disease: 'Hypertension',
105 function: 'Blood pressure regulation',
106 gene_location: 'Xp22.2'
107 }),

Callers 1

drug_discovery.pyFile · 0.70

Calls 5

existsMethod · 0.45
openMethod · 0.45
sessionMethod · 0.45
executeMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected