Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameters for penalty and threshold #138

Conversation

Jakob37
Copy link
Contributor

@Jakob37 Jakob37 commented Oct 18, 2024

Description

This addresses two issues in Lund with using Genmod compounds.

  1. We use different threshold and score from those hard-coded here.
  2. For single cases, we do not want to apply a penalty (i.e. we would use --penalty 0 here).

Close #137

Further discussed with @dnil and @northwestwitch in: Clinical-Genomics/scout#4823

Added

  • Optional command line parameter to set threshold and penalty applied in compound scorer.

Changed

Fixed

How to prepare for test

  • Ssh to relevant server (depending on type of change)
  • Use stage: us
  • Paxa the environment: paxa
  • Install on stage (example for Hasta):
    bash /home/proj/production/servers/resources/hasta.scilifelab.se/update-tool-stage.sh -e S_[TOOL]-t [TOOL] -b [THIS-BRANCH-NAME] -a

How to test

  • Do ...

Expected test outcome

  • Check that ...
  • Take a screenshot and attach or copy/paste the output.

Review

  • Tests executed by
  • "Merge and deploy" approved by
    Thanks for filling in who performed the code review and the test!

This version is a

  • MAJOR - when you make incompatible API changes
  • MINOR - when you add functionality in a backwards compatible manner
  • PATCH - when you make backwards compatible bug fixes or documentation/instructions

Implementation Plan

  • Document in ...
  • Deploy this branch on ...
  • Inform to ...

@Jakob37 Jakob37 marked this pull request as ready for review October 18, 2024 13:08
@Jakob37
Copy link
Contributor Author

Jakob37 commented Oct 18, 2024

Parameters are tested such that they respond.

First no penalty is applied, yielding score -6 (which matches the RankResult).

Then a penalty of 5 is applied, changing the score to -6.

Finally, the threshold for penalty is lowered below the low scoring compound, thus avoiding the penalty by having a passing compound variant. Score going back to -6.

jakob@laptop:~/src/genmod$ /usr/bin/python3 -m genmod.commands.base compound -p 1 test/3_scored.vcf --penalty 0 | grep Compounds | tail -1 | cut -f8 | sed "s/.*;Compounds=/Compounds=/" | tr ";" "\n" | cat -n
     1  Compounds=SAMPLE_ID:21_46602317_C_G>-11.0
     2  GeneticModels=SAMPLE_ID:AD|AR_comp
     3  ModelScore=SAMPLE_ID:99
     4  RankScore=SAMPLE_ID:-6.0
     5  RankScoreNormalized=SAMPLE_ID:0.3037974683544304
     6  RankScoreMinMax=SAMPLE_ID:-30.0:49.0
     7  RankResult=-12|0|0|1|1|0|3|0|0|0|1
     8  CompoundsNormalized=SAMPLE_ID:21_46602317_C_G>0.620253164556962
jakob@laptop:~/src/genmod$ /usr/bin/python3 -m genmod.commands.base compound -p 1 test/3_scored.vcf --penalty 5 | grep Compounds | tail -1 | cut -f8 | sed "s/.*;Compounds=/Compounds=/" | tr ";" "\n" | cat -n
     1  Compounds=SAMPLE_ID:21_46602317_C_G>-16.0
     2  GeneticModels=SAMPLE_ID:AD|AR_comp
     3  ModelScore=SAMPLE_ID:99
     4  RankScore=SAMPLE_ID:-11.0
     5  RankScoreNormalized=SAMPLE_ID:0.24050632911392406
     6  RankScoreMinMax=SAMPLE_ID:-30.0:49.0
     7  RankResult=-12|0|0|1|1|0|3|0|0|0|1
     8  CompoundsNormalized=SAMPLE_ID:21_46602317_C_G>0.5569620253164558
jakob@laptop:~/src/genmod$ /usr/bin/python3 -m genmod.commands.base compound -p 1 test/3_scored.vcf --penalty 5 --threshold -20 | grep Compounds | tail -1 | cut -f8 | sed "s/.*;Compounds=/Compounds=/" | tr ";" "\n" | cat -n
     1  Compounds=SAMPLE_ID:21_46602317_C_G>-11.0
     2  GeneticModels=SAMPLE_ID:AD|AR_comp
     3  ModelScore=SAMPLE_ID:99
     4  RankScore=SAMPLE_ID:-6.0
     5  RankScoreNormalized=SAMPLE_ID:0.3037974683544304
     6  RankScoreMinMax=SAMPLE_ID:-30.0:49.0
     7  RankResult=-12|0|0|1|1|0|3|0|0|0|1
     8  CompoundsNormalized=SAMPLE_ID:21_46602317_C_G>0.620253164556962

@@ -45,8 +45,10 @@
is_flag=True,
help='If variants are annotated with the Variant Effect Predictor.'
)
@click.option('--threshold', type=int, help="Threshold for model-dependent penalty if no compounds with passing score", default=9)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feel very free to help me improve these help texts

Copy link
Collaborator

Choose a reason for hiding this comment

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

Correctly spelling threshold is already a strong text! 😸

@Jakob37
Copy link
Contributor Author

Jakob37 commented Oct 18, 2024

Not sure how to turn to with reviewing here. Maybe @dnil , @northwestwitch or @torbjorgen could give this a look?

@Jakob37
Copy link
Contributor Author

Jakob37 commented Oct 21, 2024

Thanks for the review @torbjorgen !

I don't have merge-access to the repo. Maybe someone else could help me merge this PR?

@Jakob37
Copy link
Contributor Author

Jakob37 commented Oct 24, 2024

I don't have access to this repo, so I am unable to merge / release.

Not sure who to ask. Could maybe @torbjorgen or @dnil help me out here? With merging or giving me access to the repo so I can do it myself.

@dnil dnil self-assigned this Oct 24, 2024
Copy link
Collaborator

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

This looks safe enough - defaults are exactly as before. The PR exposes a previously somewhat internally hidden, and rather important aspect of the model.

@@ -45,8 +45,10 @@
is_flag=True,
help='If variants are annotated with the Variant Effect Predictor.'
)
@click.option('--threshold', type=int, help="Threshold for model-dependent penalty if no compounds with passing score", default=9)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Correctly spelling threshold is already a strong text! 😸

@click.pass_context
def compound(context, variant_file, silent, outfile, vep, processes, temp_dir):
def compound(context, variant_file, silent, outfile, vep, threshold: int, penalty: int, processes, temp_dir):
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@dnil
Copy link
Collaborator

dnil commented Oct 24, 2024

I would call this a minor, since it adds functionality in a completely backwards compatible manner. It does not correct a bug per se, but almost. ;)

@dnil dnil merged commit c30e149 into Clinical-Genomics:master Oct 24, 2024
3 checks passed
@dnil dnil mentioned this pull request Oct 24, 2024
15 tasks
@Jakob37
Copy link
Contributor Author

Jakob37 commented Oct 24, 2024

Thanks for the review 🙏

dnil pushed a commit that referenced this pull request Oct 24, 2024
* Add parameters for penalty and threshold

* Cleaning things up

* Cleaning up and changelog
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.

Genmod compounds control threshold and assigned score
3 participants