/** * Project : CASAVA * Module : $RCSfile: AnomalousRead.hh,v $ * @author : Richard Shaw * Copyright : Copyright (c) Illumina 2010. All rights reserved. * ** 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). * */ /*****************************************************************************/ #ifndef ANOMALOUS_READ_HH #define ANOMALOUS_READ_HH /*****************************************************************************/ #include "common/PairStats.hh" #include "variance/SingletonEvent.hh" /*****************************************************************************/ using casava::common::PairStats; namespace ca { namespace variance_detection { /*****************************************************************************/ class AnomalousRead : public Singleton { public: typedef enum { ShadowOrSemiAligned, // FIXME : split these later InsertionPair, DeletionPair, DuplicationPair, InversionPair, ChimericPair } Type; AnomalousRead(const Alignment& alignment, bool noReverse = false); // Singleton is responsible for telling the world the start and end of // the interval within which it might lie ... virtual void populateBounds (vector& eventStarts, vector& eventEnds)=0; // ... and for assigning a p-value to every position within that interval virtual void populateMetric(IndelMetricStore& indelMetric)=0; long mostLikelyBreakPt() const { return myMostLikelyBreakPt; } protected: // For an anomalous pair read on same chrom, the mid-point of the pair. // For a chimeric pair read : where mid-point of pair was expected. long myMostLikelyBreakPt; }; /*****************************************************************************/ std::ostream& operator<<(std::ostream& ostrm, const AnomalousRead::Type& anomalousReadType); /*****************************************************************************/ std::istream& operator>>(std::istream& istrm, AnomalousRead::Type& anomalousReadType); /*****************************************************************************/ // Class that simply preserves the alignment and positions given to it. // In particular, there is no reversing of R-mapped read and quality strings. // The populateBounds and populateMetric methods are deliberately no-ops. class IdentityAnomRead : public AnomalousRead { public: IdentityAnomRead(const Alignment& alignment, int minPos, int maxPos) : AnomalousRead(alignment, true) { minPos_ = minPos; maxPos_ = maxPos; } virtual void populateBounds (vector& , vector& ) { } virtual void populateMetric(IndelMetricStore& ) { } }; /*****************************************************************************/ class SingleChromPairAnomRead : public AnomalousRead { public: SingleChromPairAnomRead(const Alignment& alignment, long leftPos, unsigned int insertSize); virtual void populateBounds(vector& eventStarts, vector& eventEnds); virtual void populateMetric(IndelMetricStore& indelMetric); }; /*****************************************************************************/ class ChimericPairAnomRead : public AnomalousRead { public: ChimericPairAnomRead(const Alignment& alignment, const PairStats& pairStats, unsigned int readLen); virtual void populateBounds(vector& eventStarts, vector& eventEnds); virtual void populateMetric(IndelMetricStore& indelMetric); private: // double myStandardDeviation; }; /*****************************************************************************/ } // namespace variance_detection } // namespace ca /*****************************************************************************/ #endif // ANOMALOUS_READ_HH /*****************************************************************************/