00001 #include "log.h" 00002 #include "format.h" 00003 #include "intervalFind.h" 00004 #include <stdlib.h> 00005 #include "util.h" 00006 #include "geneFusionsConfig.h" 00007 #include "gfr.h" 00008 00009 int main (int argc, char *argv[]) 00010 { 00011 int i; 00012 GfrEntry* gfrE; 00013 Array intervals = arrayCreate( 50, Interval); 00014 Stringa buffer = stringCreate (100); 00015 00016 stringPrintf (buffer,"%s/%s",ANNOTATION_DIR,TRANSCRIPT_COMPOSITE_MODEL_FILENAME); 00017 intervalFind_addIntervalsToSearchSpace (string (buffer),0); 00018 00019 gfr_init("-"); 00020 printf( "%s\n", gfr_writeHeader()); 00021 while( gfrE = gfr_nextEntry() ) { 00022 if( strEqual( gfrE->fusionType, "cis" ) && (gfrE->strandTranscript1 == gfrE->strandTranscript2) ) { 00023 intervals = arrayCopy (intervalFind_getOverlappingIntervals (gfrE->chromosomeTranscript1, gfrE->endTranscript1+1, gfrE->startTranscript2-1 )); 00024 stringPrintf(buffer, "read-through"); 00025 if( arrayMax(intervals)>0) { 00026 for( i=0; i<arrayMax(intervals); i++) { 00027 Interval *currInterval = arru( intervals, i, Interval*); 00028 if( (currInterval->strand == gfrE->strandTranscript1 ) ) { 00029 stringPrintf(buffer,"intra"); 00030 i = arrayMax(intervals); 00031 } 00032 } 00033 } 00034 } else { 00035 if( strEqual( gfrE->fusionType, "trans" ) ) { 00036 stringPrintf( buffer, "inter"); 00037 } else { 00038 stringPrintf( buffer, "cis"); 00039 } 00040 } 00041 gfrE->fusionType = hlr_strdup(string(buffer)); 00042 printf("%s\n", gfr_writeGfrEntry( gfrE )); 00043 00044 } 00045 gfr_deInit(); 00046 arrayDestroy(intervals); 00047 stringDestroy (buffer); 00048 00049 return 0; 00050 }