/** ** 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 Consensus Assessment of Sequence And VAriation ** (CASAVA) software package. ** ** \file CountingBclWriter.hh ** ** \brief BCL writer that also collects statistics about written bases. ** ** \author Roman Petrovski **/ #ifndef CASAVA_DEMULTIPLEX_COUNTING_BCL_WRITER_HH #define CASAVA_DEMULTIPLEX_COUNTING_BCL_WRITER_HH #include "io/BclWriter.hh" namespace casava { namespace demultiplex { namespace fs = boost::filesystem; namespace cc = casava::common; namespace cio = casava::io; /** ** @brief Same as casava::common::BclWriter but knows how many of which bases has been written. **/ class CountingBclWriter: protected cio::BclWriter { public: typedef std::pair Cluster; CountingBclWriter(const fs::path &cyclePath, const unsigned int expectedClusters) : BclWriter(cyclePath, expectedClusters) , baseCounts_('T' + 1){;} void put(const Cluster& cluster) { cio::BclWriter::put(cluster); ++baseCounts_.at(cluster.first[0]); } void close(){cio::BclWriter::close();} int getBaseCount(char base){ return baseCounts_[base]; } private: std::vector baseCounts_; CountingBclWriter(); CountingBclWriter(const CountingBclWriter &); CountingBclWriter &operator=(const CountingBclWriter &); }; } // namespace demultiplex } // namespace casava #endif // CASAVA_DEMULTIPLEX_COUNTING_BCL_WRITER_HH