/** ** Copyright (c) 2010 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 PairStats.hh ** ** \brief Encapsulation of pair statistics XML file. ** ** Encapsulation of pair statistics XML file. ** ** \author Richard Shaw **/ /*****************************************************************************/ #ifndef PAIR_STATS_HH #define PAIR_STATS_HH /*****************************************************************************/ #include #include #include #include "common/RelOrient.hh" /*****************************************************************************/ namespace casava { namespace common { /*****************************************************************************/ class LaneBarcodePairStats { public: LaneBarcodePairStats(); LaneBarcodePairStats(const std::string &goodPairs, const std::string &read1Len, const std::string &read2Len, const RelOrient &relOrient, const std::string &fragmentLenMedian, const std::string &fragmentLenLowSd, const std::string &fragmentLenHighSd); unsigned int getReadLen(unsigned int readNum) const; void setNumSds(float numLowSds, float numHighSds); void getBounds(RelOrient& relOrient, double& minSize, double& maxSize) const; void getSds(double& lowSd, double& highSd) const; double mostLikelyInsertSize() const { return fragmentLenMedian_; } bool isCompatible(const LaneBarcodePairStats& that); LaneBarcodePairStats & operator |= (const LaneBarcodePairStats& that); LaneBarcodePairStats & assign(LaneBarcodePairStats that); private: // configuration float numLowSds_; float numHighSds_; // data unsigned int goodPairs_; unsigned int read1Len_; unsigned int read2Len_; RelOrient relOrient_; double fragmentLenMedian_; double fragmentLenLowSd_; double fragmentLenHighSd_; //derived double fragmentLenSizeMin_; double fragmentLenSizeMax_; void updateDerived(); }; /*****************************************************************************/ class PairStats { public: // Expects to find *pair.xml according to the run.conf.xml for this proj. PairStats(const boost::filesystem::path& projDirPath); bool isValid(const std::string &instrument, const int run, const int lane, const std::string &barcode) const { return myLaneBarcodePairStatsMap.end() != getLaneBarcodePairStats(instrument, run, lane, barcode, "isValid"); } unsigned int getReadLen(const std::string &instrument, const int run, const int lane, const std::string &barcode, unsigned int readNum) const; void setNumSds(float numLowSds, float numHighSds); void getBounds(const std::string &instrument, const int run, const int lane, const std::string &barcode, RelOrient& relOrient, double& minSize, double& maxSize) const; void getSds(const std::string &instrument, const int run, const int lane, const std::string &barcode, double& lowSd, double& highSd) const; double mostLikelyInsertSize(const std::string &instrument, const int run, const int lane, const std::string &barcode) const; private: // Prevent other forms of construction and copying. PairStats(); PairStats(const PairStats&); PairStats& operator=(const PairStats&); typedef std::map LaneBarcodePairStatsMap; typedef LaneBarcodePairStatsMap::iterator LaneBarcodePairStatsMapIter; typedef LaneBarcodePairStatsMap::const_iterator LaneBarcodePairStatsMapCIter; LaneBarcodePairStatsMap myLaneBarcodePairStatsMap; LaneBarcodePairStatsMap::const_iterator getLaneBarcodePairStats(const std::string &instrument, const int run, const int lane, const std::string &barcode, const std::string &label) const; }; /*****************************************************************************/ } // namespace common } // namespace casava /*****************************************************************************/ #endif // #ifndef PAIR_STATS_HH /*****************************************************************************/