else: if not "--calibration-training=" in prebasecallerArgs: prebasecallerArgs = prebasecallerArgs + " --calibration-training=100000" if not "--flow-signals-type" in prebasecallerArgs: prebasecallerArgs = prebasecallerArgs + " --flow-signals-type scaled-residual" basecaller.basecalling( env['SIGPROC_RESULTS'], prebasecallerArgs, env['libraryKey'], env['tfKey'], env['runID'], env['reverse_primer_dict'], os.path.join(env['BASECALLER_RESULTS'], 'recalibration'), env['barcodeId'], env['barcodeInfo'], env['library'], env['notes'], env['site_name'], env['platform'], env['instrumentName'], env['chipType']) basecaller_recalibration_datasets = blockprocessing.get_datasets_basecaller( os.path.join(env['BASECALLER_RESULTS'], 'recalibration')) if env['doBaseRecal'] == "panel_recal": basecaller_recalibration_datasets = basecaller_recalibration_datasets[ 'IonControl'] # file containing dimension info (offsets, rows, cols) and flow info for stratification try: c = open( os.path.join(env['BASECALLER_RESULTS'], "recalibration", 'BaseCaller.json'), 'r') chipflow = json.load(c) c.close() except: traceback.print_exc() raise
try: printtime("INFO: merging rawtf.basecaller.bam") block_bam_list = [os.path.join(adir, env['BASECALLER_RESULTS'], 'rawtf.basecaller.bam') for adir in dirs] block_bam_list = [block_bam_filename for block_bam_filename in block_bam_list if os.path.exists(block_bam_filename)] composite_bam_filename = os.path.join(env['BASECALLER_RESULTS'], 'rawtf.basecaller.bam') if block_bam_list: blockprocessing.merge_bam_files(block_bam_list,composite_bam_filename,composite_bai_filepath="",mark_duplicates=False,method='picard') except: print traceback.format_exc() printtime("ERROR: merging rawtf.basecaller.bam unsuccessful") if do_unfiltered_processing: basecaller_datasets = blockprocessing.get_datasets_basecaller(env['BASECALLER_RESULTS']) try: os.mkdir(os.path.join(env['BASECALLER_RESULTS'],'unfiltered.untrimmed')) basecaller.merge_datasets_basecaller_json( dirs, os.path.join(env['BASECALLER_RESULTS'],"unfiltered.untrimmed")) blockprocessing.merge_bams( dirs, os.path.join(env['BASECALLER_RESULTS'],"unfiltered.untrimmed"), basecaller_datasets, 'picard') except: print traceback.format_exc()
prebasecallerArgs, env['libraryKey'], env['tfKey'], env['runID'], env['reverse_primer_dict'], os.path.join(env['BASECALLER_RESULTS'], 'recalibration'), env['barcodeId'], env['barcodeInfo'], env['library'], env['notes'], env['site_name'], env['platform'], env['instrumentName'], env['chipType']) basecaller_recalibration_datasets = blockprocessing.get_datasets_basecaller(os.path.join(env['BASECALLER_RESULTS'],'recalibration')) if env['doBaseRecal'] == "panel_recal": basecaller_recalibration_datasets = basecaller_recalibration_datasets['IonControl'] # file containing dimension info (offsets, rows, cols) and flow info for stratification try: c = open(os.path.join(env['BASECALLER_RESULTS'], "recalibration", 'BaseCaller.json'),'r') chipflow = json.load(c) c.close() except: traceback.print_exc() raise # Recalibrate for dataset in basecaller_recalibration_datasets["datasets"]:
"rawtf.basecaller.bam") if block_bam_list: blockprocessing.merge_bam_files( block_bam_list, composite_bam_filename, composite_bai_filepath="", mark_duplicates=False, method="picard", ) except Exception: print(traceback.format_exc()) printtime("ERROR: merging rawtf.basecaller.bam unsuccessful") if do_unfiltered_processing: basecaller_datasets = blockprocessing.get_datasets_basecaller( env["BASECALLER_RESULTS"]) try: os.mkdir( os.path.join(env["BASECALLER_RESULTS"], "unfiltered.untrimmed")) basecaller.merge_datasets_basecaller_json( dirs, os.path.join(env["BASECALLER_RESULTS"], "unfiltered.untrimmed"), ) blockprocessing.merge_bams( dirs, os.path.join(env["BASECALLER_RESULTS"],
env["instrumentName"], env["chipInfo"], ) # Reuse phase estimates in main base calling task additional_basecallerArgs += " --phase-estimation-file " + os.path.join( env["BASECALLER_RESULTS"], "recalibration", "BaseCaller.json") # # Part 2) Create aligned training BAMs as input for Calibration module # Or skip alignment if we want to use blind calibration # calibration_input_bams = "" basecaller_recalibration_datasets = blockprocessing.get_datasets_basecaller( os.path.join(env["BASECALLER_RESULTS"], "recalibration")) if calibration_mode == "panel_recal": basecaller_recalibration_datasets = basecaller_recalibration_datasets[ "IonControl"] for dataset in basecaller_recalibration_datasets["datasets"]: if not dataset.get("read_count", 0) > 0: continue if "nomatch" in dataset["basecaller_bam"]: continue basecaller_bam = os.path.join( env["BASECALLER_RESULTS"], "recalibration", dataset["basecaller_bam"],