def sigproc(analysisArgs, pathtorawblock, SIGPROC_RESULTS): printtime("RUNNING SINGLE BLOCK ANALYSIS") command = "%s >> ReportLog.html 2>&1" % (analysisArgs) printtime("Analysis command: " + command) sys.stdout.flush() sys.stderr.flush() status = subprocess.call(command,shell=True) blockprocessing.add_status("Analysis", status) # write return code into file try: os.umask(0002) f = open(os.path.join(SIGPROC_RESULTS,"analysis_return_code.txt"), 'w') f.write(str(status)) f.close() except: traceback.print_exc() if status == 2: printtime("Analysis finished with status '%s'" % status) try: com = "ChkDat" com += " -r %s" % (pathtorawblock) # printtime("DEBUG: Calling '%s':" % com) # ret = subprocess.call(com,shell=True) except: traceback.print_exc() ######################################################## #Make Bead Density Plots # ######################################################## printtime("Make Bead Density Plots") bfmaskPath = os.path.join(SIGPROC_RESULTS,"analysis.bfmask.bin") maskpath = os.path.join(SIGPROC_RESULTS,"MaskBead.mask") if os.path.isfile(bfmaskPath): com = "BeadmaskParse" com += " -m MaskBead" com += " %s" % bfmaskPath ret = subprocess.call(com,shell=True) blockprocessing.add_status("BeadmaskParse", ret) try: shutil.move('MaskBead.mask', maskpath) except: printtime("ERROR: MaskBead.mask already moved") else: printtime("Warning: no analysis.bfmask.bin file exists.") if os.path.exists(maskpath): try: # Makes Bead_density_contour.png beadDensityPlot.genHeatmap(maskpath, SIGPROC_RESULTS) # os.remove(maskpath) except: traceback.print_exc() else: printtime("Warning: no MaskBead.mask file exists.") printtime("Finished single block analysis")
def basecalling( SIGPROC_RESULTS, previousReport, basecallerArgs, libKey, tfKey, runID, floworder, reverse_primer_dict, BASECALLER_RESULTS): try: if basecallerArgs: cmd = basecallerArgs else: cmd = "BaseCaller" if previousReport: cmd += " --input-dir=%s" % (os.path.join(previousReport,SIGPROC_RESULTS)) else: cmd += " --input-dir=%s" % (SIGPROC_RESULTS) cmd += " --librarykey=%s" % (libKey) cmd += " --tfkey=%s" % (tfKey) cmd += " --run-id=%s" % (runID) cmd += " --output-dir=%s" % (BASECALLER_RESULTS) # 3' adapter details qual_cutoff = reverse_primer_dict['qual_cutoff'] qual_window = reverse_primer_dict['qual_window'] adapter_cutoff = reverse_primer_dict['adapter_cutoff'] adapter = reverse_primer_dict['sequence'] cmd += " --flow-order %s" % (floworder) cmd += " --trim-qual-cutoff %s" % (qual_cutoff) cmd += " --trim-qual-window-size %s" % (qual_window) cmd += " --trim-adapter-cutoff %s" % (adapter_cutoff) cmd += " --trim-adapter %s" % (adapter) cmd += " --trim-min-read-len 5" cmd += " --bead-summary" cmd += " >> ReportLog.html 2>&1" printtime("DEBUG: Calling '%s':" % cmd) ret = subprocess.call(cmd,shell=True) blockprocessing.add_status("BaseCaller", ret) except: printtime('ERROR: BaseCaller failed') traceback.print_exc()
def post_basecalling( libsff_path, reverse_primer_dict, skipsfftrim, sfftrim_args, libKey, floworder, barcodeId, barcodesplit_filter, DIR_BC_FILES, barcodeList_path, bfmask_path, barcodeMask_path, generate_beadsummary, BASECALLER_RESULTS): if not os.path.exists(libsff_path): printtime("ERROR: %s does not exist" % libsff_path) open('badblock.txt', 'w').close() return ################################################## # Trim the SFF file if it has been requested # ################################################## if not skipsfftrim: printtime("Attempting to trim the SFF file") libsff_untrimmed_path = libsff_path (head,tail) = os.path.split(libsff_untrimmed_path) libsff_trimmed_path = os.path.join(head,tail[:-4] + ".trimmed.sff") try: com = "SFFTrim" com += " --in-sff %s" % (libsff_untrimmed_path) com += " --out-sff %s" % (libsff_trimmed_path) if sfftrim_args: printtime("using non default args '%s'" % sfftrim_args) com += " " + sfftrim_args else: printtime("no special args found, using default args") # 3' adapter details qual_cutoff = reverse_primer_dict['qual_cutoff'] qual_window = reverse_primer_dict['qual_window'] adapter_cutoff = reverse_primer_dict['adapter_cutoff'] adapter = reverse_primer_dict['sequence'] com += " --flow-order %s" % (floworder) com += " --key %s" % (libKey) com += " --qual-cutoff %s" % (qual_cutoff) com += " --qual-window-size %s" % (qual_window) com += " --adapter-cutoff %s" % (adapter_cutoff) com += " --adapter %s" % (adapter) com += " --min-read-len 5" if generate_beadsummary: com += " --bead-summary %s" % (os.path.join(BASECALLER_RESULTS, 'BaseCaller.json')) printtime("DEBUG: Calling '%s':" % com) ret = subprocess.call(com,shell=True) blockprocessing.add_status("SFFTrim", ret) except: printtime('Failed SFFTrim') traceback.print_exc() if os.path.exists(libsff_untrimmed_path): printtime ("DEBUG: remove untrimmed file %s" % libsff_untrimmed_path) os.remove(libsff_untrimmed_path) else: printtime ("ERROR: untrimmed file not found: %s" % libsff_untrimmed_path) if os.path.exists(libsff_trimmed_path): printtime ("DEBUG: Renaming %s to %s" % (libsff_trimmed_path,libsff_path)) os.rename(libsff_trimmed_path,libsff_path) else: printtime("Not attempting to trim the SFF") ##################################################### # Barcode trim SFF if barcodes have been specified # # Creates one fastq per barcode, plus unknown reads # ##################################################### if barcodeId != '': try: (head,tail) = os.path.split(libsff_path) libsff_bctrimmed_path = os.path.join(head,tail[:-4] + ".bctrimmed.sff") if not os.path.exists(DIR_BC_FILES): os.mkdir(DIR_BC_FILES) com = "barcodeSplit" com += " -s" com += " -i %s" % libsff_path com += " -b %s" % barcodeList_path com += " -k %s" % bfmask_path com += " -f %s" % floworder com += " -l %s" % barcodesplit_filter com += " -c %s" % barcodeMask_path com += " -d %s" % DIR_BC_FILES printtime("DEBUG: Calling '%s'" % com) ret = subprocess.call(com,shell=True) blockprocessing.add_status("barcodeSplit", ret) if int(ret) != 0: printtime("ERROR Failed barcodeSplit with return code %d" % int(ret)) else: # barcodeSplit is producing "bctrimmed_"+libsff_path , rename (head,tail) = os.path.split(libsff_path) bcsff = os.path.join(DIR_BC_FILES,head,"bctrimmed_"+tail) if os.path.exists(bcsff): printtime ("Renaming %s to %s" % (bcsff, libsff_bctrimmed_path)) os.rename(bcsff,libsff_bctrimmed_path) else: printtime ("ERROR: Renaming: File not found: %s" % bcsff) if os.path.exists(libsff_path): printtime ("DEBUG: remove file %s" % libsff_path) os.remove(libsff_path) else: printtime ("ERROR: Remove: File not found: %s" % libsff_path) #rename: libsff_path contains now the trimmed/bctrimmed data if os.path.exists(libsff_bctrimmed_path): printtime ("Renaming %s to %s" % (libsff_bctrimmed_path,libsff_path)) os.rename(libsff_bctrimmed_path,libsff_path) except: printtime("ERROR Failed barcodeSplit") traceback.print_exc() # implement barcode filtering by moving filtered files if float(barcodesplit_filter) > 0: from ion.utils.filter_barcodes import filter_barcodes filter_barcodes(DIR_BC_FILES) ################################################## # Once we have the new SFF, run SFFSummary # to get the predicted quality scores ################################################## try: com = "SFFSummary" com += " -o %s" % os.path.join(BASECALLER_RESULTS, 'quality.summary') com += " --sff-file %s" % libsff_path com += " --read-length 50,100,150" com += " --min-length 0,0,0" com += " --qual 0,17,20" com += " -d %s" % os.path.join(BASECALLER_RESULTS, 'readLen.txt') printtime("DEBUG: Calling '%s'" % com) ret = subprocess.call(com,shell=True) blockprocessing.add_status("SFFSummary", ret) except: printtime('Failed SFFSummary') printtime("make the read length histogram") try: filepath_readLenHistogram = os.path.join(BASECALLER_RESULTS,'readLenHisto.png') trimmedReadLenHisto.trimmedReadLenHisto('readLen.txt',filepath_readLenHistogram) except: printtime("Failed to create %s" % filepath_readLenHistogram) ##################################################### # make keypass.fastq file -c(cut key) -k(key flows) # ##################################################### try: com = "SFFRead" com += " -q %s" % libsff_path.replace(".sff",".fastq") com += " %s" % libsff_path com += " > %s" % os.path.join(BASECALLER_RESULTS, 'keypass.summary') printtime("DEBUG: Calling '%s'" % com) ret = subprocess.call(com,shell=True) blockprocessing.add_status("SFFRead", ret) except: printtime('Failed SFFRead') printtime('Failed to convert SFF ' + str(libsff_path) + ' to fastq')
def alignment_unmapped_bam( BASECALLER_RESULTS, ALIGNMENT_RESULTS, align_full, libraryName, flows, aligner_opts_extra, mark_duplicates, bidirectional, sam_parsed): printtime("Attempt to align") datasets_basecaller_path = os.path.join(BASECALLER_RESULTS,"datasets_basecaller.json") if not os.path.exists(datasets_basecaller_path): printtime("ERROR: %s does not exist" % datasets_basecaller_path) open('badblock.txt', 'w').close() return datasets_basecaller = {} try: f = open(datasets_basecaller_path,'r') datasets_basecaller = json.load(f); f.close() except: printtime("ERROR: problem parsing %s" % datasets_basecaller_path) traceback.print_exc() open('badblock.txt', 'w').close() return # establish the read-length histogram range by using the simple rule: # 0.7 * num_flows rounded up to a next multiple of 50 try: graph_max_x = int(50 * math.ceil(0.014 * int(flows))) except: graph_max_x = 400 input_prefix_list = [] for dataset in datasets_basecaller["datasets"]: if not os.path.exists(os.path.join(BASECALLER_RESULTS, dataset['basecaller_bam'])): continue #----------------------------------- # DEFAULT SINGLE SFF/FASTQ BEHAVIOR - (Runs for barcoded runs too) #----------------------------------- try: com = "alignmentQC.pl" if align_full: com += " --align-all-reads" com += " --logfile %s" % os.path.join(ALIGNMENT_RESULTS,dataset['file_prefix']+'.alignmentQC_out.txt') com += " --output-dir %s" % ALIGNMENT_RESULTS com += " --out-base-name %s" % dataset['file_prefix'] com += " --input %s" % os.path.join(BASECALLER_RESULTS, dataset['basecaller_bam']) com += " --genome %s" % libraryName #com += " --max-plot-read-len %s" % str(int(graph_max_x)) com += " --max-plot-read-len %s" % str(int(400)) if sam_parsed: com += ' -p 1' if bidirectional: com += ' --bidirectional' if aligner_opts_extra: com += ' --aligner-opts-extra "%s"' % aligner_opts_extra if mark_duplicates: com += ' --mark-duplicates' com += " >> %s 2>&1" % os.path.join(ALIGNMENT_RESULTS, 'alignment.log') printtime("Alignment QC command line:\n%s" % com) retcode = subprocess.call(com, shell=True) blockprocessing.add_status("alignmentQC.pl", retcode) if retcode != 0: printtime("alignmentQC failed, return code: %d" % retcode) alignError = open("alignment.error", "w") alignError.write(com) alignError.write('alignmentQC returned with error code: ') alignError.write(str(retcode)) alignError.close() except OSError: printtime('ERROR: Alignment Failed to start') alignError = open("alignment.error", "w") alignError.write(str(traceback.format_exc())) alignError.close() traceback.print_exc() printtime("Barcode processing, rename") if os.path.exists(os.path.join(ALIGNMENT_RESULTS,'alignment.summary')): try: fname=os.path.join(ALIGNMENT_RESULTS,dataset['file_prefix']+'.alignment.summary') os.rename(os.path.join(ALIGNMENT_RESULTS,'alignment.summary'), fname) fname=os.path.join(ALIGNMENT_RESULTS,dataset['file_prefix']+'.alignTable.txt') os.rename(os.path.join(ALIGNMENT_RESULTS,'alignStats_err.txt'), fname) except: printtime('error renaming') traceback.print_exc() alignment_post_processing(BASECALLER_RESULTS, ALIGNMENT_RESULTS, flows, mark_duplicates, False) printtime("**** Alignment completed ****")
def align_full_chip( SAM_META, libsff_path, align_full, graph_max_x, make_align_graphs, sam_parsed, bidirectional, libraryName, flows, opts_extra, mark_duplicates, outputdir, outBaseName='' ): printtime("sam_parsed is %s" % sam_parsed) #Now build the SAM meta data arg string aligner_opts_rg= '--aligner-opts-rg "' aligner_opts_extra = '' additional_aligner_opts = '' if sam_parsed: additional_aligner_opts += ' -p 1' if bidirectional: additional_aligner_opts += ' --bidirectional' if opts_extra: print ' found extra alignment options: "%s"' % opts_extra aligner_opts_extra = ' --aligner-opts-extra "' aligner_opts_extra += opts_extra + '"' first = True for key, value in SAM_META.items(): if value: sam_arg = r'-R \"' end = r'\"' sam_arg = sam_arg + key + ":" + value + end if first: aligner_opts_rg = aligner_opts_rg + sam_arg first = False else: aligner_opts_rg = aligner_opts_rg + " " + sam_arg #add the trailing quote aligner_opts_rg = aligner_opts_rg + '"' if 0 < graph_max_x: # establish the read-length histogram range by using the simple rule: 0.6 * num-flows flowsUsed = 0 try: flowsUsed = int(flows) except: flowsUsed = 400 graph_max_x = 100 * math.trunc((0.6 * flowsUsed + 99)/100.0) if graph_max_x < 400: graph_max_x = 400 #----------------------------------- # DEFAULT SINGLE SFF/FASTQ BEHAVIOR - (Runs for barcoded runs too) #----------------------------------- try: com = "alignmentQC.pl" if (align_full): com += " --align-all-reads" com += " --logfile %s" % os.path.join(outputdir,"alignmentQC_out.txt") com += " --output-dir %s" % outputdir com += " --input %s" % libsff_path com += " --genome %s" % libraryName com += " --max-plot-read-len %s" % graph_max_x if len(outBaseName) > 1: com += " --out-base-name %s" % outBaseName else: com += " %s" % (additional_aligner_opts) com += " %s %s" % (aligner_opts_rg,aligner_opts_extra) if mark_duplicates: com += " --mark-duplicates" com += " >> %s 2>&1" % os.path.join(outputdir, 'alignment.log') printtime("Alignment QC command line:\n%s" % com) retcode = subprocess.call(com, shell=True) blockprocessing.add_status("alignmentQC.pl", retcode) if retcode != 0: printtime("alignmentQC failed, return code: %d" % retcode) alignError = open("alignment.error", "w") alignError.write(com) alignError.write('alignmentQC returned with error code: ') alignError.write(str(retcode)) alignError.close() except OSError: printtime('ERROR: Alignment Failed to start') alignError = open("alignment.error", "w") alignError.write(str(traceback.format_exc())) alignError.close() traceback.print_exc() if make_align_graphs: makeAlignGraphs()
def align_full_chip( SAM_META, libsff_path, align_full, graph_max_x, do_barcode, make_align_graphs, sam_parsed, bidirectional, DIR_BC_FILES, libraryName, flows, barcodeId, opts_extra, outputdir): printtime("sam_parsed is %s" % sam_parsed) #Now build the SAM meta data arg string aligner_opts_rg= '--aligner-opts-rg "' aligner_opts_extra = '' additional_aligner_opts = '' if sam_parsed: additional_aligner_opts += ' -p 1' if bidirectional: additional_aligner_opts += ' --bidirectional' if opts_extra: print ' found extra alignment options: "%s"' % opts_extra aligner_opts_extra = ' --aligner-opts-extra "' aligner_opts_extra += opts_extra + '"' first = True for key, value in SAM_META.items(): if value: sam_arg = r'-R \"' end = r'\"' sam_arg = sam_arg + key + ":" + value + end if first: aligner_opts_rg = aligner_opts_rg + sam_arg first = False else: aligner_opts_rg = aligner_opts_rg + " " + sam_arg #add the trailing quote aligner_opts_rg = aligner_opts_rg + '"' if 0 < graph_max_x: # establish the read-length histogram range by using the simple rule: 0.6 * num-flows flowsUsed = 0 try: flowsUsed = int(flows) except: flowsUsed = 400 graph_max_x = 100 * math.trunc((0.6 * flowsUsed + 99)/100.0) if graph_max_x < 400: graph_max_x = 400 #----------------------------------- # DEFAULT SINGLE SFF/FASTQ BEHAVIOR - (Runs for barcoded runs too) #----------------------------------- if (align_full): #If a full align is forced add a '--align-all-reads' flag com = "alignmentQC.pl" com += " --logfile %s" % os.path.join(outputdir,"alignmentQC_out.txt") com += " --output-dir %s" % outputdir com += " --input %s" % libsff_path com += " --genome %s" % libraryName com += " --max-plot-read-len %s" % graph_max_x com += " --align-all-reads" com += " %s" % (additional_aligner_opts) com += " %s %s" % (aligner_opts_rg,aligner_opts_extra) com += " >> ReportLog.html 2>&1" else: com = "alignmentQC.pl" com += " --logfile %s" % os.path.join(outputdir,"alignmentQC_out.txt") com += " --output-dir %s" % outputdir com += " --input %s" % libsff_path com += " --genome %s" % libraryName com += " --max-plot-read-len %s" % graph_max_x com += " %s" % (additional_aligner_opts) com += " %s %s" % (aligner_opts_rg,aligner_opts_extra) com += " >> ReportLog.html 2>&1" try: printtime("Alignment QC command line:\n%s" % com) retcode = subprocess.call(com, shell=True) blockprocessing.add_status("alignmentQC.pl", retcode) if retcode != 0: printtime("alignmentQC failed, return code: %d" % retcode) alignError = open("alignment.error", "w") alignError.write('alignmentQC returned with error code: ') alignError.write(str(retcode)) alignError.close() except OSError: printtime('Alignment Failed to start') alignError = open("alignment.error", "w") alignError.write(str(traceback.format_exc())) alignError.close() traceback.print_exc() if make_align_graphs: makeAlignGraphs() #-------------------------------------------- # BARCODE HANDLING BEHAVIOR (Multiple FASTQ) #-------------------------------------------- if barcodeId and do_barcode: printtime("Renaming non-barcoded alignment results to 'comprehensive'") files = [ 'alignment.summary', 'alignmentQC_out.txt', 'alignTable.txt', ] for fname in files: try: #if os.path.exists(fname): # os.rename(fname, fname + ".comprehensive") shutil.copyfile(fname, fname + ".comprehensive") except: printtime('ERROR copying %s' % fname) traceback.print_exc() printtime("STARTING BARCODE ALIGNMENTS") barcodelist_path = 'barcodeList.txt' if not os.path.exists(barcodelist_path): barcodelist_path = '../barcodeList.txt' if not os.path.exists(barcodelist_path): barcodelist_path = '../../barcodeList.txt' if not os.path.exists(barcodelist_path): printtime('ERROR: barcodeList.txt not found') barcodeList = parse_bcfile(barcodelist_path) align_full = True top_dir = os.getcwd() try: os.chdir(DIR_BC_FILES) printtime('DEBUG changing to %s for barcodes alignment' % DIR_BC_FILES) except: printtime('ERROR missing %s folder' % DIR_BC_FILES) for bcid in (x['id_str'] for x in barcodeList): (head,tail) = os.path.split(libsff_path) sffName = os.path.join(head,"%s_%s" % (bcid, tail)) if os.path.exists(sffName): printtime("Barcode processing for '%s': %s" % (bcid, sffName)) else: printtime("No barcode SFF file found for '%s': %s" % (bcid, sffName)) continue if (align_full): printtime("Align All Reads") #If a full align is forced add a '--align-all-reads' flag com = "alignmentQC.pl" com += " --logfile %s" % os.path.join(outputdir,"alignmentQC_out.txt") com += " --output-dir %s" % outputdir com += " --input %s" % sffName com += " --genome %s" % libraryName com += " --max-plot-read-len %s" % graph_max_x com += " --align-all-reads" com += " %s" % (additional_aligner_opts) com += " %s %s" % (aligner_opts_rg, aligner_opts_extra) com += " >> ReportLog.html 2>&1" else: printtime("Align Subset of Reads") com = "alignmentQC.pl" com += " --logfile %s" % os.path.join(outputdir,"alignmentQC_out.txt") com += " --output-dir %s" % outputdir com += " --input %s" % sffName com += " --genome %s" % libraryName com += " --max-plot-read-len %s" % graph_max_x com += " %s" % (additional_aligner_opts) com += " %s %s" % (aligner_opts_rg, aligner_opts_extra) com += " >> ReportLog.html 2>&1" try: printtime("Alignment QC command line:\n%s" % com) retcode = subprocess.call(com, shell=True) blockprocessing.add_status("alignmentQC.pl", retcode) if retcode != 0: printtime("alignmentQC failed, return code: %d" % retcode) alignError = open("alignment.error", "a") alignError.write(com) alignError.write(': \nalignmentQC returned with error code: ') alignError.write(str(retcode)) alignError.close() except: printtime('ERROR: Alignment Failed to start') alignError = open("alignment.error", "a") alignError.write(str(traceback.format_exc())) alignError.close() traceback.print_exc() #rename each output file based on barcode found in fastq filename #but ignore the comprehensive fastq output files if os.path.exists('alignment.summary'): try: fname='alignment_%s.summary' % bcid os.rename('alignment.summary', fname) # os.rename(fname,os.path.join(DIR_BC_FILES,fname)) fname='alignmentQC_out_%s.txt' % bcid os.rename('alignmentQC_out.txt', fname) # os.rename(fname,os.path.join(DIR_BC_FILES,fname)) fname='alignTable_%s.txt' % bcid os.rename('alignTable.txt', fname) # os.rename(fname,os.path.join(DIR_BC_FILES,fname)) except: printtime('error renaming') traceback.print_exc() os.chdir(top_dir) #rename comprehensive results back to default names for fname in files: #if os.path.exists(fname + '.comprehensive'): # os.rename(fname + '.comprehensive', fname) try: shutil.copyfile(fname + '.comprehensive', fname) except: printtime('ERROR copying %s' % fname + '.comprehensive') traceback.print_exc() aggregate_alignment (DIR_BC_FILES,barcodelist_path)
def sigproc(analysisArgs, libKey, tfKey, pathtorawblock, SIGPROC_RESULTS, plot_title, oninstrumentanalysis): printtime("RUNNING SINGLE BLOCK ANALYSIS") if not oninstrumentanalysis: if analysisArgs: cmd = analysisArgs # e.g /home/user/Analysis --flowlimit 80 else: cmd = "Analysis" printtime("ERROR: Analysis command not specified, using default: 'Analysis'") sigproc_log_path = os.path.join(SIGPROC_RESULTS, 'sigproc.log') open(sigproc_log_path, 'w').close() sigproc_log = open(sigproc_log_path) cmd += " --librarykey=%s" % (libKey) cmd += " --tfkey=%s" % (tfKey) cmd += " --no-subdir" cmd += " --output-dir=%s" % (SIGPROC_RESULTS) cmd += " %s" % pathtorawblock cmd += " >> %s 2>&1" % sigproc_log_path printtime("Analysis command: " + cmd) proc = subprocess.Popen(cmd, shell=True) while proc.poll() is None: where = sigproc_log.tell() lines = sigproc_log.readlines() if lines: if any(l.startswith("Beadfind Complete") for l in lines): printtime("Beadfind is complete.") bfmaskPath = os.path.join(SIGPROC_RESULTS,"bfmask.bin") bfmaskstatspath = os.path.join(SIGPROC_RESULTS,"bfmask.stats") update_bfmask_artifacts(bfmaskPath, bfmaskstatspath, SIGPROC_RESULTS, plot_title) else: sigproc_log.seek(where) time.sleep(1) sigproc_log.close() status = proc.wait() blockprocessing.add_status("Analysis", status) # write return code into file try: os.umask(0002) f = open(os.path.join(SIGPROC_RESULTS,"analysis_return_code.txt"), 'w') f.write(str(status)) f.close() except: traceback.print_exc() if status == 2: printtime("Analysis finished with status '%s'" % status) try: com = "ChkDat" com += " -r %s" % (pathtorawblock) # printtime("DEBUG: Calling '%s':" % com) # ret = subprocess.call(com,shell=True) except: traceback.print_exc() ######################################################## #Make Bead Density Plots # ######################################################## bfmaskPath = os.path.join(SIGPROC_RESULTS,"analysis.bfmask.bin") bfmaskstatspath = os.path.join(SIGPROC_RESULTS,"analysis.bfmask.stats") update_bfmask_artifacts(bfmaskPath, bfmaskstatspath, SIGPROC_RESULTS, plot_title) printtime("Finished single block analysis")