Skip to content

Commit

Permalink
add relatedness check tsv to failure message (#4456)
Browse files Browse the repository at this point in the history
* add relatedness check tsv to failure message

* Update check_for_new_samples_from_pipeline_tests.py
  • Loading branch information
jklugherz authored Nov 6, 2024
1 parent bea7763 commit d84fef0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 9 additions & 1 deletion seqr/management/commands/check_for_new_samples_from_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
DATASET_TYPE_MAP = {'GCNV': Sample.DATASET_TYPE_SV_CALLS}
USER_EMAIL = 'manage_command'
MAX_LOOKUP_VARIANTS = 5000
RELATEDNESS_CHECK_NAME = 'relatedness_check'

PDO_COPY_FIELDS = [
'PDO', 'PDOStatus', 'SeqrLoadingDate', 'GATKShortReadCallsetPath', 'SeqrProjectURL', 'TerraProjectURL',
Expand Down Expand Up @@ -160,6 +161,7 @@ def _load_new_samples(cls, metadata_path, genome_version, dataset_type, run_vers
split_project_pdos[project.name] = cls._update_pdos(session, project.guid, sample_ids)

# Send failure notifications
relatedness_check_file_path = metadata.get('relatedness_check_file_path')
failed_family_samples = metadata.get('failed_family_samples', {})
failed_families_by_guid = {f['guid']: f for f in Family.objects.filter(
guid__in={family for families in failed_family_samples.values() for family in families}
Expand All @@ -176,9 +178,15 @@ def _load_new_samples(cls, metadata_path, genome_version, dataset_type, run_vers
split_pdos = split_project_pdos.get(project)
if split_pdos:
summary += f'\n\nSkipped samples in this project have been moved to {", ".join(split_pdos)}'

relatedness_check_message = (
f'\nRelatedness check results: {relatedness_check_file_path}'
if (relatedness_check_file_path and check == RELATEDNESS_CHECK_NAME)
else ''
)
safe_post_to_slack(
SEQR_SLACK_LOADING_NOTIFICATION_CHANNEL,
f'The following {len(failures)} families failed {check.replace("_", " ")} in {project}:\n{summary}'
f'The following {len(failures)} families failed {check.replace("_", " ")} in {project}:\n{summary}{relatedness_check_message}'
)

# Reload saved variant JSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@
'F000002_2': {'reasons': ["Missing samples: {'HG00732', 'HG00733'}"]},
'F000003_3': {'reasons': ["Missing samples: {'NA20870'}"]},
},
}
},
'relatedness_check_file_path': 'gs://seqr-loading-temp/v3.1/GRCh38/SNV_INDEL/relatedness_check/test_callset_hash.tsv',
}, {
'callsets': ['invalid_family.vcf'],
'sample_type': 'WGS',
Expand Down Expand Up @@ -552,7 +553,7 @@ def test_command(self, mock_email, mock_airtable_utils):
mock.call(
'seqr_loading_notifications',
"""The following 1 families failed relatedness check in 1kg project nåme with uniçøde:
- 1: Sample NA19679 has expected relation "parent" to NA19675 but has coefficients [0.0, 0.8505002045292791, 0.14949979547072176, 0.5747498977353613]; Sample NA19678 has expected relation "sibling" to NA19675 but has coefficients [0.17424888135104177, 0.6041745754450025, 0.22157654320395614, 0.5236638309264574]""",
- 1: Sample NA19679 has expected relation "parent" to NA19675 but has coefficients [0.0, 0.8505002045292791, 0.14949979547072176, 0.5747498977353613]; Sample NA19678 has expected relation "sibling" to NA19675 but has coefficients [0.17424888135104177, 0.6041745754450025, 0.22157654320395614, 0.5236638309264574]\nRelatedness check results: gs://seqr-loading-temp/v3.1/GRCh38/SNV_INDEL/relatedness_check/test_callset_hash.tsv""",
),
mock.call(
'seqr_loading_notifications',
Expand Down

0 comments on commit d84fef0

Please sign in to comment.