Skip to content

Commit

Permalink
Error handling on metadata improved
Browse files Browse the repository at this point in the history
  • Loading branch information
Ge94 committed Jul 22, 2024
1 parent 5e60b60 commit 15b98b1
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions genomeuploader/genome_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,17 @@ def extract_ENA_info(genomeInfo, uploadDir, webin, password):
elif longitude.endswith('E'):
longitude = longitude.split('E')[0].strip()

if latitude:
latitude = "{:.{}f}".format(round(float(latitude), GEOGRAPHY_DIGIT_COORDS), GEOGRAPHY_DIGIT_COORDS)
else:
raise IOError("Latitude could not be parsed. Check metadata for run {}.".format(runAccession))

if longitude:
longitude = "{:.{}f}".format(round(float(longitude), GEOGRAPHY_DIGIT_COORDS), GEOGRAPHY_DIGIT_COORDS)
else:
raise IOError("Longitude could not be parsed. Check metadata for run {}.".format(runAccession))
if latitude != "not provided":
try:
latitude = "{:.{}f}".format(round(float(latitude), GEOGRAPHY_DIGIT_COORDS), GEOGRAPHY_DIGIT_COORDS)
except ValueError:
raise IOError("Latitude could not be parsed. Check metadata for run {}.".format(runAccession))

if longitude != "not provided":
try:
longitude = "{:.{}f}".format(round(float(longitude), GEOGRAPHY_DIGIT_COORDS), GEOGRAPHY_DIGIT_COORDS)
except ValueError:
raise IOError("Longitude could not be parsed. Check metadata for run {}.".format(runAccession))

country = sampleInfo["country"].split(':')[0]
if not country in GEOGRAPHIC_LOCATIONS:
Expand Down

0 comments on commit 15b98b1

Please sign in to comment.