00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CGATOOLS_VARIANTS_PHASEDHYPOTHESIS_HPP_
00016 #define CGATOOLS_VARIANTS_PHASEDHYPOTHESIS_HPP_ 1
00017
00019
00020 #include "cgatools/core.hpp"
00021 #include "cgatools/variants/PhasedAllele.hpp"
00022 #include "cgatools/variants/CallDiffResult.hpp"
00023 #include "cgatools/variants/AlleleDiffSegment.hpp"
00024
00025 namespace cgatools { namespace variants {
00026
00027 class Superlocus;
00028
00030 class PhasedHypothesis
00031 {
00032 public:
00034 PhasedHypothesis(const reference::Range& range, size_t ploidy);
00035
00037 size_t size() const
00038 {
00039 return alleles_.size();
00040 }
00041
00043 const reference::Range& getRange() const
00044 {
00045 return range_;
00046 }
00047
00049 const PhasedAllele& operator[](size_t offset) const
00050 {
00051 return alleles_[offset];
00052 }
00053
00055 PhasedAllele& operator[](size_t offset)
00056 {
00057 return alleles_[offset];
00058 }
00059
00060 void swap(PhasedHypothesis& other);
00061
00064 static void findBestDiff(const Superlocus& sl,
00065 size_t maxHypothesisCount,
00066 const std::vector<PhasedHypothesis>& lhs,
00067 const std::vector<PhasedHypothesis>& rhs,
00068 const reference::CrrFile& crr,
00069 CallDiffResult& result);
00070
00071 static void testVariant(const Superlocus& sl,
00072 const std::vector<PhasedHypothesis>& hyps,
00073 const reference::Range& varRange,
00074 const std::string& varAllele,
00075 const reference::CrrFile& crr,
00076 std::string& result);
00077
00078 private:
00079 static void diffHypotheses(const PhasedHypothesis& lhs,
00080 const PhasedHypothesis& rhs,
00081 const std::string& refSequence,
00082 const std::vector<size_t>& perm,
00083 std::vector<CallDiffResult::MatchType>& result);
00084 static void testVariantOneHypothesis(
00085 const PhasedHypothesis& hyp,
00086 const PhasedAllele& rhs,
00087 const reference::Range& variantRange,
00088 const reference::Range& extendedVariantRange,
00089 const std::string& refSequence,
00090 std::vector< std::pair<char, std::vector<const variants::Call*> > >& result);
00091
00092 static void classifyCalls(
00093 const PhasedAllele& lhs,
00094 const PhasedAllele& rhs,
00095 const std::string& refSequence,
00096 const reference::CrrFile& crr,
00097 const reference::Range& range,
00098 CallDiffResult::MatchType mt,
00099 std::vector< std::pair<CallDiffResult::MatchType, const Call*> >& lhsCallClass,
00100 std::vector< std::pair<CallDiffResult::MatchType, const Call*> >& rhsCallClass);
00101
00102 static void splitIntoSegments(const PhasedAllele& lhs,
00103 const PhasedAllele& rhs,
00104 const std::string& refSequence,
00105 const reference::Range& range,
00106 std::vector<AlleleDiffSegment>& segs);
00107 static bool segCanSplit(const Call& call, uint32_t pos);
00108
00109 reference::Range range_;
00110 std::vector<PhasedAllele> alleles_;
00111 };
00112
00113 } }
00114
00115 #endif // CGATOOLS_VARIANTS_PHASEDHYPOTHESIS_HPP_