Beispiel #1
0
 void
 finish_sample(sample_t &sample, const vec_mutation_t &fixations,
               const unsigned nsam, const bool removeFixed,
               const sugar::treat_neutral treat)
 {
     if (!removeFixed)
         {
             add_fixations(sample, fixations, nsam, treat);
         }
     std::sort(sample.begin(), sample.end(),
               [](const sample_site_t &a, const sample_site_t &b) noexcept {
                   return a.first < b.first;
               });
     if (!removeFixed)
         {
             sample.erase(std::unique(sample.begin(), sample.end()),
                          sample.end());
         }
 }
Beispiel #2
0
    void update_sample_block(sample_t & block,
			     const gamete_mcont_t & variants,
			     const mcont_t & mutations,
			     const size_t & i,
			     const size_t & n,
			     const pos_finder & pf,
			     const size_t & offset = 0,
			     const size_t & scalar = 2)
    {
      for( const auto & m : variants )
	{
	  auto mutpos = mutations[m].pos;
	  auto itr = std::find_if(block.begin(),block.end(),std::bind(pf,std::placeholders::_1,mutpos));
	  if( itr == block.end() )
	    {
	      block.push_back( std::make_pair(mutpos,std::string(n,'0')) );
	      block[block.size()-1].second[scalar*i+offset] = '1';
	    }
	  else
	    {
	      itr->second[scalar*i+offset]='1';
	    }
	}
    }