|
129 | 129 | "# 1. Standard library imports\n", |
130 | 130 | "import sys\n", |
131 | 131 | "\n", |
132 | | - "sys.path.append(\"/home/ecarreno/SSC-Projects/b_REPOSITORIES/ontograph\")\n", |
| 132 | + "sys.path.append('/home/ecarreno/SSC-Projects/b_REPOSITORIES/ontograph')\n", |
133 | 133 | "\n", |
134 | 134 | "from pathlib import Path\n", |
135 | 135 | "\n", |
|
167 | 167 | "metadata": {}, |
168 | 168 | "outputs": [], |
169 | 169 | "source": [ |
170 | | - "cache_dir = Path(\"../data/out\")" |
| 170 | + "cache_dir = Path('../data/out')" |
171 | 171 | ] |
172 | 172 | }, |
173 | 173 | { |
|
266 | 266 | "source": [ |
267 | 267 | "# This function looks if the given ontology has a link with a given extension\n", |
268 | 268 | "\n", |
269 | | - "print(\"Link: {}\".format(onto_registry.get_download_url(\"chebi\", \"obo\")))" |
| 269 | + "print('Link: {}'.format(onto_registry.get_download_url('chebi', 'obo')))" |
270 | 270 | ] |
271 | 271 | }, |
272 | 272 | { |
|
282 | 282 | "metadata": {}, |
283 | 283 | "outputs": [], |
284 | 284 | "source": [ |
285 | | - "print(onto_registry.get_available_formats(ontology_id=\"chebi\"))" |
| 285 | + "print(onto_registry.get_available_formats(ontology_id='chebi'))" |
286 | 286 | ] |
287 | 287 | }, |
288 | 288 | { |
|
326 | 326 | "source": [ |
327 | 327 | "# Put the ontologies and their formats as a dictionary\n", |
328 | 328 | "resources = [\n", |
329 | | - " {\"name_id\": \"chebi\", \"format\": \"owl\"},\n", |
330 | | - " {\"name_id\": \"go\", \"format\": \"obo\"},\n", |
331 | | - " {\"name_id\": \"ado\", \"format\": \"owl\"},\n", |
| 329 | + " {'name_id': 'chebi', 'format': 'owl'},\n", |
| 330 | + " {'name_id': 'go', 'format': 'obo'},\n", |
| 331 | + " {'name_id': 'ado', 'format': 'owl'},\n", |
332 | 332 | "]\n", |
333 | 333 | "\n", |
334 | 334 | "# Use the downloader, it has a cache in case you have already downloaded the ontologies.\n", |
335 | 335 | "batch_results = downloader.fetch_batch(resources)\n", |
336 | 336 | "\n", |
337 | 337 | "# Print all the paths where your ontologies are located\n", |
338 | | - "print(\"Ontologies in cache:\")\n", |
| 338 | + "print('Ontologies in cache:')\n", |
339 | 339 | "for ontology_name, ontology_path in batch_results.items():\n", |
340 | | - " print(f\"\\t{ontology_name}: {ontology_path}\")" |
| 340 | + " print(f'\\t{ontology_name}: {ontology_path}')" |
341 | 341 | ] |
342 | 342 | }, |
343 | 343 | { |
|
376 | 376 | "metadata": {}, |
377 | 377 | "outputs": [], |
378 | 378 | "source": [ |
379 | | - "name_id_go = \"go\"\n", |
380 | | - "format_go = \"obo\"\n", |
| 379 | + "name_id_go = 'go'\n", |
| 380 | + "format_go = 'obo'\n", |
381 | 381 | "\n", |
382 | 382 | "gene_ontology = ontology_loader.load(name_id=name_id_go, format=format_go)\n", |
383 | 383 | "\n", |
384 | | - "print(f\"Loaded ontology: {name_id_go}.{format_go}\")\n", |
385 | | - "print(f\"Number of terms: {len(gene_ontology.terms())}\")" |
| 384 | + "print(f'Loaded ontology: {name_id_go}.{format_go}')\n", |
| 385 | + "print(f'Number of terms: {len(gene_ontology.terms())}')" |
386 | 386 | ] |
387 | 387 | }, |
388 | 388 | { |
|
400 | 400 | "source": [ |
401 | 401 | "# term_id = \"GO:0008150\" # biological_process\n", |
402 | 402 | "# term_id = \"GO:0160266\" # anestrus phase\n", |
403 | | - "term_id = \"GO:0070360\" # symbiont-mediated actin polymerization-dependent cell-to-cell migration in host" |
| 403 | + "term_id = 'GO:0070360' # symbiont-mediated actin polymerization-dependent cell-to-cell migration in host" |
404 | 404 | ] |
405 | 405 | }, |
406 | 406 | { |
|
412 | 412 | "queries = OntologyQueries(gene_ontology)\n", |
413 | 413 | "\n", |
414 | 414 | "# Print term relations\n", |
415 | | - "print(f\"Term: {term_id}\")\n", |
416 | | - "print(f\" Parents : {queries.ancestors(term_id)}\")\n", |
417 | | - "print(f\" Children : {queries.descendants(term_id)}\")\n", |
| 415 | + "print(f'Term: {term_id}')\n", |
| 416 | + "print(f' Parents : {queries.ancestors(term_id)}')\n", |
| 417 | + "print(f' Children : {queries.descendants(term_id)}')\n", |
418 | 418 | "\n", |
419 | 419 | "\n", |
420 | 420 | "# print(f\" Ancestors : {queries.ancestors(term_id)}\")\n", |
|
458 | 458 | "outputs": [], |
459 | 459 | "source": [ |
460 | 460 | "# Load the ontogragh catalog of ontologies\n", |
461 | | - "onto_registry = op.registry(\"../data/out\")" |
| 461 | + "onto_registry = op.registry('../data/out')" |
462 | 462 | ] |
463 | 463 | }, |
464 | 464 | { |
|
508 | 508 | "outputs": [], |
509 | 509 | "source": [ |
510 | 510 | "# You can get the metadata of each ontology and store it in a variable. At the same time, you can print it using `show_metadata=True`\n", |
511 | | - "go_metadata = onto_registry.get_ontology_metadata(\"go\", show_metadata=True)" |
| 511 | + "go_metadata = onto_registry.get_ontology_metadata('go', show_metadata=True)" |
512 | 512 | ] |
513 | 513 | }, |
514 | 514 | { |
|
518 | 518 | "outputs": [], |
519 | 519 | "source": [ |
520 | 520 | "# The catalog contains different formats for the same ontology. You can verify all the formats available for a specific ontology.\n", |
521 | | - "onto_registry.get_available_formats(\"chebi\")" |
| 521 | + "onto_registry.get_available_formats('chebi')" |
522 | 522 | ] |
523 | 523 | }, |
524 | 524 | { |
|
0 commit comments