/* * Mendel.h * * Created on: Nov 6, 2012 * Author: gpeng1 */ #ifndef MENDEL_H_ #define MENDEL_H_ #include "PCCP.h" #include "pedigree.h" enum calMethod {MCMC, BN, Peeling}; class Mendel: public pedigree { private: PCCP m_pccp; PCCP m_pccpMale; PCCP m_pccpFemale; //probability for each genotype //Pr(genotype) std::vector m_genoProb; // likelihood dMatrix m_lk; unsigned int m_nGenotype; // whether there is an error bool m_error; bool m_chromSex; bool m_loop; ///////////////////// // check functions // ///////////////////// // check whether the number of genotype in pccp matches the number of genotype in genoProb bool check_nGeno(); ///////////////////////// // calculate functions // ///////////////////////// dMatrix calPostProbPeeling(); dMatrix calPostProbPeeling(const std::vector & sampleIndex); dMatrix calPostProbBN(); dMatrix calPostProbMCMC(); double calAntProb(unsigned int iInd, unsigned int iGeno, dMatrix & antProb, std::vector > & posProb, dMatrix & checkLoop); double calPosProb(unsigned int iInd, unsigned int jInd, unsigned int iGeno, dMatrix & antProb, std::vector > & posProb, dMatrix & checkLoop); public: // constructor Mendel(const std::vector & mem, const std::vector & genoProb, const std::vector & numAllele, double mRate, bool store=true); Mendel(const std::vector & mem, const std::vector & genoProb, const std::vector & numAllele, const std::vector & mRate, bool stroe=true); // for chromosome type // 0: autosome // 1: chromosome X Mendel(const std::vector & mem, const std::vector & genoProb, const std::vector & numAllele, double mRate, const std::vector & chromType, bool store=true); Mendel(const std::vector & mem, const std::vector & genoProb, const std::vector & numAllele, const std::vector & mRate, const std::vector & chromType, bool store=true); /////////////////// // get functions // /////////////////// PCCP get_pccp() const { return m_pccp; } std::vector get_genoProb() const { return m_genoProb; } unsigned int get_nGenotype() const{ return m_nGenotype;} dMatrix get_lk() const { return m_lk; } /////////////////// // set functions // /////////////////// // set pccp // when pccp is not set properly, return false bool set_pccp(const PCCP & pccp); // set genoProb // when genoProb is not set properly, return false bool set_genoProb(const std::vector & genoProb); //set pccp and genoProb bool set_par(const PCCP & pccp, const std::vector & genoProb); //calculate the posterior probability dMatrix calPostProb(const dMatrix & lk, calMethod method=Peeling); dMatrix calPostProb(const dMatrix & lk, const std::vector & sampleId, calMethod method=Peeling); }; #endif /* MENDEL_H_ */