forked from MIRRI/mirri_utils
update mirri folder
This commit is contained in:
@@ -50,11 +50,10 @@ PUB_HEADERS = [pb["label"] for pb in PUBLICATION_FIELDS]
|
||||
|
||||
|
||||
def write_mirri_excel(path, strains, growth_media, version):
|
||||
if version == "20200601":
|
||||
_write_mirri_excel_20200601(path, strains, growth_media)
|
||||
if version == "5.1.2":
|
||||
_write_mirri_excel_12052023(path, strains, growth_media)
|
||||
|
||||
|
||||
def _write_mirri_excel_20200601(path, strains, growth_media):
|
||||
def _write_mirri_excel_12052023(path, strains, growth_media):
|
||||
wb = Workbook()
|
||||
|
||||
write_markers_sheet(wb)
|
||||
@@ -104,7 +103,7 @@ def _write_mirri_excel_20200601(path, strains, growth_media):
|
||||
redimension_cell_width(pub_sheet)
|
||||
|
||||
# write sexual states
|
||||
sex_sheet = wb.create_sheet("Sexual states")
|
||||
sex_sheet = wb.create_sheet("Sexual state")
|
||||
for sex_state in sorted(list(sexual_states)):
|
||||
sex_sheet.append([sex_state])
|
||||
redimension_cell_width(sex_sheet)
|
||||
@@ -121,7 +120,6 @@ def _write_mirri_excel_20200601(path, strains, growth_media):
|
||||
del wb["Sheet"]
|
||||
wb.save(str(path))
|
||||
|
||||
|
||||
def _deserialize_strains(strains, locations, growth_media_indexes,
|
||||
publications, sexual_states, genomic_markers):
|
||||
for strain in strains:
|
||||
@@ -189,10 +187,21 @@ def _deserialize_strains(strains, locations, growth_media_indexes,
|
||||
elif attribute == "collect.location.coords":
|
||||
lat = strain.collect.location.latitude
|
||||
long = strain.collect.location.longitude
|
||||
if lat is not None and long is not None:
|
||||
value = f"{lat};{long}"
|
||||
alt = strain.collect.location.altitude
|
||||
prec = strain.collect.location.precision
|
||||
if lat is not None and long is not None and prec is not None and alt is not None:
|
||||
value = f"{lat};{long};{prec};{alt}"
|
||||
else:
|
||||
value = None
|
||||
value = None
|
||||
elif attribute == "collect.site.links":
|
||||
name = strain.collect.site.links.nameSite
|
||||
url = strain.collect.site.links.urlSite
|
||||
value = rgetattr(strain, attribute)
|
||||
value = ";".join(value)
|
||||
if name is not None and url is not None:
|
||||
value = f"{name};{url}"
|
||||
else:
|
||||
value = None
|
||||
|
||||
elif attribute == "collect.location":
|
||||
location = strain.collect.location
|
||||
|
||||
Reference in New Issue
Block a user