From dedf3d44649be37bfddb3abc8d4fe7ddaa993f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20W=C3=B6ste?= Date: Fri, 2 Feb 2018 17:43:47 +0100 Subject: [PATCH] Add partner choice to frontend --- README.md | 6 ++-- public/viper/igv-image/igv-image.tpl.html | 2 +- public/viper/pages/inspector/controller.js | 25 +++++++++++++++- public/viper/pages/inspector/inspector.html | 30 +++++++++++++++++-- .../variant-table/VariantTableService.js | 5 ++++ .../marw/viper/api/routes/SnapshotRoutes.java | 15 ++++++++-- .../viper/visualization/SamplePartners.java | 2 +- 7 files changed, 75 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 661f4c3..f9a5164 100644 --- a/README.md +++ b/README.md @@ -42,19 +42,21 @@ These parameters are optional and may be omitted using the default values: | *breakpointTolerance* | If grouping is enabled, this is the maximum distance where two breakpoints are considered similar. | `3` | | *csvDelimiter* | Character that delimits csv columns. | `";"` | | *collectionDelimiter* | A single cell in a csv table may have multiple values. These values are seperated by this character. |`","` | +| *partnerFile* | CSV file containing partnering information (i.e., control-tumor pairs, trios). When used, VIPER offers to inspect the partner samples as well as the sample the respective variant was called in. | `null` | +| *partnerDelimiter* | Delimiter used when reading partnering information. | `","` | | *viperPort* | Port that VIPER listens on. | `8090` | | *igvPort* | Port that IGV uses to communicate with VIPER | `9090` | +| *fastaRef* | `.fasta` reference file or IGV reference key (e.g. `hg19`). Set to a `.fasta` file for improved performance.| `"hg19"` | +| *numPrecomputedSnapshots* | Precompute this number of breakpoint images to minimize visualization waiting time. | `10` | | *keepVcfSimple* | Use only mandatory vcf columns and ignore additional INFO and genotype information | `false` | | *excludeRefVcfCalls* | Ignore calls that are marked as reference calls. | `true` | *igvJar* | Path to IGV jar file. | `"igv.jar"`| -| *numPrecomputedSnapshots* | Precompute this number of breakpoint images to minimize visualization waiting time. | `10` | | *xvfbDisplay* | When using `Xvfb`, use this number as display number. | `1234` | | *xvfbWidth* | When using `Xvfb`, create a window with this width. | `1280` | | *xvfbHeight* | When using `Xvfb`, create a window with this height. | `1680` | | *igvMaxMemory* | Maximum heap size of the IGV process. | `1200` | | *xslxExportWindowSize* | When creating `.xlsx` files, this improves memory usage. Only change if exceptions occur during `.xlsx` export. | `1000` | | *igvLog* | File containing IGV logs | `igv.log` | -| *fastaRef* | `.fasta` reference file or IGV reference key (e.g. `hg19`). Set to a `.fasta` file for improved performance.| ## Examples diff --git a/public/viper/igv-image/igv-image.tpl.html b/public/viper/igv-image/igv-image.tpl.html index d647aa7..ac32f17 100644 --- a/public/viper/igv-image/igv-image.tpl.html +++ b/public/viper/igv-image/igv-image.tpl.html @@ -18,7 +18,7 @@ along with VIPER. If not, see . --> -

Breakpoint: +

