Skip to content

fix(cn): wire the copy-number intervals into the couple screen and the report, and close the review follow-ups - #288

Merged
GeiserX merged 17 commits into
mainfrom
pgp/followups-cn
Nov 6, 2026
Merged

GeiserX merged 17 commits into
mainfrom
pgp/followups-cn

Conversation

@GeiserX

@GeiserX GeiserX commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Problem

Step 35 writes a copy-number interval table (<id>_cn_intervals.tsv), and the couple screen can read it to list the carrier deletion alleles and a male partner's AZF deletions. Nothing passed it in. Step 39 and the Nextflow couple screen left out the table and the CNVpytor calls that cross-check it, so those lines only showed up if you ran couple_report.py by hand. The Nextflow HTML report also never received the table, so summary.json had no interval rows in Nextflow even though the bash report reads them. Two beta-globin deletions were still missing, and step 35's docs did not list the table among its outputs.

Fix

  • Step 39 passes paralogs/<id>_cn_intervals.tsv (step 35) and cnvpytor/<id>_cnvs.vcf.gz (step 18) for each partner who has them.
  • COUPLE_CARRIER matches both files by name. main.nf hands them over from PARASCOPY and CNVPYTOR_VCF through two new emits, BAM_ANALYSIS.out.cn_intervals and SV.out.cnvpytor_vcf.
  • HTML_REPORT puts <id>_cn_intervals.tsv in paralogs/, where collect_summary.py looks for it, and main.nf joins it into the report inputs.
  • Two new interval rows use HbVar's GRCh38 spans: the 619 bp HBB deletion (HbVar 979, Orkin 1979, PMID 287080) and the 13.4 kb Sicilian (delta-beta)0 deletion (HbVar 1035, Henthorn 1990, PMID 2307466). I checked both spans by placing 50 bp of NG_000007.3 on each side of each breakpoint on NC_000011.10. Both agree with HbVar's hg38 positions. The couple screen lists them as two more alleles. docs/cn-loci.md says that the rows only count copies over their span: a Sicilian carrier reads as a deletion on all three HBB rows.
  • cn-intervals-2-hg002 now checks HG002's AZFc_DAZ result, not assessed with reason between_counts and an estimate between 3.3 and 3.9. It reads 3.63 on this head (fork run below).
  • The three beta-globin rows overlap: the Sicilian deletion covers both HBB rows, and the 619 bp and exon 3 rows share 487 bp. One deletion can read as present on two or three of them, so the couple report and docs/39-couple.md now say so, and that only a clinical test names the allele.
  • Step 18 counts in 1 kb bins and cannot see a deletion of about 600 bp. The couple report no longer prints "CNVpytor calls no deletion here" for an allele shorter than 2 kb (the two HBB rows), where that silence is no evidence.
  • docs/35-paralogs.md lists the interval table. docs/39-couple.md and docs/cn-loci.md no longer say the inputs are not passed.

Output changes, all additions: the interval table gets two new lines (HBB_619bp_del, HBD_HBB_Sicilian_del), and the couple report gets two new allele lines per partner. No column, file name or option was renamed or removed.

Decisions:

How it was checked

