bool BaseCallerParameters::InitializeFilesFromOptArgs(OptArgs& opts) { bc_files.input_directory = opts.GetFirstString ('i', "input-dir", "."); bc_files.output_directory = opts.GetFirstString ('o', "output-dir", "."); bc_files.unfiltered_untrimmed_directory = bc_files.output_directory + "/unfiltered.untrimmed"; bc_files.unfiltered_trimmed_directory = bc_files.output_directory + "/unfiltered.trimmed"; CreateResultsFolder ((char*)bc_files.output_directory.c_str()); CreateResultsFolder ((char*)bc_files.unfiltered_untrimmed_directory.c_str()); CreateResultsFolder ((char*)bc_files.unfiltered_trimmed_directory.c_str()); ValidateAndCanonicalizePath(bc_files.input_directory); ValidateAndCanonicalizePath(bc_files.output_directory); ValidateAndCanonicalizePath(bc_files.unfiltered_untrimmed_directory); ValidateAndCanonicalizePath(bc_files.unfiltered_trimmed_directory); bc_files.filename_wells = opts.GetFirstString ('-', "wells", bc_files.input_directory + "/1.wells"); bc_files.filename_mask = opts.GetFirstString ('-', "mask", bc_files.input_directory + "/analysis.bfmask.bin"); ValidateAndCanonicalizePath(bc_files.filename_wells); ValidateAndCanonicalizePath(bc_files.filename_mask, bc_files.input_directory + "/bfmask.bin"); bc_files.filename_filter_mask = bc_files.output_directory + "/bfmask.bin"; bc_files.filename_json = bc_files.output_directory + "/BaseCaller.json"; bc_files.filename_phase = bc_files.output_directory + "/PhaseEstimates.json"; printf("\n"); printf("Input files summary:\n"); printf(" --input-dir %s\n", bc_files.input_directory.c_str()); printf(" --wells %s\n", bc_files.filename_wells.c_str()); printf(" --mask %s\n", bc_files.filename_mask.c_str()); printf("\n"); printf("Output directories summary:\n"); printf(" --output-dir %s\n", bc_files.output_directory.c_str()); printf(" unf.untr %s\n", bc_files.unfiltered_untrimmed_directory.c_str()); printf(" unf.tr %s\n", bc_files.unfiltered_trimmed_directory.c_str()); printf("\n"); bc_files.lib_datasets_file = opts.GetFirstString ('-', "datasets", ""); bc_files.calibration_panel_file = opts.GetFirstString ('-', "calibration-panel", ""); if (not bc_files.lib_datasets_file.empty()) ValidateAndCanonicalizePath(bc_files.lib_datasets_file); if (not bc_files.calibration_panel_file.empty()) ValidateAndCanonicalizePath(bc_files.calibration_panel_file); bc_files.options_set = true; return true; };
/************************************************************************************************* ************************************************************************************************* * * Start of Main Function * ************************************************************************************************* ************************************************************************************************/ int main (int argc, char *argv[]) { init_salute(); #ifdef _DEBUG atexit (memstatus); dbgmemInit(); #endif /* _DEBUG */ // Disable armadillo warning messages. ofstream null_ostream("/dev/null"); arma::set_stream_err1(null_ostream); arma::set_stream_err2(null_ostream); TrackProgress my_progress; DumpStartingStateOfProgram (argc,argv,my_progress); CommandLineOpts clo (argc, argv); InitPinnedWellReporterSystem (clo.img_control); // Directory to which results files will be written char *experimentName = NULL; experimentName = strdup (clo.GetExperimentName()); CreateResultsFolder (experimentName); CreateResultsFolder (clo.sys_context.basecaller_output_directory); string analysisLocation; clo.sys_context.SetUpAnalysisLocation (experimentName,analysisLocation); // Start logging process parameters & timing now that we have somewhere to log to my_progress.fpLog = clo.InitFPLog(); // create a raw wells file object // for new analysis, this is a file to be created; for reprocessing, this is the wells file to be read. // create the new wells file on a local partition. ClearStaleWellsFile(); clo.sys_context.MakeNewTmpWellsFile (experimentName); RawWells rawWells (clo.sys_context.wellsFilePath, clo.sys_context.wellsFileName); int well_rows, well_cols; // dimension of wells file - found out from images if we use them - why is this separate from the rawWells object? // structure our flows & special key sequences we look for int numFlows = clo.GetNumFlows(); SeqListClass my_keys; my_keys.StdInitialize (clo.flow_context.flowOrder,clo.key_context.libKey, clo.key_context.tfKey,my_progress.fpLog); // 8th duplicated flow processing code //@TODO: these parameters are just for reporting purposes??? // they appear to be ignored everywhere my_keys.UpdateMinFlows (clo.key_context.minNumKeyFlows); my_keys.UpdateMaxFlows (clo.key_context.maxNumKeyFlows); // GENERATE FUNCTIONAL WELLS FILE & BEADFIND FROM IMAGES OR PREVIOUS PROCESS Region wholeChip; //Create empty Mask object ExportSubRegionSpecsToMask (clo.loc_context); Mask bfmask (1, 1); Mask *maskPtr = &bfmask; GetFromImagesToWells (rawWells, maskPtr, clo, experimentName, analysisLocation, numFlows, my_keys,my_progress, wholeChip, well_rows,well_cols); if (!clo.mod_control.USE_RAWWELLS & clo.mod_control.WELLS_FILE_ONLY) { // stop after generating the functional wells file UpdateBeadFindOutcomes (maskPtr, wholeChip, experimentName, !clo.bfd_control.SINGLEBF, clo.mod_control.USE_RAWWELLS); my_progress.ReportState ("Analysis (wells file only) Complete"); } else { fprintf (stderr, "\n"); fprintf (stderr, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); fprintf (stderr, "ERROR: Analysis has reached removed BaseCalling code section\n"); fprintf (stderr, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); fprintf (stderr, "\n"); exit (EXIT_FAILURE); /* // Update progress bar status file: img proc complete/sig proc started updateProgress (IMAGE_TO_SIGNAL); // ============================================== // BASE CALLING // ============================================== // no images below this point // operating from a wells file generated above GenerateBasesFromWells (clo, rawWells, maskPtr, my_keys.seqList, well_rows, well_cols, experimentName, my_progress); UpdateBeadFindOutcomes (maskPtr, wholeChip, experimentName, !clo.bfd_control.SINGLEBF, clo.mod_control.USE_RAWWELLS); my_progress.ReportState ("Analysis Complete"); */ } clo.sys_context.CleanupTmpWellsFile (clo.mod_control.USE_RAWWELLS); free (experimentName); exit (EXIT_SUCCESS); }