Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
# Overriding config
if args.config is not None:
cc = ConfigClient(args.config)
if args.species is not None:
cc.species = args.species
if args.api_version is not None:
cc.version = args.api_version
if args.host is not None:
cc.host = args.host
if args.assembly is not None:
assembly = args.assembly
else:
assembly = _DEFAULT_ASSEMBLY
cbc = CellBaseClient(cc)
if args.which == 'xref':
# Getting available databases
databases = _get_databases_list(cbc, assembly)
# Filtering databases with include and exclude
include = args.include.split(',') if args.include is not None else None
exclude = args.exclude.split(',') if args.exclude is not None else None
databases = _filter_databases(databases, include=include,
exclude=exclude)
# Converting IDs
convert_ids(input_fpath=args.input_fpath,
output_fpath=args.output_fpath,
cellbase_client=cbc,
assembly=assembly,
def _get(self, resource, query_id=None, options=None):
"""Queries the REST service and returns the result"""
response = get(host=self._configuration.host,
port=self._configuration.port,
version=self._configuration.version,
species=self._configuration.species,
category=self._category,
subcategory=self._subcategory,
query_id=query_id,
resource=resource,
options=options)
return response
def _get(self, resource, query_id=None, options=None):
"""Queries the REST service and returns the result"""
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=self._configuration.species,
category=self._category,
subcategory=self._subcategory,
query_id=query_id,
resource=resource,
options=options)
return response
def ping(self, **options):
"""Checks if service is alive"""
# This particular REST endpoint follows the structure
# /{version}/meta/ping
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=None,
category=self._category,
subcategory=None,
resource='ping',
options=options)
return response
def _post(self, resource, query_id=None, options=None, data=None):
"""Queries the REST service and returns the result"""
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=self._configuration.species,
category=self._category,
subcategory=self._subcategory,
query_id=query_id,
resource=resource,
options=options,
method='post',
data=data)
return response
def get_species(self, **options):
"""Returns available species"""
# This particular REST endpoint follows the structure
# /{version}/meta/species
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=None,
category=self._category,
subcategory=None,
resource='species',
options=options)
return response
def get_feature_class(self, **options):
"""Returns list of available regulatory feature classes"""
# This particular REST endpoint follows the structure
# /{version}/{species}/regulatory/featureClass
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=self._configuration.species,
category=self._category,
subcategory=None,
resource='featureClass',
options=options)
return response
def get_info(self, **options):
"""Returns general information"""
# This particular REST endpoint follows the structure
# /{version}/{species}/info
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=self._configuration.species,
category=None,
subcategory=None,
resource='info',
options=options)
return response
def get_versions(self, **options):
# This particular REST endpoint follows the structure
# /{version}/meta/{species}/versions
"""Returns source version metadata, including source urls"""
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=None,
category=self._category,
subcategory=self._configuration.species,
resource='versions',
options=options)
return response
def get_category(self, query_id, **options):
# This particular REST endpoint follows the structure
# /{version}/meta/{category}
"""Returns source version metadata, including source urls"""
categories = ['feature', 'genomic', 'network', 'regulatory']
if query_id not in categories:
msg = 'Query has to be one of the following: ' + str(categories)
raise ValueError(msg)
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=None,
category=self._category,
subcategory=None,
resource=query_id,
options=options)
return response