Files
obikmer/benchmark/simulate_query_one.sh
T

35 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# Usage: simulate_query_one.sh genome.fna.gz output_dir
# Simulates a fixed-size paired-end HiSeq read set for the query benchmark.
# Unlike simulate_one.sh (coverage-proportional, used to build the indexed
# specimens), this always draws N_READS pairs regardless of genome size —
# query benchmark numbers (wall/RSS) must stay comparable across genomes of
# very different sizes. Independent iss run (unseeded), so error draw
# differs from any simulated_data/ reads for the same genome.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ISS="${SCRIPT_DIR}/../.venv/bin/iss"
N_READS=100000
CPUS="${CPUS:-$(sysctl -n hw.logicalcpu 2>/dev/null || nproc 2>/dev/null || echo 2)}"
genome_file="$1"
out_dir="$2"
mkdir -p "${out_dir}"
tmp_fasta=$(mktemp "${TMPDIR:-/tmp}/obikmer_XXXXXX.fna")
trap 'rm -f "${tmp_fasta}"' EXIT
gzip -dc "${genome_file}" > "${tmp_fasta}"
echo "[${out_dir}] ${N_READS} read pairs (query benchmark, fixed size)"
"${ISS}" generate \
--genomes "${tmp_fasta}" \
--model HiSeq \
--n_reads "${N_READS}" \
--cpus "${CPUS}" \
--compress \
--output "${out_dir}/reads"