Skip to content

Commit

Permalink
Validate Entity Stable ID
Browse files Browse the repository at this point in the history
  • Loading branch information
oplantalech authored and dippindots committed Sep 6, 2023
1 parent 49423ce commit 1d8227b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions core/src/main/scripts/importer/validateData.py
Original file line number Diff line number Diff line change
Expand Up @@ -4456,12 +4456,17 @@ def __init__(self, *args, **kwargs):

def parseFeatureColumns(self, nonsample_col_vals):
"""Check the IDs in the first column."""

allowed_characters = r'[^A-Za-z0-9_.-]'

value = nonsample_col_vals[0].strip()
if ' ' in value:
self.logger.error('Do not use space in the stable id',

# Check if genetic entity is present and contains allowed characters
if re.search(allowed_characters, value) is not None:
self.logger.error('Feature id contains one or more illegal characters',
extra={'line_number': self.line_number,
'column_number': 1,
'cause': nonsample_col_vals[0]})
'cause': 'id was`' + value + '` and only alpha-numeric, _, . and - are allowed.'})

return value

def checkId(self):
Expand Down

0 comments on commit 1d8227b

Please sign in to comment.