Skip to content

Commit 874cb12

Browse files
committed
Only allow SOMATIC or GERMLINE values for SV_Status column
1 parent fb81dc6 commit 874cb12

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

scripts/importer/validateData.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,8 +3217,9 @@ def checkNCBIbuild(ncbi_build):
32173217
def checkSVstatus(sv_status):
32183218
""" Allowed values for SV_Status column are SOMATIC and GERMLINE """
32193219
if sv_status is None:
3220-
self.logger.warning('No value in SV_Status, assuming the variant is SOMATIC',
3221-
extra={'line_number': self.line_number})
3220+
self.logger.error('Invalid SV_Status value: possible values are [SOMATIC, GERMLINE]',
3221+
extra={'line_number': self.line_number,
3222+
'cause': sv_status})
32223223
elif sv_status.lower() == 'germline':
32233224
self.logger.warning('GERMLINE variant identified from the SV_Status value. If this variant is not meant for public release, please remove it.',
32243225
extra={'line_number': self.line_number,

tests/unit_tests_validate_data.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2023,9 +2023,15 @@ def test_missing_values(self):
20232023
self.logger.setLevel(logging.ERROR)
20242024
record_list = self.validate('data_structural_variants_missing_values.txt',
20252025
validateData.StructuralVariantValidator)
2026-
self.assertEqual(2, len(record_list))
2026+
self.assertEqual(3, len(record_list))
20272027
record_iterator = iter(record_list)
20282028

2029+
# Expected first error due to a SV_Status being empty
2030+
record = next(record_iterator)
2031+
self.assertEqual(logging.ERROR, record.levelno)
2032+
self.assertEqual(3, record.line_number)
2033+
self.assertIn("Invalid SV_Status value: possible values are [SOMATIC, GERMLINE]", record.message)
2034+
20292035
# Expected ERROR message due to missing Entrez gene id and/or gene symbol at site 1 and site 2
20302036
record = next(record_iterator)
20312037
self.assertEqual(logging.ERROR, record.levelno)

0 commit comments

Comments
 (0)