00001 #include "log.h" 00002 #include "format.h" 00003 #include "gfr.h" 00004 #include <stdio.h> 00005 00006 00007 00008 int main (int argc, char *argv[]) 00009 { 00010 GfrEntry *currGE; 00011 GfrInterRead *currGIR; 00012 int i; 00013 Stringa buffer; 00014 FILE *fp; 00015 int count; 00016 00017 count = 0; 00018 buffer = stringCreate (100); 00019 gfr_init ("-"); 00020 puts (gfr_writeHeader ()); 00021 00022 while (currGE = gfr_nextEntry ()){ 00023 count++; 00024 if (strEqual (currGE->fusionType,"inter") || strEqual (currGE->fusionType,"trans") ) { 00025 puts (gfr_writeGfrEntry (currGE)); 00026 continue; 00027 } 00028 stringPrintf (buffer,"%s.gff",currGE->id); 00029 fp = fopen (string (buffer),"w"); 00030 if (fp == NULL) { 00031 die ("Unable to open GFF file"); 00032 } 00033 fprintf (fp,"browser pack knownGene\n"); 00034 fprintf (fp,"track name=\"%s\" visibility=2\n",currGE->id); 00035 for (i = 0; i < arrayMax (currGE->interReads); i++) { 00036 currGIR = arrp (currGE->interReads,i,GfrInterRead); 00037 fprintf (fp,"%s\tRNA_Seq\texon\t%d\t%d\t.\t.\t.\tTG%d\n",currGE->chromosomeTranscript1,currGIR->readStart1,currGIR->readEnd1,i); 00038 fprintf (fp,"%s\tRNA_Seq\texon\t%d\t%d\t.\t.\t.\tTG%d\n",currGE->chromosomeTranscript2,currGIR->readStart2,currGIR->readEnd2,i); 00039 } 00040 fclose (fp); 00041 puts (gfr_writeGfrEntry (currGE)); 00042 } 00043 gfr_deInit (); 00044 stringDestroy (buffer); 00045 warn ("%s_numGfrEntries: %d",argv[0],count); 00046 return 0; 00047 } 00048