Skip to content

Commit

Permalink
Finalized calculation of VCF numeric field series as averaged
Browse files Browse the repository at this point in the history
... rather than cumulated, as it used to be.
  • Loading branch information
GuilhemSempere committed Jul 23, 2024
1 parent 41e3f0b commit 780843a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/webapp/js/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,11 @@ function buildCustomisationDiv(chartInfo) {
let fieldName = jsonResult[key];
if (i == 0)
vcfMetadataSelectionHTML += '<div class="col-md-3" id="vcfFieldPlots"><p align="center">Additional series based on VCF genotype metadata:</p>';
vcfMetadataSelectionHTML += '<div><input id="chartVCFSeries_' + fieldName + '" type="checkbox" style="margin-top:0;" class="showHideSeriesBox" onchange="displayOrHideSeries(\'' + fieldName + '\', this.checked, ' + (i + chartTypes.get(currentChartType).series.length) + ')"> <label style="font-weight:normal;" for="chartVCFSeries_' + fieldName + '">Cumulated ' + fieldName + ' data</label></div>';
vcfMetadataSelectionHTML += '<div><input id="chartVCFSeries_' + fieldName + '" type="checkbox" style="margin-top:0;" class="showHideSeriesBox" onchange="displayOrHideSeries(\'' + fieldName + '\', this.checked, ' + (i + chartTypes.get(currentChartType).series.length) + ')"> <label style="font-weight:normal;" for="chartVCFSeries_' + fieldName + '">Average ' + fieldName + ' data</label></div>';
i++;
}
if (i > 0)
vcfMetadataSelectionHTML += '<div>(cumulated for selected individuals, averaged on #variants per interval)</div></div>';
vcfMetadataSelectionHTML += '</div>';

},
error: function (xhr, ajaxOptions, thrownError) {
Expand Down Expand Up @@ -754,14 +754,14 @@ function addMetadataSeries(minPos, maxPos, fieldName, colorIndex) {
chart.addAxis({ // Secondary yAxis
id: fieldName,
title: {
text: "Cumulated " + fieldName
text: "Average " + fieldName
},
lineWidth: 3,
lineColor: colorTab[colorIndex],
opposite: true,
});
chart.addSeries({
name: fieldName,
name: "Average " + fieldName,
type: 'spline',
lineWidth: 1,
color: colorTab[colorIndex],
Expand Down Expand Up @@ -889,7 +889,7 @@ function displayOrHideSeries(fieldName, isChecked, colorIndex) {
if (chart === null)
return;

if (isChecked && $("select#plotGroupingMetadataValues").val() == null) {
if (isChecked && $("select#plotGroupingMetadataValues").is(":visible") && $("select#plotGroupingMetadataValues").val() == null) {
alert("You must select some individuals to show this series");
$("input#chartVCFSeries_" + fieldName).prop("checked", false);
return;
Expand Down Expand Up @@ -983,6 +983,7 @@ function updateAvailableGroups() {
selectOptions += '<option value="' + value + '">' + value + '</option>';
});
groupSelect.html(selectOptions);
$("select#plotGroupingMetadataValues").find('option').prop('selected', true);
groupSelect.change();
}
});
Expand Down

0 comments on commit 780843a

Please sign in to comment.