00001 #include "log.h"
00002 #include "format.h"
00003 #include "bowtieParser.h"
00004 #include "bp.h"
00005 #include "common.h"
00006
00007 static int sortBowtieQueries ( BowtieQuery *a, BowtieQuery *b)
00008 {
00009 return strcmp ( a->sequenceName, b->sequenceName );
00010 }
00011
00012 int main (int argc, char *argv[])
00013 {
00014 Array breakPoints;
00015 Array bowtieQueries;
00016 BreakPoint *currBP;
00017 Stringa buffer = stringCreate( 20 );
00018 int i;
00019 if( argc<2 ) {
00020 usage("Usage: %s <prefix>", argv[0]);
00021 }
00022 bp_init("-");
00023 breakPoints = bp_getBreakPoints();
00024 stringPrintf( buffer, "%s", argv[1]);
00025 bowtieParser_initFromFile (string(buffer));
00026 bowtieQueries = bowtieParser_getAllQueries ();
00027 bowtieParser_deInit ();
00028 arraySort( bowtieQueries, (ARRAYORDERF) sortBowtieQueries);
00029
00030 for( i=0; i<arrayMax( breakPoints ); i++ ) {
00031 currBP = arrp( breakPoints, i, BreakPoint );
00032 BowtieQuery *test;
00033 int pos;
00034 AllocVar( test );
00035 stringPrintf( buffer, "%s|%s", currBP->tileCoordinate1, currBP->tileCoordinate2 );
00036 test->sequenceName = hlr_strdup( string( buffer) );
00037 int found=arrayFind( bowtieQueries, test, &pos, (ARRAYORDERF) sortBowtieQueries );
00038 if( !found ) {
00039 printf( "%s\n", bp_writeBreakPoint( currBP ) );
00040 }
00041 hlr_free( test->sequenceName);
00042 freeMem( test );
00043 }
00044 stringDestroy( buffer );
00045 bp_deInit();
00046 return 0;
00047 }