diff --git a/CHANGELOG.md b/CHANGELOG.md index dda3da6ec..5783e5624 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,7 @@ Each release's notes. From 1.0.0 on, a major or minor release has hand-written n - A pull request that changes only Rust code now runs the e2e cases that run `og`. Before, `rust/` was outside the e2e scope, but for two files of `og-dev`, so such a pull request ran no case, and a merge of it started no run on main: a change in what `og` writes reached main with no real-tool run. A change under `rust/` now picks every case whose row in `scripts/ci/e2e-case-paths.tsv` has a glob that matches `bin/og`, as a change to `bin/og` does, and main runs every case after such a merge. 20 case rows that run `og` through a step, helper or module now list `bin/og`. `tests/test_e2e_scope.sh` checks the pick. - The required `e2e` check reads cancelled, not failed, when its run was cancelled, by a newer push or by hand. Before, it ran anyway and failed, which read as a broken case when the cases had only been stopped. A cancelled check still blocks a merge. - The testing guide says what a green `container-ok` means on a pull request that changes no image: no smoke row ran. It also says why the AnnotSV row with its 5.3 GB of full data stays monthly and on dispatch: no image pull request waits on that download. -- `summary.json` says what part of the genome a run covered. A run on part of the genome (`--intervals`, or a VCF cut down to chr20 and chr22) gave callability, polygenic score, ancestry, telomere, ROH and archaic results that read as whole-genome results. `og summary collect` now reads the chromosomes of the sample VCF's records and writes a new top-level `scope` object: `autosomes_covered`, `autosomes`, `chrx`, `intervals` (a `run intervals` row of `run_manifest.tsv`, else `null`), `partial` and `mark`. No step writes the `run intervals` row yet, so today `intervals` is `null`, and a run limited with `--intervals` is caught only by the chromosomes its calls are on. When fewer than 22 autosomes have calls, or the run was limited to intervals, each of those six sections that has a result of this run gets a new `partial` field, such as `partial: covers 2 of 22 autosomes`. A stale one of the six, a result from an earlier run whose scope was not recorded, gets `partial: not known, from an earlier run` whatever this run covered. Without a readable sample VCF there is no `scope` and nothing is marked. These are new keys; no key, file or format changes or goes away. The reports and the live site do not show the mark yet. `docs/results/quality.md` describes it, and `tests/schema/summary.schema.json` has both fields. +- `summary.json` says what part of the genome a run covered. A run on part of the genome (`--intervals`, or a VCF cut down to chr20 and chr22) gave callability, polygenic score, ancestry, telomere, ROH and archaic results that read as whole-genome results. `og summary collect` now reads the chromosomes of the sample VCF's records and writes a new top-level `scope` object: `autosomes_covered`, `autosomes`, `chrx`, `intervals` (a `run intervals` row of `run_manifest.tsv`, else `null`), `partial` and `mark`. `run_manifest.tsv` has that new row when the run was limited with `--intervals` (`INTERVALS` for `run-all.sh`): `bin/write_manifest.sh` writes it from `INTERVALS`, and the Nextflow `HTML_REPORT` from `--intervals`, the regions on one line with single spaces. A whole-genome run has no such row. So a run limited to parts of all 22 autosomes is marked too, not only one whose calls miss a chromosome. When fewer than 22 autosomes have calls, or the run was limited to intervals, each of those six sections that has a result of this run gets a new `partial` field, such as `partial: covers 2 of 22 autosomes`. A stale one of the six, a result from an earlier run whose scope was not recorded, gets `partial: not known, from an earlier run` whatever this run covered. Without a readable sample VCF there is no `scope` and nothing is marked. These are new keys; no key, file or format changes or goes away. The reports and the live site do not show the mark yet. `docs/results/quality.md` describes it, and `tests/schema/summary.schema.json` has both fields. - Gene callability (step 16b and the Nextflow `MOSDEPTH` process) no longer counts a fragment twice. The gene pass ran mosdepth with `--fast-mode`, which counts every base from a read's start to its end: where the two mates of a pair overlap, a base counted two reads, and the bases of a deletion in a read counted as read. A gene that fewer than 10 fragments covered could reach 10x and read as read. The gene pass now runs without `--fast-mode`; the genome-wide 500 bp pass keeps it. The file name and columns of `_callability.bed.gz` do not change; its `10X` counts can be lower, so a gene near 90% can move to "not read". Step 16b skips a sample it already ran, so a sample from before this change keeps its old counts: delete `/mosdepth/_callability.bed.gz` and run step 16b again, and only the gene pass runs. On public HG002 30x, 4 of 1,553 genes moved (DHX40, SPATA31C2, GOLGA6L10 and UGT2B17), and the pass takes about 37% more CPU time, 3.5-4 min on a 10-core Mac mini. The step doc and `docs/lessons-learned.md` said `--fast-mode` drops the per-base output; `--no-per-base` does that, and they now say so. A new e2e case, `i411-callability-overlap-1-mates`, runs both paths on a small BAM with overlapping pairs and a deletion. - The output contract check now compares the contract with the last release, so a stable output cannot disappear between releases. Before, `og dev contract --static` compared the code with the contract of the same checkout only: a change that renamed a stable output in the code and in its row, removed a stable param with its row, or made a stable row experimental passed. `og dev contract --baseline FILE` checks every stable row of a release's contract against this one: still listed, still stable, the same format, every leg that wrote the file and every required field. New rows and changes to experimental and internal rows pass. Guard's `rust` job runs it against the contract of the newest `v1.x.y` tag; until 1.0.0 is tagged there is none, and the step says so. The HG002 e2e case now also checks 31 stable files the base run writes whose `e2e` cell was `-` (the clinical summary, the slivar, mitochondrial and pypgx tables, the ClinVar cDNA and deep-intronic tables, the gVCF, the read count, the charts and search index, the PharmCAT JSON and HTML, the coverage beds, the sex check, indexcov, the Stranger VCF of ExpansionHunter, the indexes of the clinical, slivar and mitochondrial VCFs, and the Mutect2 stats of chrM). `run_manifest.tsv`, those three indexes and the Mutect2 stats are now listed on both legs, since the step scripts write them too. No output changes. `.github/CODEOWNERS` now says it routes review requests: main requires its status checks, not an approving review. - Step 50 marks a known disease insertion (the FKTN, TAF1 and BBS1 SVAs of `assets/mei_sites.tsv`) seen only when MEGAnE's call there passed its own filters (FILTER `PASS`). Before, a call MEGAnE had flagged, such as `LC` for low confidence, also made the site read seen, so a call MEGAnE did not trust could read as carrier status. Now a site whose only calls are flagged reads `call filtered out (LC)` (with the call's flags) in the `status` column of `mei/_mei_sites.tsv`, and `call` names the flagged call. A `PASS` call in the same window still makes the site seen. That status value is new; the columns and the other values (seen, not seen, not callable) do not change. A window with zero depth and no call reads not callable, never not seen, as before; a new test now holds that. The calls table `mei/_mei.tsv` does not change: it lists flagged calls with their `filter`, as before. Tests: `rust/crates/og-reports/tests/i411_mei_seen_pass.rs`. Part of #411. diff --git a/bin/write_manifest.sh b/bin/write_manifest.sh index e264a779d..3f55ceac3 100755 --- a/bin/write_manifest.sh +++ b/bin/write_manifest.sh @@ -8,7 +8,10 @@ # run written_utc, written_by, git_commit, og_tree_hash (the rust/ tree # the og binary in bin/.og was built from, or "not built"), # pipeline_version (the OwnGenome release: the version in -# nextflow.config's manifest block), declared_sex +# nextflow.config's manifest block), declared_sex, intervals (the +# regions the run called, INTERVALS as run-all.sh passes it to +# --intervals; no row for a whole-genome run, nor for step 29's +# genome and chip) # version every NAME=VALUE line of versions.env # image each *_IMAGE reference and the digest Docker resolved it to # ("not pulled" when the image is not on this machine) @@ -77,6 +80,17 @@ if [ ! -r "${PGP_ROOT}/nextflow.config" ]; then fi [ -z "$release" ] || row run pipeline_version "$release" [ -z "$DECLARED_SEX" ] || row run declared_sex "$DECLARED_SEX" +# The regions the run was limited to (INTERVALS, run-all.sh's --intervals), on +# one line with single spaces, so a tab or newline in the value cannot break +# the row. og summary collect reads it and marks the genome-wide sections +# partial. No row when the run called the whole genome, nor for genome or +# chip: step 29 reads the same INTERVALS, and those two are its whole genome +# and its CHIP genes, not regions the run was limited to. +read -r -d '' -a regions <<< "${INTERVALS:-}" || true +case "${regions[*]:-}" in + ''|genome|chip) ;; + *) row run intervals "${regions[*]}" ;; +esac # versions.env as written (comments and blank lines dropped) while IFS= read -r line || [ -n "$line" ]; do diff --git a/docs/results/quality.md b/docs/results/quality.md index e66b1382c..c755a7a2a 100644 --- a/docs/results/quality.md +++ b/docs/results/quality.md @@ -19,7 +19,7 @@ So `summary.json` records the run's scope under `scope`. It comes from the chrom - `autosomes_covered`: how many of chr1 to chr22 have calls, and `autosomes`: which ones. - `chrx`: whether chrX has calls. chrX alone does not make a run partial, because these results read the autosomes. -- `intervals`: the intervals the run was limited to, from a `run intervals` row of `run_manifest.tsv`, else `null`. No step writes this row yet, so today it is `null`: a run limited with `--intervals` is caught only by the chromosomes its calls are on. +- `intervals`: the intervals the run was limited to, from the `run intervals` row of `run_manifest.tsv`, else `null`. `run-all.sh` writes that row when it was given `INTERVALS` (its `--intervals`), and so does the Nextflow report for `--intervals`; a whole-genome run has no such row. So a run limited to parts of all 22 autosomes is marked too. - `partial` and `mark`: the run is partial when it covers fewer than 22 autosomes (`partial: covers 2 of 22 autosomes`) or was limited to intervals (`partial: limited to the run's intervals (...)`). When the run is partial, each of those six sections that has a result of this run gets the same text in its `partial` field. A stale section holds a result from an earlier run, and that run's scope was not recorded: it gets `partial: not known, from an earlier run`, whatever this run covered. Without a sample VCF that can be read to its end, the scope is not known: `summary.json` has no `scope`, and no section is marked. The scope says which chromosomes have calls. It does not say how much of each chromosome was read well; callability does that. diff --git a/modules/local/html_report/main.nf b/modules/local/html_report/main.nf index 2734c6ba1..85a2a56da 100644 --- a/modules/local/html_report/main.nf +++ b/modules/local/html_report/main.nf @@ -33,7 +33,9 @@ vcf/.g.vcf.gz and its .tbi (or .csi), where the bash report finds step 03's gVCF. A run_manifest.tsv in the sample folder records the OwnGenome release (nextflow.config's manifest.version), so the report - names it as the bash report does; it is not published, because + names it as the bash report does, and the regions of --intervals when + the run was limited to them, so summary.json marks the run partial as + the bash report does; it is not published, because run-all.sh writes the full manifest there. Every gene and rsID the results mention also goes to ${id}_search_index.json beside it (bin/results_index.py), for the live site's search, and the report's @@ -69,6 +71,8 @@ process HTML_REPORT { def gvcf_index = meta.gvcf ? meta.gvcf[1].toString().replace("'", "'\\''") : '' def gvcf_suffix = gvcf_index.endsWith('.csi') ? 'csi' : 'tbi' def release = workflow.manifest.version ?: '' + // --intervals as given, single-quoted below like gvcf; the task script puts it on one line + def intervals = params.intervals ? params.intervals.toString().replace("'", "'\\''") : '' """ # Where og summary collect looks for each output (rust/crates/og-summary) S=layout/${id} @@ -82,7 +86,13 @@ process HTML_REPORT { fi # The release this run is (bash: bin/write_manifest.sh's run pipeline_version row) release='${release}' - [ -z "\$release" ] || printf 'run\\tpipeline_version\\t%s\\n' "\$release" > "\$S/run_manifest.tsv" + [ -z "\$release" ] || printf 'run\\tpipeline_version\\t%s\\n' "\$release" >> "\$S/run_manifest.tsv" + # The regions this run was limited to (bash: the run intervals row), so + # og summary collect marks the genome-wide sections partial; one line with + # single spaces, as bin/write_manifest.sh writes INTERVALS + intervals='${intervals}' + read -r -d '' -a regions <<< "\$intervals" || true + [ "\${#regions[@]}" -eq 0 ] || printf 'run\\tintervals\\t%s\\n' "\${regions[*]}" >> "\$S/run_manifest.tsv" for f in input/*; do n=\$(basename "\$f") if [ -n "\$gvcf" ] && { [ "\$n" = "\$gvcf" ] || [ "\$n" = "\$gvcf_index" ]; }; then continue; fi diff --git a/tests/test_write_manifest.sh b/tests/test_write_manifest.sh index 3e9597976..3791cdb28 100755 --- a/tests/test_write_manifest.sh +++ b/tests/test_write_manifest.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# og-leg: OG_REQUIRED # bin/write_manifest.sh with two or more writers of one sample at once (a run # and a report script can both write run_manifest.tsv). A fake container # engine holds each writer at its first image lookup, after it has started @@ -10,12 +11,24 @@ # script that builds the manifest in one shared temporary file # (run_manifest.tsv.tmp, the old name) must leave a manifest that is not # whole under the same overlap. +# +# The run intervals row (INTERVALS, run-all.sh's --intervals): INTERVALS set +# writes one row, its regions on one line with single spaces; INTERVALS unset, +# blank, genome or chip (step 29's whole genome and CHIP genes) writes none. Then og summary collect reads the manifest the script +# wrote, beside a sample VCF with calls on all 22 autosomes: the row marks the +# run partial ("limited to the run's intervals"). Red controls: a copy of the +# script without the row line writes no row with INTERVALS set, and the same +# folder without the row is not marked. The og part needs og (OG, else +# bin/og); without it that part is skipped with a note, and with OG_REQUIRED +# set the skip is a failure. set -uo pipefail REPO="$(cd "$(dirname "$0")/.." && pwd)" T=$(mktemp -d) trap 'rm -rf "$T"' EXIT fails=0 +# The run intervals row comes from INTERVALS: only section 3 sets it. +unset INTERVALS ok() { echo "PASS $*"; } bad() { echo "FAIL $*"; fails=$((fails + 1)); } @@ -127,5 +140,214 @@ else bad "control: could not plant the shared temporary name in the copy" fi +# 3. the run intervals row. manifest SCRIPT GENOME_DIR [INTERVALS]: the +# manifest SCRIPT writes for sample s1, with INTERVALS set when given. +manifest() { + local script=$1 gd=$2 + mkdir -p "${gd}/s1" + if [ "$#" -gt 2 ]; then + INTERVALS=$3 CONTAINER_ENGINE=true GENOME_DIR="$gd" bash "$script" s1 test > /dev/null 2> "${gd}/err" + else + CONTAINER_ENGINE=true GENOME_DIR="$gd" bash "$script" s1 test > /dev/null 2> "${gd}/err" + fi || bad "${script} failed for ${gd}: $(cat "${gd}/err")" +} +intervals_rows() { awk -F'\t' '$1 == "run" && $2 == "intervals"' "$1/s1/run_manifest.tsv"; } +want=$'run\tintervals\tchr1:1-1000000 chr2:1-1000000' +manifest "${REPO}/bin/write_manifest.sh" "${T}/iv" $' chr1:1-1000000\t chr2:1-1000000\n' +rows=$(intervals_rows "${T}/iv") +if [ "$rows" = "$want" ]; then + ok "INTERVALS set writes one run intervals row, on one line" +else + bad "INTERVALS set wrote the rows '${rows//$'\t'/ }', want '${want//$'\t'/ }'" +fi +manifest "${REPO}/bin/write_manifest.sh" "${T}/noiv" +manifest "${REPO}/bin/write_manifest.sh" "${T}/blankiv" " " +# genome and chip are step 29's own INTERVALS values (the whole genome, the +# CHIP genes), not regions the run was limited to. +manifest "${REPO}/bin/write_manifest.sh" "${T}/genomeiv" " genome " +manifest "${REPO}/bin/write_manifest.sh" "${T}/chipiv" "chip" +for gd in noiv blankiv genomeiv chipiv; do + rows=$(intervals_rows "${T}/${gd}") + if [ -z "$rows" ]; then + ok "${gd}: no run intervals row (a whole-genome run)" + else + bad "${gd}: wrote '${rows//$'\t'/ }'" + fi +done +# Red control: a copy of the script without the row line, INTERVALS set. +N="${T}/norow" +mkdir -p "${N}/bin" "${N}/scripts" +cp "${REPO}/bin/write_manifest.sh" "${N}/bin/" +cp -R "${REPO}/scripts/lib" "${N}/scripts/" +cp "${REPO}/versions.env" "${REPO}/nextflow.config" "${N}/" +sed -i.bak '/row run intervals /d' "${N}/bin/write_manifest.sh" +if grep -q 'row run intervals ' "${N}/bin/write_manifest.sh"; then + bad "control: could not drop the row line from the copy" +else + manifest "${N}/bin/write_manifest.sh" "${T}/norowiv" "chr1:1-1000000 chr2:1-1000000" + if [ -z "$(intervals_rows "${T}/norowiv")" ]; then + ok "control: the copy without the row line writes no row with INTERVALS set" + else + bad "control: the copy without the row line still wrote it; the check above cannot fail" + fi +fi + +# 4. og summary collect reads the row: a sample VCF with calls on all 22 +# autosomes and the manifest of 3 is marked partial; without the row it is not. +OG=${OG:-${REPO}/bin/og} +if ! "$OG" version > /dev/null 2>&1; then + if [ -n "${OG_REQUIRED:-}" ]; then + bad "og is not built (scripts/setup.sh --og), and OG_REQUIRED is set" + else + echo "skip: og is not built for this machine (scripts/setup.sh --og): the run intervals row is not read back" + fi +else + vcf="${T}/iv/s1/vcf/s1.vcf.gz" + mkdir -p "$(dirname "$vcf")" + { + printf '##fileformat=VCFv4.2\n#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\ts1\n' + for i in $(seq 1 22); do printf 'chr%s\t1000000\t.\tA\tG\t50\tPASS\t.\tGT\t0/1\n' "$i"; done + } | gzip > "$vcf" + mark='"mark": "partial: limited to the run'"'"'s intervals (chr1:1-1000000 chr2:1-1000000)"' + # scope SAMPLE_DIR: og summary collect writes SAMPLE_DIR/summary.json + # (emptied first, so a failed run leaves nothing to read). + scope() { + : > "$1/summary.json" + "$OG" summary collect --sample s1 --sample-dir "$1" --assets "${REPO}/assets" --out "$1/summary.json" > /dev/null 2> "$1/og.err" \ + || bad "og summary collect failed: $(cat "$1/og.err")" + } + scope "${T}/iv/s1" + json=$(cat "${T}/iv/s1/summary.json") + if grep -qF "$mark" <<< "$json" && grep -qF '"autosomes_covered": 22' <<< "$json"; then + ok "og summary collect marks the run partial from the row (22 autosomes covered)" + else + bad "og summary collect did not mark the run partial from the row: $(grep -A1 -F '"mark"' <<< "$json" | head -2)" + fi + # Red control: the same folder, its manifest without the row. + awk -F'\t' '!($1 == "run" && $2 == "intervals")' "${T}/iv/s1/run_manifest.tsv" > "${T}/iv/m" \ + && mv "${T}/iv/m" "${T}/iv/s1/run_manifest.tsv" + [ -z "$(intervals_rows "${T}/iv")" ] || bad "control: could not drop the row from the manifest" + scope "${T}/iv/s1" + json=$(cat "${T}/iv/s1/summary.json") + if grep -qF '"autosomes_covered": 22' <<< "$json" && ! grep -qF "$mark" <<< "$json" \ + && grep -qF '"mark": null' <<< "$json"; then + ok "control: without the row the same run is not marked partial" + else + bad "control: without the row the run is still marked; the check above cannot fail" + fi +fi + +# 5. The Nextflow side: HTML_REPORT (modules/local/html_report/main.nf) writes +# the same row from --intervals. No Nextflow here, so the test does what +# Nextflow would: it evaluates the module's def intervals (toString, then each +# .replace("'", "'\\''"); any other step is refused, so a new step needs a new +# test), puts the result in the task script's intervals lines, Groovy's +# escapes undone, and runs those lines in bash. A value with a tab and a +# newline must give the row section 3 wants; a value with a quote must reach +# the row as it is. Red controls: module copies without the one-line step, +# without the quote escape and without the printf line must not. +# HTML_REPORT_MODULE overrides the module. +MOD=${HTML_REPORT_MODULE:-${REPO}/modules/local/html_report/main.nf} +# nf_def MODULE VALUE: what the module's def intervals gives for --intervals +# VALUE (a Groovy '' is false, and both sides give ''). +nf_def() { + local expr v=$2 q="'" r="'\\''" + local head='params.intervals ? params.intervals.toString()' tail=" : ''" + local esc=".replace(\"'\", \"'\\\\''\")" + expr=$(sed -n -E 's/^[[:space:]]*def intervals = (.*)$/\1/p' "$1") + [[ "$expr" == "$head"*"$tail" ]] || { echo "def intervals is not '${head}...${tail}': '${expr}'"; return 1; } + expr=${expr#"$head"} + expr=${expr%"$tail"} + while [ -n "$expr" ]; do + [[ "$expr" == "$esc"* ]] || { echo "def intervals has a step this test cannot evaluate: '${expr}'"; return 1; } + v=${v//"$q"/"$r"} + expr=${expr#"$esc"} + done + printf '%s' "$v" +} +# nf_rows MODULE VALUE: the rows the module's intervals lines write for VALUE. +nf_rows() { + local d val + d=$(mktemp -d "${T}/nf.XXXXXX") + nf_def "$1" "$2" > "${d}/val" || { cat "${d}/val"; return; } + val=$(cat "${d}/val"; printf x) + val=${val%x} + # The lines from intervals='${intervals}' to the printf of the row, as bash + # sees them: \$ is $, \\ is \ (any other escape is refused), then the def's + # value in place of ${intervals}, as data. + # shellcheck disable=SC2016 # the dollar signs are awk's and the script's + if ! OG_VAL="$val" awk ' + index($0, "intervals='"'"'${intervals}'"'"'") { on = 1 } + on { + out = "" + for (i = 1; i <= length($0); i++) { + c = substr($0, i, 1) + if (c == "\\") { + nxt = substr($0, i + 1, 1) + if (nxt != "\\" && nxt != "$") { print "unexpected Groovy escape \\" nxt > "/dev/stderr"; exit 1 } + out = out nxt; i++ + } else out = out c + } + k = index(out, "${intervals}") + if (k) out = substr(out, 1, k - 1) ENVIRON["OG_VAL"] substr(out, k + 12) + print out + if (index($0, "printf") && index($0, "run\\\\tintervals")) { found = 1; exit } + } + END { exit !found }' "$1" > "${d}/block.sh"; then + echo "no intervals lines" + return + fi + (cd "$d" && S="$d" bash -euo pipefail "${d}/block.sh") 2> "${d}/err" || { echo "the lines failed: $(cat "${d}/err")"; return; } + [ ! -e "${d}/run_manifest.tsv" ] || awk -F'\t' '$1 == "run" && $2 == "intervals"' "${d}/run_manifest.tsv" +} +messy=$' chr1:1-1000000\t chr2:1-1000000\n' +quoted="chr1:1-1000000 it's" +want_quoted=$'run\tintervals\t'"$quoted" +rows=$(nf_rows "$MOD" "$messy") +if [ "$rows" = "$want" ]; then + ok "HTML_REPORT writes the row write_manifest.sh writes, --intervals with a tab and a newline on one line" +else + bad "HTML_REPORT wrote '${rows//$'\t'/ }', want '${want//$'\t'/ }'" +fi +rows=$(nf_rows "$MOD" "$quoted") +if [ "$rows" = "$want_quoted" ]; then + ok "HTML_REPORT writes a quote in --intervals as it is" +else + bad "HTML_REPORT wrote '${rows//$'\t'/ }' for a quote, want '${want_quoted//$'\t'/ }'" +fi +rows=$(nf_rows "$MOD" "") +if [ -z "$rows" ]; then + ok "HTML_REPORT without --intervals writes no row" +else + bad "HTML_REPORT without --intervals wrote '${rows//$'\t'/ }'" +fi +# Red controls: module copies that each break one step. +# shellcheck disable=SC2016 # the module's text, not expansions +sed 's/"\\${regions\[\*\]}" >>/"\\$intervals" >>/' "$MOD" > "${T}/html_report_rawiv.nf" +# shellcheck disable=SC2016 # as above +if ! grep -qF '"\$intervals" >>' "${T}/html_report_rawiv.nf"; then + bad "control: could not drop the one-line step from the module copy" +elif [ "$(nf_rows "${T}/html_report_rawiv.nf" "$messy")" != "$want" ]; then + ok "control: the module without the one-line step does not write the row" +else + bad "control: the module without the one-line step still wrote the row; the check above cannot fail" +fi +sed '/def intervals = /s/\.replace([^)]*)//' "$MOD" > "${T}/html_report_noesc.nf" +if grep -E 'def intervals = .*replace' "${T}/html_report_noesc.nf" > /dev/null; then + bad "control: could not drop the quote escape from the module copy" +elif [ "$(nf_rows "${T}/html_report_noesc.nf" "$quoted")" != "$want_quoted" ]; then + ok "control: the module without the quote escape does not write a quote as it is" +else + bad "control: the module without the quote escape still wrote the quote; the check above cannot fail" +fi +sed '/printf .run\\\\tintervals/d' "$MOD" > "${T}/html_report_norow.nf" +if grep -q 'run\\\\tintervals' "${T}/html_report_norow.nf"; then + bad "control: could not drop the printf line from the module copy" +elif [ "$(nf_rows "${T}/html_report_norow.nf" "chr1:1-1000000 chr2:1-1000000")" != "$want" ]; then + ok "control: the module without the printf line does not write the row" +else + bad "control: the module without the printf line still wrote a row; the check above cannot fail" +fi + echo "${fails} failure(s)" [ "$fails" -eq 0 ]