Beads: pgp-pfw6.36 (pgp-19um was fixed by #276)

…een and the Nextflow report

Step 39 and COUPLE_CARRIER now hand couple_report.py each partner's
step 35 interval table and step 18 CNVpytor VCF when they exist, so the
carrier deletion alleles and AZF lines appear without a hand-run command.
HTML_REPORT places <id>_cn_intervals.tsv in paralogs/, where
collect_summary.py reads it, and main.nf joins it into the report inputs.

Bead: pgp-pfw6.36
HG002's DAZ depth gives an estimate of 3.63 in CI run 41767270253, so the
row is not assessed with reason between_counts. The case now checks that,
with the estimate held to 3.3 to 3.9, and checks that the same assertion
fails on the female table.

Bead: pgp-pfw6.36
…depth

Two interval rows at their HbVar GRCh38 spans (979 and 1035), checked by
placing the NG_000007.3 breakpoint flanks on NC_000011.10. The couple
screen lists both as carrier deletion alleles. The step 35 interval table
gains two lines; no existing row or column changes.

Bead: pgp-pfw6.36
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 27 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ba87cb7 and 861dbb3.

Files ignored due to path filters: 2

  • bin/cn_loci.tsv is excluded by !**/*.tsv
  • scripts/ci/e2e-case-paths.tsv is excluded by !**/*.tsv
Files selected for processing: 18

  • bin/collect_summary.py
  • bin/couple_report.py
  • docs/35-paralogs.md
  • docs/39-couple.md
  • docs/cn-loci.md
  • main.nf
  • modules/local/couple/main.nf
  • modules/local/html_report/main.nf
  • scripts/39-couple.sh
  • scripts/ci/build-cn-intervals.py
  • tests/e2e/cn-intervals-1-catalog.sh
  • tests/e2e/cn-intervals-2-hg002.sh
  • tests/e2e/followups-cn-1-couple-report.sh
  • tests/test_copy_number.py
  • tests/test_couple_report.py
  • workflows/bam_analysis.nf
  • workflows/family.nf
  • workflows/sv.nf
Walkthrough

The change adds two HBB deletion alleles to the copy-number catalog and couple report. It also passes interval tables and CNVpytor VCFs through couple-screen workflows, stages interval tables for HTML reports, and adds related tests and documentation.

Changes: Copy-number couple screening

Layer / File(s) Summary
Add HBB deletion intervals
scripts/ci/build-cn-intervals.py, tests/test_copy_number.py, docs/cn-loci.md
The interval catalog adds the HBB 619 bp and Sicilian deletions with their HbVar spans. Catalog tests check their names and coordinates.
Report deletion alleles
bin/couple_report.py, tests/test_couple_report.py, docs/cn-loci.md
The couple report recognizes both deletions and notes that overlapping HBB rows can report one deletion more than once. Tests check present and absent results.
Pass interval and CNVpytor inputs
workflows/bam_analysis.nf, workflows/sv.nf, main.nf, workflows/family.nf, modules/local/couple/main.nf, modules/local/html_report/main.nf, scripts/39-couple.sh, docs/35-paralogs.md, docs/39-couple.md, docs/cn-loci.md, tests/e2e/*
The workflows pass interval tables and CNVpytor VCFs to the couple screen and stage interval tables for HTML reports. End-to-end tests check the input paths, report output, and AZFc results.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · previous review ba87c

No concrete merge-blocking defect is established. The new inputs follow the documented cross-check behavior; whether absent CNVpytor calls need additional interpretation for the 619 bp allele remains unresolved.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: wiring copy-number interval tables and CNVpytor calls into the couple screen and report. It also names the review follow-ups. The changeset matches this. The title is …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: wiring copy-number interval tables and CNVpytor calls into the couple screen and report. It also names the review follow-ups. The changeset matches this. The title is long (110 characters, 17 words), and the second clause is vague, but the primary change is clear.

Full details: Docstring Coverage

Explanation

Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 7 files. (9 skipped: 9 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments: 1
bin/couple_report.py-403-404: 1

403-404: Minor · Potential issue · Quick win

Unverified finding
We couldn't verify this from the code. It is shown for review, not as a verified issue.

Adding the 619 bp HBB allele makes the existing CNVpytor disagreement annotation apply to a sub-kilobase deletion. If step 18 cannot reliably call deletions that small, the report may present an expected lack of a CNVpytor call as contradictory evidence.

The couple report says “CNVpytor (step 18) calls no deletion here” beside a genuine depth-based finding, potentially misleading readers about the strength of the evidence.

This can occur when: Step 35 calls the HBB 619 bp deletion present and a CNVpytor VCF is supplied with no call over that span.

Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 4685227 and ba87cb7.

Files ignored due to path filters: 1
  • bin/cn_loci.tsv is excluded by !**/*.tsv
Files selected for processing: 16
  • bin/couple_report.py
  • docs/35-paralogs.md
  • docs/39-couple.md
  • docs/cn-loci.md
  • main.nf
  • modules/local/couple/main.nf
  • modules/local/html_report/main.nf
  • scripts/39-couple.sh
  • scripts/ci/build-cn-intervals.py
  • tests/e2e/cn-intervals-2-hg002.sh
  • tests/e2e/followups-cn-1-couple-report.sh
  • tests/test_copy_number.py
  • tests/test_couple_report.py
  • workflows/bam_analysis.nf
  • workflows/family.nf
  • workflows/sv.nf

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@GeiserX

GeiserX commented Nov 4, 2026

Copy link
Copy Markdown
Owner Author

The unverified note on bin/couple_report.py 403-404 holds: step 18 calls on 1 kb bins, so it cannot see the 619 bp or 621 bp HBB deletions. Fixed in 0c490e0: the missing-call note is now printed only for an allele of 2 kb or more, with a unit check that was red before the fix.

@GeiserX

GeiserX commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@GeiserX
GeiserX merged commit 933732a into main Nov 6, 2026
37 of 41 checks passed
@GeiserX
GeiserX deleted the pgp/followups-cn branch November 6, 2026 14:44
GeiserX added a commit that referenced this pull request Nov 6, 2026
#288 added the case while a case could still go without a row; this PR
makes a missing row fail Guard, so the merge of main failed unit-tests.
69 s is its time in the passing fork run 42134759461; it reads only its
own folder, so it needs nothing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant