]> git.donarmstrong.com Git - fastq-tools.git/blobdiff - src/fastq-grep.c
Sort by gc content and mean quality score, and seededing of random sort.
[fastq-tools.git] / src / fastq-grep.c
index 8eb6f7f6cc1f8182b4705e6673e26faceadab5a1..4a5c412404935e2b4a41d14b411cd2760327a49a 100644 (file)
@@ -33,7 +33,7 @@ static const char* prog_name = "fastq-grep";
 
 void print_help()
 {
-    fprintf(stdout, 
+    fprintf(stdout,
 "fastq-grep [OPTION]... PATTERN [FILE]...\n"
 "Search for PATTERN in the read sequences in each FILE or standard input.\n"
 "PATTERN, by default, is a perl compatible regular expression.\n\n"
@@ -59,10 +59,10 @@ void fastq_grep(FILE* fin, FILE* fout, FILE* mismatch_file, pcre* re)
     int ovector[3];
     size_t count = 0;
 
-    fastq_t* fqf = fastq_open(fin);
-    seq_t* seq = fastq_alloc_seq();
+    fastq_t* fqf = fastq_create(fin);
+    seq_t* seq = seq_create();
 
-    while (fastq_next(fqf, seq)) {
+    while (fastq_read(fqf, seq)) {
 
         rc = pcre_exec(re,          /* pattern */
                        NULL,        /* extra data */
@@ -82,8 +82,8 @@ void fastq_grep(FILE* fin, FILE* fout, FILE* mismatch_file, pcre* re)
         }
     }
 
-    fastq_free_seq(seq);
-    fastq_close(fqf);
+    seq_free(seq);
+    fastq_free(fqf);
 
     if (count_flag) fprintf(fout, "%zu\n", count);
 }
@@ -113,7 +113,7 @@ int main(int argc, char* argv[])
     FILE* mismatch_file = NULL;
 
     static struct option long_options[] =
-        { 
+        {
           {"id",           no_argument, &id_flag,     1},
           {"invert-match", no_argument, &invert_flag, 1},
           {"mismatches",   required_argument, NULL, 'm'},