Skip to content

Fix N/A homoz and total obs when n.obs is 0#6038

Draft
northwestwitch wants to merge 5 commits intomainfrom
fix_na_obs_when_zero
Draft

Fix N/A homoz and total obs when n.obs is 0#6038
northwestwitch wants to merge 5 commits intomainfrom
fix_na_obs_when_zero

Conversation

@northwestwitch
Copy link
Member

@northwestwitch northwestwitch commented Feb 11, 2026

This PR adds a functionality or fixes a bug.

Before

image

After

image
Testing on cg-vm1 server (Clinical Genomics Stockholm)

Prepare for testing

  1. Make sure the PR is pushed and available on Docker Hub
  2. First book your testing time using the Pax software available at https://pax.scilifelab.se/. The resource you are going to call dibs on is scout-stage and the server is cg-vm1.
  3. ssh <USER.NAME>@cg-vm1.scilifelab.se
  4. sudo -iu hiseq.clinical
  5. ssh localhost
  6. (optional) Find out which scout branch is currently deployed on cg-vm1: podman ps
  7. Stop the service with current deployed branch: systemctl --user stop scout@<name_of_currently_deployed_branch>
  8. Start the scout service with the branch to test: systemctl --user start scout@<this_branch>
  9. Make sure the branch is deployed: systemctl --user status scout.target
  10. After testing is done, repeat procedure at https://pax.scilifelab.se/, which will release the allocated resource (scout-stage) to be used for testing by other users.
Testing on hasta server (Clinical Genomics Stockholm)

Prepare for testing

  1. ssh <USER.NAME>@hasta.scilifelab.se
  2. Book your testing time using the Pax software. us; paxa -u <user> -s hasta -r scout-stage. You can also use the WSGI Pax app available at https://pax.scilifelab.se/.
  3. (optional) Find out which scout branch is currently deployed on cg-vm1: conda activate S_scout; pip freeze | grep scout-browser
  4. Deploy the branch to test: bash /home/proj/production/servers/resources/hasta.scilifelab.se/update-tool-stage.sh -e S_scout -t scout -b <this_branch>
  5. Make sure the branch is deployed: us; scout --version
  6. After testing is done, repeat the paxa procedure, which will release the allocated resource (scout-stage) to be used for testing by other users.

How to test:

  1. how to test it, possibly with real cases/data

Expected outcome:
The functionality should be working
Take a screenshot and attach or copy/paste the output.

Review:

  • code approved by
  • tests executed by CR

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.88%. Comparing base (72cee20) to head (3abffad).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    Clinical-Genomics/scout#6038   +/-   ##
=======================================
  Coverage   83.88%   83.88%           
=======================================
  Files         336      336           
  Lines       21022    21022           
=======================================
  Hits        17635    17635           
  Misses       3387     3387           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@northwestwitch northwestwitch marked this pull request as ready for review February 11, 2026 07:11
{{ value }}
{% endif %}
{%- endmacro %}
{% macro render_obs(value) %}
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved this macro outside, so it can be shared by obs_table and old_observations_table

Copy link
Member

Choose a reason for hiding this comment

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

That is nice! 💯

@sonarqubecloud
Copy link

@northwestwitch northwestwitch marked this pull request as draft February 11, 2026 14:25
Copy link
Member

@dnil dnil left a comment

Choose a reason for hiding this comment

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

I'm still confused - my current take is that the issue was about changing loqusdbapi to a 0 return with totals, instead of throwing an exception.

{{ value }}
{% endif %}
{%- endmacro %}
{% macro render_obs(value) %}
Copy link
Member

Choose a reason for hiding this comment

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

That is nice! 💯

<td>{{ obs.observations|default('N/A') }}</td>
<td>{{ obs.homozygote|default('N/A') }}</td>
<td>{{ obs.total|default('N/A') }}</td>
<td>{{ render_obs(obs_count) }}</td>
Copy link
Member

Choose a reason for hiding this comment

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

👍

<td>{{ obs.homozygote|default('N/A') }}</td>
<td>{{ obs.total|default('N/A') }}</td>
<td>{{ render_obs(obs_count) }}</td>
<td>{{ render_obs(0 if obs_count == 0 else obs.homozygote) }}</td>
Copy link
Member

Choose a reason for hiding this comment

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

Mm, sure, I guess if we saw none, then there can be no homozygotes.

<td>{{ obs.total|default('N/A') }}</td>
<td>{{ render_obs(obs_count) }}</td>
<td>{{ render_obs(0 if obs_count == 0 else obs.homozygote) }}</td>
<td>{{ render_obs(0 if obs_count == 0 else obs.total) }}</td>
Copy link
Member

Choose a reason for hiding this comment

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

We used to add an N/A here for variant totals not loaded; contrast this with e.g. a fully empty loqusdb instance. I think maybe our issue contributor would rather have loqusdbapi always return totals, even if the variant was not found, much like the loqusdb exe?

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.

N/A in total number of local observations when number of observations is 0

2 participants