1. Sebastien Mondet
  2. fastq_bench

Commits

Sebastien Mondet  committed b9ac453

Update to smondet/biocaml@master API changes

  • Participants
  • Parent commits c854f41
  • Branches master

Comments (0)

Files changed (1)

File fastqbench.ml

View file
   ksprintf (fun s -> Lwt.fail (Failure s)) fmt
   
 let count_next_reads parser =
+  let strpos = Biocaml_pos.to_string in
   let rec next_m c =
     match Biocaml_fastq.next parser with
-    | `nothing_ready -> return c
+    | `not_ready -> return c
     | `record {Biocaml_fastq. name; sequence; comment; qualities; } ->
       next_m (c + 1)
     | `error (`sequence_and_qualities_do_not_match (l, seq, qs)) ->
-      failf "Error line %d: %d bp Vs %d q-scores\n" l
+      failf "Error  %s: %d bp Vs %d q-scores\n" (strpos l)
         (String.length seq) (String.length qs)
     | `error (`wrong_comment_line (l, _)) ->
-      failf "Syntax error (comment line) line: %d\n" l
+      failf "Syntax error %s: (comment line)\n" (strpos l)
     | `error (`wrong_name_line (l, _)) ->
-      failf "Syntax error (name line) line: %d\n" l
+      failf "Syntax error %s: (name line)\n" (strpos l)
   in
   next_m 0
 
 let count_reads ~buffer_size file =
-  let parser = Biocaml_fastq.parser () in
+  let parser = Biocaml_transform.Line_oriented.parser ~filename:file () in
   let reads = ref 0 in
   Lwt_io.with_file ~buffer_size ~mode:Lwt_io.input file (fun i ->
     let rec loop () =
       if read_string = "" then
         return !reads
       else (
-        Biocaml_fastq.feed_string parser read_string;
+        Biocaml_transform.Line_oriented.feed_string parser read_string;
         count_next_reads parser >>= fun c ->
         reads := !reads + c;
         loop ())