36 #ifndef _GENOTYPER_HPP_
37 #define _GENOTYPER_HPP_
41 #include "Configurable.hpp"
42 #include "shared_ptr.hpp"
48 class ChromosomePairRange;
51 class VariantIndicator;
62 inline char genotype_make_pair(
char allele_0,
char allele_1)
64 return (allele_0<<4) | allele_1;
68 inline char genotype_sum(
char genotype)
70 return (genotype>>4) + (genotype & 0x0F);
74 inline char genotype_first(
char genotype)
80 inline char genotype_second(
char genotype)
82 return (genotype & 0x0F);
91 GenotypeData(
const char* begin,
const char* end) : std::vector<char>(begin, end) {}
93 double allele_frequency()
const;
101 typedef shared_ptr<GenotypeData> GenotypeDataPtr;
108 GenotypeDataPtr
get(
const Locus& locus)
const
112 std::ostringstream message;
113 message <<
"[GenotypeMap] Locus " << locus <<
" not found.";
114 throw std::runtime_error(message.str().c_str());
117 GenotypeDataPtr result = at(locus);
121 std::ostringstream message;
122 message <<
"[GenotypeMap] Null data at locus " << locus;
123 throw std::runtime_error(message.str().c_str());
131 typedef shared_ptr<GenotypeMap> GenotypeMapPtr;
144 char genotype(
const Locus& locus,
145 const Organism& organism,
146 const VariantIndicator& indicator)
const;
149 char genotype(
const Locus& locus,
150 const ChromosomePairRange& range,
151 const VariantIndicator& indicator)
const;
154 void genotype(
const Loci& loci,
155 const Population& population,
156 const VariantIndicator& indicator,
161 #endif // _GENOTYPER_HPP_