# HG changeset patch # User greg # Date 1568738757 14400 # Node ID 72e79ed7ca41b6884718ba893c9c1d519c6ad54f # Parent b5f5c3d0f349c7c70423a8d1bb1cbfea296b8ff8 Uploaded diff -r b5f5c3d0f349 -r 72e79ed7ca41 validate_affy_metadata.py --- a/validate_affy_metadata.py Fri Sep 13 13:55:24 2019 -0400 +++ b/validate_affy_metadata.py Tue Sep 17 12:45:57 2019 -0400 @@ -63,6 +63,14 @@ return accumulated_msgs +def validate_integer(line_no, integer_string, column, accumulated_msgs): + try: + integer_string.isdigit() + return accumulated_msgs + except Exception: + return add_error_msg(accumulated_msgs, "Line %d contains an incorrect integer value (%s) for column %s." % (line_no, integer_string, column)) + + accumulated_msgs = "" # Parse the input file, skipping the header, and validating # that each data line consists of 31 comma-separated items. @@ -107,8 +115,10 @@ geographic_origin = items[8] # Optional. colony_location = items[9] - # Optional. depth = items[10] + # If depth has a value, then it must be integer. + if len(depth) > 0: + accumulated_msgs = validate_integer(line_no, depth, "depth", accumulated_msgs) # Optional. disease_resist = items[11] # Optional.