diff --git a/seal/schedulers.py b/seal/schedulers.py index 08b0e84..49fbd8d 100644 --- a/seal/schedulers.py +++ b/seal/schedulers.py @@ -449,7 +449,7 @@ def importvcf(): app.logger.error(f'Path does not exist for : {vcf_path}') path_locker.unlink() return - + status_final = False if "add_caller" in data and data["add_caller"] == True: sample = get_sample(data) if not sample: @@ -457,6 +457,7 @@ def importvcf(): path_locker.unlink() return msg = "Add new caller" + status_final = sample.status else: sample = create_sample(data) msg = "Import Sample" @@ -493,7 +494,8 @@ def importvcf(): app.logger.info("------ END VEP ------") except CommandFailedError as e: app.logger.info(f"{type(e).__name__} : {e}") - sample.status = -1 + if not status_final: + sample.status = -1 path_locker.unlink() db.session.commit() error_file = current_file.with_suffix('.error') @@ -678,7 +680,8 @@ def importvcf(): date=datetime.now(), action=f"Sample Imported") db.session.add(history) - sample.status = 1 + if not status_final: + sample.status = status db.session.commit() diff --git a/seal/static/seal/analysis/sample.js b/seal/static/seal/analysis/sample.js index 51bba43..feb2822 100644 --- a/seal/static/seal/analysis/sample.js +++ b/seal/static/seal/analysis/sample.js @@ -360,7 +360,6 @@ function BaseConditionsFilterSelect(values_options, condition="==", sort=true) { } if (sort) { options.sort((a, b) => { - console.log(a.val()) if (a.val().toLowerCase() < b.val().toLowerCase()) { return -1; } else if (a.val().toLowerCase() > b.val().toLowerCase()) { @@ -408,14 +407,6 @@ function BaseConditionsFilterSelect(values_options, condition="==", sort=true) { case "isTrue": conditionName = "Is True"; search = function (value) { - console.log("t"); - console.log((value === false || - value === "false" || - value === "0" || - value === null || - value === undefined || - value === "" || - (typeof value === 'number' && isNaN(value)))) return value === true || value === "true" || value === "1" || @@ -426,14 +417,6 @@ function BaseConditionsFilterSelect(values_options, condition="==", sort=true) { case "isFalse": conditionName = "Is False"; search = function (value) { - console.log("f"); - console.log((value === false || - value === "false" || - value === "0" || - value === null || - value === undefined || - value === "" || - (typeof value === 'number' && isNaN(value)))) return value === false || value === "false" || value === "0" || diff --git a/seal/templates/analysis/sample.html b/seal/templates/analysis/sample.html index b872f55..cca0563 100644 --- a/seal/templates/analysis/sample.html +++ b/seal/templates/analysis/sample.html @@ -548,6 +548,9 @@

Comments ()

data: "annotations", myTitleFn: (data) => formatNA(data.SYMBOL), renderConfig: { + default: (data) => { + return data.SYMBOL + }, display: (data) => { return data.SYMBOL == null ? "NA" @@ -560,44 +563,45 @@

Comments ()

// Nomenclature Column createColumn({ id: "visible-Nomenclature", - data: "annotations", + data: null, className: 'w3-border-right', myTitleFn: (data) => { - if (data == null) return "NA"; + if (data.annotations == null) return "NA"; - let response = data.preferred ? " (selected)" : ""; - response += data.canonical ? " (canonical)" : ""; + let response = data.annotations.preferred ? " (selected)" : ""; + response += data.annotations.canonical ? " (canonical)" : ""; - const HGVSg = formatNA(data.HGVSg, "NA"); - const HGVSc = formatNA(data.HGVSc, "NA"); - const HGVSp = formatNA(data.HGVSp, "NA"); + const HGVSg = formatNA(data.annotations.HGVSg, "NA"); + const HGVSc = formatNA(data.annotations.HGVSc, "NA"); + const HGVSp = formatNA(data.annotations.HGVSp, "NA"); return `${HGVSg}\n${HGVSc}${response}\n${HGVSp}`; }, renderConfig: { display: (data) => { - if (data == null) return "NA"; - const mobidetails = (current_user_api_key_md !== "None") ? ` + if (data.annotations == null) return "NA"; + const genome = "{{ genome_version }}".toLowerCase() == "grch38" ? "hg38" : "hg19"; + const mobidetails = (current_user_api_key_md !== "None") ? ` MD
` : ""; - const genebe = ` + const genebe = ` GB
`; - const franklin = ` + const franklin = ` F `; - const color = data.preferred ? "w3-text-flat-peter-river" : ""; - const starIcon = data.canonical + const color = data.annotations.preferred ? "w3-text-flat-peter-river" : ""; + const starIcon = data.annotations.canonical ? `` : ``; @@ -607,9 +611,9 @@

Comments ()

${starIcon}
-

${formatNA(data.HGVSg, "NA")}

-

${formatNA(data.HGVSc, "NA")}

-

${formatNA(data.HGVSp, "NA")}

+

${formatNA(data.annotations.HGVSg, "NA")}

+

${formatNA(data.annotations.HGVSc, "NA")}

+

${formatNA(data.annotations.HGVSp, "NA")}

${mobidetails}${genebe}${franklin} @@ -618,9 +622,9 @@

Comments ()

`; }, sort: (data) => { - if (!data || !data.HGVSg) return -1; + if (!data.annotations || !data.annotations.HGVSg) return -1; - const matches = data.HGVSg.match(/(chr|cen|pter|qter|sup)?([0-9XYMt]+):[gmno]\.([0-9]+)(_[0-9]+)?([ACGT]+>)?(dup|ins|del|inv|[ACGT]+)?/); + const matches = data.annotations.HGVSg.match(/(chr|cen|pter|qter|sup)?([0-9XYMt]+):[gmno]\.([0-9]+)(_[0-9]+)?([ACGT]+>)?(dup|ins|del|inv|[ACGT]+)?/); if (!matches) return -1; const zero = "000000000"; @@ -896,10 +900,6 @@

Comments ()

const clinvar = data.clinvar || {}; const phenotypes = data.phenotypes || {}; const star = (clinvar.CLNREVSTAT == null) ? 0 : clinvar_stars[clinvar.CLNREVSTAT]; - if(clinvar.CLNREVSTAT == null){ - console.log(`${clinvar_stars[clinvar.CLNREVSTAT]} - ${clinvar.CLNREVSTAT}`) - } - let stat = ''; if (clinvar.CLNREVSTAT) { stat = ` (${star}/4)`; @@ -951,7 +951,6 @@

Comments ()

color = "peter-river"; colorHover = "belize-hole"; if (/pathogenic|establish/i.test(clinvar.CLNSIGCONF)) { - console.log(clinvar.CLNREVSTAT) color = "carrot"; colorHover = "pumpkin"; } @@ -1474,25 +1473,28 @@

Comments ()

}), createColumn({ id: "export-filter-clinvar_revstat", - data: "clinvar.CLNSIG", + data: null, searchBuilderTitle:"ClinVar", visible: false, type: "clinvar", renderConfig: { default: (data) => { - const clinvar = data || {}; + const clinvar = data.clinvar || {}; let value = "2 - NA"; - if (clinvar) { - if (/benign/i.test(clinvar)) value = "0 - Benign/Likely Benign"; - else if (/uncertain/i.test(clinvar)) value = "3 - Uncertain significance"; - else if (/pathogenic|establish/i.test(clinvar)) value = "5 - Pathogenic/Likely Pathogenic"; - else if (/conflicting/i.test(clinvar)) { - value = "1 - Conflicting (without Pathogenic)"; - if (/pathogenic|establish/i.test(clinvar)) { - value = "4 - Conflicting (with Pathogenic)"; + if (clinvar.CLNSIG) { + if (/benign/i.test(clinvar.CLNSIG)) { + value = "0 - Benign/Likely Benign" + } else if (/uncertain/i.test(clinvar.CLNSIG)) { + value = "3 - Uncertain significance" + } else if (/conflicting/i.test(clinvar.CLNSIG)) { + value = "1 - Conflicting (without Pathogenic)" + if (/pathogenic|establish/i.test(clinvar.CLNSIGCONF)) { + value = "4 - Conflicting (with Pathogenic)" } - } + } else if (/pathogenic|establish/i.test(clinvar.CLNSIG)) { + value = "5 - Pathogenic/Likely Pathogenic" + } } return value; }, @@ -1539,16 +1541,16 @@

Comments ()

}), createColumn({ id: "export-filter-MES", - data: "annotations", + data: null, searchBuilderTitle:"Prediction - MaxEntScan", visible: false, renderConfig: { default: (data, type) => { - const alt = parseFloat(data.MaxEntScan_alt || 0).toFixed(2); - const ref = parseFloat(data.MaxEntScan_ref || 0).toFixed(2); + const alt = parseFloat(data.annotations.MaxEntScan_alt || 0).toFixed(2); + const ref = parseFloat(data.annotations.MaxEntScan_ref || 0).toFixed(2); const mes_var = (((alt - ref) / Math.abs(ref)) * 100).toFixed(2); d = isNaN(parseFloat(mes_var)) ? null: parseFloat(mes_var).toFixed(2); - return type === 'export' && d=== null? '' : data; + return type === 'export' && d=== null? '' : Math.abs(d); }, } }), @@ -1560,7 +1562,7 @@

Comments ()

renderConfig: { default: (data, type) => { d = isNaN(parseFloat(data)) ? null: parseFloat(data).toFixed(2); - return type === 'export' && d=== null? '' : data; + return type === 'export' && d=== null? '' : d; }, } }), @@ -1572,8 +1574,7 @@

Comments ()

renderConfig: { default: (data, type) => { d = isNaN(parseFloat(data)) ? null: parseFloat(data).toFixed(2); - return type === 'export' && d=== null? '' : data; - return isNaN(parseFloat(data)) ? null: parseFloat(data).toFixed(2); + return type === 'export' && d=== null? '' : d; }, } }), @@ -1658,7 +1659,7 @@

Comments ()

return `[${family.filter}] ${af} (${family.allelic_depth}/${family.depth})`; }, } - }) + }), {% endfor %} ];