int main (int argc, char *argv[]) { MrfEntry *currEntry; int mode; if (argc != 3) { usage ("%s <file.annotation> <include|exclude>",argv[0]); } intervalFind_addIntervalsToSearchSpace (argv[1],0); if (strEqual (argv[2],"include")) { mode = MODE_INCLUDE; } else if (strEqual (argv[2],"exclude")) { mode = MODE_EXCLUDE; } else { usage ("%s <file.annotation> <include|exclude>",argv[0]); } mrf_init ("-"); puts (mrf_writeHeader ()); while (currEntry = mrf_nextEntry ()) { processEntry (currEntry,mode); } mrf_deInit (); return 0; }
int main (int argc, char *argv[]) { MrfEntry *currEntry; char *targetName; int targetStart,targetEnd; WordIter w; if (argc != 2) { usage ("%s <targetName:targetStart-targetEnd>",argv[0]); } w = wordIterCreate (argv[1],":- ",0); targetName = hlr_strdup (wordNext (w)); targetStart = atoi (wordNext (w)); targetEnd = atoi (wordNext (w)); wordIterDestroy (w); mrf_init ("-"); puts (mrf_writeHeader ()); while (currEntry = mrf_nextEntry ()) { processEntry (currEntry,targetName,targetStart,targetEnd); } mrf_deInit (); hlr_free (targetName); return 0; }
int main (int argc, char *argv[]) { MrfEntry *currEntry; char *targetName; int targetStart,targetEnd; WordIter w; int count=0; int currCount=0; if (argc != 2) { usage ("%s <targetName:targetStart-targetEnd>",argv[0]); } w = wordIterCreate (argv[1],":- ",0); targetName = hlr_strdup (wordNext (w)); targetStart = atoi (wordNext (w)); targetEnd = atoi (wordNext (w)); wordIterDestroy (w); mrf_init ("-"); while (currEntry = mrf_nextEntry ()) { currCount = processEntry (currEntry,targetName,targetStart,targetEnd); count = currCount+count; } printf("Count for %s:%d-%d = %d\n", targetName, targetStart, targetEnd, count); mrf_deInit (); hlr_free (targetName); return 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; }
int main (int argc, char *argv[]) { int i,j,groupNumber; MrfEntry *currEntry; GffEntry *currGffEntry,*nextGffEntry; Array gffEntries; FILE *fp; Stringa buffer; short int paired; if (argc != 2) { usage ("%s <prefix>",argv[0]); } buffer = stringCreate (1000); groupNumber = 0; mrf_init ("-"); gffEntries = arrayCreate (100000,GffEntry); while (currEntry = mrf_nextEntry ()) { processRead (gffEntries, currEntry, &groupNumber); } mrf_deInit (); arraySort (gffEntries,(ARRAYORDERF)sortGffEntriesByTargetNameAndGroupNumber); i = 0; while (i < arrayMax (gffEntries)) { currGffEntry = arrp (gffEntries,i,GffEntry); stringPrintf (buffer,"%s_%s.gff",argv[1],currGffEntry->targetName); fp = fopen (string (buffer),"w"); if (fp == NULL) { die ("Unable to open file: %s",string (buffer)); } fprintf (fp,"browser hide all\n"); fprintf (fp,"track name=\"%s_%s\" visibility=2\n",argv[1],currGffEntry->targetName); fprintf (fp,"%s\n",currGffEntry->line); j = i + 1; while (j < arrayMax (gffEntries)) { nextGffEntry = arrp (gffEntries,j,GffEntry); if (!strEqual (currGffEntry->targetName,nextGffEntry->targetName)) { break; } fprintf (fp,"%s\n",nextGffEntry->line); j++; } i = j; fclose (fp); } stringDestroy (buffer); return 0; }