Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Commit

Permalink
Add partner choice to frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Wöste committed Feb 5, 2018
1 parent b0ed85a commit dedf3d4
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 10 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion public/viper/igv-image/igv-image.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
along with VIPER. If not, see <http://www.gnu.org/licenses/>.
-->
<h3>Breakpoint:
<h3>Inspecting:
<small>
{{ igvImageController.sample }},
{{ igvImageController.chr }}
Expand Down
25 changes: 24 additions & 1 deletion public/viper/pages/inspector/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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 () {
Expand All @@ -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 = [];

Expand Down
30 changes: 27 additions & 3 deletions public/viper/pages/inspector/inspector.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,33 @@ <h3 class="variant-well-header">variants: {{ inspectorCtrl.tableSize }}</h3>

<br>

<div ng-if="inspectorCtrl.getCurrentPartners().length > 0">

<strong>Select sample to inspect:</strong>

<br>

<div class="radio">
<label>
<input type="radio" ng-model="inspectorCtrl.selectedSample" value="{{ inspectorCtrl.getCurrentVariantSample() }}">
{{ inspectorCtrl.getCurrentVariantSample() }}
<small><em>called</em></small>
</label>
</div>

<div class="radio" ng-repeat="partnerSample in inspectorCtrl.getCurrentPartners()">
<label>
<input type="radio" ng-model="inspectorCtrl.selectedSample" value="{{ partnerSample }}">
{{ partnerSample }}
<small><em>partner</em></small>
</label>
</div>

</div>

<div ng-if="inspectorCtrl.relatedVariants.length > 1">

<strong>Select related call to inspect:</strong>
<strong>Select related call in group to inspect:</strong>

<rzslider
rz-slider-model="inspectorCtrl.relatedCallIndex"
Expand Down Expand Up @@ -196,7 +220,7 @@ <h4>Visualization settings</h4>

<div class="col-md-6">
<igv-image
sample="inspectorCtrl.relatedVariants[inspectorCtrl.relatedCallIndex]['sample']"
sample="inspectorCtrl.selectedSample"
chr="inspectorCtrl.relatedVariants[inspectorCtrl.relatedCallIndex]['chr1']"
pos="inspectorCtrl.relatedVariants[inspectorCtrl.relatedCallIndex]['bp1']"
igv-configuration-hash="inspectorCtrl.configurationHash">
Expand All @@ -205,7 +229,7 @@ <h4>Visualization settings</h4>

<div class="col-md-6">
<igv-image
sample="inspectorCtrl.relatedVariants[inspectorCtrl.relatedCallIndex]['sample']"
sample="inspectorCtrl.selectedSample"
chr="inspectorCtrl.relatedVariants[inspectorCtrl.relatedCallIndex]['chr2']"
pos="inspectorCtrl.relatedVariants[inspectorCtrl.relatedCallIndex]['bp2']"
igv-configuration-hash="inspectorCtrl.configurationHash">
Expand Down
5 changes: 5 additions & 0 deletions public/viper/variant-table/VariantTableService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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", {}, {
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/de/imi/marw/viper/api/routes/SnapshotRoutes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> relatedPartners = this.partners.getPartners(sample);

for (String partner : relatedPartners) {

this.igv.scheduleSnapshot(partner, chr1, bp1, isCurrentSnapshot);
this.igv.scheduleSnapshot(partner, chr2, bp2, isCurrentSnapshot);

}

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private SamplePartners(Map<String, List<String>> samplePartnerMap) {
}

public Map<String, List<String>> getMap() {
return Collections.unmodifiableMap(samplePartnerMap);
return Collections.unmodifiableMap(this.samplePartnerMap);
}

public List<String> getPartners(String sample) {
Expand Down

0 comments on commit dedf3d4

Please sign in to comment.