Skip to content

Commit

Permalink
improved classify page and cspec brca assays annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinDo committed Dec 15, 2024
1 parent 45293e3 commit 713fb00
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 17 deletions.
4 changes: 2 additions & 2 deletions resources/backups/database_dumper/dump_database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ then
echo $DATE > $SCRIPTPATH/most_recent_dump.txt
fi

if [ "${WEBAPP_ENV}" == "prod" ]
if [ "${WEBAPP_ENV}" == "prod" ] || [ "${WEBAPP_ENV}" == "demo" ]
then
dump_path=$SCRIPTPATH/prod
dump_path=$SCRIPTPATH/$WEBAPP_ENV
mkdir -p $dump_path
dump_name=production-dump-$DATE.sql

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def get_autoclass_json(self, variant_id, conn: Connection) -> str:
minigene = assay.get_metadata_value("minigene", "False") == "True"
patient_rna = assay.get_metadata_value("patient_rna", "False") == "True"
allelic = assay.get_metadata_value("allele_specific", "False")
quantification = functions.percent_to_decimal(assay.metadata.get("minimal_percentage", None))
quantification = functions.percent_to_decimal(assay.get_metadata_value("minimal_percentage", None))
all_splicing_assays.append({"minigene": minigene,
"patient_rna": patient_rna,
"allelic": allelic,
Expand Down
8 changes: 7 additions & 1 deletion src/frontend_celery/webapp/static/css/colors.css
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,13 @@ input[type=checkbox]:checked + label.btn-ba {
background-color: #000d58;
}


/*
input {
appearance: unset;
-webkit-appearance: unset;
-moz-appearance: unset;
}
*/

.btn-check:disabled + label.acmg-button {
color: rgb(170, 170, 170);
Expand Down
47 changes: 42 additions & 5 deletions src/frontend_celery/webapp/static/js/classify.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ $(document).ready(function() {
});

add_default_for_important_information()
hide_important_information_heading()
});


Expand All @@ -342,8 +343,10 @@ function add_default_for_important_information() {
$(this).append(default_empty)
}
})

}


// update global scheme field variable
function update_scheme_field_variable() {
scheme = $('#scheme').val()
Expand Down Expand Up @@ -427,10 +430,12 @@ function set_user_selection_counts(scheme) {
var selected_criteria = scheme_with_info['criteria'] ?? [] // propagate the above
for (var i in selected_criteria) {
var criterium = selected_criteria[i]
var criterium_id = criterium['name']
var count_label = document.getElementById('users_selected_' + criterium_id)
count_label.innerText = parseInt(count_label.innerText) + 1
count_label.hidden = false;
if (criterium["state"] == "selected") {
var criterium_id = criterium['name']
var count_label = document.getElementById('users_selected_' + criterium_id)
count_label.innerText = parseInt(count_label.innerText) + 1
count_label.hidden = false;
}
}
}
}
Expand Down Expand Up @@ -459,8 +464,28 @@ function preselect_criteria_from_database(scheme) {
if (typeof current_scheme_with_info !== "undefined") { // only preselect if there is data for it
selected_criteria = current_scheme_with_info['scheme']['criteria']
preselect_criteria_from_list(selected_criteria)
remove_criterium_button_backgrounds()
}
}

function remove_criterium_button_backgrounds() {
$(".acmg-button").each(function() {
var criterium_label = this
var all_btn_classes = []
for (var i = 0; i < criterium_label.classList.length; i++) {
var current_class = criterium_label.classList[i]
if (current_class.indexOf("btn-") >= 0) {
all_btn_classes.push(current_class)
//criterium_label.classList.remove(current_class)
//criterium_label.classList.toggle(current_class)
}
}
all_btn_classes.pop()

all_btn_classes.forEach(css_class => {
criterium_label.classList.remove(css_class)
});
})
}

function preselect_criteria_from_list(selected_criteria, is_intermediate = false) {
Expand All @@ -478,6 +503,8 @@ function preselect_criteria_from_list(selected_criteria, is_intermediate = false
set_criterium(criterium_id, state, is_intermediate)
}
}


}


Expand Down Expand Up @@ -629,6 +656,12 @@ function hide_all_information() {
})
}

function hide_important_information_heading() {
if ($("#important_information_container").find("visually_hidden").length > 0) {
document.getElementById('important_information_heading').classList.remove('visually_hidden')
}
}

