forked from MIRRI/mirri_utils
18-07
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -19,12 +19,6 @@ from mirri.settings import (COMMERCIAL_USE_WITH_AGREEMENT, GENOMIC_INFO,
|
||||
NAGOYA_PROBABLY_SCOPE, NO_RESTRICTION,
|
||||
ONLY_RESEARCH, ONTOBIOTOPE,
|
||||
PUBLICATION_FIELDS, STRAINS, SUBTAXAS)
|
||||
from mirri.settings_v1 import (COMMERCIAL_USE_WITH_AGREEMENT, GENOMIC_INFO,
|
||||
GROWTH_MEDIA, LITERATURE_SHEET, LOCATIONS,
|
||||
MIRRI_FIELDS, NAGOYA_DOCS_AVAILABLE, NAGOYA_NO_RESTRICTIONS,
|
||||
NAGOYA_PROBABLY_SCOPE, NO_RESTRICTION,
|
||||
ONLY_RESEARCH, ONTOBIOTOPE,
|
||||
PUBLICATION_FIELDS, STRAINS, SUBTAXAS)
|
||||
from mirri.utils import get_country_from_name
|
||||
|
||||
RESTRICTION_USE_TRANSLATOR = {
|
||||
@@ -44,34 +38,12 @@ TRUEFALSE_TRANSLATOR = {
|
||||
|
||||
|
||||
def parse_mirri_excel(fhand, version=""):
|
||||
if version == "20200602":
|
||||
return _parse_mirri_v20200601(fhand)
|
||||
elif version == "12052023":
|
||||
if version == "5.1.2":
|
||||
return _parse_mirri_v12052023(fhand)
|
||||
else:
|
||||
raise NotImplementedError("Only versions 20200601 and 12052023 are implemented")
|
||||
raise NotImplementedError("Only version is 5.1.2 implemented")
|
||||
|
||||
|
||||
def _parse_mirri_v20200601(fhand):
|
||||
fhand.seek(0)
|
||||
file_content = BytesIO(fhand.read())
|
||||
wb = load_workbook(filename=file_content, read_only=True, data_only=True)
|
||||
|
||||
locations = workbook_sheet_reader(wb, LOCATIONS)
|
||||
ontobiotopes = workbook_sheet_reader(wb, ONTOBIOTOPE)
|
||||
|
||||
growth_media = list(parse_growth_media(wb))
|
||||
|
||||
markers = workbook_sheet_reader(wb, GENOMIC_INFO)
|
||||
|
||||
publications = list(parse_publications(wb))
|
||||
|
||||
strains = parse_strains(wb, locations=locations, growth_media=growth_media,
|
||||
markers=markers, publications=publications,
|
||||
ontobiotopes=ontobiotopes)
|
||||
|
||||
return {"strains": strains, "growth_media": growth_media}
|
||||
|
||||
def _parse_mirri_v12052023(fhand):
|
||||
fhand.seek(0)
|
||||
file_content = BytesIO(fhand.read())
|
||||
|
||||
Reference in New Issue
Block a user