+#define MAX_SEQ_NAME 1024
#define FASTA_BUFFER 256 * 1024
#define isseq( x ) ( x > 32 && x < 127 ) ? TRUE : FALSE
/* Count all entries in a FASTA file given a file pointer. */
size_t fasta_count( FILE *fp );
+/* Get the next FASTA sequence name from a stream. */
+bool fasta_get_seq_name( FILE *fp, char **seq_name_ppt );
+
/* Get next sequence entry from a FASTA file given a file pointer. */
bool fasta_get_entry( file_buffer **buffer_ppt, seq_entry **entry );
}
+bool fasta_get_seq_name( FILE *fp, char **seq_name_ppt )
+{
+ /* Martin A. Hansen, August 2008 */
+
+ /* Get the next FASTA sequence name from a stream. */
+
+ char *pt;
+ char buffer[ MAX_SEQ_NAME ];
+
+ while ( 1 )
+ {
+ if ( ( pt = fgets( buffer, MAX_SEQ_NAME, fp ) ) )
+ {
+ printf( "buffer: %s\n", buffer );
+
+ if ( buffer[ 0 ] == '>' )
+ {
+ *seq_name_ppt = &buffer[ 1 ];
+
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+
//bool fasta_get_entry( FILE *fp, seq_entry **entry )
//{
// /* Martin A. Hansen, May 2008 */
{
fprintf( stderr, " Testing fasta_get_seq_name ... " );
+ FILE *fp = NULL;
+ char *seq_name = NULL;
+
+ fp = read_open( TEST_FILE1 );
+
+ fasta_get_seq_name( fp, &seq_name );
+
+ printf( "SEQ_NAME: ->%s<-\n", seq_name );
+
assert( strcmp( seq_name, "test0" ) == 0 );
fprintf( stderr, "OK\n" );
&Maasha::Common::run( "mkvtree", "-db $tmp_dir/$tmp_file -dna -pl -allout -indexname $dst_dir/$tmp_file > /dev/null 3>&1" );
unlink "$tmp_dir/$tmp_file";
-# }
+ }
close $fh;
}