Skip to content

Refactor cancer SNVs code to use shared routines#6128

Open
northwestwitch wants to merge 11 commits intomainfrom
refactor_cancer_variants
Open

Refactor cancer SNVs code to use shared routines#6128
northwestwitch wants to merge 11 commits intomainfrom
refactor_cancer_variants

Conversation

@northwestwitch
Copy link
Member

@northwestwitch northwestwitch commented Mar 13, 2026

This PR adds a functionality or fixes a bug.

  • Refactor and simplify cancer SNVs code
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


# When a POST request with filter containing wrongly formatted parameters is sent
form_data = {
"control_frequency": "not a number!",
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed this test which is testing an impossible condition, as the form now has enforced a HTML5 check, so you can't enter a string - it just accepts numbers

NOTE that the test would have failed with
assert 200 == 302

This is because cancer variant form is currently validated.

Validation is lost with the refactoring - it's complicated to have a common function and just validate cancer variants forms on POST request. Would be much easier to start working on a common validation code for each variant type at a later stage.

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 79.16667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.88%. Comparing base (4602f73) to head (02abcef).

Files with missing lines Patch % Lines
scout/server/blueprints/variants/controllers.py 70.58% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6128      +/-   ##
==========================================
- Coverage   83.93%   83.88%   -0.06%     
==========================================
  Files         343      343              
  Lines       21174    21126      -48     
==========================================
- Hits        17773    17722      -51     
- Misses       3401     3404       +3     

☔ 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.

if category == "snv":
args.append(request.form)
elif category == "cancer":
args.append(form)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not a typo: cancer_variants expects the WTF itself, not the request form

@northwestwitch northwestwitch marked this pull request as ready for review March 16, 2026 07:36
@sonarqubecloud
Copy link

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.

2 participants