Skip to content

Commit

Permalink
Bugfix when pulling phenotypes from more than one individual.
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Mar 30, 2021
1 parent 92d6a6c commit 74df5c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
3 changes: 1 addition & 2 deletions variants/sync_upstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _isa_helper_get_term_field(fields, key):
lst.append(value.name)
elif ontology_name:
lst.append(value.name)
else:
elif value.name or value.accession or value.ontology_name:
lst.append(str(value))
return lst

Expand Down Expand Up @@ -208,7 +208,6 @@ def fetch_remote_pedigree(source, project, add_log_entry=_nolog):
)
add_log_entry("new member: %s" % member)
remote_pedigree[material.name] = member

return remote_pedigree


Expand Down
30 changes: 13 additions & 17 deletions variants/templates/variants/case_update_terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,37 +100,33 @@ <h3>Update Terms for Case {{ object.name }}</h3>
$("#load-upstream-indicator").toggleClass("fa-cloud-download fa-spinner fa-spin");
btn.data("state", "loading");
// Perform AJAX call.
let ajaxCall = $.ajax({
$.ajax({
type: "GET",
dataType: "json",
url: "{% url "variants:case-fetch-upstream-terms" project=project.sodar_uuid case=object.sodar_uuid %}",
success: function (result) {
console.log("SUCCESS")
console.log(result);
let lines = [];
$.each(result, function (index, value) {
console.log("index " + index);
const sampleIds = Object.keys(result)
for (let index = 0; index < sampleIds.length; index++) {
const value = result[sampleIds[index]]
if (lines.length > 0) {
lines.push("")
} else {
lines.push("### " + index + " ###");
lines.push("");
let keys = ["hpo_terms", "omim_diseases", "orphanet_diseases"];
for (let i = 0; i < keys.length; ++i) {
for (let j = 0; j < value[keys[i]].length; ++j) {
let term = value[keys[i]][j];
lines.push(term.id + " - " + (term.description || "UNKNOWN TERM"));
}
}
lines.push("### " + value.name + " ###");
lines.push("");
const keys = ["hpo_terms", "omim_diseases", "orphanet_diseases"];
for (let i = 0; i < keys.length; ++i) {
for (let j = 0; j < value[keys[i]].length; ++j) {
let term = value[keys[i]][j];
lines.push(term.id + " - " + (term.description || "UNKNOWN TERM"));
}
}
});
}
$("#load-upstream-indicator").toggleClass("fa-cloud-download fa-spinner fa-spin");
btn.data("state", "initial");
$("#upstream-terms").val(lines.join("\n"))
},
error: function (jqXHR, textStatus, errorThrown) {
console.log("ERROR")
console.log(result);
$("#upstream-terms").val("ERROR\n\nA problem occured while trying to query SODAR: " + textStatus + "\n\nERROR")
$("#load-upstream-indicator").toggleClass("fa-cloud-download fa-spinner fa-spin");
btn.data("state", "initial");
Expand Down

0 comments on commit 74df5c1

Please sign in to comment.