/** ** Copyright (c) 2007-2009 Illumina, Inc. ** ** This software is covered by the "Illumina Genome Analyzer Software ** License Agreement" and the "Illumina Source Code License Agreement", ** and certain third party copyright/licenses, and any user of this ** source file is bound by the terms therein (see accompanying files ** Illumina_Genome_Analyzer_Software_License_Agreement.pdf and ** Illumina_Source_Code_License_Agreement.pdf and third party ** copyright/license notices). ** ** This file is part of the Off Line Base-caller (OLB) ** ** \file statsTosignalMeans.cpp ** ** Top level application to convert a set of stats files - and their associated ** filter - for a single tile into the corresponding SignalMeans files ** ** \author Come Raczy **/ #include "common/Program.hh" #include "basecalling/StatsToSignalMeansConverter.hh" namespace casava { namespace basecalling { namespace fs = boost::filesystem; namespace po = boost::program_options; namespace fs = boost::filesystem; class StatsToSignalMeansOptions: public casava::common::Options { public: StatsToSignalMeansOptions(); unsigned int laneIdentifier; unsigned int repeatIdentifier; std::vector cycleList; bool noCycleCheck; fs::path inputDirectory; fs::path filterFilePath; fs::path signalMeansFilePath; std::string statsFileName; bool ignoreMissingStats; bool needSeparateControls; private: std::string usagePrefix() const {return "statsToSignalMeans [options] {cycles}";} void postProcess(boost::program_options::variables_map &vm); }; StatsToSignalMeansOptions::StatsToSignalMeansOptions() : laneIdentifier(0) // invalid value , repeatIdentifier(1) , cycleList() , inputDirectory(".") , filterFilePath("") , signalMeansFilePath("") , statsFileName("") , needSeparateControls(false) { namedOptions_.add_options() ("lane,l" , po::value(&laneIdentifier), "identifier of the lane (1, 2, 3, ..., 8)") ("repeat,r" , po::value(&repeatIdentifier)->default_value(1), "identifier of the repeat (1, 2, ...)") ("input-directory,i" , po::value(&inputDirectory)->default_value("."), "full path to the input directory containing the 'lane' directories (and ultimately the *.stats files)") ("filter-file" , po::value(&filterFilePath), "full path to the filter file") ("no-cycle-check" , po::value(&noCycleCheck)->default_value(false)->zero_tokens(), "do not check the validity of the cycle numbers") ("signal-means-file" , po::value(&signalMeansFilePath), "full path to the output signal means file") ("stats-file-name" , po::value(&statsFileName), "name of the stats file") ("ignore-missing-stats" , po::value(&ignoreMissingStats)->default_value(false)->zero_tokens(), "fill in with zeros, when any *.stats file is missing") ("need-separate-controls", po::value< bool >(&needSeparateControls)->zero_tokens(), "Whether the controls are in a separate file, or included in the filter files (default)") ; unnamedOptions_.add_options() ("positional", po::value >(&cycleList), "list of cycles") ; positionalOptions_.add("positional",-1); } void StatsToSignalMeansOptions::postProcess(boost::program_options::variables_map &vm) { if (0 == laneIdentifier) { throw po::validation_error(po::validation_error::invalid_option_value, "0", "lane"); } if (filterFilePath.empty()) { throw po::validation_error(po::validation_error::invalid_option_value, "", "filter-file"); } if (signalMeansFilePath.empty()) { throw po::validation_error(po::validation_error::invalid_option_value, "", "signal-means-file"); } if (statsFileName.empty()) { throw po::validation_error(po::validation_error::invalid_option_value, "", "stats-file-name"); } if (cycleList.empty()) { throw po::validation_error(po::validation_error::at_least_one_value_required, "", "positional"); } } void statsToSignalMeans(const StatsToSignalMeansOptions &options) { typedef StatsToSignalMeansConverter Converter; Converter converter(options.laneIdentifier, options.repeatIdentifier, options.cycleList, options.inputDirectory, options.statsFileName, options.filterFilePath, options.signalMeansFilePath, !options.noCycleCheck, options.ignoreMissingStats, !options.needSeparateControls); converter.run(); } } //namespace basecalling } //namespace casava int main(int argc, char *argv[]) { casava::common::run(casava::basecalling::statsToSignalMeans, argc, argv); }