Example #1
0
void abcDstat2::print(funkyPars *pars){
  
  if(doAbbababa2==0)
    return;
  funkyAbbababa2 *abbababaStruct = (funkyAbbababa2 *) pars->extras[index];//new
  
  if(currentChr==-1){//if first chunk
    DENprint=0; //    
    NUMprint=0; //numerator for current block
    Eprint = 0;
    for(int i=0;i<256;i++)
      COMBprint[i]=0; 
    //start new block
    getBlockNum(pars->posi[0]);
    currentChr=0;
  }

  while(currentChr!=pars->refId){ //if new chr (not first)
    //start new block
    printAndEmpty(block*blockSize,currentChr);
    currentChr=pars->refId;
    getBlockNum(pars->posi[0]);
  }
 
  for(int i=0;i<256;i++)
    COMBprint[i] += abbababaStruct->COMB[i]; //?????
  
  for(int s=0;s<pars->numSites;s++){
    int comp=0;
    if(pars->posi[s]>=block*blockSize+blockSize){
      printAndEmpty(block*blockSize,pars->refId);
      getBlockNum(pars->posi[s]);
    }    
    if(pars->keepSites[s]==0)
      continue;
    NUMprint+=abbababaStruct->NUM[s];
    DENprint+=abbababaStruct->DEN[s];
    NSITEprint++;
    if(abbababaStruct->NUM[s]>abbababaStruct->DEN[s])
      Eprint += 1;
  }

}//---end of abcDstat2::print(funkyPars *pars)
Example #2
0
abcDstat2::~abcDstat2(){
  free(ancName);
  if(doAbbababa2==0)
    return;

  printAndEmpty(block*blockSize,currentChr);

  if(outfile) fclose(outfile);
  //if(outfile2) fclose(outfile2);
  if(bufstr.s!=NULL)
    free(bufstr.s);
}
Example #3
0
abcDstat::~abcDstat(){
  free(ancName);
  if(doAbbababa==0)
    return;

  printAndEmpty();
  if(outfile) fclose(outfile);
  //  fclose(outfile2);
  if(bufstr.s!=NULL)
    free(bufstr.s);
  delete[] ABBA;
  delete[] BABA;

}
Example #4
0
void abcDstat::print(funkyPars *pars){
  //   fprintf(stderr,"currentpos %lu %d\n",currentPos,header->l_ref[currentChr]);

  if(doAbbababa==0)
    return;

  funkyAbbababa *abbababaStruct = (funkyAbbababa *) pars->extras[index];//new

  if(currentChr==-1){//if first chunk
    //start new block
    for(int j=0;j<nComb;j++){
      ABBA[j]=0;
      BABA[j]=0;
    }
    getBlockNum(pars->posi[0]);
    currentChr=0;
  }

  while(currentChr!=pars->refId){//if new chr (not first)
    //start new block
    printAndEmpty();
    currentChr++;
    getBlockNum(pars->posi[0]);
  }





  for(int s=0;s<pars->numSites;s++){
    int comp=0;

    if(pars->posi[s]>=block*blockSize+blockSize){
      printAndEmpty();
      getBlockNum(pars->posi[s]);
    }

    if(pars->keepSites[s]==0)
	continue;
    for(int h3=0; h3<(pars->nInd); h3++){
      for(int h2=0; h2<(pars->nInd); h2++){
	if(h2==h3)
	  continue;
	for(int h1=0; h1<h2; h1++){
	  if(h1==h3)
	    continue;
	  if(abbababaStruct->ABCD[s][comp]==4)
	    ABBA[comp]++;
	  else if(abbababaStruct->ABCD[s][comp]==7){
	    BABA[comp]++;
	  }
	    comp++;
	}
      }
    }
  }
  /*
  for(int p=currentPos;p<abbababaStruct->start;p++){
    if(p % NbasesPerLine == 0)
      fprintf(outfile,"\n");
    
    fprintf(outfile,"N");
    currentPos++;
  }
  int c=0;
  for(int p=currentPos;p<abbababaStruct->stop;p++){
    if(p==pars->posi[c]){
      if(p % NbasesPerLine == 0)
	fprintf(outfile,"\n");
      fprintf(outfile,"%d",abbababaStruct->seq[c]);
      //      fprintf(stdout,"%lu%d\t%c\n",currentPos+1,pars->posi[c],abbababaStruct->seq[c]);
      c++;
    }
    else{
      if(p % NbasesPerLine == 0)
	fprintf(outfile,"\n");
      fprintf(outfile,"N");
    }
    currentPos++;
  }

  */
}