Hello to all.
I am unable to collect data from my input files. The format of the input files is standardized.
the format is something like this:
>blah blah blah
SDJKDJDJKFJDSKLJGDKLJFDKJDFJDSKJ
I need to be able to take the info after the ">" and store in a structure called
loadedSequences.name and then take the characters after that and store in
a structure named loadedSequences.data.
I am able to deal with input files and get the first part but unable to collect the second part.
Here is the relevant code:
Any help would be great.Code:if( (strcmp ( command, "read" )) == 0 ) { filename = strtok(NULL, " \t\n" ) ; // collect filename if( filename ) { input = fopen(filename, "r") ; if ( !input ) { perror(filename); continue ; } } fgets( header_data, 1000, input) ; seqName = &header_data[1] ; // After the > in FASTA format loadedSequences[nSequences].name = (char *) malloc( ( strlen(seqName) + 1 ) * sizeof( char ) ) ; strcpy( loadedSequences[nSequences].name , seqName ) ; // Collect the sequence from FASTA file loadedSequences[nSequences].data[n++] = 0 ; while (c = getc(input) != EOF) { if(c >= 'A' && c <= 'Z') { loadedSequences[nSequences].data[n++] = c ; } } loadedSequences[nSequences].length = strlen((loadedSequences[nSequences].data)) ; fclose(input) ; ++nSequences ; }



LinkBack URL
About LinkBacks



