Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code for samples with missing location #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions genomeuploader/genome_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,14 @@ def extract_ENA_info(genomeInfo, uploadDir, webin, password):
latitude = '-' + location.split('S')[0].strip()
longitude = location.split('S')[1].strip()

if 'W' in longitude:
longitude = '-' + longitude.split('W')[0].strip()
elif longitude.endswith('E'):
longitude = longitude.split('E')[0].strip()
try:
if 'W' in longitude:
longitude = '-' + longitude.split('W')[0].strip()
elif longitude.endswith('E'):
longitude = longitude.split('E')[0].strip()
except TypeError:
# NoneType is not iterable
pass

if latitude:
latitude = "{:.{}f}".format(round(float(latitude), GEOGRAPHY_DIGIT_COORDS), GEOGRAPHY_DIGIT_COORDS)
Expand Down Expand Up @@ -492,12 +496,12 @@ def combine_ENA_info(genomeInfo, ENADict):
latitude = latitList[0]
if multipleElementSet(latitList):
latitude = "not provided"
genomeInfo[g]["latitude"] = str(round(float(latitude), GEOGRAPHY_DIGIT_COORDS))
genomeInfo[g]["latitude"] = str(round(float(latitude), GEOGRAPHY_DIGIT_COORDS)) if latitude != "not provided" else latitude

longitude = longList[0]
if multipleElementSet(longList):
longitude = "not provided"
genomeInfo[g]["longitude"] = str(round(float(longitude), GEOGRAPHY_DIGIT_COORDS))
genomeInfo[g]["longitude"] = str(round(float(longitude), GEOGRAPHY_DIGIT_COORDS)) if longitude != "not provided" else longitude

samples = samplesList[0]
if multipleElementSet(samplesList):
Expand Down