Commit cb803fbd authored by Francisco Arcila Salamanca's avatar Francisco Arcila Salamanca
Browse files

fix ontology look-up that failed with empty values

parent 81a92183
......@@ -450,25 +450,20 @@ def format_id_val_ontologies(meta_dict: dict, ontologies_dic: dict) -> None:
if ontologies_dic[x]["preferred_label"] == 1
}
missing = [
(x, meta_dict[x])
for x in meta_dict
if meta_dict[x] not in preferred_labels
and x in validate_airr_dic
and "Ontology" in validate_airr_dic[x]["Format"]
]
if missing:
logger.warning(f"WARNING {missing} not in ontologies table")
fix_ontos = {missing[0]: {"id": {}, "label": {}}}
# for x in missing}
fix_ontos = {}
else:
fix_ontos = {
x: {"id": meta_dict[x], "label": preferred_labels[meta_dict[x]]}
for x in meta_dict
if x in validate_airr_dic and "Ontology" in validate_airr_dic[x]["Format"]
}
for x in meta_dict:
if x in validate_airr_dic and "Ontology" in validate_airr_dic[x]["Format"]:
if meta_dict[x] not in preferred_labels:
logger.warning(f"WARNING {x} not in ontologies table")
fix_ontos[x] = {"id": None, "label": None}
elif meta_dict[x] in preferred_labels:
fix_ontos[x] = {
"id": meta_dict[x],
"label": preferred_labels[meta_dict[x]],
}
else:
print(x)
for x in meta_dict:
if x in fix_ontos:
......@@ -584,14 +579,21 @@ def process_repertoires(
else repertoire_dic[rep][x]
for x in repertoire_dic[rep]
}
list_reps.append(
sr.dump_repertoire(
format_id_val_ontologies(repertoire_dic[rep], replace_ontos)
)
rept = sr.dump_repertoire(
format_id_val_ontologies(repertoire_dic[rep], replace_ontos)
)
list_reps.append(rept)
essential_validation(repertoire_dic[rep], rep)
import airr
try:
airr.RepertoireSchema.validate_object(rept)
except airr.ValidationError as e:
print("has repertoire at array position with validation error: %s\n" % e)
repertoires_dic = {"Repertoire": list_reps}
return repertoires_dic
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment