Skip to content

Commit

Permalink
Only allow SOMATIC or GERMLINE values for SV_Status column
Browse files Browse the repository at this point in the history
  • Loading branch information
oplantalech committed Oct 31, 2024
1 parent fb81dc6 commit 874cb12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions scripts/importer/validateData.py
Original file line number Diff line number Diff line change
Expand Up @@ -3217,8 +3217,9 @@ def checkNCBIbuild(ncbi_build):
def checkSVstatus(sv_status):
""" Allowed values for SV_Status column are SOMATIC and GERMLINE """
if sv_status is None:
self.logger.warning('No value in SV_Status, assuming the variant is SOMATIC',
extra={'line_number': self.line_number})
self.logger.error('Invalid SV_Status value: possible values are [SOMATIC, GERMLINE]',
extra={'line_number': self.line_number,
'cause': sv_status})
elif sv_status.lower() == 'germline':
self.logger.warning('GERMLINE variant identified from the SV_Status value. If this variant is not meant for public release, please remove it.',
extra={'line_number': self.line_number,
Expand Down
8 changes: 7 additions & 1 deletion tests/unit_tests_validate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2023,9 +2023,15 @@ def test_missing_values(self):
self.logger.setLevel(logging.ERROR)
record_list = self.validate('data_structural_variants_missing_values.txt',
validateData.StructuralVariantValidator)
self.assertEqual(2, len(record_list))
self.assertEqual(3, len(record_list))
record_iterator = iter(record_list)

# Expected first error due to a SV_Status being empty
record = next(record_iterator)
self.assertEqual(logging.ERROR, record.levelno)
self.assertEqual(3, record.line_number)
self.assertIn("Invalid SV_Status value: possible values are [SOMATIC, GERMLINE]", record.message)

# Expected ERROR message due to missing Entrez gene id and/or gene symbol at site 1 and site 2
record = next(record_iterator)
self.assertEqual(logging.ERROR, record.levelno)
Expand Down

0 comments on commit 874cb12

Please sign in to comment.