Ejemplo n.º 1
0
int main (int argc, char *argv[]) 
{
  if( argc != 3 ) {
    usage( "%s <errors|noerrors> <gaps|nogaps>", argv[0]);
    return -1;
  }
  MrfEntry *currEntry;
  MrfBlock *currBlock;
  int i, error, errorCode, numErrors;
  int gaps = 0;
  if( strEqual( "gaps", argv[2] ) )
    gaps = 1;
  seq_init();
  mrf_init ("-");
  printf( "%s\n", mrf_writeHeader());
  numErrors = 0;
  while (currEntry = mrf_nextEntry ()) {
    error = 0;
    for( i=0; i<arrayMax(currEntry->read1.blocks); i++) {   
      currBlock=arrp( currEntry->read1.blocks, i, MrfBlock);
      if( i==0 ) {
	errorCode = processBlock ( currBlock, NULL, gaps );
      } else {
	errorCode = processBlock ( currBlock, arrp( currEntry->read1.blocks, i-1, MrfBlock ), gaps );
      }
      if(  errorCode != 0 ) {
	warn( "Error code (read1): %d\t%s:%c:%d:%d:%d:%d", errorCode, currBlock->targetName, currBlock->strand, currBlock->targetStart, 
	      currBlock->targetEnd, currBlock->queryStart, currBlock->queryEnd);	
	error++;
      }
    }
    if (currEntry->isPairedEnd & error == 0) {
      for( i=0; i<arrayMax(currEntry->read2.blocks); i++) {
	currBlock=arrp( currEntry->read2.blocks, i, MrfBlock);
	if( i==0 ) {
	  errorCode = processBlock ( currBlock, NULL , gaps ); 
	} else {
	  errorCode = processBlock (currBlock, arrp( currEntry->read2.blocks, i-1, MrfBlock) , gaps);
	}
	if( errorCode !=0 ) {
	  warn( "Error code (read2): %d\t%s:%c:%d:%d:%d:%d", errorCode, currBlock->targetName, currBlock->strand, currBlock->targetStart, 
		currBlock->targetEnd, currBlock->queryStart, currBlock->queryEnd);
	  error++;
	}
      }
    }
    if( error > 0 && strEqual(argv[1], "errors")) {
      printf( "%s\n", mrf_writeEntry( currEntry ));
      error=0;
      numErrors++;
    } 
    if( error == 0 && strEqual(argv[1], "noerrors")) 
      printf( "%s\n", mrf_writeEntry( currEntry ));
  }
  mrf_deInit ();
  warn("%s: done", argv[0]);
  return 0;

}
Ejemplo n.º 2
0
static void processEntry (MrfEntry *currEntry, char *targetName, int targetStart, int targetEnd) 
{
  int containment;

  containment = 0;
  containment += isContained (&currEntry->read1,targetName,targetStart,targetEnd);
  if (currEntry->isPairedEnd) {
    containment += isContained (&currEntry->read2,targetName,targetStart,targetEnd);
  }
  if (containment != 0) {
    puts (mrf_writeEntry (currEntry));
  }
}
Ejemplo n.º 3
0
static void processEntry (MrfEntry *currEntry, int mode) 
{
  int containment;

  containment = 0;
  containment += isContained (&currEntry->read1);
  if (currEntry->isPairedEnd) {
    containment += isContained (&currEntry->read2);
  }
  if ((containment != 0 && mode == MODE_INCLUDE) ||
      (containment == 0 && mode == MODE_EXCLUDE)) {
    puts (mrf_writeEntry (currEntry));
  }
}