Пример #1
0
 def get_entities(self):
     self.logger.info('getting genes')
     attempts = 0
     while attempts < 3:
         try:
             # get S288C genes
             gene_ids_so = DBSession.query(
                 Dnasequenceannotation.dbentity_id,
                 Dnasequenceannotation.so_id).filter(
                     Dnasequenceannotation.taxonomy_id == 274901).all()
             dbentity_ids_to_so = {}
             dbentity_ids = set([])
             so_ids = set([])
             for gis in gene_ids_so:
                 dbentity_ids.add(gis[0])
                 so_ids.add(gis[1])
                 dbentity_ids_to_so[gis[0]] = gis[1]
             all_genes = DBSession.query(Locusdbentity).filter(
                 Locusdbentity.dbentity_id.in_(list(dbentity_ids)),
                 Locusdbentity.dbentity_status == 'Active').all()
             break
         except StatementError:
             traceback.print_exc()
             log.info(
                 'DB error corrected. Rollingback previous error in db connection'
             )
             DBSession.rollback()
             attempts += 1
     return all_genes
Пример #2
0
 def get_entities(self):
     self.logger.info('getting gos')
     attempts = 0
     while attempts < 3:
         try:
             gos = DBSession.query(Go).all()
             break
         except:
             traceback.print_exc()
             DBSession.rollback()
             attempts += 1
     return gos
Пример #3
0
 def get_entities(self):
     self.log('getting phenotypes')
     attempts = 0
     while attempts < 3:
         try:
             phenotypes = DBSession.query(Phenotype).all()
             break
         except:
             traceback.print_exc()
             DBSession.rollback()
             attempts += 1
     return phenotypes
Пример #4
0
 def get_entities(self):
     self.logger.info('getting observables')
     attempts = 0
     while attempts < 3:
         try:
             observables = DBSession.query(Apo).filter_by(
                 apo_namespace="observable").all()
             break
         except:
             traceback.print_exc()
             DBSession.rollback()
             attempts += 1
     return observables