Skip to content

Commit

Permalink
adding cached results
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbie1977 committed Aug 11, 2024
1 parent abf64a9 commit 698a0e0
Show file tree
Hide file tree
Showing 2 changed files with 210 additions and 210 deletions.
252 changes: 57 additions & 195 deletions snippets/.ipynb_checkpoints/VFB_connect_Quick_Guide-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/local/anaconda3/lib/python3.10/site-packages/pandas/core/arrays/masked.py:60: UserWarning: Pandas requires version '1.3.6' or newer of 'bottleneck' (version '1.3.5' currently installed).\n",
" from pandas.core import (\n"
]
}
],
"source": [
"from vfb_connect.cross_server_tools import VfbConnect\n",
"\n",
Expand All @@ -14,176 +23,26 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'term': {'core': {'short_form': 'VFB_00010001',\n",
" 'label': 'fru-F-500075',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFB_00010001',\n",
" 'types': ['Individual',\n",
" 'VFB',\n",
" '_Individual',\n",
" 'NBLAST',\n",
" 'Neuron',\n",
" 'Anatomy',\n",
" 'Cell',\n",
" 'Entity']},\n",
" 'description': ['A(n) neuron expressing Scer\\\\GAL4[fru.P1.D] that is part of a female Scer\\\\GAL4[fru.P1.D] expression pattern.'],\n",
" 'comment': ['OutAge: Adult 5~15 days']},\n",
" 'query': 'Get JSON for Individual:Anatomy',\n",
" 'version': '0f4d3af',\n",
" 'dataset_license': [{'dataset': {'link': 'http://flybase.org/reports/FBrf0210580.html',\n",
" 'core': {'short_form': 'Chiang2010',\n",
" 'label': 'FlyCircuit 1.0 - single neurons (Chiang2010)',\n",
" 'iri': 'http://virtualflybrain.org/reports/Chiang2010',\n",
" 'types': ['Individual', 'DataSet', 'Entity']}},\n",
" 'license': {'icon': '',\n",
" 'link': '',\n",
" 'core': {'short_form': 'VFBlicense_FlyCircuit_License',\n",
" 'label': 'FlyCircuit License',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFBlicense_FlyCircuit_License',\n",
" 'types': ['Individual', 'License', 'Entity']}}}],\n",
" 'parents': [{'short_form': 'FBbt_00050031',\n",
" 'label': 'adult SMPpv1 lineage neuron',\n",
" 'iri': 'http://purl.obolibrary.org/obo/FBbt_00050031',\n",
" 'types': ['Class',\n",
" 'VFB',\n",
" '_Class',\n",
" 'Neuron',\n",
" 'Anatomy',\n",
" 'Cell',\n",
" 'Entity',\n",
" 'Leaf_node']}],\n",
" 'relationships': [{'relation': {'label': 'member_of',\n",
" 'iri': 'http://purl.obolibrary.org/obo/RO_0002350',\n",
" 'type': 'member_of'},\n",
" 'object': {'short_form': 'VFB_00017636',\n",
" 'label': 'cluster 3.97',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFB_00017636',\n",
" 'types': ['Individual', 'VFB', '_Individual', 'Entity', 'Cluster']}},\n",
" {'relation': {'label': 'expresses',\n",
" 'iri': 'http://purl.obolibrary.org/obo/RO_0002292',\n",
" 'type': 'expresses'},\n",
" 'object': {'short_form': 'FBal0276838',\n",
" 'label': 'Scer\\\\GAL4[fru.P1.D]',\n",
" 'iri': 'http://flybase.org/reports/FBal0276838',\n",
" 'types': ['Class', 'VFB', '_Class', 'Entity', 'Feature']}},\n",
" {'relation': {'label': 'part of',\n",
" 'iri': 'http://purl.obolibrary.org/obo/BFO_0000050',\n",
" 'type': 'part_of'},\n",
" 'object': {'short_form': 'VFBexp_FBal0276838',\n",
" 'label': 'Scer\\\\GAL4[fru.P1.D] expression pattern',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFBexp_FBal0276838',\n",
" 'types': ['Class', 'VFB', '_Class', 'Expression_pattern', 'Entity']}},\n",
" {'relation': {'label': 'part of',\n",
" 'iri': 'http://purl.obolibrary.org/obo/BFO_0000050',\n",
" 'type': 'part_of'},\n",
" 'object': {'short_form': 'FBbt_00007011',\n",
" 'label': 'female organism',\n",
" 'iri': 'http://purl.obolibrary.org/obo/FBbt_00007011',\n",
" 'types': ['Class', 'VFB', '_Class', 'Anatomy', 'Entity']}},\n",
" {'relation': {'label': 'part of',\n",
" 'iri': 'http://purl.obolibrary.org/obo/BFO_0000050',\n",
" 'type': 'part_of'},\n",
" 'object': {'short_form': 'FBbt_00003624',\n",
" 'label': 'adult brain',\n",
" 'iri': 'http://purl.obolibrary.org/obo/FBbt_00003624',\n",
" 'types': ['Class', 'VFB', '_Class', 'Anatomy', 'Entity']}},\n",
" {'relation': {'label': 'overlaps',\n",
" 'iri': 'http://purl.obolibrary.org/obo/RO_0002131',\n",
" 'type': 'overlaps'},\n",
" 'object': {'short_form': 'FBbt_00007055',\n",
" 'label': 'superior medial protocerebrum',\n",
" 'iri': 'http://purl.obolibrary.org/obo/FBbt_00007055',\n",
" 'types': ['Class',\n",
" 'VFB',\n",
" '_Class',\n",
" 'Synaptic_neuropil',\n",
" 'Synaptic_neuropil_domain',\n",
" 'Anatomy',\n",
" 'Entity']}},\n",
" {'relation': {'label': 'overlaps',\n",
" 'iri': 'http://purl.obolibrary.org/obo/RO_0002131',\n",
" 'type': 'overlaps'},\n",
" 'object': {'short_form': 'FBbt_00045050',\n",
" 'label': 'flange',\n",
" 'iri': 'http://purl.obolibrary.org/obo/FBbt_00045050',\n",
" 'types': ['Class',\n",
" 'VFB',\n",
" '_Class',\n",
" 'Synaptic_neuropil',\n",
" 'Synaptic_neuropil_domain',\n",
" 'Anatomy',\n",
" 'Entity']}}],\n",
" 'xrefs': [{'link_base': 'http://flycircuit.tw/modules.php?name=clearpage&op=detail_table&neuron=',\n",
" 'icon': '',\n",
" 'link_postfix': '',\n",
" 'site': {'short_form': 'FlyCircuit',\n",
" 'label': 'FlyCircuit',\n",
" 'iri': 'http://virtualflybrain.org/reports/FlyCircuit',\n",
" 'types': ['Individual', 'Site', 'Entity']},\n",
" 'accession': 'fru-F-500075',\n",
" 'link_text': 'fru-F-500075 on FlyCircuit',\n",
" 'homepage': 'http://flycircuit.tw'}],\n",
" 'channel_image': [{'channel': {'short_form': 'VFBc_00010001',\n",
" 'label': 'fru-F-500075-c',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFBc_00010001',\n",
" 'types': ['Individual', 'VFB', 'Entity']},\n",
" 'imaging_technique': {'short_form': 'FBbi_00000251',\n",
" 'label': 'confocal microscopy',\n",
" 'iri': 'http://purl.obolibrary.org/obo/FBbi_00000251',\n",
" 'types': ['Class', '_Class', 'FBBI', 'Entity']},\n",
" 'image': {'template_channel': {'short_form': 'VFBc_00017894',\n",
" 'label': 'JFRC2_template_c',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFBc_00017894',\n",
" 'types': ['Individual', 'VFB', 'Template', 'Entity']},\n",
" 'template_anatomy': {'short_form': 'VFB_00017894',\n",
" 'label': 'adult brain template JFRC2',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFB_00017894',\n",
" 'types': ['Individual',\n",
" 'VFB',\n",
" '_Individual',\n",
" 'Template',\n",
" 'Anatomy',\n",
" 'Entity']},\n",
" 'image_folder': 'http://www.virtualflybrain.org/data/VFB/i/0001/0001/',\n",
" 'index': []}},\n",
" {'channel': {'short_form': 'VFBc_00010001',\n",
" 'label': 'fru-F-500075-c',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFBc_00010001',\n",
" 'types': ['Individual', 'VFB', 'Entity']},\n",
" 'imaging_technique': {'short_form': 'FBbi_00000251',\n",
" 'label': 'confocal microscopy',\n",
" 'iri': 'http://purl.obolibrary.org/obo/FBbi_00000251',\n",
" 'types': ['Class', '_Class', 'FBBI', 'Entity']},\n",
" 'image': {'template_channel': {'short_form': 'VFBc_00101567',\n",
" 'label': 'JRC2018Unisex_c',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFBc_00101567',\n",
" 'types': ['Individual', 'Template', 'Entity']},\n",
" 'template_anatomy': {'short_form': 'VFB_00101567',\n",
" 'label': 'JRC2018Unisex',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFB_00101567',\n",
" 'types': ['Individual',\n",
" 'VFB',\n",
" '_Individual',\n",
" 'Template',\n",
" 'Anatomy',\n",
" 'Entity']},\n",
" 'image_folder': 'http://www.virtualflybrain.org/data/VFB/i/0001/0001/VFB_00101567/',\n",
" 'index': []}}],\n",
" 'related_individuals': [{'relation': {'label': 'member_of',\n",
" 'iri': 'http://purl.obolibrary.org/obo/RO_0002350',\n",
" 'type': 'member_of'},\n",
" 'object': {'short_form': 'VFB_00017636',\n",
" 'label': 'cluster 3.97',\n",
" 'iri': 'http://virtualflybrain.org/reports/VFB_00017636',\n",
" 'types': ['Individual', 'VFB', '_Individual', 'Entity', 'Cluster']}}]}]"
"[{'label': 'fru-F-500075',\n",
" 'symbol': '',\n",
" 'id': 'VFB_00010001',\n",
" 'tags': 'Entity|Adult|Anatomy|Cell|Expression_pattern_fragment|Individual|Nervous_system|Neuron|VFB|has_image|FlyCircuit|NBLAST',\n",
" 'parents_label': 'expression pattern fragment|adult SMPpv1 lineage neuron',\n",
" 'parents_id': 'VFBext_0000004|FBbt_00050031',\n",
" 'data_source': 'FlyCircuit',\n",
" 'accession': 'fru-F-500075',\n",
" 'templates': 'JRC2018Unisex|adult brain template JFRC2',\n",
" 'dataset': 'Chiang2010',\n",
" 'license': ''}]"
]
},
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -200,47 +59,50 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"dict_keys(['term', 'query', 'version', 'dataset_license', 'parents', 'relationships', 'xrefs', 'channel_image', 'related_individuals'])"
"[{'label': 'fru-F-500075',\n",
" 'symbol': '',\n",
" 'id': 'VFB_00010001',\n",
" 'tags': 'Entity|Adult|Anatomy|Cell|Expression_pattern_fragment|Individual|Nervous_system|Neuron|VFB|has_image|FlyCircuit|NBLAST',\n",
" 'parents_label': 'expression pattern fragment|adult SMPpv1 lineage neuron',\n",
" 'parents_id': 'VFBext_0000004|FBbt_00050031',\n",
" 'data_source': 'FlyCircuit',\n",
" 'accession': 'fru-F-500075',\n",
" 'templates': 'JRC2018Unisex|adult brain template JFRC2',\n",
" 'dataset': 'Chiang2010',\n",
" 'license': ''}]"
]
},
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"vc.neo_query_wrapper.get_TermInfo(['VFB_00010001'])[0].keys()"
"vc.neo_query_wrapper.get_TermInfo(['VFB_00010001'])"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'link_base': 'http://flycircuit.tw/modules.php?name=clearpage&op=detail_table&neuron=',\n",
" 'icon': '',\n",
" 'link_postfix': '',\n",
" 'site': {'short_form': 'FlyCircuit',\n",
" 'label': 'FlyCircuit',\n",
" 'iri': 'http://virtualflybrain.org/reports/FlyCircuit',\n",
" 'types': ['Individual', 'Site', 'Entity']},\n",
" 'accession': 'fru-F-500075',\n",
" 'link_text': 'fru-F-500075 on FlyCircuit',\n",
" 'homepage': 'http://flycircuit.tw'}]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
"ename": "TypeError",
"evalue": "QueryWrapper.get_TermInfo() got an unexpected keyword argument 'summary'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[5], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mvc\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mneo_query_wrapper\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_TermInfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mVFB_00010001\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msummary\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mxrefs\u001b[39m\u001b[38;5;124m'\u001b[39m]\n",
"File \u001b[0;32m/usr/local/anaconda3/lib/python3.10/site-packages/vfb_connect/neo/query_wrapper.py:39\u001b[0m, in \u001b[0;36mbatch_query.<locals>.wrapper_batch\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 37\u001b[0m arglist[\u001b[38;5;241m1\u001b[39m] \u001b[38;5;241m=\u001b[39m c\n\u001b[1;32m 38\u001b[0m subargs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mtuple\u001b[39m(arglist)\n\u001b[0;32m---> 39\u001b[0m out\u001b[38;5;241m.\u001b[39mextend(\u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43msubargs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 40\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m arg1typ \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mk\u001b[39m\u001b[38;5;124m'\u001b[39m:\n\u001b[1;32m 41\u001b[0m kwargdict \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mdict\u001b[39m(kwargs)\n",
"\u001b[0;31mTypeError\u001b[0m: QueryWrapper.get_TermInfo() got an unexpected keyword argument 'summary'"
]
}
],
"source": [
Expand All @@ -249,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -294,7 +156,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -338,7 +200,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -429,7 +291,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -460,7 +322,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -495,7 +357,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -536,7 +398,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -632,7 +494,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.10.9"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 698a0e0

Please sign in to comment.