uint32_t parse_seq_str(const char *str, const char *file_name) { uint64_t k; int64_t c; uint32_t b; if (scan_seq(str,&k,&b,&c)) { check_and_set_base(b,file_name); return get_seq(k,c); } return UINT32_MAX; }
void test_scan_seq() { fprintf( stderr, " Running test_scan_seq ... " ); //char *seq = "AAAANTCGGCTNGGGG"; //char *seq = "AAAATCGGCTGGGG"; char *seq = "AAAAAAAAAAAAAAG"; size_t seq_len = strlen( seq ); size_t nmemb = 1 << 5; uint *count_array = count_array_new( nmemb ); scan_seq( seq, seq_len, count_array ); // count_array_print( count_array, nmemb, 1 ); /* DEBUG */ fprintf( stderr, "done.\n" ); }
void scan_file( char *file, seq_entry *entry, uint *count_array ) { /* Martin A. Hansen, September 2008 */ /* Scan all FASTA entries of a file. */ FILE *fp = read_open( file ); while ( fasta_get_entry( fp, &entry ) == TRUE ) { fprintf( stderr, " Scanning: %s (%zu nt) ... ", entry->seq_name, entry->seq_len ); scan_seq( entry->seq, entry->seq_len, count_array ); fprintf( stderr, "done.\n" ); } close_stream( fp ); }