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 int i; 00012 Stringa buffer; 00013 FILE *fp1,*fp2; 00014 int count; 00015 00016 buffer = stringCreate (100); 00017 count = 0; 00018 gfr_init ("-"); 00019 puts (gfr_writeHeader ()); 00020 while (currGE = gfr_nextEntry ()){ 00021 stringPrintf (buffer,"%s_1.fasta",currGE->id); 00022 fp1 = fopen (string (buffer),"w"); 00023 stringPrintf (buffer,"%s_2.fasta",currGE->id); 00024 fp2 = fopen (string (buffer),"w"); 00025 if (fp1 == NULL || fp2 == NULL) { 00026 die ("Unable to open FASTA files"); 00027 } 00028 for (i = 0; i < arrayMax (currGE->readsTranscript1); i++) { 00029 fprintf (fp1,">%s_1_%d\n%s\n",currGE->id,i + 1,textItem (currGE->readsTranscript1,i)); 00030 } 00031 for (i = 0; i < arrayMax (currGE->readsTranscript2); i++) { 00032 fprintf (fp2,">%s_2_%d\n%s\n",currGE->id,i + 1,textItem (currGE->readsTranscript2,i)); 00033 } 00034 fclose (fp1); 00035 fclose (fp2); 00036 puts (gfr_writeGfrEntry (currGE)); 00037 count++; 00038 } 00039 gfr_deInit (); 00040 warn ("%s_numGfrEntries: %d",argv[0],count); 00041 return 0; 00042 } 00043