Inspecting: {{ igvImageController.sample }}, {{ igvImageController.chr }} diff --git a/public/viper/pages/inspector/controller.js b/public/viper/pages/inspector/controller.js index 49f1d97..0f85b59 100644 --- a/public/viper/pages/inspector/controller.js +++ b/public/viper/pages/inspector/controller.js @@ -30,11 +30,14 @@ var module = angular.module('de.imi.marw.viper.inspector', [ Ctrl.index = null; Ctrl.relatedCallIndex = null; Ctrl.currentVariant = null; + Ctrl.selectedSample = null; Ctrl.relatedVariants = [ ]; Ctrl.columnNames = [ ]; Ctrl.init = init; Ctrl.onIndexChange = onIndexChange; + Ctrl.getCurrentPartners = getCurrentPartners; + Ctrl.getCurrentVariantSample = getCurrentVariantSample; Ctrl.variantPropertyToString = VariantTableService.variantPropertyToString; Ctrl.sendDecision = sendDecision; Ctrl.changeIGVSetting = changeIGVSetting; @@ -46,17 +49,20 @@ var module = angular.module('de.imi.marw.viper.inspector', [ VariantTableService.getSize(), VariantTableService.getRelatedColumnNames(), VariantTableService.getIGVConfiguration(), - VariantTableService.getIGVConfigurationHash() + VariantTableService.getIGVConfigurationHash(), + VariantTableService.getPartnerMap() ]).then(function (data) { var tableSize = data[0]; var columnNames = data[1]; var configuration = data[2]; var configurationHash = data[3]; + var partnerMap = data[4] Ctrl.tableSize = tableSize; Ctrl.index = VariantTableService.currentVariantIndex; Ctrl.columnNames = columnNames; + Ctrl.partnerMap = partnerMap; Ctrl.configuration = configuration; Ctrl.configurationHash = configurationHash; @@ -80,6 +86,21 @@ var module = angular.module('de.imi.marw.viper.inspector', [ }); } + function getCurrentVariantSample() { + + if (Ctrl.relatedVariants == null || Ctrl.relatedCallIndex == null) return null; + + return Ctrl.relatedVariants[Ctrl.relatedCallIndex].sample + + } + + function getCurrentPartners() { + + if (Ctrl.partnerMap == null) return null; + + return Ctrl.partnerMap[Ctrl.getCurrentVariantSample()] || []; + } + function sendDecision (decision) { var promise = VariantTableService.sendDecision(Ctrl.index, decision); @@ -94,6 +115,7 @@ var module = angular.module('de.imi.marw.viper.inspector', [ function onRelatedCallIndexChange (sliderId, modelValue) { VariantTableService.scheduleSnapshot(Ctrl.index, modelValue); + Ctrl.selectedSample = Ctrl.relatedVariants[modelValue].sample; } function onIndexChange () { @@ -109,6 +131,7 @@ var module = angular.module('de.imi.marw.viper.inspector', [ ]).then(function (data) { Ctrl.currentVariant = data[0]; Ctrl.relatedVariants = data[1]; + Ctrl.selectedSample = Ctrl.relatedVariants[0].sample; var samples = []; diff --git a/public/viper/pages/inspector/inspector.html b/public/viper/pages/inspector/inspector.html index b91fec4..3911d63 100644 --- a/public/viper/pages/inspector/inspector.html +++ b/public/viper/pages/inspector/inspector.html @@ -50,9 +50,33 @@

variants: {{ inspectorCtrl.tableSize }}


+
+ + Select sample to inspect: + +
+ +
+ +
+ +
+ +
+ +
+
- Select related call to inspect: + Select related call in group to inspect: Visualization settings

@@ -205,7 +229,7 @@

Visualization settings

diff --git a/public/viper/variant-table/VariantTableService.js b/public/viper/variant-table/VariantTableService.js index abfb797..d908c60 100644 --- a/public/viper/variant-table/VariantTableService.js +++ b/public/viper/variant-table/VariantTableService.js @@ -39,6 +39,7 @@ var module = angular.module('de.imi.marw.viper.variant-table.service', [ Service.getTableRange = getTableRange; Service.getTableRow = getTableRow; Service.getUnfilteredSize = getUnfilteredSize; + Service.getPartnerMap = getPartnerMap; Service.saveProgress = saveProgress; Service.scheduleSnapshot = scheduleSnapshot; Service.searchStringColumn = searchStringColumn @@ -140,6 +141,10 @@ var module = angular.module('de.imi.marw.viper.variant-table.service', [ return promise; } + function getPartnerMap() { + return performRequest("/api/snapshots/partners"); + } + function scheduleSnapshot(index, relatedCallIndex) { var promise = $http.post("/api/snapshots/take-snapshot", {}, { diff --git a/src/main/java/de/imi/marw/viper/api/routes/SnapshotRoutes.java b/src/main/java/de/imi/marw/viper/api/routes/SnapshotRoutes.java index 13d461f..dc0a1da 100644 --- a/src/main/java/de/imi/marw/viper/api/routes/SnapshotRoutes.java +++ b/src/main/java/de/imi/marw/viper/api/routes/SnapshotRoutes.java @@ -129,8 +129,19 @@ private Object takeSnapshot(Request req, Response res) { int bp1 = ((Double) relatedCall.get(VariantTable.BP1_COLUMN_NAME)).intValue(); int bp2 = ((Double) relatedCall.get(VariantTable.BP2_COLUMN_NAME)).intValue(); - this.igv.scheduleSnapshot(sample, chr1, bp1, i == queryIndex && j == selectedRelatedCall); - this.igv.scheduleSnapshot(sample, chr2, bp2, i == queryIndex && j == selectedRelatedCall); + boolean isCurrentSnapshot = i == queryIndex && j == selectedRelatedCall; + + this.igv.scheduleSnapshot(sample, chr1, bp1, isCurrentSnapshot); + this.igv.scheduleSnapshot(sample, chr2, bp2, isCurrentSnapshot); + + List relatedPartners = this.partners.getPartners(sample); + + for (String partner : relatedPartners) { + + this.igv.scheduleSnapshot(partner, chr1, bp1, isCurrentSnapshot); + this.igv.scheduleSnapshot(partner, chr2, bp2, isCurrentSnapshot); + + } } } diff --git a/src/main/java/de/imi/marw/viper/visualization/SamplePartners.java b/src/main/java/de/imi/marw/viper/visualization/SamplePartners.java index 5f1d7a7..c1dc60c 100644 --- a/src/main/java/de/imi/marw/viper/visualization/SamplePartners.java +++ b/src/main/java/de/imi/marw/viper/visualization/SamplePartners.java @@ -55,7 +55,7 @@ private SamplePartners(Map> samplePartnerMap) { } public Map> getMap() { - return Collections.unmodifiableMap(samplePartnerMap); + return Collections.unmodifiableMap(this.samplePartnerMap); } public List getPartners(String sample) {