00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CGATOOLS_VARIANTS_CALL_HPP_
00016 #define CGATOOLS_VARIANTS_CALL_HPP_ 1
00017
00019
00020 #include "cgatools/core.hpp"
00021 #include "cgatools/reference/CrrFile.hpp"
00022 #include "cgatools/util/DelimitedFile.hpp"
00023 #include <string>
00024
00025 namespace cgatools { namespace variants {
00026
00029 struct Call
00030 {
00031 public:
00032 enum VarQuality
00033 {
00034 VAR_QUALITY_EMPTY = 0,
00035 VAR_QUALITY_LOW = 1,
00036 VAR_QUALITY_HIGH = 2
00037 };
00038
00039 class VarQualityField : public util::DelimitedFieldParser
00040 {
00041 public:
00042 VarQualityField(const std::string& name, VarQuality* varQuality);
00043
00044 void parse(const char* first, const char* last);
00045
00046 private:
00047 VarQuality* varQuality_;
00048 };
00049
00050 class TotalScoreField : public util::DelimitedFieldParser
00051 {
00052 public:
00053 TotalScoreField(
00054 const std::string& name,
00055 int32_t* varScoreVAF,
00056 int32_t* varScoreEAF);
00057
00058 void parse(const char* first, const char* last);
00059
00060 private:
00061 int32_t* varScoreVAF_;
00062 int32_t* varScoreEAF_;
00063 };
00064
00066 static const uint16_t ALL_HAPLOTYPES;
00067
00069 static const uint16_t UNKNOWN_PLOIDY;
00070
00072 static const int32_t EMPTY_SCORE;
00073
00075 Call ();
00076
00079 std::string calledSequence(const reference::CrrFile& crr) const;
00080
00083 std::string refSequence(const reference::CrrFile& crr) const;
00084
00087 bool isRefConsistent(const reference::CrrFile& crr) const;
00088
00091 bool hasNoCalls() const;
00092
00095 void addFieldParsers(util::DelimitedFile& df, const reference::CrrFile& crr);
00096
00098 std::ostream& write(std::ostream& out,
00099 const reference::CrrFile& crr,
00100 const char sep = '\t') const;
00101
00103 static const char* varQualityToString(const VarQuality varQuality);
00104
00106 static VarQuality parseVarQuality(const char* first, const char* last);
00107
00109 static std::string getHeader (const char separator = '\t');
00110
00112 uint32_t locus_;
00113
00116 uint16_t ploidy_;
00117
00120 uint16_t haplotype_;
00121
00123 reference::Range range_;
00124
00126 std::string varType_;
00127
00129 std::string reference_;
00130
00132 std::string alleleSeq_;
00133
00135 int32_t varScoreVAF_;
00136
00141 int32_t varScoreEAF_;
00142
00145 VarQuality varQuality_;
00146
00148 std::string hapLink_;
00149
00151 std::string xRef_;
00152 };
00153
00156 void upgradeOldFieldValues(Call& c);
00157
00158 std::ostream& operator<<(std::ostream& out, const Call::VarQuality& varQuality);
00159
00160 } }
00161
00162 #endif // CGATOOLS_VARIANTS_CALL_HPP_