concord_search.fifth_concordance = return_vals[-9] return 1 if __name__ == '__main__': #Handle arguments parser = argparse.ArgumentParser(description='Puts the project-summary.csv info into the bcbio database') parser.add_argument('sample_key', type=str, help='The sample name from which the snp_stats process is keyed') parser.add_argument('-d','--directory', dest='directory', type=str, default=None, help='The path to the concordance and hethom files. The default is the files stored in the snp_stats process.') parser.add_argument('--search', dest='search', action='store_true', help='This extracts and stores the search statistics instead of the snp_stats statistics.') args = parser.parse_args() system_config = ConfigParser.ConfigParser() system_config.read('/home/sequencing/src/pipeline_project/pipeline/config/ihg_system.cfg') pipeline_config = ConfigParser.ConfigParser() pipeline_config.read('/home/sequencing/src/pipeline_project/pipeline/config/qc_on_ihg.cfg') mockdb = initiate_mockdb(system_config) sample_snp_stats_dict = mockdb['SnpStats'].__attribute_value_to_object_dict__('sample_key') try: snp_stats = sample_snp_stats_dict[args.sample_key][0] print snp_stats.sample_key + "," + str(snp_stats.key) except KeyError: pieces = args.sample_key.split('-') sample_key2 = pieces[0] + '-' + pieces[1] + '_' + pieces[2] #sys.stderr.write("%s\n" % sample_key2) snp_stats = sample_snp_stats_dict[sample_key2][0] if args.search: concord_search = mockdb['ConcordanceSearch'].objects[snp_stats.search_key] store_search_stats_in_db(concord_search,directory=args.directory,sample_key=args.sample_key) else: store_snp_stats_in_db(snp_stats,directory=args.directory,sample_key=args.sample_key) save_mockdb(system_config,mockdb)
#Complete any backup process that have been initiated by a finished sequencing run. #for pipeline_name in pipeline_config.keys(): # configs.update({'pipeline':pipeline_config[pipeline_name]}) # continue_backup_processes(configs,storage_devices,mockdb) #Advance the running pipelines. If a step is done, preceed to the next. If the pipeline is done, complete it. if system_config.get("Logging","debug") is "True": print "Advancing" for pipeline_name in pipeline_config.keys(): if system_config.get("Logging","debug") is "True": print "Advancing " + pipeline_name if pipeline_name == 'QualityControlPipeline': configs.update({'pipeline':pipeline_config['QualityControlPipeline']}) advance_running_qc_pipelines(configs,mockdb,storage_devices=storage_devices) else: configs.update({'pipeline':pipeline_config[pipeline_name]}) advance_running_std_pipelines(configs,mockdb,pipeline_name,storage_devices=storage_devices) #The remaining pipeline are taking up storage. I used to account for this, but no longer. This can be added back in, but needs a little work. #add_running_storage(configs['system'],storage_devices,mockdb) #If there is enough space, move the next pipeline into the queue for pipeline_name in pipeline_config: configs.update({'pipeline':pipeline_config[pipeline_name]}) run_pipelines_with_enough_space(configs,storage_devices,mockdb,pipeline_name) #Generate and send any outstanding reports. configs.update({'pipeline':pipeline_config['QualityControlPipeline']}) handle_automated_reports(configs,mockdb) save_mockdb(configs['system'],mockdb)
for object_key, object in collection.objects.iteritems(): try: if object.sample_key == orig_sample_key: object.sample_key = new_sample_key count += 1 except AttributeError: pass return count def rename_sample_key(config,mockdb,orig_sample_key,new_sample_key): collection_clses = child_classes(Sample,config=config) + [Sample] for cls in collection_clses: collection = mockdb[cls.__name__] for object_key, object in collection.objects.iteritems(): if object.key == orig_sample_key: object.key = new_sample_key return 1 if __name__ == '__main__': #Handle arguments parser = argparse.ArgumentParser(description='Puts the project-summary.csv info into the bcbio database') parser.add_argument('sample_key', type=str, help='The sample name as it currently is in the database') parser.add_argument('new_key', type=str, help='The sample name to which the sample_key will be renamed') args = parser.parse_args() config = ConfigParser.ConfigParser() config.read('/home/sequencing/src/pipeline_project/pipeline/config/qc_on_ihg.cfg') mockdb = initiate_mockdb(config) rename_all_sample_keys(mockdb,args.sample_key,args.new_key) rename_sample_key(config,mockdb,args.sample_key,args.new_key) save_mockdb(config,mockdb)