|
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", |
136 | 136 | "# 2. Related third party imports\n", |
137 | | - "import pronto\n", |
138 | | - "\n", |
139 | 137 | "# 3. Local application/library specific imports\n", |
140 | 138 | "from ontograph.downloader import PoochDownloaderAdapter\n", |
141 | 139 | "from ontograph.ontology_query import OntologyQueries\n", |
|
158 | 156 | "metadata": {}, |
159 | 157 | "outputs": [], |
160 | 158 | "source": [ |
161 | | - "cache_dir = Path(\"../data/out\")" |
| 159 | + "cache_dir = Path('../data/out')" |
162 | 160 | ] |
163 | 161 | }, |
164 | 162 | { |
|
224 | 222 | "metadata": {}, |
225 | 223 | "outputs": [], |
226 | 224 | "source": [ |
227 | | - "for index, ontology in enumerate(onto_registry.list_available_ontologies()):\n", |
| 225 | + "for ontology in onto_registry.list_available_ontologies():\n", |
228 | 226 | " print(ontology)" |
229 | 227 | ] |
230 | 228 | }, |
|
243 | 241 | "source": [ |
244 | 242 | "# This function looks if the given ontology has a link with a given extension\n", |
245 | 243 | "\n", |
246 | | - "print(\"Link: {}\".format(onto_registry.get_download_url(\"chebi\", \"obo\")))" |
| 244 | + "print('Link: {}'.format(onto_registry.get_download_url('chebi', 'obo')))" |
247 | 245 | ] |
248 | 246 | }, |
249 | 247 | { |
|
259 | 257 | "metadata": {}, |
260 | 258 | "outputs": [], |
261 | 259 | "source": [ |
262 | | - "print(onto_registry.get_available_formats(ontology_id=\"chebi\"))" |
| 260 | + "print(onto_registry.get_available_formats(ontology_id='chebi'))" |
263 | 261 | ] |
264 | 262 | }, |
265 | 263 | { |
|
303 | 301 | "source": [ |
304 | 302 | "# Put the ontologies and their formats as a dictionary\n", |
305 | 303 | "resources = [\n", |
306 | | - " {\"name_id\": \"chebi\", \"format\": \"owl\"},\n", |
307 | | - " {\"name_id\": \"go\", \"format\": \"obo\"},\n", |
308 | | - " {\"name_id\": \"ado\", \"format\": \"owl\"},\n", |
| 304 | + " {'name_id': 'chebi', 'format': 'owl'},\n", |
| 305 | + " {'name_id': 'go', 'format': 'obo'},\n", |
| 306 | + " {'name_id': 'ado', 'format': 'owl'},\n", |
309 | 307 | "]\n", |
310 | 308 | "\n", |
311 | 309 | "# Use the downloader, it has a cache in case you have already downloaded the ontologies.\n", |
312 | 310 | "batch_results = downloader.fetch_batch(resources)\n", |
313 | 311 | "\n", |
314 | 312 | "# Print all the paths where your ontologies are located\n", |
315 | | - "print(\"Ontologies in cache:\")\n", |
| 313 | + "print('Ontologies in cache:')\n", |
316 | 314 | "for ontology_name, ontology_path in batch_results.items():\n", |
317 | | - " print(f\"\\t{ontology_name}: {ontology_path}\")" |
| 315 | + " print(f'\\t{ontology_name}: {ontology_path}')" |
318 | 316 | ] |
319 | 317 | }, |
320 | 318 | { |
|
353 | 351 | "metadata": {}, |
354 | 352 | "outputs": [], |
355 | 353 | "source": [ |
356 | | - "name_id_go = \"go\"\n", |
357 | | - "format_go = \"obo\"\n", |
| 354 | + "name_id_go = 'go'\n", |
| 355 | + "format_go = 'obo'\n", |
358 | 356 | "\n", |
359 | 357 | "gene_ontology = ontology_loader.load(name_id=name_id_go, format=format_go)\n", |
360 | 358 | "\n", |
361 | | - "print(f\"Loaded ontology: {name_id_go}.{format_go}\")\n", |
362 | | - "print(f\"Number of terms: {len(gene_ontology.terms())}\")" |
| 359 | + "print(f'Loaded ontology: {name_id_go}.{format_go}')\n", |
| 360 | + "print(f'Number of terms: {len(gene_ontology.terms())}')" |
363 | 361 | ] |
364 | 362 | }, |
365 | 363 | { |
|
377 | 375 | "source": [ |
378 | 376 | "# term_id = \"GO:0008150\" # biological_process\n", |
379 | 377 | "# term_id = \"GO:0160266\" # anestrus phase\n", |
380 | | - "term_id = \"GO:0070360\" # symbiont-mediated actin polymerization-dependent cell-to-cell migration in host" |
| 378 | + "term_id = 'GO:0070360' # symbiont-mediated actin polymerization-dependent cell-to-cell migration in host" |
381 | 379 | ] |
382 | 380 | }, |
383 | 381 | { |
|
389 | 387 | "queries = OntologyQueries(gene_ontology)\n", |
390 | 388 | "\n", |
391 | 389 | "# Print term relations\n", |
392 | | - "print(f\"Term: {term_id}\")\n", |
393 | | - "print(f\" Parents : {queries.parents(term_id)}\")\n", |
394 | | - "print(f\" Children : {queries.children(term_id)}\")\n", |
| 390 | + "print(f'Term: {term_id}')\n", |
| 391 | + "print(f' Parents : {queries.parents(term_id)}')\n", |
| 392 | + "print(f' Children : {queries.children(term_id)}')\n", |
395 | 393 | "\n", |
396 | 394 | "\n", |
397 | 395 | "# print(f\" Ancestors : {queries.ancestors(term_id)}\")\n", |
|
0 commit comments