comparison chado.py @ 12:df8527b4f2b8 draft

"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/chado commit 1640878827bdc3870b6f34eded3a3f7571a1849f"
author gga
date Wed, 21 Aug 2019 05:12:35 -0400
parents d3ffd510c98a
children
comparison
equal deleted inserted replaced
11:95221c68838f 12:df8527b4f2b8
387 os.environ['GALAXY_CHADO_DBNAME'], 387 os.environ['GALAXY_CHADO_DBNAME'],
388 os.environ['GALAXY_CHADO_DBUSER'], 388 os.environ['GALAXY_CHADO_DBUSER'],
389 os.environ['GALAXY_CHADO_DBPASS'], 389 os.environ['GALAXY_CHADO_DBPASS'],
390 os.environ['GALAXY_CHADO_DBSCHEMA'], 390 os.environ['GALAXY_CHADO_DBSCHEMA'],
391 os.environ['GALAXY_CHADO_DBPORT'], 391 os.environ['GALAXY_CHADO_DBPORT'],
392 no_reflect=True 392 no_reflect=True,
393 pool_connections=False
393 ) 394 )
394 395
395 396
396 def list_organisms(*args, **kwargs): 397 def list_organisms(*args, **kwargs):
397 398
472 def _list_analyses(ci, *args, **kwargs): 473 def _list_analyses(ci, *args, **kwargs):
473 ans_data = [] 474 ans_data = []
474 for an in ci.analysis.get_analyses(): 475 for an in ci.analysis.get_analyses():
475 ans_data.append((an['name'], str(an['analysis_id']), False)) 476 ans_data.append((an['name'], str(an['analysis_id']), False))
476 return ans_data 477 return ans_data
478
479
480 def list_dbs(*args, **kwargs):
481
482 ci = _get_instance()
483
484 # Key for cached data
485 cacheKey = 'dbs'
486 # We don't want to trust "if key in cache" because between asking and fetch
487 # it might through key error.
488 if cacheKey not in cache:
489 # However if it ISN'T there, we know we're safe to fetch + put in
490 # there.<?xml version="1.0"?>
491
492 data = _list_dbs(ci, *args, **kwargs)
493 cache[cacheKey] = data
494 ci.session.close()
495 return data
496 try:
497 # The cache key may or may not be in the cache at this point, it
498 # /likely/ is. However we take no chances that it wasn't evicted between
499 # when we checked above and now, so we reference the object from the
500 # cache in preparation to return.
501 data = cache[cacheKey]
502 ci.session.close()
503 return data
504 except KeyError:
505 # If access fails due to eviction, we will fail over and can ensure that
506 # data is inserted.
507 data = _list_dbs(ci, *args, **kwargs)
508 cache[cacheKey] = data
509 ci.session.close()
510 return data
511
512
513 def _list_dbs(ci, *args, **kwargs):
514 dbs_data = []
515 for db in ci.load._get_dbs():
516 dbs_data.append((db['name'], str(db['db_id']), False))
517 return dbs_data