00001 #include "log.h" 00002 #include "format.h" 00003 #include "intervalFind.h" 00004 #include "geneFusionsConfig.h" 00005 #include "gfr.h" 00006 00007 00008 00009 int main (int argc, char *argv[]) 00010 { 00011 GfrEntry *currGE; 00012 int count,countRemoved; 00013 int i; 00014 Array intervals; 00015 GfrInterRead *currGIR; 00016 int totalOverlaps; 00017 int minNumInterReads; 00018 00019 if (argc != 3) { 00020 usage ("%s <repeatMasker.interval> <minNumInterReads>",argv[0]); 00021 } 00022 intervalFind_addIntervalsToSearchSpace (argv[1],0); 00023 minNumInterReads = atoi (argv[2]); 00024 count = 0; 00025 countRemoved = 0; 00026 gfr_init ("-"); 00027 puts (gfr_writeHeader ()); 00028 while (currGE = gfr_nextEntry ()){ 00029 for (i = 0; i < arrayMax (currGE->interReads); i++) { 00030 currGIR = arrp (currGE->interReads,i,GfrInterRead); 00031 if (currGIR->pairType == GFR_PAIR_TYPE_EXONIC_EXONIC) { 00032 continue; 00033 } 00034 totalOverlaps = 0; 00035 intervals = intervalFind_getOverlappingIntervals (currGE->chromosomeTranscript1,currGIR->readStart1,currGIR->readEnd1); 00036 totalOverlaps += arrayMax (intervals); 00037 intervals = intervalFind_getOverlappingIntervals (currGE->chromosomeTranscript2,currGIR->readStart2,currGIR->readEnd2); 00038 totalOverlaps += arrayMax (intervals); 00039 if (totalOverlaps > 0) { 00040 currGE->numInter--; 00041 currGIR->flag = 1; 00042 } 00043 } 00044 if (currGE->numInter < minNumInterReads) { 00045 countRemoved++; 00046 continue; 00047 } 00048 puts (gfr_writeGfrEntry (currGE)); 00049 count++; 00050 } 00051 gfr_deInit (); 00052 warn ("%s_numRemoved: %d",argv[0],countRemoved); 00053 warn ("%s_numGfrEntries: %d",argv[0],count); 00054 return 0; 00055 } 00056