function revert_strength_selects() {
var all_buttons = document.querySelectorAll('.btn-check')
for (var i = 0; i < all_buttons.length; i++) {
Expand Down Expand Up @@ -1204,6 +1237,7 @@ function copy_evidence(obj) {

select_criterium_check.value = state
set_criterium(criterium_id, state, is_intermediate = true)
update_classification_preview()
}

function add_user_acmg_classification_details(criterium_id) {
Expand Down Expand Up @@ -1568,14 +1602,17 @@ function set_criterium(criterium_id, state, is_intermediate = false) {

state_check.value = state

console.log("set_criterium: " + criterium_id + " to state: " + state)
console.log("set_criterium: " + criterium_id + " to state: " + state + " with strength: " + strength_check.value)

update_criterium_button_label(criterium_id)
//remove_criterium_button_background(criterium_id)
update_criterium_button_background(criterium_id)

if (!(['unchecked', 'unselected'].includes(previous_state) && ['unchecked', 'unselected'].includes(state))) {
update_mutual_criteria(criterium_id)
}


}


Expand Down
4 changes: 2 additions & 2 deletions src/frontend_celery/webapp/static/js/variant_addition.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ function show_heredicare_upload_status(color_class, summary, inner_text) {
const pill_holder_id = "heredicare_status_pill_holder"
const pill_id = "heredicare_status_pill"
var prepend_html = null
if (summary["needs_upload"] && ["error", "api_error", "success", "requested", "multiple stati"].includes(summary["status"])) {

if (summary["needs_upload"] && ["error", "api_error", "success", "requested", "multiple stati", "unknown"].includes(summary["status"])) {
prepend_html = create_exclamation_mark()
add_tooltip(prepend_html, "The consensus classification needs to be uploaded to HerediCaRe!")
}
Expand Down
10 changes: 10 additions & 0 deletions src/frontend_celery/webapp/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,19 @@ <h4>Changelog</h4>

<div class="underline">v 1.14.5 ()</div>
<div>
General changes:
<ul>
<li>Removed "Important Information" heading on classify page if there is no important information to show</li>
<li>CSpecBRCA splicing assay quantification is now the sum of percent abberant transcript. It was the minimal value previously.</li>
<li>CSpecBRCA splicing assay quantification is now explicitly set to 0 if the assay is minigene or patient RNA and the result is "no abberation" which is not ignored</li>
<li>Consensus classify count labels now only count criteria which were selected and ignore unselected criteria</li>
</ul>
Bugfixes:
<ul>
<li>Fixed a bug where assay annotations would not be considered for automatic classification</li>
<li>Fixed a bug which was causing criteria buttons to show the default color after page reload even though the strength was non-default. This problem only existed in Firefox.</li>
<li>When copying evidence on the consensus classify page, the classifcation preview would not update</li>
<li>Needs HerediCaRe upload for consensus classifications was not showing when there was no HerediCaRe submission</li>
</ul>
</div>

Expand Down
4 changes: 2 additions & 2 deletions src/frontend_celery/webapp/templates/variant/classify.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ <h4 class="sst">Description:</h4>
<div id="additional_content" class="sst"></div>
<h4 class="bst">Evidence:</h4>
<textarea type="text" id="criteria_evidence" class="form-control sst" placeholder="insert evidence..."></textarea>
<h4 class="bst">Important information</h4>
<div>
<h4 id="important_information_heading" class="bst visually_hidden">Important information</h4>
<div id="important_information_container">
<div class="sst important_information" id="splicing_info">
<h5>Splicing</h5>
{% set current_annotations = variant.annotations.get_group('Splicing') %}
Expand Down
14 changes: 10 additions & 4 deletions tools/db_converter_CSpec_splicing_assays.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
percent_aberrant_transcript = parts[13]
allele_specific = parts[14]
comment = parts[15]
result = parts[9]


transcript = gene2transcript[gene]
Expand All @@ -74,17 +75,22 @@
for percentage in re.findall(r'[\d]+[.,\d]+|[\d]*[.][\d]+|[\d]+', percentage):
percentage = float(percentage)
all_percentages_curated.append(percentage)
minimal_percentage = ""
quantification = ""
if len(all_percentages_curated) > 0:
minimal_percentage = str(min(all_percentages_curated))
quantification = str(sum(all_percentages_curated))
else: # add quantification 0% if not stated
if minigene == "Y" or patient_rna == "Y":
if result == "no aberration" and comment != "Result ignored (design limitations to detect aberration)":
quantification = "0"


splicing_assay = [functions.encode_vcf(patient_rna),
functions.encode_vcf(minigene),
functions.encode_vcf(minimal_percentage),
functions.encode_vcf(quantification),
functions.encode_vcf(allele_specific),
functions.encode_vcf(comment),
functions.encode_vcf("https://pubmed.ncbi.nlm.nih.gov/" + pmid)]
functions.encode_vcf("https://pubmed.ncbi.nlm.nih.gov/" + pmid),
functions.encode_vcf(result)]
splicing_assay = "|".join(splicing_assay)

csv_line_parts = [transcript,
Expand Down

0 comments on commit 713fb00

Please sign in to comment.