From 3f07318cc21296fcf1008424af4acdbe6072a12d Mon Sep 17 00:00:00 2001 From: BasLee Date: Thu, 31 Aug 2023 16:49:07 +0200 Subject: [PATCH] Add json prop for custom patient view sample type colors (#10336) --- .../mskcc/cbio/portal/util/GlobalProperties.java | 14 ++++++++++++++ .../customization/portal.properties-Reference.md | 13 +++++++++++++ portal/src/main/webapp/config_service.jsp | 2 ++ 3 files changed, 29 insertions(+) diff --git a/core/src/main/java/org/mskcc/cbio/portal/util/GlobalProperties.java b/core/src/main/java/org/mskcc/cbio/portal/util/GlobalProperties.java index 88fbcf4a8ef..18209811460 100644 --- a/core/src/main/java/org/mskcc/cbio/portal/util/GlobalProperties.java +++ b/core/src/main/java/org/mskcc/cbio/portal/util/GlobalProperties.java @@ -183,6 +183,12 @@ public void setOncoprintClinicalTracksConfigJson(String property) { oncoprintClinicalTracksConfigJson = property; } + private static String skinPatientViewCustomSampleTypeColorsJson; + @Value("${skin.patient_view.custom_sample_type_colors_json:}") // default is empty string + public void setSkinPatientViewCustomSampleTypeColorsJson(String property) { + skinPatientViewCustomSampleTypeColorsJson = property; + } + // properties for showing the right logo in the header_bar and default logo public static final String SKIN_RIGHT_LOGO = "skin.right_logo"; @@ -1257,6 +1263,14 @@ public static String getOncoprintClinicalTracksConfigJson() { } } + public static String getSkinPatientViewCustomSampleTypeColorsJson() { + if (skinPatientViewCustomSampleTypeColorsJson.length() > 0) { + return readFile(skinPatientViewCustomSampleTypeColorsJson); + } else { + return null; + } + } + public static String getQuerySetsOfGenes() { String fileName = portalProperties.getProperty(SETSOFGENES_LOCATION, null); return readFile(fileName); diff --git a/docs/deployment/customization/portal.properties-Reference.md b/docs/deployment/customization/portal.properties-Reference.md index 07dc145b1e7..bff32c60fb6 100644 --- a/docs/deployment/customization/portal.properties-Reference.md +++ b/docs/deployment/customization/portal.properties-Reference.md @@ -225,6 +225,19 @@ skin.patient_view.copy_number_table.columns.show_on_init= skin.patient_view.structural_variant_table.columns.show_on_init= ``` +### Define custom sample type colors +Define the colors of custom sample types in the patient view using a json object with for each sample type a color: +``` +skin.patient_view.custom_sample_type_colors_json=classpath:/skin-patient-view-custom-sample-type-colors.json +``` +Example of json file contents: +```json +{ + "Primary": "green", + "Biopsy 3": "#00c040ff" +} +``` + ### Choose the display name for authenticated users By default the display name for authenticated users is email, but it can be changed for the user name: diff --git a/portal/src/main/webapp/config_service.jsp b/portal/src/main/webapp/config_service.jsp index 1fe5079ae3a..495bce3e1f5 100644 --- a/portal/src/main/webapp/config_service.jsp +++ b/portal/src/main/webapp/config_service.jsp @@ -185,6 +185,8 @@ obj.put("oncoprint_clinical_tracks_config_json",GlobalProperties.getOncoprintClinicalTracksConfigJson()); + obj.put("skin_patient_view_custom_sample_type_colors_json", GlobalProperties.getSkinPatientViewCustomSampleTypeColorsJson()); + obj.put("authenticationMethod",GlobalProperties.authenticationMethod()); obj.put("mskWholeSlideViewerToken", GlobalProperties.getMskWholeSlideViewerToken());