Skip to content

Commit

Permalink
bugfix regenie check
Browse files Browse the repository at this point in the history
  • Loading branch information
meyerkm committed Sep 30, 2024
1 parent 1630243 commit 9f37a5e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 7 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/pipeline-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ jobs:
prerun_cmd: cp ./tests/deeprvat/pretrained/deeprvat_config.yaml ./example/
dry_run: false
upload_pretrained_outputs: true

Reference-Output-Pretrained-Regenie:
uses: ./.github/workflows/run-pipeline.yml
with:
branch: main
pipeline_file: ./pipelines/association_testing_pretrained_regenie.snakefile
environment_file: ./deeprvat_env_no_gpu.yml
prerun_cmd: cp ./tests/deeprvat/regenie/pretrained/deeprvat_config.yaml ./example/
dry_run: false
upload_regenie_outputs: true

# Association Testing Pretrained Pipeline
Smoke-Association-Testing-Pretrained:
Expand Down Expand Up @@ -97,16 +107,16 @@ jobs:
prerun_cmd: cp ./tests/deeprvat/regenie/pretrained/deeprvat_config.yaml ./example/

Pipeline-Tests-Association-Testing-Pretrained-Regenie:
needs: [Smoke-Association-Testing-Pretrained-Regenie, Reference-Output-Pretrained]
needs: [Smoke-Association-Testing-Pretrained-Regenie, Reference-Output-Pretrained-Regenie]
uses: ./.github/workflows/run-pipeline.yml
with:
pipeline_file: ./pipelines/association_testing_pretrained_regenie.snakefile
environment_file: ./deeprvat_env_no_gpu.yml
prerun_cmd: cp ./tests/deeprvat/regenie/pretrained/deeprvat_config.yaml ./example/
dry_run: false
download_pretrained_outputs: true
run_burden_results_check: true
run_association_results_check: true
download_regenie_outputs: true
#run_burden_results_check: true
run_regenie_association_results_check: true

# Association Testing Training
Smoke-Association-Testing-Training:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/run-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ on:
required: false
default: false
type: boolean
upload_regenie_outputs:
required: false
default: false
type: boolean
download_training_outputs:
required: false
default: false
Expand All @@ -60,6 +64,10 @@ on:
required: false
default: false
type: boolean
download_regenie_outputs:
required: false
default: false
type: boolean
run_training_results_check:
required: false
default: false
Expand All @@ -72,6 +80,10 @@ on:
required: false
default: false
type: boolean
run_regenie_association_results_check:
required: false
default: false
type: boolean

jobs:
Run-Pipeline:
Expand Down Expand Up @@ -148,6 +160,15 @@ jobs:
./example/**/all_results.parquet
include-hidden-files: true #for .zarr needed
retention-days: 1
- name: Upload Regenie Outputs
id: uploaded_regenie_outputs
if: inputs.upload_regenie_outputs
uses: actions/upload-artifact@v4
with:
name: completed_regenie_outputs
path: |
./example/**/all_results.parquet
retention-days: 1
- name: Download Previous Training Outputs
id: downloaded_training_outputs
if: inputs.download_training_outputs
Expand All @@ -162,6 +183,13 @@ jobs:
with:
name: completed_pretrained_outputs
path: ./tests/completed_pretrained_outputs
- name: Download Previous Regenie Outputs
id: downloaded_regenie_outputs
if: inputs.download_regenie_outputs
uses: actions/download-artifact@v4
with:
name: completed_regenie_outputs
path: ./tests/completed_regenie_outputs
# - name: Display structure of downloaded files
# if: inputs.download_outputs
# run: ls -R ./tests/completed_run_output
Expand All @@ -186,4 +214,11 @@ jobs:
./example/ ./tests/completed_pretrained_outputs/ \
"Cholesterol" "Platelet_count"
shell: micromamba-shell {0}
- name: Run REGENIE Association Results Check
if: inputs.run_regenie_association_results_check
run: |
python $GITHUB_WORKSPACE/tests/deeprvat/compare_reference.py compare-association \
./example/ ./tests/completed_regenie_outputs/ \
"Cholesterol" "Platelet_count"
shell: micromamba-shell {0}

6 changes: 3 additions & 3 deletions tests/deeprvat/compare_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ def compare_training(
)

if max_difference > tolerance:
params_pairs = [(p1, p2) for p1, p2 in zip(model.parameters(), reference_model.parameters())]
logger.info("Model and reference model parameter pairs:\n %s", params_pairs)
raise RuntimeError(
f"FAIL! Max difference between model and reference parameters (repeat {r}) "
f"differs by {max_difference} > {tolerance=}\n"
f"REFERENCE Model Params: {reference_model.parameters()}\n\n"
f"Current Test Model Params; {model.parameters()}"
f"differs by {max_difference} > {tolerance=}\n"
)
else:
logger.info(
Expand Down

0 comments on commit 9f37a5e

Please sign in to comment.