fixed method autocomplete
-import pycellbase.cbrestclients as fts
+import pycellbase.cbrestclients as crc
from pycellbase.cbconfig import ConfigClient
from pycellbase.commons import get
@@ -7,8 +7,13 @@ class CellBaseClient(object):
"""Creates different query clients and allows direct queries to the RESTful
service"""
def __init__(self, config_client=None):
- # Client storage; If a client is already created, then it is returned
- self._clients = {}
+ # CellBase REST clients
+ self._gene_client = None
+ self._transcript_client = None
+ self._protein_client = None
+ self._variation_client = None
+ self._genomic_region_client = None
+ self._variant_client = None
# Setting up config params
if config_client is not None:
@@ -18,7 +23,7 @@ class CellBaseClient(object):
msg = ('CellBaseClient configuration not properly set.' +
' "pycellbase.config.ConfigClient" object is needed as' +
' parameter')
- raise IOError(msg)
+ raise ValueError(msg)
self._configuration = config_client
else:
self._configuration = ConfigClient()
@@ -42,39 +47,37 @@ class CellBaseClient(object):
def get_gene_client(self):
"""Creates the gene client"""
- if 'GENE' not in self._clients:
- self._clients['GENE'] = fts.GeneClient(self._configuration)
- return self._clients['GENE']
+ if self._gene_client is None:
+ self._gene_client = crc.GeneClient(self._configuration)
+ return self._gene_client
def get_transcript_client(self):
"""Creates the protein client"""
- if 'TRANSCRIPT' not in self._clients:
- self._clients['TRANSCRIPT'] =\
- fts.TranscriptClient(self._configuration)
- return self._clients['TRANSCRIPT']
+ if self._transcript_client is None:
+ self._transcript_client = crc.TranscriptClient(self._configuration)
+ return self._transcript_client
def get_protein_client(self):
"""Creates the protein client"""
- if 'PROTEIN' not in self._clients:
- self._clients['PROTEIN'] = fts.ProteinClient(self._configuration)
- return self._clients['PROTEIN']
+ if self._protein_client is None:
+ self._protein_client = crc.ProteinClient(self._configuration)
+ return self._protein_client
def get_variation_client(self):
"""Creates the variation client"""
- if 'VARIATION' not in self._clients:
- self._clients['VARIATION'] =\
- fts.VariationClient(self._configuration)
- return self._clients['VARIATION']
+ if self._variation_client is None:
+ self._variation_client = crc.VariationClient(self._configuration)
+ return self._variation_client
def get_genomic_region_client(self):
"""Creates the genomic region client"""
- if 'GENOMIC_REGION' not in self._clients:
- self._clients['GENOMIC_REGION'] = \
- fts.GenomicRegionClient(self._configuration)
- return self._clients['GENOMIC_REGION']
+ if self._genomic_region_client is None:
+ self._genomic_region_client = \
+ crc.GenomicRegionClient(self._configuration)
+ return self._genomic_region_client
def get_variant_client(self):
"""Creates the variant client"""
- if 'VARIANT' not in self._clients:
- self._clients['VARIANT'] = fts.VariantClient(self._configuration)
- return self._clients['VARIANT']
+ if self._variant_client is None:
+ self._variant_client = crc.VariantClient(self._configuration)
+ return self._variant_client
