Skip to content

compute num reads for size

Mojo function 🡭

def compute_num_reads_for_size(target_size_bytes: Int, min_length: Int, max_length: Int) -> Int

Compute the number of FASTQ reads needed to approximate a target size.

Estimates bytes per record based on:

  • Header: @read_<padded_i>\n (constant size: 6 + num_digits + 1 bytes)
  • Sequence line: read_len + 1 (newline)
  • Plus line: +\n (2 bytes)
  • Quality line: read_len + 1 (newline)

Uses average read length and constant header size (indices are zero-padded in generate_synthetic_fastq_buffer).

Args:

  • target_size_bytes (Int): Target total size in bytes.
  • min_length (Int): Minimum read length per record.
  • max_length (Int): Maximum read length per record.

Returns:

Int: Estimated number of reads needed to reach target_size_bytes.