@@ -71,17 +71,15 @@ def platforms(self, experiment_id):
7171 def quantitation_types (self , experiment_id ):
7272 return self ._query_api (join ('datasets' , experiment_id , 'quantitationTypes' ))
7373
74+ gemma_api = GemmaApi ()
75+
7476class GemmaTaskMixin (luigi .Task ):
7577 experiment_id = luigi .Parameter ()
7678
77- def __init__ (self , * kwargs , ** kwds ):
78- super ().__init__ (* kwargs , ** kwds )
79- self ._gemma_api = GemmaApi ()
80-
8179 @property
8280 def dataset_info (self ):
8381 if not hasattr (self , '_dataset_info' ):
84- data = self . _gemma_api .datasets (self .experiment_id )
82+ data = gemma_api .datasets (self .experiment_id )
8583 if not data :
8684 raise RuntimeError ('Could not retrieve Gemma dataset with short name {}.' .format (self .experiment_id ))
8785 self ._dataset_info = data [0 ]
@@ -112,7 +110,7 @@ def reference_id(self):
112110 try :
113111 if self .assay_type == GemmaAssayType .BULK_RNA_SEQ :
114112 return {'human' : cfg .human_reference_id , 'mouse' : cfg .mouse_reference_id , 'rat' : cfg .rat_reference_id }[
115- self .taxon ]
113+ self .taxon ]
116114 elif self .assay_type == GemmaAssayType .SINGLE_CELL_RNA_SEQ :
117115 return {'human' : cfg .human_single_cell_reference_id , 'mouse' : cfg .mouse_single_cell_reference_id ,
118116 'rat' : cfg .rat_single_cell_reference_id }[
@@ -150,7 +148,7 @@ def assay_type(self):
150148 'http://www.ebi.ac.uk/efo/EFO_0005684' ]
151149 fac_sorted_uri = 'http://www.ebi.ac.uk/efo/EFO_0009108'
152150
153- annotations = self . _gemma_api .dataset_annotations (self .experiment_id )
151+ annotations = gemma_api .dataset_annotations (self .experiment_id )
154152 fac_sorted = any (annotation ['classUri' ] == assay_type_class_uri and annotation ['termUri' ] == fac_sorted_uri
155153 for annotation in annotations )
156154 for annotation in annotations :
0 commit comments