From 286fed10f6a223248dce546af26d82be5aa82462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Loraine=20Gu=C3=A9guen?= <loraine-gueguen@users.noreply.github.com> Date: Tue, 1 Jun 2021 12:14:17 +0200 Subject: [PATCH] fix get picture --- utilities.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/utilities.py b/utilities.py index 547a169..b928b4c 100755 --- a/utilities.py +++ b/utilities.py @@ -145,11 +145,10 @@ def get_sp_picture(sp_dict_list): genus_species = get_gspecies_string_from_sp_dict(sp) + # no picture stored yet for this genus_species if genus_species not in sp_picture_dict.keys() \ - or (genus_species not in sp_picture_dict.keys() - and sp_picture_dict[genus_species] != "") \ - or (constants.ORG_PARAM_DESC_MAIN_SPECIES in sp[constants.ORG_PARAM_DESC].keys() - and sp[constants.ORG_PARAM_DESC][constants.ORG_PARAM_DESC_MAIN_SPECIES] == True ) : + or (genus_species in sp_picture_dict.keys() + and sp_picture_dict[genus_species] == ""): if constants.ORG_PARAM_DESC_PICTURE_PATH in sp[constants.ORG_PARAM_DESC].keys() and \ sp[constants.ORG_PARAM_DESC][constants.ORG_PARAM_DESC_PICTURE_PATH] != "": @@ -157,6 +156,14 @@ def get_sp_picture(sp_dict_list): else: sp_picture_dict[genus_species] = "" + # overwrite stored picture if a picture exists for the main strain + if (constants.ORG_PARAM_DESC_MAIN_SPECIES in sp[constants.ORG_PARAM_DESC].keys() + and sp[constants.ORG_PARAM_DESC][constants.ORG_PARAM_DESC_MAIN_SPECIES] == True )\ + and (constants.ORG_PARAM_DESC_PICTURE_PATH in sp[constants.ORG_PARAM_DESC].keys() + and sp[constants.ORG_PARAM_DESC][constants.ORG_PARAM_DESC_PICTURE_PATH] != ""): + + sp_picture_dict[genus_species] = sp[constants.ORG_PARAM_DESC][constants.ORG_PARAM_DESC_PICTURE_PATH] + return sp_picture_dict def get_sp_jbrowse_links(org_list): -- GitLab