Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-4753 - Implement RD Tiering Disable/Enable option by configuration. Not currently working. #820

Merged
merged 11 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/sites/iva/conf/browsers.settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,25 @@ const INTERPRETER_SETTINGS = {
],
},
{
id: "methods"
id: "methods",
items: [
{
type: "SINGLE",
methods: [
{id: "exomiser"},
],
},
{
type: "FAMILY",
methods: [
{id: "exomiser"},
],
},
{
type: "CANCER",
methods: [],
},
],
},
{
id: "variant-browser",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
*/

import {LitElement, html} from "lit";
import UtilsNew from "../../../core/utils-new.js";
import "../../commons/view/detail-tabs.js";
import "../../clinical/analysis/rd-tiering-analysis.js";
import "../../clinical/analysis/exomiser-analysis.js";
import "../../clinical/analysis/hrdetect-analysis.js";

class VariantInterpreterMethods extends LitElement {

Expand All @@ -44,46 +42,36 @@ class VariantInterpreterMethods extends LitElement {
clinicalAnalysisId: {
type: String
},
config: {
type: Object
}
settings: {
type: Object,
},
};
}

_init() {
this._prefix = UtilsNew.randomString(8);
this._config = this.getDefaultConfig();
}

connectedCallback() {
super.connectedCallback();
}

update(changedProperties) {
if (changedProperties.has("opencgaSession")) {
this.opencgaSessionObserver();
}
if (changedProperties.has("clinicalAnalysisId")) {
this.clinicalAnalysisIdObserver();
}
// if (changedProperties.has("clinicalAnalysis")) {
// this.clinicalAnalysisObserver();
// }
super.update(changedProperties);
}

opencgaSessionObserver() {
this._config = this.getDefaultConfig();
this.requestUpdate();
if (changedProperties.has("opencgaSession") || changedProperties.has("clinicalAnalysis") || changedProperties.has("settings")) {
this._config = this.getDefaultConfig();
}

super.update(changedProperties);
}

clinicalAnalysisIdObserver() {
if (this.opencgaSession?.opencgaClient && this.clinicalAnalysisId) {
this.opencgaSession.opencgaClient.clinical()
.info(this.clinicalAnalysisId, {study: this.opencgaSession.study.fqn})
.info(this.clinicalAnalysisId, {
study: this.opencgaSession.study.fqn,
})
.then(response => {
this.clinicalAnalysis = response.responses[0].results[0];
// this.requestUpdate();
})
.catch(response => {
console.error("An error occurred fetching clinicalAnalysis: ", response);
Expand All @@ -92,12 +80,23 @@ class VariantInterpreterMethods extends LitElement {
}

render() {
// Check Project exists
if (!this.opencgaSession.project) {
if (!this.opencgaSession?.project) {
return html`
<div>
<h3><i class="fas fa-lock"></i> No public projects available to browse. Please login to continue</h3>
</div>`;
</div>
`;
}

// If no methods have been configured, we will display a warning message
if (!this._config || this._config.items.length === 0) {
return html`
<div class="col-md-6 col-md-offset-3" style="padding: 20px">
<div class="alert alert-warning" role="alert">
No automatic methods available at this time.
</div>
</div>
`;
}

return html`
Expand All @@ -112,79 +111,54 @@ class VariantInterpreterMethods extends LitElement {
getDefaultConfig() {
const items = [];

if (this.clinicalAnalysis) {
const probandId = this.clinicalAnalysis.proband.id;

if (this.clinicalAnalysis.type.toUpperCase() === "SINGLE") {
items.push({
id: "exomiser",
name: "Exomiser",
render: (clinicalAnalysis, active, opencgaSession) => {
return html`
<div class="col-md-6 col-md-offset-3">
<tool-header title="Exomiser - ${probandId}" class="bg-white"></tool-header>
<exomiser-analysis
.toolParams="${{clinicalAnalysis: clinicalAnalysis.id}}"
.opencgaSession="${opencgaSession}"
.title="${""}">
</exomiser-analysis>
</div>
`;
},
});
}

if (this.clinicalAnalysis.type.toUpperCase() === "FAMILY") {
items.push({
id: "exomiser",
name: "Exomiser",
active: true,
render: (clinicalAnalysis, active, opencgaSession) => {
return html`
<div class="col-md-6 col-md-offset-3">
<tool-header title="Exomiser - ${probandId}" class="bg-white"></tool-header>
<exomiser-analysis
.toolParams="${{clinicalAnalysis: clinicalAnalysis.id}}"
.opencgaSession="${opencgaSession}"
.title="${""}">
</exomiser-analysis>
</div>
`;
},
});
items.push({
id: "rd-tiering",
name: "RD Tiering",
render: (clinicalAnalysis, active, opencgaSession) => {
return html`
<div class="col-md-6 col-md-offset-3">
<tool-header title="RD Tiering - ${probandId}" class="bg-white"></tool-header>
<rd-tiering-analysis
.toolParams="${{clinicalAnalysis: clinicalAnalysis.id, panels: clinicalAnalysis.panels?.map(panel => panel.id).join(",")}}"
.opencgaSession="${opencgaSession}"
.title="${""}">
</rd-tiering-analysis>
</div>
`;
},
});
}

if (this.clinicalAnalysis.type.toUpperCase() === "CANCER") {
items.push({
id: "",
name: "Cancer Analysis",
render: (clinicalAnalysis, active, opencgaSession) => {
return html`
<div class="col-md-6 col-md-offset-3" style="padding: 20px">
<div class="alert alert-warning" role="alert">
No automatic methods available for cancer analysis at this time.
if (this.clinicalAnalysis && this.settings) {
const probandId = this.clinicalAnalysis.proband?.id || "";
const type = this.clinicalAnalysis.type?.toUpperCase() || "";
const caseConfig = (this.settings.items || []).find(item => item.type === type);

(caseConfig?.methods || []).forEach(method => {
if (method.id === "exomiser") {
items.push({
id: "exomiser",
name: "Exomiser",
render: (clinicalAnalysis, active, opencgaSession) => {
return html`
<div class="col-md-6 col-md-offset-3">
<tool-header title="Exomiser - ${probandId}" class="bg-white"></tool-header>
<exomiser-analysis
.toolParams="${{clinicalAnalysis: clinicalAnalysis.id}}"
.opencgaSession="${opencgaSession}"
.title="${""}">
</exomiser-analysis>
</div>
</div>
`;
},
});
}
`;
},
});
}

if (method.id === "rd-tiering" || method.id === "rdtiering") {
items.push({
id: "rd-tiering",
name: "RD Tiering",
render: (clinicalAnalysis, active, opencgaSession) => {
const toolParams = {
clinicalAnalysis: clinicalAnalysis.id,
panels: clinicalAnalysis.panels?.map(panel => panel.id).join(","),
};
return html`
<div class="col-md-6 col-md-offset-3">
<tool-header title="RD Tiering - ${probandId}" class="bg-white"></tool-header>
<rd-tiering-analysis
.toolParams="${toolParams}"
.opencgaSession="${opencgaSession}"
.title="${""}">
</rd-tiering-analysis>
</div>
`;
},
});
}
});
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,9 @@ class VariantInterpreter extends LitElement {
-->
</div>
<div>
<!-- Controls aligned to the LEFT -->
<div class="row hi-icon-wrap wizard hi-icon-animation variant-interpreter-wizard">
${this._config?.tools?.map(item => html`
${!item.hidden ? html`
${(typeof item.visible === "undefined" || !!item.visible) ? html`
<a class="icon-wrapper variant-interpreter-step ${!this.clinicalAnalysis && item.id !== "select" || item.disabled ? "disabled" : ""} ${this.activeTab[item.id] ? "active" : ""}"
href="javascript: void 0" data-view="${item.id}"
@click="${this.onClickSection}">
Expand Down Expand Up @@ -480,7 +479,7 @@ class VariantInterpreter extends LitElement {
<variant-interpreter-methods
.opencgaSession="${this.opencgaSession}"
.clinicalAnalysis="${this.clinicalAnalysis}"
.config="${this._config}">
.settings="${this._config.tools.find(tool => tool.id === "methods")}">
</variant-interpreter-methods>
</div>
` : null}
Expand Down
Loading