Example #1
0
File: pp.c Project: hvds/seq
void pp_save_r(int n, int prime, int power) {
	pp_pp* pp = &pppp[power];
	pp_value* v;
	int i, raise;
	mpq_t q;
	if (!pp->p)
		new_pp(pp, prime, power);
	QINIT(&q, "pp_save_r temp");
	mpq_set_ui(q, 1, n);
	pp_save_any(pp, q, n, 1);
	QCLEAR(&q, "pp_save_r temp");
}
Example #2
0
void HaploWindow::prunePhase(int i, double t)
{

  // pp[i][z]
  // hap1[i][z]
  // hap2[i][z]
  // skip[z] 

  if ( (!haplo->include[i]) ||(!ambig[i]))
    return;

  MultiLocusGenotype * mlg = genoGroup[i];

  double psum = 0;

  vector<double> new_pp(0);
  vector<int> new_h1(0);
  vector<int> new_h2(0);
  vector<bool> new_skip(0);

  for (int z=0; z < hap1[i].size(); z++)
    {

      if ( pp[i][z] >= t ) 
	{
	  new_pp.push_back(pp[i][z]);
	  psum += pp[i][z];
	  new_h1.push_back(hap1[i][z]);
	  new_h2.push_back(hap2[i][z]);
	  new_skip.push_back(mlg->skip[z]);
	}
    }

  // Normalise?
  if (pp[i].size() > new_pp.size() )
    {
      for (int z=0; z < new_pp.size(); z++)
	new_pp[z] /= psum;
    }

	
  // Update
  pp[i] = new_pp;
  hap1[i] = new_h1;
  hap2[i] = new_h2;
  mlg->skip = new_skip;
	

}