comparison validate_affy_metadata.py @ 24:8a826d1afe69 draft

Uploaded
author greg
date Tue, 23 Apr 2019 08:57:13 -0400
parents 84478b80cc47
children d9f3bcfeecfe
comparison
equal deleted inserted replaced
23:84478b80cc47 24:8a826d1afe69
75 if i > 97: 75 if i > 97:
76 accumulated_msgs = add_error_msg(accumulated_msgs, "The input file contains more than 97 lines (must be 1 header line and no more than 96 data lines).") 76 accumulated_msgs = add_error_msg(accumulated_msgs, "The input file contains more than 97 lines (must be 1 header line and no more than 96 data lines).")
77 stop_error(accumulated_msgs) 77 stop_error(accumulated_msgs)
78 items = line.split("\t") 78 items = line.split("\t")
79 if len(items) != 32: 79 if len(items) != 32:
80 accumulated_msgs = add_error_msg(accumulated_msgs, "Line %d contains %s columns, (must be 30)." % (i, len(items))) 80 accumulated_msgs = add_error_msg(accumulated_msgs, "Line %d contains %s columns, (must be 32)." % (i, len(items)))
81 stop_error(accumulated_msgs) 81 stop_error(accumulated_msgs)
82 # Required and validated. 82 # Required and validated.
83 # Required. 83 # Required.
84 user_specimen_id = items[0] 84 user_specimen_id = items[0]
85 if len(user_specimen_id) == 0: 85 if len(user_specimen_id) == 0:
113 # Optional. 113 # Optional.
114 longitude_outplant = items[11] 114 longitude_outplant = items[11]
115 # Optional. 115 # Optional.
116 depth = items[12] 116 depth = items[12]
117 # Optional. 117 # Optional.
118 dist_shore = items[13] 118 disease_resist = items[13]
119 # Optional. 119 # Optional.
120 disease_resist = items[14] 120 bleach_resist = items[14]
121 # Optional. 121 # Optional.
122 bleach_resist = items[15] 122 mortality = items[15]
123 # Optional. 123 # Optional.
124 mortality = items[16] 124 tle = items[16]
125 # Optional. 125 # Optional.
126 tle = items[17] 126 spawning = string_as_boolean_string(items[17])
127 # Optional.
128 spawning = string_as_boolean_string(items[18])
129 # Required. 127 # Required.
130 collector_last_name = items[19] 128 collector_last_name = items[18]
131 if len(collector_last_name) == 0: 129 if len(collector_last_name) == 0:
132 accumulated_msgs = empty_value(i, "collector_last_name", accumulated_msgs) 130 accumulated_msgs = empty_value(i, "collector_last_name", accumulated_msgs)
133 # Required. 131 # Required.
134 collector_first_name = items[20] 132 collector_first_name = items[19]
135 if len(collector_first_name) == 0: 133 if len(collector_first_name) == 0:
136 accumulated_msgs = empty_value(i, "collector_first_name", accumulated_msgs) 134 accumulated_msgs = empty_value(i, "collector_first_name", accumulated_msgs)
137 # Required. 135 # Required.
138 org = items[21] 136 org = items[20]
139 if len(org) == 0: 137 if len(org) == 0:
140 accumulated_msgs = empty_value(i, "org", accumulated_msgs) 138 accumulated_msgs = empty_value(i, "org", accumulated_msgs)
141 # Required and validated. 139 # Required and validated.
142 collection_date = items[22] 140 collection_date = items[21]
143 accumulated_msgs = validate_date_string(i, collection_date, accumulated_msgs) 141 accumulated_msgs = validate_date_string(i, collection_date, accumulated_msgs)
144 # Required and validated. 142 # Required and validated.
145 contact_email = items[23] 143 contact_email = items[22]
146 accumulated_msgs = validate_email(i, contact_email, accumulated_msgs) 144 accumulated_msgs = validate_email(i, contact_email, accumulated_msgs)
147 # Required. 145 # Required.
148 seq_facility = items[24] 146 seq_facility = items[23]
149 if len(seq_facility) == 0: 147 if len(seq_facility) == 0:
150 accumulated_msgs = empty_value(i, "seq_facility", accumulated_msgs) 148 accumulated_msgs = empty_value(i, "seq_facility", accumulated_msgs)
151 # Optional. 149 # Optional.
152 array_version = items[25] 150 array_version = items[24]
153 # Optional. 151 # Optional.
154 public = string_as_boolean_string(items[26]) 152 public = string_as_boolean_string(items[25])
155 # Optional. 153 # Optional.
156 public_after_date = items[27] 154 public_after_date = items[26]
157 accumulated_msga = validate_date_string(i, public_after_date, accumulated_msgs) 155 accumulated_msga = validate_date_string(i, public_after_date, accumulated_msgs)
158 # Required and validated. 156 # Required and validated.
159 sperm_motility = items[28] 157 sperm_motility = items[27]
160 accumulated_msgs = validate_decimal(i, sperm_motility, accumulated_msgs) 158 accumulated_msgs = validate_decimal(i, sperm_motility, accumulated_msgs)
161 # Required and validated. 159 # Required and validated.
162 healing_time = items[29] 160 healing_time = items[28]
163 accumulated_msgs = validate_decimal(i, healing_time, accumulated_msgs) 161 accumulated_msgs = validate_decimal(i, healing_time, accumulated_msgs)
164 # Optional. 162 # Optional.
165 dna_extraction_method = items[9] 163 dna_extraction_method = items[29]
166 # Optional. 164 # Optional.
167 dna_concentration = items[31] 165 dna_concentration = items[30]
168 # If dna_concentration has a value, then it must be decimal. 166 # If dna_concentration has a value, then it must be decimal.
169 if len(dna_concentration) > 0: 167 if len(dna_concentration) > 0:
170 accumulated_msgs = validate_decimal(i, dna_concentration, accumulated_msgs) 168 accumulated_msgs = validate_decimal(i, dna_concentration, accumulated_msgs)
169 # Optional.
170 registry_id = items[31]
171 171
172 172
173 if len(accumulated_msgs) > 0: 173 if len(accumulated_msgs) > 0:
174 stop_error(accumulated_msgs) 174 stop_error(accumulated_msgs)
175 175