|
82 | 82 | "source": [ |
83 | 83 | "node_schema = []\n", |
84 | 84 | "node_pattern = \"(?P<directory>.+)/(?P<label>.+)\\.(?P<entity>.+)\\.csv\"\n", |
85 | | - "for filename in glob(\"csv/*.nodes.csv\"):\n", |
| 85 | + "for filename in glob(\"csv_jakleen/*.nodes.csv\"):\n", |
86 | 86 | " match = re.match(node_pattern, filename).groupdict()\n", |
87 | 87 | " label = match[\"label\"].replace(\"_\", \" \")\n", |
88 | 88 | " df = pd.read_csv(filename)\n", |
|
185 | 185 | "edge_schema = []\n", |
186 | 186 | "edge_pattern = \"(?P<directory>.+)/(?P<source_type>.+)\\.(?P<relation>.+)\\.(?P<target_type>.+)\\.(?P<entity>.+)\\.csv\"\n", |
187 | 187 | "\n", |
188 | | - "for filename in glob(\"csv/*.edges.csv\"):\n", |
| 188 | + "for filename in glob(\"csv_jakleen/*.edges.csv\"):\n", |
189 | 189 | " match = re.match(edge_pattern, filename).groupdict()\n", |
190 | 190 | " entity = match[\"entity\"]\n", |
191 | 191 | " source_type = match[\"source_type\"]\n", |
|
223 | 223 | " " |
224 | 224 | ] |
225 | 225 | }, |
| 226 | + { |
| 227 | + "cell_type": "code", |
| 228 | + "execution_count": 4, |
| 229 | + "metadata": {}, |
| 230 | + "outputs": [ |
| 231 | + { |
| 232 | + "data": { |
| 233 | + "text/plain": [ |
| 234 | + "2" |
| 235 | + ] |
| 236 | + }, |
| 237 | + "execution_count": 4, |
| 238 | + "metadata": {}, |
| 239 | + "output_type": "execute_result" |
| 240 | + } |
| 241 | + ], |
| 242 | + "source": [ |
| 243 | + "len(edge_schema)" |
| 244 | + ] |
| 245 | + }, |
226 | 246 | { |
227 | 247 | "attachments": {}, |
228 | 248 | "cell_type": "markdown", |
|
242 | 262 | }, |
243 | 263 | { |
244 | 264 | "cell_type": "code", |
245 | | - "execution_count": 4, |
| 265 | + "execution_count": null, |
246 | 266 | "metadata": {}, |
247 | 267 | "outputs": [], |
248 | 268 | "source": [ |
249 | | - "title = \"Enrichr-KG\"\n", |
| 269 | + "# First you need to modify this based on your dataset. \n", |
| 270 | + "# This will be the initial query that the users will see when visiting your site\n", |
| 271 | + "initial_query = {\n", |
| 272 | + "\t\"start\": \"Gene\",\n", |
| 273 | + "\t\"start_term\": \"APOE\",\n", |
| 274 | + "\t\"start_field\": \"label\"\n", |
| 275 | + "}" |
| 276 | + ] |
| 277 | + }, |
| 278 | + { |
| 279 | + "cell_type": "code", |
| 280 | + "execution_count": 5, |
| 281 | + "metadata": {}, |
| 282 | + "outputs": [], |
| 283 | + "source": [ |
| 284 | + "title = \"Demo-KG\"\n", |
250 | 285 | "icon = \"https://minio.dev.maayanlab.cloud/enrichr-kg/enrichr-kg.png\"\n", |
251 | 286 | "rest = {\n", |
252 | 287 | " \"header\": {\n", |
|
273 | 308 | "\t\t\t\t\"component\": \"KnowledgeGraph\",\n", |
274 | 309 | "\t\t\t\t\"props\": {\n", |
275 | 310 | "\t\t\t\t\t\"init_function\": \"initialize_kg\",\n", |
276 | | - "\t\t\t\t\t\"initial_query\": {\n", |
277 | | - "\t\t\t\t\t\t\"start\": \"Gene\",\n", |
278 | | - "\t\t\t\t\t\t\"start_term\": \"APOE\",\n", |
279 | | - "\t\t\t\t\t\t\"start_field\": \"label\"\n", |
280 | | - "\t\t\t\t\t},\n", |
| 311 | + "\t\t\t\t\t\"initial_query\": initial_query,\n", |
281 | 312 | "\t\t\t\t\t\"subheader\": {\n", |
282 | 313 | "\t\t\t\t\t\t\"url_field\": \"filter\",\n", |
283 | 314 | "\t\t\t\t\t\t\"query_field\": \"relation\"\n", |
|
356 | 387 | }, |
357 | 388 | { |
358 | 389 | "cell_type": "code", |
359 | | - "execution_count": 5, |
| 390 | + "execution_count": 6, |
360 | 391 | "metadata": {}, |
361 | 392 | "outputs": [], |
362 | 393 | "source": [ |
|
366 | 397 | " **rest\n", |
367 | 398 | "}\n", |
368 | 399 | "\n", |
369 | | - "with open(\"../schema.json\", 'w') as o:\n", |
| 400 | + "with open(\"../schema_sample.json\", 'w') as o:\n", |
370 | 401 | " o.write(json.dumps(schema, indent=4))" |
371 | 402 | ] |
372 | 403 | }, |
|
480 | 511 | "docker-compose up\n", |
481 | 512 | "```\n", |
482 | 513 | "you can check http://localhost:3000 again\n", |
483 | | - "\n" |
| 514 | + "\n", |
| 515 | + "```\n", |
| 516 | + "# push to dockerhub\n", |
| 517 | + "docker-compose push kg\n", |
| 518 | + "```" |
484 | 519 | ] |
485 | 520 | }, |
486 | 521 | { |
|
0 commit comments