Esempio n. 1
0
/*Want to access P-value, I statistic, and name of test.
 *
 * void gene_accumulate_assoc( VariantGroup & vars , void *p ){
	Py_geneassocGroup geneassocgroup;

	std::vector<Py_test> tests;
	for( int i = 0; i < )


}*/
void group_accumulate_func( VariantGroup &v, void *p ){
  //Variant Group
	Py_variantGroup vargroup;
	vargroup.NV = v.n_variants();
	vargroup.SIZE = v.size();
	vargroup.COORD = v.coordinate();
	vargroup.SPAN = v.span();
	vargroup.MIDPOS = v.midposition();
	vargroup.NAME = v.name();
	vargroup.NIND = v.n_individuals();
	std::vector<Py_variant> vars;
	for(int i = 0; i < v.n_variants(); i++){
		// Add new variant to the vector of variant groups.
		Variant vn = v.var(i);
		Py_variant var;
		var.CHR = vn.chromosome();
		var.BP1 = vn.position();
		var.BP2 = vn.stop();
		var.ID = vn.name();
		var.NS = vn.n_samples();

		// Sample variant
		SampleVariant &sv = vn.sample(-1);
		Py_sample_variant svar;
		svar.FSET = sv.fileset();
		svar.REF = sv.reference();
		svar.ALT = sv.alternate();
		svar.QUAL = sv.quality();

		// Genotype
		Py_genotype py_geno;
		std::vector<int> gt;
		int nind = vn.size(-1);
		for (int i = 0; i < nind; i++) {
			Genotype* geno = vn.genotype(-1, i);
		    if (geno->more() || geno->null()) {
		    	gt.push_back(-1); // Code NA as -1
		    } else {
		    	gt.push_back(geno->allele_count());
		    }
		  }
		 py_geno.GT = gt;
		 svar.GENO = py_geno;
		 var.CON = svar;

		vars.push_back(var);

	}
	vargroup.VARS = vars;
	std::vector<Py_variantGroup>* d = (std::vector<Py_variantGroup>*)p;
	d->push_back(vargroup);
}
Esempio n. 2
0
void accumulate_func(Variant &v, void *p) {
  // Variant
  Py_variant var;
  var.CHR = v.chromosome();
  var.BP1 = v.position();
  var.BP2 = v.stop();
  var.ID = v.name();
  var.NS = v.n_samples();

  // Sample variant
  SampleVariant &sv = v.sample(-1);
  Py_sample_variant svar;
  svar.FSET = sv.fileset();
  svar.REF = sv.reference();
  svar.ALT = sv.alternate();
  svar.QUAL = sv.quality();

  // Genotype
  Py_genotype py_geno;
  std::vector<int> gt;
  int nind = v.size(-1);
  for (int i = 0; i < nind; i++) {
    Genotype* geno = v.genotype(-1, i);
    if (geno->more() || geno->null()) {
      gt.push_back(-1); // Code NA as -1
    } else {
      gt.push_back(geno->allele_count());
    }
  }
  py_geno.GT = gt;
  svar.GENO = py_geno;
  var.CON = svar;

  // Add new variant to the vector of variants
  std::vector<Py_variant>* d = (std::vector<Py_variant>*)p;
  d->push_back(var);
}