Commit e233a8a 1 parent 645cbfe commit e233a8a Copy full SHA for e233a8a
File tree 4 files changed +38
-1
lines changed
examples/03_data_features
4 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 16
16
import sphinx_rtd_theme # this import must be kept to make sphinx_rtd_theme function
17
17
import sphinx_autopackagesummary # this import must be kept to make autopackagesummary function
18
18
19
+ print ("sphinx-rtd-theme:" , sphinx_rtd_theme .__version__ )
20
+ print ("sphinx-autopackagesummary" , sphinx_autopackagesummary .__version__ )
21
+
19
22
os .environ ['SIIBRA_LOG_LEVEL' ] = "ERROR"
20
23
sys .path .insert (0 , os .path .abspath (".." ))
21
24
print ("Path:" , sys .path )
22
25
26
+
23
27
def is_allen_api_microarray_service_available ():
24
28
import requests
25
-
29
+
26
30
# see https://community.brain-map.org/t/human-brain-atlas-api/2876
27
31
microarray_test_url = "http://api.brain-map.org/api/v2/data/query.json?criteria= service::human_microarray_expression[probes$eq1023146,1023147][donors$eq15496][structures$eq9148]"
28
32
try :
@@ -31,6 +35,7 @@ def is_allen_api_microarray_service_available():
31
35
return False
32
36
return response ["success" ]
33
37
38
+
34
39
# -- Project information -----------------------------------------------------
35
40
36
41
project = "siibra-python"
Original file line number Diff line number Diff line change 138
138
# For example, the gene expressions retrieved from the Allen atlas are linked by the coordinate
139
139
# For example, the gene expressions retrieved from the Allen atlas are linked by the coordinate
140
140
# of their tissue probes in MNI space. If a coordinate is inside the selected brain regions, it is an exact match.
141
+ #
142
+ # .. warning::
143
+ # The service "web API of the Allen Brain Atlas for the human microarray expression"
144
+ # is not available at the moment, therefore siibra is not able to fetch
145
+ # gene expression features. This is a known issue which we are investigating:
146
+ # https://github.com/FZJ-INM1-BDA/siibra-python/issues/636.
147
+ #
141
148
features = siibra .features .get (v1 , siibra .features .molecular .GeneExpressions , gene = "TAC1" )
142
149
print (features [0 ].last_match_description )
Original file line number Diff line number Diff line change 17
17
Gene expressions
18
18
~~~~~~~~~~~~~~~~
19
19
20
+ .. warning::
21
+ The service "web API of the Allen Brain Atlas for the human microarray expression"
22
+ is not available at the moment, therefore siibra is not able to fetch
23
+ gene expression features. This is a known issue which we are investigating:
24
+ https://github.com/FZJ-INM1-BDA/siibra-python/issues/636.
25
+
20
26
``siibra`` can query gene expression data from the Allen brain atlas. The gene
21
27
expressions are linked to atlas regions by coordinates of their probes in MNI
22
28
space. When querying feature by a region, ``siibra`` automatically builds a
Original file line number Diff line number Diff line change 35
35
LOCATION_PRECISION_MM = 2. # the assumed spatial precision of the probe locations in MNI space
36
36
37
37
38
+ def is_allen_api_microarray_service_available ():
39
+ import requests
40
+
41
+ # see https://community.brain-map.org/t/human-brain-atlas-api/2876
42
+ microarray_test_url = "http://api.brain-map.org/api/v2/data/query.json?criteria= service::human_microarray_expression[probes$eq1023146,1023147][donors$eq15496][structures$eq9148]"
43
+ try :
44
+ response = requests .get (microarray_test_url ).json ()
45
+ except requests .RequestException :
46
+ return False
47
+ return response ["success" ]
48
+
49
+
38
50
class InvalidAllenAPIResponseException (Exception ):
39
51
pass
40
52
@@ -124,6 +136,13 @@ def parse_gene(spec):
124
136
self .genes = parse_gene (gene )
125
137
126
138
def query (self , concept : structure .BrainStructure ) -> List [GeneExpressions ]:
139
+ if not is_allen_api_microarray_service_available ():
140
+ raise InvalidAllenAPIResponseException (
141
+ 'The service "web API of the Allen Brain Atlas for the human microarray expression" '
142
+ 'is not available at the moment, therefore siibra is not able to fetch '
143
+ 'gene expression features. This is a known issue which we are investigating: '
144
+ 'https://github.com/FZJ-INM1-BDA/siibra-python/issues/636.'
145
+ )
127
146
128
147
mnispace = _space .Space .registry ().get ('mni152' )
129
148
You can’t perform that action at this time.
0 commit comments