dba_params = {'dbhost': args['--dbhost'], 'dbname': args['--dbname'], 'logger_name': __name__} dba = DBAdaptor(dba_params) dbi = dba.get_dbinfo() logger.info("Connected to TCRD database {} (schema ver {}; data ver {})".format(args['--dbname'], dbi['schema_ver'], dbi['data_ver'])) if not args['--quiet']: print("Connected to TCRD database {} (schema ver {}; data ver {})".format(args['--dbname'], dbi['schema_ver'], dbi['data_ver'])) start_time = time.time() rv = dba.upd_tdls_null() if type(rv) == int: print(f"\nSet tdl to NULL for {rv} target rows") else: print(f"Error setting target.tdl values to NULL. See logfile {logfile} for details.") exit(1) rv = dba.del_dataset('TDLs') if rv: print(f"Deleted previous 'TDLs' dataset") else: print(f"Error deleting 'TDLs' dataset. See logfile {logfile} for details.") exit(1) load_tdls(dba, logfile, logger) # Dataset dataset_id = dba.ins_dataset( {'name': 'TDLs', 'source': 'IDG-KMC generated data by Steve Mathias at UNM.', 'app': PROGRAM, 'app_version': __version__, 'comments': 'TDLs are calculated by the loading app from data in TCRD.'} ) assert dataset_id, f"Error inserting dataset. See logfile {logfile} for details." # Provenance rv = dba.ins_provenance({'dataset_id': dataset_id, 'table_name': 'target', 'column_name': 'tdl'}) assert rv, f"Error inserting provenance. See logfile {logfile} for details."
if not args['--quiet']: print(f"Connected to ChEMBL database {CHEMBL_DB}") start_time = time.time() # delete previous data, if any print("\nDeleting existing ChEMBL data...") rv = dba.del_cmpd_activities('ChEMBL') if type(rv) == int: print(f" Deleted {rv} 'ChEMBL' cmpd_activity rows") else: print( f"Error deleting 'ChEMBL' cmpd_activity rows. See logfile {logfile} for details." ) exit(1) rv = dba.del_dataset('ChEMBL') if not rv: print( f"Error deleting 'ChEMBL' dataset. See logfile {logfile} for details." ) exit(1) rv = dba.del_tdl_infos('ChEMBL First Reference Year') if type(rv) == int: print(f" Deleted {rv} 'ChEMBL First Reference Year' tdl_info rows") else: print( f"Error deleting 'ChEMBL First Reference Year' tdl_info rows. See logfile {logfile} for details." ) exit(1) rv = dba.del_tdl_infos('ChEMBL Selective Compound') if type(rv) == int: