// -*- mode: c++; indent-tabs-mode: nil; -*- // // Copyright 2009 Illumina, Inc. // // 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). // // /// \file /// \author Chris Saunders /// #include "blt_util/nploid_genotype_util.hh" #include unsigned nploid_gtype_size(const unsigned ploidy) { static const unsigned NB1(N_BASE-1); const double r(boost::math::binomial_coefficient(NB1+ploidy,NB1)); assert(r>=0); return static_cast(r); } nploid_info:: nploid_info(const unsigned init_ploidy) : _ploidy(init_ploidy), _echunk(1./static_cast(init_ploidy)) { gtype_info gi; gi.label.resize(_ploidy); ginfo_init(_ploidy,0,0,gi); unsigned init_index(0); unsigned* init_ref(_ref_gtype); ref_gtype_init(_ploidy,0,0,true,init_ref,init_index); } // recursively derive labels and base frequencies for each genotype void nploid_info:: ginfo_init(const unsigned ploidy, const unsigned pli, const unsigned init_i, gtype_info& gi) { for(unsigned i(init_i); i