'
- ## yay python 2.7
- ro = fileinput.input(output_file, inplace=True, backup=".bak")
- for roline in ro:
- print(roline.replace(to_find, to_replace), end='')
- ro.close()
-
- return
-
-
-if __name__ == "__main__":
- parser = ArgumentParser(
- prog="csOverview",
- description="Generate an overview plot of crossSample results.")
-
- parser.add_argument(
- '-i',
- dest="input_file",
- required=True,
- help="File location for the summary statistics from CrossSample.")
-
- parser.add_argument(
- '-I',
- dest="input_mfi",
- required=True,
- help="File location for the MFI summary statistics from CrossSample.")
-
- parser.add_argument(
- '-s',
- dest="cs_outputs",
- required=True,
- action='append',
- help="File location for the CrossSample output files.")
-
- parser.add_argument(
- '-o',
- dest="output_file",
- required=True,
- help="File location for the HTML output file.")
-
- parser.add_argument(
- '-m',
- dest="mfi",
- required=True,
- help="File location for the MFI from FLOCK.")
-
- parser.add_argument(
- '-d',
- dest="output_directory",
- required=True,
- help="Directory location for the html supporting files.")
-
- parser.add_argument(
- '-t',
- dest="tool_directory",
- required=True,
- help="Location of the Tool Directory.")
-
- args = parser.parse_args()
-
- cs_files = [f for f in args.cs_outputs]
- cs_overview(args.input_file, args.input_mfi, args.mfi, args.output_file, args.output_directory, args.tool_directory, cs_files)
- sys.exit(0)
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/crossSampleOverview.xml
--- a/cs_overview/crossSampleOverview.xml Mon Feb 27 12:48:54 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-
- of the CrossSample analysis
-
- jinja2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/flowtools/css/parallelCoordinates.css
--- a/cs_overview/static/flowtools/css/parallelCoordinates.css Mon Feb 27 12:48:54 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*Chart*/
-.chartDiv {
- margin-top: 10px;
- margin-bottom: 10px;
- margin-left: 10px;
- margin-right: 10px;
- background-color: #ffffff;
-}
-/*This for stacked / bar plot*/
-.optionButtons{
- padding-bottom: 8px;
-}
-.igbtn {
- border-radius: 4px;
- color: white;
- background-color: #0E3163;
- border:1px;
- font-size: 14px;
- font-weight: bold;
- border-color: #0E3163;
- padding: 6px 12px;
- background: -webkit-linear-gradient(#0E3163, #3e6db0);
- background: -o-linear-gradient(#0E3163, #3e6db0);
- background: -moz-linear-gradient(#0E3163, #3e6db0);
- background: linear-gradient(#0E3163, #3e6db0);
-}
- #togglePlot {
- display: block;
- margin-left: auto;
- margin-right: auto;
- height: 60px;
- width: 90px;
- padding: 4px 8px 8px 4px;
-}
-/*DataTables config*/
-div.dt-buttons {
- float: right;
-}
-th {
- background-color:#3965A4;
- color:#fff;
- border-radius: 2px;
- padding:6px 12px;
- font-size:14px;
- text-align: center;
-}
-.igtable th {
- background: -webkit-linear-gradient(#0E3163, #3e6db0);
- background: -o-linear-gradient(#0E3163, #3e6db0);
- background: -moz-linear-gradient(#0E3163, #3e6db0);
- background: linear-gradient(#0E3163, #3e6db0)
-}
-body td {
- max-width: 50px;
- font-size: 14px;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-.pctable td {
- max-width: 100px;
-}
-.dtable td {
- max-width: 50px;
- word-break: break-all;
- word-wrap: break-word;
-}
-.popt thead {
- display:none;
-}
-.popt td {
- max-width: 40px;
- word-break: break-all;
- word-wrap: break-word;
-}
-div.dataTables_wrapper {
- width: 95%;
- margin: 0 auto;
-}
-/*Opacity widget*/
-.widget {
- margin-top: 4px;
- padding: 4px 4px 8px 4px;
- margin-bottom: 10px
- height: 36px;
- line-height: 12px;
- font-size: 12px;
- text-align: center;
- // float: right;
-}
-/*This section for coordinates plot*/
-.table th {
- text-align: center;
- padding: 10px;
-}
-.table {
- width:100%;
- border:0px solid;
- border-collapse:collapse;
- text-align:center;
- font-size: 14px;
-}
-svg {
- font: 10px sans-serif;
-}
-.background path {
- fill: none;
- stroke: #F0F0F0;
- shape-rendering: crispEdges;
-}
-.foreground path {
- fill: none;
- stroke-opacity: .8;
-}
-.brush .extent {
- fill-opacity: .3;
- stroke: #fff;
- shape-rendering: crispEdges;
-}
-.axis line,
-.axis path {
- fill: none;
- stroke: #000;
- stroke-width: 2;
- shape-rendering: crispEdges;
-}
-.axis text {
- text-shadow: 0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff;
-}
-.xlabel {
- font-size: 14px;
- fill: #808080;
-}
-.ylabel {
- font-size: 16px;
- fill: #808080;
-}
-/*This section for boxplots*/
-.box {
- font: 10px sans-serif;
-}
-.box line,
-.box rect,
-.box circle {
- fill: red;
- stroke: #000;
- stroke-width: 1px;
-}
-.box .center {
- stroke-dasharray: 3,3;
-}
-.box .outlier {
- fill: none;
- stroke: #000;
-}
-.axisbp path,
-.axisbp line {
- stroke-width: 1px;
- fill:
-}
-.y.axisbp path {
- stroke-width: 2;
- stroke: #000;
- fill: none;
-}
-.x.axisbp path {
- fill: none;
- stroke: #C8C8C8;
- stroke-width: 0px;
- shape-rendering: crispEdges;
-}
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/flowtools/js/boxplots.js
--- a/cs_overview/static/flowtools/js/boxplots.js Mon Feb 27 12:48:54 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,608 +0,0 @@
-// Copyright (c) 2016 Northrop Grumman.
-// All rights reserved.
-
-var displayMarkerTable = function(plotconfig){
- var nbm = plotconfig.mrkrNames.length + 1;
- $(plotconfig.mtable).empty();
- plotconfig.allMarkers.map(function(v) {
- $(plotconfig.mtable).append('
'
- + ' | '
- + ''
- + plotconfig.mrkrNames[v] + ' | '
- + ' |
');
- });
- if (nbm > 5) {
- $(plotconfig.mrkrSelectAll).prop('checked', false);
- $(plotconfig.mrkrSelectAll).prop('disabled', true);
- $('#markerWarning').show();
- $(plotconfig.mrkrSelectj).each(function() {
- var selectedMrkr = parseInt(this.value);
- if (selectedMrkr > 4){
- this.checked = false;
- this.disabled = true;
- } else {
- this.checked = true;
- }
- });
- }
-
- $(plotconfig.mrkrSelectAll).click(function() {
- var checkAll = $(plotconfig.mrkrSelectAll).prop('checked');
- if (checkAll) {
- $(plotconfig.mrkrSelectj).prop("checked", true);
- } else {
- $(plotconfig.mrkrSelectj).prop("checked", false);
- }
- updateCSplots(plotconfig);
- });
-
- $(plotconfig.mrkrSelectj).click(function() {
- if (nbm < 6){
- if ($(plotconfig.mrkrSelectj).length == $(plotconfig.mrkrSelectCheck).length) {
- $(plotconfig.mrkrSelectAll).prop("checked",true);
- } else {
- $(plotconfig.mrkrSelectAll).prop("checked",false);
- }
- } else {
- var nbSelected = 0;
- $(plotconfig.mrkrSelectj).each(function() {
- if (this.checked) {nbSelected++}
- });
- if (nbSelected < 5) {
- $(plotconfig.mrkrSelectj).prop('disabled', false);
- } else {
- $(plotconfig.mrkrSelectj).each(function() {
- if (!this.checked) {
- this.disabled = true;
- }
- });
- }
- }
- updateCSplots(plotconfig);
- });
-};
-
-var updateBoxplot = function(plotconfig){
- var margin = {top: 30, right: 10, bottom: 50, left: 60},
- h = 0,
- w = 0,
- width = 0,
- height = 0,
- labels = false, // show the text labels beside individual boxplots?
- mfi_option = false,
- min = Infinity,
- max = -Infinity,
- checkLabels = $(plotconfig.displayvalues).prop("checked"),
- checkMFI = $(plotconfig.displayMFI).prop("checked"),
- dataToPlot = [],
- tmp = [],
- nbm = plotconfig.mrkrNames.length + 1,
- maxRange = 0,
- minRange = 0,
- domainx = [],
- domainx1 = [];
-
- $(plotconfig.plotdivj).empty();
- h = $(window).height() - 200;
- $(plotconfig.plotdivj).height(h);
- w = $(plotconfig.plotdivj).width();
- width = w - margin.left - margin.right;
- height = h - margin.top - margin.bottom;
-
- var svg = d3.select(plotconfig.plotdivj).append("svg")
- .attr("width", w)
- .attr("height", h)
- .attr("class", "box")
- .append("g")
- .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
-
- if (checkLabels) {
- labels = true;
- };
- if (checkMFI) {
- mfi_option = true;
- };
- /* Get the data in proper shape to feed to the boxplot function
- want [Object, Object, ..., Object] where Object:
- 'population': pop
- 'Data' : [Object, Object, ..., Object] where Object:
- 'Marker' : marker name
- 'outliers' : outliers
- */
-
- if (plotconfig.view == 'p') {
- plotconfig.selectedPopulations.forEach(function(p) {
- tmpPlot = [];
- plotconfig.selectedMarkers.forEach(function(m) {
- var markernm = plotconfig.mrkrNames[m],
- qtmp = [
- +plotconfig.csdata.q1[markernm][p],
- +plotconfig.csdata.q2[markernm][p],
- +plotconfig.csdata.q3[markernm][p]
- ],
- wtmp = [
- +plotconfig.csdata.lower[markernm][p],
- +plotconfig.csdata.upper[markernm][p]
- ];
- tmp = [];
- // Get min and max while we're here
- plotconfig.csdata.outliers[markernm][p].forEach(function(outl) {
- tmp.push(+outl);
- if (+outl > max) {max = +outl};
- if (+outl < min) {min = +outl};
- });
- if (+plotconfig.csdata.upper[markernm][p] > max) {
- max = +plotconfig.csdata.upper[markernm][p];
- };
- if (+plotconfig.csdata.lower[markernm][p] < min) {
- min = +plotconfig.csdata.lower[markernm][p];
- };
- tmpPlot.push({
- marker: markernm,
- outliers: tmp,
- quartiles: qtmp,
- whiskers: wtmp,
- config: [m,p, nbm],
- mfi: +plotconfig.csdata.mfi[markernm][p]
- });
- });
- dataToPlot.push({population:p, popdata: tmpPlot});
- });
- } else {
- plotconfig.selectedMarkers.forEach(function(m) {
- var markernm = plotconfig.mrkrNames[m];
- tmpPlot = [];
- plotconfig.selectedPopulations.forEach(function(p) {
- var qtmp = [
- +plotconfig.csdata.q1[markernm][p],
- +plotconfig.csdata.q2[markernm][p],
- +plotconfig.csdata.q3[markernm][p]
- ],
- wtmp = [
- +plotconfig.csdata.lower[markernm][p],
- +plotconfig.csdata.upper[markernm][p]
- ];
- tmp = [];
- // Get min and max while we're here
- plotconfig.csdata.outliers[markernm][p].forEach(function(outl) {
- tmp.push(+outl);
- if (+outl > max) {max = +outl};
- if (+outl < min) {min = +outl};
- });
- if (+plotconfig.csdata.upper[markernm][p] > max) {
- max = +plotconfig.csdata.upper[markernm][p];
- };
- if (+plotconfig.csdata.lower[markernm][p] < min) {
- min = +plotconfig.csdata.lower[markernm][p];
- };
- tmpPlot.push({
- population:p,
- outliers: tmp,
- quartiles: qtmp,
- whiskers: wtmp,
- config: [m,p, nbm],
- mfi: +plotconfig.csdata.mfi[markernm][p]
- });
- });
- dataToPlot.push({marker: markernm, popdata: tmpPlot});
- });
- };
- maxRange = max + 30;
- minRange = min - 30;
-
- if (plotconfig.view == 'p') {
- domainx = plotconfig.selectedPopulations;
- domainx1 = plotconfig.selectedMarkers.map(function(d){
- return plotconfig.mrkrNames[d];
- });
- } else {
- domainx1 = plotconfig.selectedPopulations;
- domainx = plotconfig.selectedMarkers.map(function(d){
- return plotconfig.mrkrNames[d];
- });
- }
- // axes
- var xScale = d3.scale.ordinal()
- .domain(domainx)
- .rangeRoundBands([0 , width], 0.2, 0.02);
-
- var x1Scale = d3.scale.ordinal()
- .domain(domainx1)
- .rangeRoundBands([0, xScale.rangeBand()], 0.1);
-
- var xAxis = d3.svg.axis()
- .scale(xScale)
- .orient("bottom");
-
- // the y-axis
- var yScale = d3.scale.linear()
- .domain([minRange, maxRange])
- .range([height + margin.top, 0 + margin.top]);
-
- var yAxis = d3.svg.axis()
- .scale(yScale)
- .orient("left")
- .tickFormat(d3.format("d"));
-
- svg.append("g")
- .attr("class", "x axisbp")
- .attr("transform", "translate(0," + (height + margin.top) + ")")
- .call(xAxis);
-
- svg.append("g")
- .attr("class", "y axisbp")
- .call(yAxis)
- .append("text")
- .attr("class", "ylabel")
- .attr("transform", "rotate(-90)")
- .attr("y", 0 - margin.left)
- .attr("x", 0 - (height / 2))
- .attr("dy", "1em")
- .style("text-anchor", "middle")
- .text("MFI values");
-
- var boxplot = d3.box()
- .width(x1Scale.rangeBand())
- .height(height + margin.top)
- .domain([minRange, maxRange])
- .showLabels(labels)
- .showMFI(mfi_option);
-
- if (plotconfig.view == 'p'){
- var group = svg.selectAll(".groups")
- .data(dataToPlot)
- .enter().append("g")
- .attr("class", "group")
- .attr("transform", function(d) {
- return "translate(" + xScale(d.population) + ",0)";
- });
-
- group.selectAll(".box")
- .data(function(d) { return d.popdata; })
- .enter().append("g")
- .attr("transform", function(d) {return "translate(" + x1Scale(d.marker) + ",0)"; })
- .call(boxplot);
- } else {
- var group = svg.selectAll(".groups")
- .data(dataToPlot)
- .enter().append("g")
- .attr("class", "group")
- .attr("transform", function(d) {
- return "translate(" + xScale(d.marker) + ",0)";
- });
-
- group.selectAll(".box")
- .data(function(d) { return d.popdata; })
- .enter().append("g")
- .attr("transform", function(d) { return "translate(" + x1Scale(d.population) + ",0)"; })
- .call(boxplot);
- }
-};
-
-(function() {
- // Inspired by http://informationandvisualization.de/blog/box-plot
- // Modified to fit our data structure.
- d3.box = function() {
- var width = 1,
- height = 1,
- duration = 0,
- domain = null,
- value = Number,
- showLabels = true, // whether or not to show text labels
- numBars = 4,
- curBar = 1,
- showMFI = true, // display MFI ?
- tickFormat = null,
- margin = {top: 30, right: 10, bottom: 50, left: 60};
-
- // For each small multiple…
- function box(g) {
- g.each(function(data, i) {
- var d = data.outliers.sort(d3.ascending),
- g = d3.select(this),
- n = d.length,
- min = Infinity,
- max = -Infinity;
- if (n > 0){
- min = d[0],
- max = d[n - 1];
- }
- // Readjust min and max with upper and lower values
- if (data.whiskers[0] < min) {min = data.whiskers[0]}
- if (data.whiskers[1] > max) {max = data.whiskers[1]}
- // Compute quartiles. Must return exactly 3 elements.
- var quartileData = data.quartiles;
- // Compute whiskers. Must return exactly 2 elements, or null.
- var whiskerData = data.whiskers;
- // Compute outliers. here all data in d is an outlier.
- // We compute the outliers as indices, so that we can join across transitions!
- var outlierIndices = d3.range(n);
- var mfiData = data.mfi;
- // this is the scale for ONE SET of values
- // Compute the new x-scale.
- var x1 = d3.scale.linear()
- .domain(domain && domain.call(this, d, i) || [min, max])
- .range([height , 0 + margin.top ]);
- // Retrieve the old x-scale, if this is an update.
- var x0 = this.__chart__ || d3.scale.linear()
- .domain([0, Infinity])
- .range(x1.range());
-
- // Stash the new scale.
- this.__chart__ = x1;
-// Note: the box, median, and box tick elements are fixed in number,
-// so we only have to handle enter and update. In contrast, the outliers
-// and other elements are variable, so we need to exit them! Variable
-// elements also fade in and out.
- // Update center line: the vertical line spanning the whiskers.
- var center = g.selectAll("line.center")
- .data(whiskerData ? [whiskerData] : []);
-
- //vertical line
- center.enter().insert("line", "rect")
- .attr("class", "center")
- .attr("x1", width / 2)
- .attr("y1", function(d) { return x0(d[0]); })
- .attr("x2", width / 2)
- .attr("y2", function(d) { return x0(d[1]); })
- .style("opacity", 1e-6)
- .style("stroke", function(d) { return color_palette[0][data.config[1]][3]; })
- .transition()
- .duration(duration)
- .style("opacity", 1)
- .attr("y1", function(d) { return x1(d[0]); })
- .attr("y2", function(d) { return x1(d[1]); });
-
- center.transition()
- .duration(duration)
- .style("opacity", 1)
- .attr("y1", function(d) { return x1(d[0]); })
- .attr("y2", function(d) { return x1(d[1]); });
-
- center.exit().transition()
- .duration(duration)
- .style("opacity", 1e-6)
- .attr("y1", function(d) { return x1(d[0]); })
- .attr("y2", function(d) { return x1(d[1]); })
- .remove();
-
- // Update innerquartile box.
- var box = g.selectAll("rect.box")
- .data([quartileData]);
-
- box.enter().append("rect")
- .attr("class", "box")
- .style("fill", function(d) {
- var nbm = data.config[2],
- pop = data.config[1],
- mrkr = data.config[0];
- var color = color_palette[0][pop][1] + (mrkr + 1 )/ nbm + ')';
- return color; })
- .style("stroke", function(d) { return color_palette[0][data.config[1]][3]; })
- .attr("x", 0)
- .attr("y", function(d) { return x0(d[2]); })
- .attr("width", width)
- .attr("height", function(d) { return x0(d[0]) - x0(d[2]); })
- .transition()
- .duration(duration)
- .attr("y", function(d) { return x1(d[2]); })
- .attr("height", function(d) { return x1(d[0]) - x1(d[2]); });
-
- box.transition()
- .duration(duration)
- .attr("y", function(d) { return x1(d[2]); })
- .attr("height", function(d) { return x1(d[0]) - x1(d[2]); });
-
- // Update median line.
- var medianLine = g.selectAll("line.median")
- .data([quartileData[1]]);
-
- medianLine.enter().append("line")
- .attr("class", "median")
- .attr("x1", 0)
- .attr("y1", x0)
- .attr("x2", width)
- .attr("y2", x0)
- .style("stroke", function(d) { return color_palette[0][data.config[1]][3]; })
- .transition()
- .duration(duration)
- .attr("y1", x1)
- .attr("y2", x1);
-
- medianLine.transition()
- .duration(duration)
- .attr("y1", x1)
- .attr("y2", x1);
-
- // Update MFI line.
- var MFILine = g.selectAll("line.mfi")
- .data([mfiData]);
- if (showMFI == true) {
- MFILine.enter().append("line")
- .attr("class", "mfi")
- .style("stroke", function(d){ return color_palette[0][data.config[1]][2]; })
- .attr("x1", 0)
- .attr("y1", x0)
- .attr("x2", width)
- .attr("y2", x0)
- .transition()
- .duration(duration)
- .attr("y1", x1)
- .attr("y2", x1);
-
- MFILine.transition()
- .duration(duration)
- .attr("y1", x1)
- .attr("y2", x1);
- }
-
- // Update whiskers.
- var whisker = g.selectAll("line.whisker")
- .data(whiskerData || []);
-
- whisker.enter().insert("line", "circle, text")
- .attr("class", "whisker")
- .attr("x1", 0)
- .attr("y1", x0)
- .attr("x2", 0 + width)
- .attr("y2", x0)
- .style("opacity", 1e-6)
- .style("stroke", function(d) { return color_palette[0][data.config[1]][3]; })
- .transition()
- .duration(duration)
- .attr("y1", x1)
- .attr("y2", x1)
- .style("opacity", 1);
-
- whisker.transition()
- .duration(duration)
- .attr("y1", x1)
- .attr("y2", x1)
- .style("opacity", 1);
-
- whisker.exit().transition()
- .duration(duration)
- .attr("y1", x1)
- .attr("y2", x1)
- .style("opacity", 1e-6)
- .remove();
-
- // Update outliers.
- var outlier = g.selectAll("circle.outlier")
- .data(outlierIndices, Number);
-
- outlier.enter().insert("circle", "text")
- .attr("class", "outlier")
- .attr("r", 3)
- .attr("cx", function(d){
- return Math.floor(Math.random() * width);
- })
- .attr("cy", function(i) { return x0(d[i]); })
- .style("opacity", 1e-6)
- .style("fill", function(d) {
- var nbm = data.config[2],
- pop = data.config[1],
- mrkr = data.config[0];
- var color = color_palette[0][pop][1] + (mrkr + 1 )/ nbm + ')';
- return color; })
- .style("stroke", function(d) { return color_palette[0][data.config[1]][3]; })
- .transition()
- .duration(duration)
- .attr("cy", function(i) { return x1(d[i]); })
- .style("opacity", 1);
-
- outlier.transition()
- .duration(duration)
- .attr("cy", function(i) { return x1(d[i]); })
- .style("opacity", 1);
-
- outlier.exit().transition()
- .duration(duration)
- .attr("cy", function(i) { return x1(d[i]); })
- .style("opacity", 1e-6)
- .remove();
-
- // Compute the tick format.
- var format = tickFormat || x1.tickFormat(8);
-
- // Update box ticks.
- var boxTick = g.selectAll("text.box")
- .data(quartileData);
- if(showLabels == true) {
- boxTick.enter().append("text")
- .attr("class", "box")
- .attr("dy", ".3em")
- .attr("dx", function(d, i) { return i & 1 ? 6 : -6 })
- .attr("x", function(d, i) { return i & 1 ? + width : 0 })
- .attr("y", x0)
- .attr("text-anchor", function(d, i) { return i & 1 ? "start" : "end"; })
- .text(format)
- .transition()
- .duration(duration)
- .attr("y", x1);
- }
-
- boxTick.transition()
- .duration(duration)
- .text(format)
- .attr("y", x1);
-
- // Update whisker ticks. These are handled separately from the box
- // ticks because they may or may not exist, and we want don't want
- // to join box ticks pre-transition with whisker ticks post-.
- var whiskerTick = g.selectAll("text.whisker")
- .data(whiskerData || []);
- if(showLabels == true) {
- whiskerTick.enter().append("text")
- .attr("class", "whisker")
- .attr("dy", ".3em")
- .attr("dx", 6)
- .attr("x", width)
- .attr("y", x0)
- .text(format)
- .style("opacity", 1e-6)
- .transition()
- .duration(duration)
- .attr("y", x1)
- .style("opacity", 1);
- }
- whiskerTick.transition()
- .duration(duration)
- .text(format)
- .attr("y", x1)
- .style("opacity", 1);
-
- whiskerTick.exit().transition()
- .duration(duration)
- .attr("y", x1)
- .style("opacity", 1e-6)
- .remove();
- });
- d3.timer.flush();
- }
-
- box.width = function(x) {
- if (!arguments.length) return width;
- width = x;
- return box;
- };
- box.height = function(x) {
- if (!arguments.length) return height;
- height = x;
- return box;
- };
- box.tickFormat = function(x) {
- if (!arguments.length) return tickFormat;
- tickFormat = x;
- return box;
- };
- box.duration = function(x) {
- if (!arguments.length) return duration;
- duration = x;
- return box;
- };
- box.domain = function(x) {
- if (!arguments.length) return domain;
- domain = x == null ? x : d3.functor(x);
- return box;
- };
- box.value = function(x) {
- if (!arguments.length) return value;
- value = x;
- return box;
- };
- box.showLabels = function(x) {
- if (!arguments.length) return showLabels;
- showLabels = x;
- return box;
- };
- box.showMFI = function(x) {
- if (!arguments.length) return showMFI;
- showMFI = x;
- return box;
- };
- return box;
- };
-})();
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/flowtools/js/color_palette.js
--- a/cs_overview/static/flowtools/js/color_palette.js Mon Feb 27 12:48:54 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-// Copyright (c) 2016 Northrop Grumman.
-// All rights reserved.
-
-/* Palettes for graphics.
-* 0 -> Liz's palette (original ImmPort color scheme for graphics)
-* 1 -> Cris's palette (diverging)
-* 2 -> Christmas (diverging)
-* 3 -> not Christmas (sequential color blind friendly)
-* 4 -> Rainbow (sequential)
-* arrays are color HEX, color RGB (for transparency effect), contrasting color, darker shade for borders
-*/
-var color_palette = [[
- ['#000000','rgba(0,0,0,','rgba(52,17,81,1)','#111111'],
- ['#FF0000','rgba(255,0,0,','rgba(52,17,81,1)','#D21111'],
- ['#FFFF00','rgba(255,255,0,','rgba(52,17,81,1)','#FFC900'],
- ['#008000','rgba(0,128,0,','rgba(52,17,81,1)','#016D01'],
- ['#0000FF','rgba(0,0,255,','rgba(255,0,0,1)','#2121A0'],
- ['#FFA500','rgba(255,165,0,','rgba(52,17,81,1)','#DE991B'],
- ['#8A2BE2','rgba(138,43,226,','rgba(52,17,81,1)','#6A0EBF'],
- ['#808000','rgba(128,128,0,','rgba(52,17,81,1)','#66660A'],
- ['#00FFFF','rgba(0,255,255,','rgba(52,17,81,1)','#1DCBCB'],
- ['#FF00FF','rgba(255,0,255,','rgba(52,17,81,1)','#A009A0'],
- ['#00FF00','rgba(0,255,0,','rgba(52,17,81,1)','#20AB20'],
- ['#000080','rgba(0,0,128,','rgba(255,0,0,1)','#13135B'],
- ['#F08080','rgba(240,128,128,','rgba(52,17,81,1)','#922626'],
- ['#800080','rgba(128,0,128,','rgba(255,0,0,1)','#580B58'],
- ['#F0E68C','rgba(240,230,140,','rgba(52,17,81,1)','#F0C08C'],
- ['#8FBC8F','rgba(143,188,143,','rgba(52,17,81,1)','#668166'],
- ['#2F4F4F','rgba(47,79,79,','rgba(52,17,81,1)','#0E3636'],
- ['#008080','rgba(0,128,128,','rgba(52,17,81,1)','#095454'],
- ['#9932CC','rgba(153,50,204,','rgba(52,17,81,1)','#78289F'],
- ['#FF7F50','rgba(255,127,80,','rgba(52,17,81,1)','#B0431A'],
- ['#FFD700','rgba(255,215,0,','rgba(52,17,81,1)','#FFB900'],
- ['#008B8B','rgba(0,139,139,','rgba(52,17,81,1)','#097171'],
- ['#800000','rgba(128,0,0,','rgba(255,0,0,1)','#500303'],
- ['#5F9EA0','rgba(95,158,160,','rgba(52,17,81,1)','#366668'],
- ['#FFC0CB','rgba(255,192,203,','rgba(52,17,81,1)','#FC869B'],
- ['#545454','rgba(84,84,84,','rgba(255,0,0,1)','#342C2C'],
- ['#7FFFD4','rgba(127,255,212,','rgba(255,0,0,1)','#8CCAB5'],
- ['#ADD8E6','rgba(173,216,230,','rgba(52,17,81,1)','#77C6DF'],
- ['#DB7093','rgba(219,112,147,','rgba(52,17,81,1)','#B24B6D'],
- ['#CD853F','rgba(205,133,63,','rgba(52,17,81,1)','#BA6D22'],
- ['#4169E1','rgba(65,105,225,','rgba(52,17,81,1)','#1840B8'],
- ['#708090','rgba(112,128,144,','rgba(52,17,81,1)','#465A6D'],
- ['#4682B4','rgba(70,130,180,','rgba(52,17,81,1)','#1F5785'],
- ['#D8BFD8','rgba(216,191,216,','rgba(52,17,81,1)','#B679B6'],
- ['#F5DEB3','rgba(245,222,179,','rgba(52,17,81,1)','#E9AB3F'],
- ['#9ACD32','rgba(154,205,50,','rgba(52,17,81,1)','#6E971B'],
- ['#BDB76B','rgba(189,183,107,','rgba(52,17,81,1)','#938E49'],
- ['#8B008B','rgba(139,0,139,','rgba(255,0,0,1)','#590A59'],
- ['#556B2F','rgba(85,107,47,','rgba(52,17,81,1)','#3A4D19'],
- ['#00CED1','rgba(0,206,209,','rgba(52,17,81,1)','#1BA0A2'],
- ['#FF1493','rgba(255,20,147,','rgba(52,17,81,1)','#A40F5F']
-],[
- //cris
- ['#000000','rgba(0,0,0,','rgba(52,17,81,1)','#111111'],
- ['#5B1A48','rgba(91,26,72,','rgba(255,0,0,1)','#922B74'],
- ['#1ED992','rgba(30,217,146,','rgba(52,17,81,1)','#108A5B'],
- ['#FFE4FF','rgba(255,228,255,','rgba(52,17,81,1)','#FF9AFF'],
- ['#3B2000','rgba(59,32,0,','rgba(255,0,0,1)','#8C4D02'],
- ['#BDF765','rgba(189,247,101,','rgba(52,17,81,1)','#83b438'],
- ['#C6DCFD','rgba(198,220,253,','rgba(52,17,81,1)','#70A9FE'],
- ['#542788','rgba(84,39,136,','rgba(255,0,0,1)','#8055B2'],
- ['#FB8072','rgba(251,128,114,','rgba(52,17,81,1)','#D55446'],
- ['#F2E0B8','rgba(242,224,184,','rgba(52,17,81,1)','#F9C146'],
- ['#0A684C','rgba(10,104,76,','rgba(52,17,81,1)','#27B88D'],
- ['#FD8ADC','rgba(253,138,220,','rgba(52,17,81,1)','#CB3AA2'],
- ['#CDFAFF','rgba(205,250,255,','rgba(52,17,81,1)','#66EDFC'],
- ['#0C1657','rgba(12,22,87,','rgba(255,0,0,1)','#3243B6'],
- ['#FFDE69','rgba(255,222,105,','rgba(52,17,81,1)','#CFAD34'],
- ['#BEBADA','rgba(190,186,218,','rgba(52,17,81,1)','#6A5EBA'],
- ['#8D182B','rgba(141,24,43,','rgba(52,17,81,1)','#5E0412'],
- ['#FFFF00','rgba(255,255,0,','rgba(52,17,81,1)','#FFC900'],
- ['#788D84','rgba(120,141,132,','rgba(52,17,81,1)','#496F5F'],
- ['#A53DD5','rgba(165,61,213,','rgba(52,17,81,1)','#66178A'],
- ['#5DF33F','rgba(93,243,63,','rgba(52,17,81,1)','#47A035'],
- ['#C8C8C8','rgba(200,200,200,','rgba(52,17,81,1)','#878484'],
- ['#9A1B7D','rgba(154,27,125,','rgba(52,17,81,1)','#D54BB5'],
- ['#1068BD','rgba(16,104,189,','rgba(52,17,81,1)','#0C3156'],
- ['#C7EAE5','rgba(199,234,229,','rgba(52,17,81,1)','#68B8AC'],
- ['#8C510A','rgba(140,81,10,','rgba(52,17,81,1)','#653B07'],
- ['#FFBD01','rgba(255,189,1,','rgba(52,17,81,1)','#CE9800'],
- ['#DFFCC5','rgba(223,252,197,','rgba(52,17,81,1)','#99C670'],
- ['#41C8C4','rgba(65,200,196,','rgba(52,17,81,1)','#24918E'],
- ['#9685F5','rgba(150,133,245,','rgba(52,17,81,1)','#6257A1'],
- ['#D8B365','rgba(216,179,101,','rgba(52,17,81,1)','#9F7E39'],
- ['#00FFFF','rgba(0,255,255,','rgba(52,17,81,1)','#1DCBCB'],
- ['#F1F1A2','rgba(241,241,162,','rgba(52,17,81,1)','#CECE54'],
- ['#AFBFFD','rgba(175,191,253,','rgba(52,17,81,1)','#5E72BF'],
- ['#FF0019','rgba(255,0,25,','rgba(52,17,81,1)','#970110'],
- ['#8A598A','rgba(138,89,138,','rgba(52,17,81,1)','#602E60'],
- ['#75B030','rgba(117,176,48,','rgba(52,17,81,1)','#3D690A'],
- ['#0A5A83','rgba(10,90,131,','rgba(52,17,81,1)','#0F3447'],
- ['#937B6A','rgba(147,123,106,','rgba(52,17,81,1)','#473121'],
- ['#1540EC','rgba(21,64,236,','rgba(255,0,0,1)','#0C2589'],
- ['#010101','rgba(1,1,1,','rgba(255,0,0,1)','#4A4242']
-],[
- //christmas
- ['#000000','rgba(0,0,0,','rgba(52,17,81,1)','#111111'],
- ['#BD1A00','rgba(189,26,0,','rgba(52,17,81,1)','#7B1E0F'],
- ['#FF8F68','rgba(255,143,104,','rgba(52,17,81,1)','#BC4F28'],
- ['#FFFFBF','rgba(255,255,191,','rgba(52,17,81,1)','#EAEA72'],
- ['#1A9850','rgba(26,152,80,','rgba(52,17,81,1)','#0F582F'],
- ['#BDF765','rgba(189,247,101,','rgba(52,17,81,1)','#73B70C'],
- ['#542788','rgba(84,39,136,','rgba(255,0,0,1)','#230941'],
- ['#998EC3','rgba(153,142,195,','rgba(52,17,81,1)','#483884'],
- ['#D8DAEB','rgba(216,218,235,','rgba(52,17,81,1)','#7581E9'],
- ['#5A95B8','rgba(90,149,184,','rgba(52,17,81,1)','#154C6C'],
- ['#01555E','rgba(1,85,94,','rgba(255,0,0,1)','#04272A'],
- ['#FEE0B6','rgba(254,224,182,','rgba(52,17,81,1)','#C8954F'],
- ['#F1A340','rgba(241,163,64,','rgba(52,17,81,1)','#BD7519'],
- ['#B35806','rgba(179,88,6,','rgba(52,17,81,1)','#683303'],
- ['#8D182B','rgba(141,24,43,','rgba(52,17,81,1)','#5B0B18'],
- ['#EF8AB4','rgba(239,138,180,','rgba(52,17,81,1)','#E7337E'],
- ['#C51B7D','rgba(197,27,125,','rgba(52,17,81,1)','#690840'],
- ['#3B2000','rgba(59,32,0,','rgba(255,0,0,1)','#120A00'],
- ['#8C510A','rgba(140,81,10,','rgba(52,17,81,1)','#442907'],
- ['#D8B365','rgba(216,179,101,','rgba(52,17,81,1)','#816426'],
- ['#C7EAE5','rgba(199,234,229,','rgba(52,17,81,1)','#54AB9F'],
- ['#41B6C4','rgba(65,182,196,','rgba(52,17,81,1)','#167D89'],
- ['#225EA8','rgba(34,94,168,','rgba(52,17,81,1)','#103B6F'],
- ['#0C1657','rgba(12,22,87,','rgba(255,0,0,1)','#030933'],
- ['#00FF00','rgba(0,255,0,','rgba(52,17,81,1)','#20AB20'],
- ['#FF0000','rgba(255,0,0,','rgba(52,17,81,1)','#D21111'],
- ['#AFAFAF','rgba(175,175,175,','rgba(52,17,81,1)','#818D8D'],
- ['#FFFF00','rgba(255,255,0,','rgba(52,17,81,1)','#FFC900'],
- ['#FF00DB','rgba(255,0,219,','rgba(52,17,81,1)','#A70C91'],
- ['#0000FF','rgba(0,0,255,','rgba(255,0,0,1)','#2121A0'],
- ['#00FFFF','rgba(0,255,255,','rgba(52,17,81,1)','#1DCBCB'],
- ['#95E199','rgba(149,225,153,','rgba(52,17,81,1)','#369F3B'],
- ['#A53DD5','rgba(165,61,213,','rgba(52,17,81,1)','#590480'],
- ['#1A4A26','rgba(26,74,38,','rgba(255,0,0,1)','#08240F'],
- ['#FCCDE5','rgba(252,205,229,','rgba(52,17,81,1)','#D082AA'],
- ['#FDB462','rgba(255,222,105,','rgba(52,17,81,1)','#D77C15'],
- ['#FFDE69','rgba(253,180,98,','rgba(52,17,81,1)','#E6B505'],
- ['#80B1D3','rgba(128,177,211,','rgba(52,17,81,1)','#306E99'],
- ['#737B1B','rgba(115,123,27,','rgba(52,17,81,1)','#424705'],
- ['#BEBADA','rgba(190,186,218,','rgba(52,17,81,1)','#514984'],
- ['#8DD3C7','rgba(141,211,199,','rgba(52,17,81,1)','#248D7B']
-],[
-// Not christmas
- ['#000000','rgba(0,0,0,','rgba(52,17,81,1)','#111111'],
- ['#781C81','rgba(120,28,129,','rgba(255,0,0,1)','#49074F'],
- ['#61187E','rgba(97,24,126,','rgba(255,0,0,1)','#3B0251'],
- ['#531B7F','rgba(83,27,127,','rgba(255,0,0,1)','#320356'],
- ['#4A2384','rgba(74,35,132,','rgba(255,0,0,1)','#260656'],
- ['#442E8A','rgba(68,46,138,','rgba(255,0,0,1)','#1E0A5C'],
- ['#413B93','rgba(65,59,147,','rgba(255,0,0,1)','#18125E'],
- ['#3F499D','rgba(63,73,157,','rgba(255,0,0,1)','#17206F'],
- ['#3F58A8','rgba(63,88,168,','rgba(255,0,0,1)','#11276C'],
- ['#4066B2','rgba(64,102,178,','rgba(255,0,0,1)','#16377B'],
- ['#4273BB','rgba(66,115,187,','rgba(255,0,0,1)','#13438A'],
- ['#447FC0','rgba(68,127,192,','rgba(52,17,81,1)','#164F8E'],
- ['#488AC2','rgba(72,138,194,','rgba(52,17,81,1)','#195A92'],
- ['#4C94BF','rgba(76,148,191,','rgba(52,17,81,1)','#1C6490'],
- ['#519CB8','rgba(81,156,184,','rgba(52,17,81,1)','#1E6D8B'],
- ['#57A3AE','rgba(87,163,174,','rgba(52,17,81,1)','#287985'],
- ['#5EA9A2','rgba(94,169,162,','rgba(52,17,81,1)','#277A72'],
- ['#65AE95','rgba(101,174,149,','rgba(52,17,81,1)','#28785D'],
- ['#6DB388','rgba(109,179,136,','rgba(52,17,81,1)','#348252'],
- ['#76B67D','rgba(118,182,125,','rgba(52,17,81,1)','#388340'],
- ['#7FB972','rgba(127,185,114,','rgba(52,17,81,1)','#448635'],
- ['#88BB69','rgba(136,187,105,','rgba(52,17,81,1)','#518730'],
- ['#92BD60','rgba(146,189,96,','rgba(52,17,81,1)','#62902D'],
- ['#9CBE59','rgba(156,190,89,','rgba(52,17,81,1)','#6D9028'],
- ['#A7BE53','rgba(167,190,83,','rgba(52,17,81,1)','#70871D'],
- ['#B1BE49','rgba(177,190,78,','rgba(52,17,81,1)','#7C8919'],
- ['#BABC49','rgba(186,188,73,','rgba(52,17,81,1)','#87891B'],
- ['#C3BA45','rgba(195,186,69,','rgba(52,17,81,1)','#928917'],
- ['#CCB742','rgba(204,183,66,','rgba(52,17,81,1)','#AC9516'],
- ['#D3B33F','rgba(211,179,63,','rgba(52,17,81,1)','#A78713'],
- ['#DAAD3C','rgba(218,173,60,','rgba(52,17,81,1)','#AB7E0D'],
- ['#DFA539','rgba(223,165,57,','rgba(52,17,81,1)','#B17609'],
- ['#E39C37','rgba(227,156,55,','rgba(52,17,81,1)','#BB730D'],
- ['#E59134','rgba(229,145,52,','rgba(52,17,81,1)','#B16006'],
- ['#E78432','rgba(231,132,50,','rgba(52,17,81,1)','#B45404'],
- ['#E7752F','rgba(231,117,47,','rgba(52,17,81,1)','#763703'],
- ['#E6652D','rgba(230,101,45,','rgba(52,17,81,1)','#AD3906'],
- ['#E4542A','rgba(228,84,42,','rgba(52,17,81,1)','#AE2A04'],
- ['#E14326','rgba(225,67,38,','rgba(52,17,81,1)','#AD1E04'],
- ['#DD3123','rgba(221,49,35,','rgba(52,17,81,1)','#A11105'],
- ['#D92120','rgba(217,33,32,','rgba(52,17,81,1)','#8A0201']
-],[
-// Rainbow
- ['#000000','rgba(0,0,0,','rgba(52,17,81,1)','#111111'],
- ['#FF0000','rgba(255,0,0,','rgba(52,17,81,1)','#C30707'],
- ['#FF2600','rgba(255,38,0,','rgba(52,17,81,1)','#BA250B'],
- ['#FF4D00','rgba(255,77,0,','rgba(52,17,81,1)','#BD3A02'],
- ['#FF7300','rgba(255,115,0,','rgba(52,17,81,1)','#C15B06'],
- ['#FF9900','rgba(255,153,0,','rgba(52,17,81,1)','#BF7504'],
- ['#FFBF00','rgba(255,191,0,','rgba(52,17,81,1)','#C49405'],
- ['#FFE500','rgba(255,229,0,','rgba(52,17,81,1)','#BEAB01'],
- ['#F2FF00','rgba(242,255,0,','rgba(52,17,81,1)','#B3BD03'],
- ['#CCFF00','rgba(204,255,0,','rgba(52,17,81,1)','#93B607'],
- ['#A6FF00','rgba(166,255,0,','rgba(52,17,81,1)','#7BBB05'],
- ['#80FF00','rgba(128,255,0,','rgba(52,17,81,1)','#59AC05'],
- ['#59FF00','rgba(89,255,0,','rgba(52,17,81,1)','#3DAD01'],
- ['#33FF00','rgba(51,255,0,','rgba(52,17,81,1)','#24B001'],
- ['#0DFF00','rgba(13,255,0,','rgba(52,17,81,1)','#0CAA03'],
- ['#00FF1A','rgba(0,255,26,','rgba(52,17,81,1)','#03AC14'],
- ['#00FF40','rgba(0,255,64,','rgba(52,17,81,1)','#02AB2C'],
- ['#00FF66','rgba(0,255,102,','rgba(52,17,81,1)','#01AD46'],
- ['#00FF8C','rgba(0,255,140,','rgba(52,17,81,1)','#06B466'],
- ['#00FFB3','rgba(0,255,179,','rgba(52,17,81,1)','#01AB79'],
- ['#00FFD9','rgba(0,255,217,','rgba(52,17,81,1)','#02B399'],
- ['#00FFFF','rgba(0,255,255,','rgba(52,17,81,1)','#04AEAE'],
- ['#00D9FF','rgba(0,217,255,','rgba(52,17,81,1)','#0496B0'],
- ['#00B2FF','rgba(0,178,255,','rgba(52,17,81,1)','#0272A3'],
- ['#008CFF','rgba(0,140,255,','rgba(255,0,0,1)','#00569D'],
- ['#0068FF','rgba(0,102,255,','rgba(255,0,0,1)','#044AAE'],
- ['#0040FF','rgba(0,64,255,','rgba(255,0,0,1)','#032894'],
- ['#0019FF','rgba(0,25,255,','rgba(255,0,0,1)','#01109C'],
- ['#0D00FF','rgba(13,0,255,','rgba(255,0,0,1)','#0B03A7'],
- ['#3300FF','rgba(51,0,255,','rgba(255,0,0,1)','#2403A7'],
- ['#5900FF','rgba(89,0,255,','rgba(255,0,0,1)','#3E04AA'],
- ['#8000FF','rgba(128,0,255,','rgba(255,0,0,1)','#5302A4'],
- ['#A600FF','rgba(166,0,255,','rgba(255,0,0,1)','#6F03A9'],
- ['#CC00FF','rgba(204,0,255,','rgba(255,0,0,1)','#8A04AC'],
- ['#F200FF','rgba(242,0,255,','rgba(52,17,81,1)','#9D03A5'],
- ['#FF00E5','rgba(255,0,229,','rgba(52,17,81,1)','#B607A4'],
- ['#FF00BF','rgba(255,0,191,','rgba(52,17,81,1)','#B40588'],
- ['#FF0099','rgba(255,0,153,','rgba(52,17,81,1)','#B4016D'],
- ['#FF0073','rgba(255,0,115,','rgba(52,17,81,1)','#A9024D'],
- ['#FF004C','rgba(255,0,76,','rgba(52,17,81,1)','#A90335'],
- ['#FF0026','rgba(255,0,38,','rgba(52,17,81,1)','#A6051D']
-]];
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/flowtools/js/crossSamplePlots.js
--- a/cs_overview/static/flowtools/js/crossSamplePlots.js Mon Feb 27 12:48:54 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-// Copyright (c) 2016 Northrop Grumman.
-// All rights reserved.
-var updateCSplots = function(plotconfig){
- plotconfig.selectedPopulations = [];
- $(plotconfig.popSelectj).each(function() {
- if (this.checked) {
- plotconfig.selectedPopulations.push(parseInt(this.value));
- }
- });
- if (plotconfig.hasOwnProperty("mtable")) {
- // Update selected markers?
- plotconfig.selectedMarkers = [];
- $(plotconfig.mrkrSelectj).each(function() {
- if (this.checked) {
- plotconfig.selectedMarkers.push(parseInt(this.value));
- }
- });
- // update plot
- updateBoxplot(plotconfig);
- } else {
- updatePlot(plotconfig);
- }
-};
-
-var displayPopulationLegend = function(plotconfig) {
- $(plotconfig.table).empty();
- plotconfig.allPopulations.map(function(value,index) {
- $(plotconfig.table).append('
'
- + ' | '
- + newPopNames[value] + ' | |
');
- });
-
- $(plotconfig.popSelectAll).click(function() {
- var checkAll = $(plotconfig.popSelectAll).prop('checked');
- if (checkAll) {
- $(plotconfig.popSelectj).prop("checked", true);
- } else {
- $(plotconfig.popSelectj).prop("checked", false);
- }
- updateCSplots(plotconfig);
- });
-
- $(plotconfig.popSelectj).click(function() {
- if ($(plotconfig.popSelectj).length == $(plotconfig.popSelectCheck).length) {
- $(plotconfig.popSelectAll).prop("checked",true);
- } else {
- $(plotconfig.popSelectAll).prop("checked",false);
- }
- updateCSplots(plotconfig);
- });
-
- $(plotconfig.popSelectj).each(function() {
- var selectedpopn = parseInt(this.value);
- if ($.inArray(selectedpopn,plotconfig.selectedPopulations) > -1) {
- this.checked = true;
- } else {
- this.checked = false;
- }
- });
-};
-
-var displayToolbar = function(plotconfig){
- $(plotconfig.displaybutton).on("click",function() {
- $(plotconfig.popSelectj).prop("checked", true);
- $(plotconfig.popSelectAll).prop("checked", true);
- if (plotconfig.hasOwnProperty("mtable")){
- $(plotconfig.displayMFI).prop("checked", false);
- $(plotconfig.displayvalues).prop("checked", false);
- $(plotconfig.mrkrSelectj).prop("checked", true);
- $(plotconfig.mrkrSelectAll).prop("checked",true);
- }
- updateCSplots(plotconfig);
- });
-
- if (plotconfig.hasOwnProperty("mtable")){
- $(plotconfig.displayMFI).on("click", function(){
- updateCSplots(plotconfig);
- });
- $(plotconfig.displayvalues).on("click", function(){
- updateCSplots(plotconfig);
- });
- }
- $(plotconfig.toggledisplayj).on("click",function() {
- plotconfig.selectedPopulations = [];
- $(plotconfig.popSelectj).each(function() {
- if (this.checked) {
- plotconfig.selectedPopulations.push(parseInt(this.value));
- }
- })
- if (plotconfig.hasOwnProperty("mtable")){
- plotconfig.selectedMarkers = [];
- $(plotconfig.mrkrSelectj).each(function() {
- if (this.checked) {
- plotconfig.selectedMarkers.push(parseInt(this.value));
- }
- });
- var text = document.getElementById(plotconfig.toggledisplay).firstChild;
- text.data = text.data == "View per marker" ? "View per population" : "View per marker";
- plotconfig.view = plotconfig.view == "p" ? "m" : "p";
- updateBoxplot(plotconfig);
- } else {
- var imgSrc = document.getElementById(plotconfig.toggledisplay);
- imgSrc.src = imgSrc.src.endsWith("stackedsm.png") ? "/static/images/flowtools/barssm.png" : "/static/images/flowtools/stackedsm.png";
- plotconfig.type = plotconfig.type == "barplot" ? "areaplot" : "barplot";
- updatePlot(plotconfig);
- }
- });
- displayPlot(plotconfig);
-};
-
-var displayPlot = function(plotconfig) {
- var h = $(window).height() - 200;
- $(plotconfig.plotdivj).empty();
- $(plotconfig.plotdivj).height(h);
-
- if (plotconfig.hasOwnProperty("mtable")) {
- var nbPop = Object.keys(plotconfig.csdata.mfi[plotconfig.mrkrNames[0]]).length + 2;
- // Get Markers too
- for (var i = 0, nbMarkers = plotconfig.mrkrNames.length; i < nbMarkers; i++) {
- plotconfig.allMarkers.push(i);
- plotconfig.selectedMarkers.push(i);
- }
- } else {
- var nbPop = plotconfig.csdata[0].length;
- }
-
- for (var i = 2; i < nbPop; i++) {
- plotconfig.allPopulations.push(i - 1);
- plotconfig.selectedPopulations.push(i - 1);
- }
-
- $(window).on('resize',function() {
- waitForFinalEvent(function() {
- if (plotconfig.hasOwnProperty("mtable")){
- updateBoxplot(plotconfig);
- } else {
- updatePlot(plotconfig);
- }
- }, 500, "resizePlot");
- });
-
- displayPopulationLegend(plotconfig);
- if (plotconfig.hasOwnProperty("mtable")){
- displayMarkerTable(plotconfig);
- updateBoxplot(plotconfig);
- } else {
- updatePlot(plotconfig);
- }
-};
-
-var updatePlot = function(plotconfig) {
- var h = $(window).height() - 200,
- traces = [],
- tmptraces = [],
- x_values = [],
- totals = [];
- layout = {};
-
- $(plotconfig.plotdivj).empty();
- $(plotconfig.plotdivj).height(h);
- for (var i = 1, j = plotconfig.csdata.length; i < j; i++) {
- x_values.push(newSmpNames[plotconfig.csdata[i][1]]);
- }
-
- for (var k = 1, i = plotconfig.csdata.length; k < i; k++){
- totals[k] = 0;
- for (var m = 2, o = plotconfig.csdata[0].length; m < o; m++){
- for (var n = 0, p = plotconfig.selectedPopulations.length; n < p; n++){
- if (plotconfig.csdata[0][m] === plotconfig.selectedPopulations[n]) {
- totals[k] += plotconfig.csdata[k][m];
- }
- }
- }
- }
-
- for (var i = 0, ii = plotconfig.selectedPopulations.length; i < ii; i++) {
- pop = plotconfig.selectedPopulations[i];
- var popName = "Pop " + pop;
- var y_values = [];
- var obj;
-
- for (var j = 1, jj = plotconfig.csdata.length; j < jj; j++) {
- var newvalue = (plotconfig.csdata[j][pop + 1] / totals[j]) * 100;
- y_values.push(newvalue);
- }
- if (plotconfig.type === "areaplot") {
- obj = {
- x: x_values,
- y: y_values,
- hoverinfo: "x",
- name: popName,
- type: 'area',
- fill: 'tonexty',
- marker: {color: color_palette[0][pop][0]}
- };
- }
- if (plotconfig.type === "barplot") {
- obj = {
- x: x_values,
- y: y_values,
- hoverinfo: "x",
- name: popName,
- type: 'bar',
- marker: {color: color_palette[0][pop][0]}
- };
- }
- tmptraces.push(obj)
- }
-
- if (plotconfig.type === "barplot") {
- layout = {
- hovermode:'closest',
- title: '',
- barmode: 'stack',
- showlegend: false,
- yaxis: {
- mirror: 'all',
- tickmode: 'array',
- ticktext: ["","20%", "40%", "60%", "80%", "100%"],
- tickvals: [0,20,40,60,80,100],
- title: 'Populations proportions in selected set',
- titlefont: {
- size: 16,
- color: 'grey'
- }
- }
- };
- traces = tmptraces;
- }
- if (plotconfig.type === "areaplot") {
- function stacked(trcs) {
- for(var i=1; i
t<"bottom"lp><"clear">',
- columnDefs: [{
- targets: propTargets,
- className: "dt-body-right",
- render: function(data, type, row){
- return parseFloat(data).toFixed(2) + '%';
- }
- }, {
- targets: [smpcol - 1, smpcol, smpcol + 1],
- className: "dt-body-left",
- }],
- buttons: [
- 'copy', 'pdfHtml5','csvHtml5', 'colvis'
- ],
- colReorder: {
- fixedColumnsLeft:1
- },
- select: true
- });
-
- // Add titles to File ID and Sample Name
- $('#proptable tr').each(function(i,d){
- if (i > 0) {
- $(this).find('td').each(function(j,e){
- if (j == 1 ) {
- $(this).prop('title', fileID[i - 1] );
- }
- if (j == 2) {
- $(this).prop('title', sampleNames[i - 1]);
- }
- });
- }
- });
-
- // Add a table below to rename pops
- // Might want to change that some other time?
- $('#popnamesDiv').html(popHTML);
- var popEditor = new $.fn.dataTable.Editor({
- ajax: popHandle,
- table: '#popnamestable',
- fields: popEditorData,
- idSrc: '1'
- });
-
- $('#popnamestable').on( 'click', 'tbody td', function (e) {
- popEditor.bubble(this);
- });
- var popTable = $('#popnamestable').DataTable({
- columns: popTableHeadings,
- dom: 't',
- select: true,
- data: popTableData
- });
-
- smpEditor.on( 'preSubmit', function(e, object, action){
- var data = object.data;
- var key = Object.keys(data)[0];
- var count = object.data[key]['Comment'];
-
- propTableData.forEach(function(d){
- if (d.SampleName === key) {
- d.Comment = count;
- newSmpNames[key] = count;
- }
- });
- pctablecontent = $.extend(true, [], propTableData);
- });
- popEditor.on( 'preSubmit', function(e, object, action){
- var data = object.data;
- var key = Object.keys(data['1'])[0];
- var count = object.data['1'][key];
- popTableData[0][key] = count;
- newPopNames[key] = count;
- });
- });
-};
-
-var displayStackedAreaPlot = function() {
- $.ajax({
- url: url,
- dataType: "text",
- success: function(text) {
- configAreaplot = {
- displaybutton : '#updateDisplayA',
- popSelectj : '.popSelectA',
- plotdivj : '#plotDivA',
- toggledisplayj : '#togglePlot',
- toggledisplay : 'toggleButtonImg',
- csdata : preprocess(text),
- plotdiv : 'plotDivA',
- type : 'areaplot',
- table : '#popTableA tbody',
- popSelect : 'popSelectA',
- allPopulations : [],
- selectedPopulations : [],
- popSelectAll : '#popSelectAllA',
- popSelectCheck : '.popSelectA:checked'
- };
- displayToolbar(configAreaplot);
- }
- });
-};
-
-var displayBoxplot = function() {
- $.ajax({
- url: boxplotUrl,
- dataType: "json",
- success: function(data) {
- configBoxplot = {
- displaybutton : '#updateDisplayC',
- toggledisplayj : '#changeDisplayC',
- toggledisplay : 'changeDisplayC',
- popSelectj : '.popSelectC',
- plotdivj : '#plotDivC',
- csdata : data,
- plotdiv : 'plotDivC',
- type : 'boxplot',
- table : '#popTableC tbody',
- popSelect : 'popSelectC',
- allMarkers : [],
- selectedMarkers: [],
- allPopulations : [],
- selectedPopulations : [],
- popSelectAll : '#popSelectAllC',
- popSelectCheck: '.popSelectC:checked',
- mrkrSelectAll : '#mrkrSelectAllC',
- mrkrSelectCheck: '.mrkrSelectC:checked',
- mrkrSelect : 'mrkrSelectC',
- mtable : '#mrkrTableC tbody',
- mrkrSelectj: '.mrkrSelectC',
- displayvalues: '#displayLabelsC',
- displayMFI: '#displayMFIC',
- view: 'p',
- mrkrNames : Object.keys(data.mfi)
- };
- displayToolbar(configBoxplot);
- }
- });
-};
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/flowtools/js/pCoordCSstats.js
--- a/cs_overview/static/flowtools/js/pCoordCSstats.js Mon Feb 27 12:48:54 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,418 +0,0 @@
-// Copyright (c) 2016 Northrop Grumman.
-// All rights reserved.
-
-/*
- * Initialize variables for parallelCoordinates display
-*/
-var pcApp = pcApp || {};
-
-pcApp.allSamples = [];
-pcApp.selectedSamples = [];
-pcApp.origData;
-pcApp.flowData;
-pcApp.updatedData;
-pcApp.headers = [];
-pcApp.foreground;
-pcApp.background;
-
-var displayAll = function() {
- displayParallelPlot();
-}
-/*
- * Display the Population Legend
-*/
-var displaySmpTable = function() {
- $('#popTablePC tbody').empty();
- pcApp.origData.map(function(d) {
- $('#popTablePC tbody').append(''
- + ' | ' + newSmpNames[d.SampleName]
- + ' | |
');
- });
-
- $('#popSelectAllPC').click(function() {
- var checkAll = $("#popSelectAllPC").prop('checked');
- if (checkAll) {
- $(".popSelectPC").prop("checked", true);
- } else {
- $(".popSelectPC").prop("checked", false);
- }
- pcApp.selectedSamples = [];
- $('.popSelectPC').each(function() {
- if (this.checked) {
- pcApp.selectedSamples.push(parseInt(this.value));
- }
- })
- displayTableGrid();
- if (checkAll) {
- displayParallelPlot();
- } else {
- updateParallelForeground();
- }
- });
-
- $('.popSelectPC').click(function() {
- if ($('.popSelectPC').length == $(".popSelectPC:checked").length) {
- $('#popSelectAllPC').prop("checked",true);
- } else {
- $('#popSelectAllPC').prop("checked",false);
- }
- pcApp.selectedSamples = [];
- $('.popSelectPC').each(function() {
- if (this.checked) {
- pcApp.selectedSamples.push(parseInt(this.value));
- }
- })
- displayTableGrid();
- updateParallelForeground();
- });
- updateSmpTable();
-};
-
-var updateSmpTable = function() {
- $('.popSelectPC').each(function() {
- var smp = parseInt(this.value);
- if ($.inArray(smp,pcApp.selectedSamples) > -1) {
- this.checked = true;
- } else {
- this.checked = false;
- }
- })
-}
-
-var displayTableGrid = function() {
- var colTable = [],
- colNames = [],
- pctargets = [],
- updatedHeaders = [],
- displayData = [],
- targetCol = 0,
- textCol = [],
- colOrder = [],
- tableHTML = [];
-
- $("#tableDivPC").empty();
- pcApp.updatedData = $.extend(true,[],pctablecontent);
- pcApp.updatedData.forEach(function(d, idx){
- d.SampleName = idx + 1;
- delete(d.FileID);
- });
-
- updatedHeaders = Object.keys(pcApp.updatedData[0]);
- displayData = pcApp.updatedData.filter(function(d,i) {
- if ($.inArray(i,pcApp.selectedSamples) > -1) {
- return d;
- }
- });
-
- targetCol = updatedHeaders.length - 2;
- updatedHeaders.forEach(function(d,i){
- colTable.push("" + d + " | ");
- colNames.push({"data":d});
- if (i < targetCol){
- pctargets.push(i);
- }
- });
- textCol = [targetCol, targetCol + 1];
- colOrder = textCol.concat(pctargets);
- tableHTML = [
- '',
- '',
- '',
- colTable.join("\n"),
- '
',
- '',
- '
',
- ];
-
- $('#tableDivPC').html(tableHTML.join("\n"));
- var pcTable = $('#pcTable').DataTable({
- columns: colNames,
- data: displayData,
- order: [[ targetCol, "asc" ]],
- pageLength: 10,
- //paging: false,
- scrollY: 250,
- scrollCollapse: true,
- scrollX: true,
- dom: '<"top"B>t<"bottom"lip><"clear">',
- columnDefs: [{
- targets: pctargets,
- className: "dt-body-right",
- render: function(data,type,row){
- return parseFloat(data).toFixed(2) + '%';
- }
- }, {
- targets: [targetCol, targetCol+1],
- className: "dt-body-center"
- }, {
- targets:[targetCol],
- render: function(data, type, row){
- return 'Sample' + parseInt(data);
- }
- }],
- buttons: [
- 'copy', 'pdfHtml5','csvHtml5', 'colvis'
- ],
- colReorder: {order:colOrder},
- select: true
- });
-
- $('#pcTable').on('mouseover', 'tr', function() {
- var data = pcTable.row(this).data();
- if (data != undefined) {
- var smp = parseInt(data.SampleName) - 1;
- pcApp.selectedSamples = [smp];
- updateParallelForeground();
- }
- });
- $('#pcTable').on('mouseleave', 'tr', function() {
- pcApp.selectedSamples = [];
- $('.popSelectPC').each(function() {
- if (this.checked) {
- pcApp.selectedSamples.push(parseInt(this.value));
- }
- updateParallelForeground();
- })
- });
-};
-/*
- * Display The Main Plot
-*/
-var displayParallelPlot = function() {
- var margin = {top: 30, right: 10, bottom: 10, left: 10},
- h = 300,
- w = $("#plotDivPC").width(),
- width = w - margin.left - margin.right,
- height = h - margin.top - margin.bottom,
- y = {},
- dragging = {},
- ymax = 0;
-
- $("#plotDivPC").empty();
- $("#plotDivPC").height(h);
- var svg = d3.select("#plotDivPC").append("svg")
- .attr("width", width + margin.left + margin.right)
- .attr("height", height + margin.top + margin.bottom)
- .append("g")
- .attr("transform", "translate(" + margin.left + "," + margin.top + ")")
-
- var x = d3.scale.ordinal().rangePoints([0, width], 1);
- var line = d3.svg.line();
- var axis = d3.svg.axis()
- .orient("left")
- .tickFormat(d3.format("d"))
- .ticks(5);
-
- for (var m = 0, n = pcApp.flowData.length; m < n; m++){
- for (var p in pcApp.flowData[m]){
- if (+pcApp.flowData[m][p] > ymax){
- ymax = +pcApp.flowData[m][p];
- }
- }
- }
-
- // Y axis label
- svg.append("text")
- .attr("class", "ylabel")
- .attr("transform", "rotate(-90)")
- .attr("y", 0 - margin.left)
- .attr("x",0 - (height / 2))
- .attr("dy", "1em")
- .style("text-anchor", "middle")
- .text("Fraction of population in sample");
-
- var dimensions = d3.keys(pcApp.flowData[0]).filter(function(d) {
- return (y[d] = d3.scale.linear()
- .domain([0,parseInt(ymax)+1])
- .range([height, 0]));
- });
- x.domain(dimensions);
-
- function path(d) {
- return line(dimensions.map(function(p) { return [x(p), y[p](d[p])]; }));
- }
-
- function position(d) {
- var v = dragging[d];
- return v == null ? x(d) : v;
- }
-
- function transition(g) {
- return g.transition().duration(500);
- }
-
- function brush() {
- var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); });
- var extents = actives.map(function(p) { return y[p].brush.extent(); });
- var selectedSamples = pcApp.origData.filter(function(d) {
- var smp = parseInt(d.SampleNumber);
- var tf = actives.every(function(p,i) {
- return extents[i][0] <= pcApp.flowData[smp][p] &&
- pcApp.flowData[smp][p] <= extents[i][1];
- });
- if (tf) {
- return smp.toString();
- }
- });
- pcApp.selectedSamples = selectedSamples.map(function(d) {
- return parseInt(d.SampleNumber);
- });
-
- updateParallelForeground();
- updateSmpTable()
- displayTableGrid();
- }
- // Display paths in light gray color, to use as reference
- pcApp.background = svg.append("g")
- .attr("class", "background")
- .selectAll("path")
- .data(pcApp.flowData)
- .enter().append("path")
- .attr("d", path);
-
- // Add foreground lines for focus, color by population.
- pcApp.foreground = svg.append("g")
- .attr("class", "foreground")
- .selectAll("path")
- .data(pcApp.origData)
- .enter().append("path")
- .attr("d", function(d) {
- var smp = d.SampleNumber;
- return path(pcApp.flowData[smp]); })
- .attr("stroke",function(d){
- var smp = d.SampleNumber + 1;
- return color_palette[0][smp][0];})
- .attr("stroke-width", 1);
-
- // Add a group element for each dimension.
- var g = svg.selectAll(".dimension")
- .data(dimensions)
- .enter().append("g")
- .attr("class", "dimension")
- .attr("transform", function(d) { return "translate(" + x(d) + ")"; })
- .call(d3.behavior.drag()
- .origin(function(d) { return {x: x(d)}; })
- .on("dragstart", function(d) {
- dragging[d] = x(d);
- pcApp.background.attr("visibility", "hidden");})
- .on("drag", function(d) {
- dragging[d] = Math.min(width, Math.max(0, d3.event.x));
- pcApp.foreground.attr("d", path);
- dimensions.sort(function(a, b) { return position(a) - position(b); });
- x.domain(dimensions);
- g.attr("transform", function(d) { return "translate(" + position(d) + ")"; }); })
- .on("dragend", function(d) {
- delete dragging[d];
- transition(d3.select(this)).attr("transform", "translate(" + x(d) + ")");
- transition(pcApp.foreground).attr("d", path);
- pcApp.background
- .attr("d", path)
- .transition()
- .delay(500)
- .duration(0)
- .attr("visibility", null);
- }));
-
- // Add an axis and title.
- g.append("g")
- .attr("class", "axis")
- .each(function(d) { d3.select(this).call(axis.scale(y[d])); });
- g.append("g")
- .attr("class", "xlabel")
- .append("text")
- .style("text-anchor", "middle")
- .attr("y", -9)
- .text(function(d) { return d; });
-
- // Add and store a brush for each axis.
- g.append("g")
- .attr("class", "brush")
- .each(function(d) { d3.select(this).call(y[d].brush = d3.svg.brush().y(y[d]).on("brush", brush)); })
- .selectAll("rect")
- .attr("x", -8)
- .attr("width", 16);
-
- // Control line opacity.
- $('#PCline_opacity').on('change', (function() {
- var val = $(this).val();
- $('#plotDivPC .foreground path').css('stroke-opacity', val.toString());
- $('#pc_opacity').html((Math.round(val*10000)/100) + "%");
- }));
-};
-
-var updateParallelForeground = function() {
- pcApp.foreground[0].map(function(d) {
- var smp = parseInt(d['__data__']['SampleNumber'])
- if ($.inArray(smp,pcApp.selectedSamples) < 0) {
- d.style.display = "none";
- } else {
- d.style.display = null;
- }
- });
-};
-/*
- * Retrieve the data, then call display functions
-*/
-var displayParallelCoordinates = function() {
-/* var inputFile = "./csOverview.tsv";
- d3.tsv(inputFile, function(error, data) {
- if (error) {
- alert("Problem Retrieving Data");
- return;
- }
- */
- pcApp.origData = $.extend(true,[], pctablecontent);
- pcApp.headers = Object.keys(pcApp.origData[0]);
- pcApp.headers.splice(pcApp.headers.indexOf("FileID"), 1);
- pcApp.origData.forEach(function(d,idx){
- d.SampleNumber = idx;
-// delete d.FileID;
- })
- /*
- * For the plot use only the proportion of each
- * population per sample. Store in flowData
- */
- pcApp.flowData = $.extend(true,[],pctablecontent);
- pcApp.flowData.forEach(function(d,idx){
- delete d.SampleName;
- delete d.FileID;
- delete d.Comment;
- });
- for (var i = 0, j = pcApp.flowData.length; i < j ; i++) {
- pcApp.allSamples.push(i);
- pcApp.selectedSamples.push(i);
- }
- displaySmpTable();
- displayTableGrid();
- displayParallelPlot();
-
- $("#resetPCDisplay").on("click",function() {
- var opcty = ".8";
- for (var i = 0, j = pcApp.flowData.length; i < j; i++) {
- pcApp.allSamples.push(i);
- pcApp.selectedSamples.push(i);
- }
- $("#smpSelectAllPC").prop('checked',true);
- $(".smpSelectPC").prop("checked",true);
-
- $('#plotDivPC .foreground path').css('stroke-opacity', opcty);
- $('#pc_opacity').html("80%");
- $('#PCline_opacity').val(0.8);
-
- displaySmpTable();
- displayTableGrid();
- displayParallelPlot();
- });
-
- $(window).on('resize',function() {
- waitForFinalEvent(function() {
- displayAll();
- }, 500, "resizePC");
- });
-// });
-};
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/flowtools/js/pCoordMFIstats.js
--- a/cs_overview/static/flowtools/js/pCoordMFIstats.js Mon Feb 27 12:48:54 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,559 +0,0 @@
-// Copyright (c) 2016 Northrop Grumman.
-// All rights reserved.
-/*
- * Initialize variables for parallelCoordinates display
-*/
-var pcAppMFI = pcAppMFI || {};
-
-pcAppMFI.origData;
-pcAppMFI.flowData;
-pcAppMFI.background;
-pcAppMFI.foreground;
-pcAppMFI.selectedLines = [];
-pcAppMFI.selectedPopulations = [];
-pcAppMFI.selectedSamples = [];
-pcAppMFI.populations = [];
-pcAppMFI.samples = [];
-pcAppMFI.lines = [];
-pcAppMFI.allLines;
-pcAppMFI.headers = [];
-
-var displayAllm = function() {
- displayParallelPlotm();
-};
-/*
- * Display the Population Legend
-*/
-var displayPopTablem = function() {
- $('#popTablePCm tbody').empty();
- pcAppMFI.populations.map(function(d, index) {
- $('#popTablePCm tbody').append(''
- + ' | ' + newPopNames[d]
- + ' | |
');
- });
-
- $('#popSelectAllPCm').click(function() {
- var checkAll = $("#popSelectAllPCm").prop('checked');
- if (checkAll) {
- $(".popSelectPCm").prop("checked", true);
- for (var i = 0; i < pcAppMFI.allLines; i ++) {
- pcAppMFI.selectedLines.push(i);
- pcAppMFI.lines.push(i);
- }
- } else {
- $(".popSelectPCm").prop("checked", false);
- pcAppMFI.selectedLines = [];
- pcAppMFI.lines = [];
- }
-
- pcAppMFI.selectedPopulations = [];
- $('.popSelectPCm').each(function() {
- if (this.checked) {
- pcAppMFI.selectedPopulations.push(parseInt(this.value));
- }
- });
-
- displayTableGridm();
- if (checkAll) {
- displayParallelPlotm();
- } else {
- updateParallelForegroundidx();
- }
- });
-
- $('.popSelectPCm').click(function() {
- if ($('.popSelectPCm').length == $(".popSelectPCm:checked").length) {
- $('#popSelectAllPCm').prop("checked",true);
- } else {
- $('#popSelectAllPCm').prop("checked",false);
- }
- pcAppMFI.selectedPopulations = [];
- $('.popSelectPCm').each(function() {
- if (this.checked) {
- pcAppMFI.selectedPopulations.push(parseInt(this.value));
- }
- });
- pcAppMFI.selectedLines = [];
- pcAppMFI.lines = [];
- pcAppMFI.origData.forEach(function(d,idx){
- if ($.inArray(pcAppMFI.populations.indexOf(d.Population), pcAppMFI.selectedPopulations) > -1) {
- if ($.inArray(pcAppMFI.samples.indexOf(d.SmpName), pcAppMFI.selectedSamples) > -1){
- pcAppMFI.selectedLines.push(idx);
- pcAppMFI.lines.push(idx);
- }
- }
- });
- displayTableGridm();
- updateParallelForegroundidx();
- });
- updatePopTableidx();
- updateSmpTableidx();
-};
-
-var updatePopTableidx = function() {
- $('.popSelectPCm').each(function() {
- var pop = parseInt(this.value);
- var selectedPops = pcAppMFI.origData.map(function(d){
- if ($.inArray(d.idx, pcAppMFI.selectedLines) > -1){
- return pcAppMFI.populations.indexOf(d.Population);
- }
- });
- if ($.inArray(pop,selectedPops) > -1) {
- this.checked = true;
- } else {
- this.checked = false;
- }
- });
-};
-/*
-* Display Sample Legend
-*/
-var displaySmpTablem = function(){
- $('#smpTablePCm tbody').empty();
- pcAppMFI.samples.map(function(d, index) {
- $('#smpTablePCm tbody').append('' + newSmpNames[d]
- + ' | ' + ' |
');
- });
-
- $('#smpSelectAllPCm').click(function() {
- var checkAll = $("#smpSelectAllPCm").prop('checked');
- if (checkAll) {
- $(".smpSelectPCm").prop("checked", true);
- for (var i = 0; i < pcAppMFI.allLines; i ++) {
- pcAppMFI.selectedLines.push(i);
- pcAppMFI.lines.push(i);
- }
- } else {
- $(".smpSelectPCm").prop("checked", false);
- pcAppMFI.selectedLines = [];
- pcAppMFI.lines = [];
- }
- pcAppMFI.selectedSamples = [];
- $('.smpSelectPCm').each(function() {
- if (this.checked) {
- pcAppMFI.selectedSamples.push(parseInt(this.value));
- }
- });
- displayTableGridm();
- if (checkAll) {
- displayParallelPlotm();
- } else {
- updateParallelForegroundidx();
- }
- });
-
- $('.smpSelectPCm').click(function() {
- if ($('.smpSelectPCm').length == $(".smpSelectPCm:checked").length) {
- $('#smpSelectAllPCm').prop("checked",true);
- } else {
- $('#smpSelectAllPCm').prop("checked",false);
- }
- pcAppMFI.selectedSamples = [];
- $('.smpSelectPCm').each(function() {
- if (this.checked) {
- pcAppMFI.selectedSamples.push(parseInt(this.value));
- }
- });
- pcAppMFI.selectedLines = [];
- pcAppMFI.lines = [];
- pcAppMFI.origData.forEach(function(d,idx) {
- if ($.inArray(pcAppMFI.populations.indexOf(d.Population), pcAppMFI.selectedPopulations) > -1) {
- if ($.inArray(pcAppMFI.samples.indexOf(d.SmpName), pcAppMFI.selectedSamples) > -1){
- pcAppMFI.selectedLines.push(idx);
- pcAppMFI.lines.push(idx);
- }
- }
- });
- displayTableGridm();
- updateParallelForegroundidx();
- });
-};
-
-var updateSmpTableidx = function() {
- $('.smpSelectPCm').each(function() {
- var smp = parseInt(this.value),
- selectedSamples = pcAppMFI.origData.map(function(d){
- if ($.inArray(d.idx, pcAppMFI.selectedLines) > -1){
- return pcAppMFI.samples.indexOf(d.SmpName);
- }
- });
- if ($.inArray(smp,selectedSamples) > -1) {
- this.checked = true;
- } else {
- this.checked = false;
- }
- });
-};
-/*
- * Display Data table
-*/
-var displayTableGridm = function() {
- var colTablem = [],
- colNamesm = [],
- pctargetsm = [],
- displayDatamfi = [],
- targetColm = pcAppMFI.headers.length - 3,
- textColm = [],
- colOrderm = [],
- tableHTMLm = [];
-
- $("#tableDivPCm").empty();
-
- displayDatamfi = pcAppMFI.origData.filter(function(d,i) {
- if ($.inArray(i,pcAppMFI.selectedLines) > -1) {
- return d;
- }
- });
- displayDatamfi.forEach(function(d){
- d.EditedPopName = newPopNames[d.Population];
- d.SampleName = newSmpNames[d.SmpName];
- });
- pcAppMFI.headers.forEach(function(d,i){
- colTablem.push("" + d + " | ");
- colNamesm.push({"data":d});
- if (i < targetColm - 1){
- pctargetsm.push(i);
- }
- });
- textColm = [targetColm, targetColm + 1, targetColm + 2];
- colOrderm = textColm.concat(pctargetsm);
- colOrderm.push(targetColm - 1);
- tableHTMLm = [
- '',
- '',
- '',
- colTablem.join("\n"),
- '
',
- '',
- '
',
- ];
- $('#tableDivPCm').html(tableHTMLm.join("\n"));
- var pcTablem = $('#pcTableMFI').DataTable({
- columns: colNamesm,
- data: displayDatamfi,
- order: [[ targetColm, "asc" ]],
- pageLength: 10,
- //paging: false,
- scrollY: 250,
- scrollCollapse: true,
- scrollX: true,
- dom: '<"top"B>t<"bottom"lip><"clear">',
- columnDefs: [{
- targets: pctargetsm,
- className: "dt-body-right",
- render: function(data,type,row){
- return parseFloat(data).toFixed(2);
- }
- }, {
- targets: [targetColm - 1],
- className: "dt-body-right",
- render: function(data,type,row){
- return parseFloat(data).toFixed(2) + '%';
- }
- }, {
- targets: [targetColm, targetColm+1, targetColm+2],
- className: "dt-body-center"
- }],
- buttons: [
- 'copy', 'pdfHtml5','csvHtml5', 'colvis'
- ],
- colReorder: {order:colOrderm},
- select: true
- });
-
- $('#pcTableMFI').on('mouseover', 'tr', function() {
- var data = pcTablem.row(this).data();
- if (data != undefined) {
- var line = parseInt(data.idx);
- pcAppMFI.selectedLines = [line];
- updateParallelForegroundidx();
- }
- });
- $('#pcTableMFI').on('mouseleave', 'tr', function() {
- pcAppMFI.selectedLines = [];
- for (var i = 0, j = pcAppMFI.lines.length; i < j; i++){
- pcAppMFI.selectedLines.push(pcAppMFI.lines[i]);
- }
- updateParallelForegroundidx();
- });
-};
-/*
-* Update Parallel Foreground
-*/
-var updateParallelForegroundidx = function() {
- pcAppMFI.foreground[0].map(function(d) {
- var ln = parseInt(d['__data__']['idx']);
-
- if ($.inArray(ln,pcAppMFI.selectedLines) < 0){
- d.style.display = "none";
- } else {
- d.style.display = null;
- }
- });
-};
-/*
- * Display The Main Plot
-*/
-var displayParallelPlotm = function() {
- var margin = {top: 30, right: 10, bottom: 10, left: 10},
- h = $("#chartDivPCm").height() * 0.6,
- w = $("#plotDivPCm").width(),
- y = {},
- dragging = {},
- width = w - margin.left - margin.right,
- height = h - margin.top - margin.bottom;
-
- $("#plotDivPCm").empty();
- $("#plotDivPCm").height(h);
-
- var svg = d3.select("#plotDivPCm").append("svg")
- .attr("width", w)
- .attr("height", h)
- .append("g")
- .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
-
- // Y axis label
- svg.append("text")
- .attr("class", "ylabel")
- .attr("transform", "rotate(-90)")
- .attr("y", 0 - margin.left)
- .attr("x", 0 - (height / 2))
- .attr("dy", "1em")
- .style("text-anchor", "middle")
- .text("MFI");
-
- var x = d3.scale.ordinal().rangePoints([0, width], 1);
- var line = d3.svg.line();
- var axis = d3.svg.axis().orient("left").ticks(8);
-
- // Use this to scale line width to percentage population
- var pd = d3.extent(pcAppMFI.origData, function(p) { return +p['Percentage']; });
- var popScale = d3.scale.linear().range([1,5]).domain(pd);
-
- var dimensions = d3.keys(pcAppMFI.flowData[0]).filter(function(d) {
- return (y[d] = d3.scale.linear()
- .domain(d3.extent(pcAppMFI.flowData,function(p) { return +p[d]; }))
- .range([height, 0]));
- });
- x.domain(dimensions);
-
- function path(d) {
- return line(dimensions.map(function(p) { return [x(p), y[p](d[p])]; }));
- }
- function position(d) {
- var v = dragging[d];
- return v == null ? x(d) : v;
- }
- function transition(g) {
- return g.transition().duration(500);
- }
-
- function brush() {
- var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); });
- var extents = actives.map(function(p) { return y[p].brush.extent(); });
- var indices = pcAppMFI.origData.filter(function(d) {
- var line = parseInt(d.idx)
- var tf = actives.every(function(p,i) {
- return extents[i][0] <= pcAppMFI.flowData[line][p] &&
- pcAppMFI.flowData[line][p] <= extents[i][1];
- });
- if (tf) {
- return line.toString();
- }
- });
-
- pcAppMFI.selectedLines = indices.map(function(d) {
- return parseInt(d.idx);
- });
- pcAppMFI.lines = indices.map(function(d) {
- return parseInt(d.idx);
- });
- updateParallelForegroundidx();
- updatePopTableidx();
- updateSmpTableidx();
- displayTableGridm();
- }
-
- // Display paths in light gray color, to use as reference
- pcAppMFI.background = svg.append("g")
- .attr("class", "background")
- .selectAll("path")
- .data(pcAppMFI.flowData)
- .enter().append("path")
- .attr("d", path);
-
- // Add foreground lines for focus, color by population.
- pcAppMFI.foreground = svg.append("g")
- .attr("class", "foreground")
- .selectAll("path")
- .data(pcAppMFI.origData)
- .enter().append("path")
- .attr("d", path)
- .attr("stroke",function(d){
- var pop = pcAppMFI.populations.indexOf(d.Population) + 1;
- return color_palette[0][pop][0]; })
- //.attr("stroke-width", 1);
- // Use this if you want to scale the lines based on
- // population percentage
- .attr("stroke-width", function(d) {
- var pop = pcAppMFI.populations.indexOf(d.Population);
- var w = popScale(pcAppMFI.origData[pop]['Percentage']);
- w = parseInt(w);
- return w;
- });
-
- // Add a group element for each dimension.
- var g = svg.selectAll(".dimension")
- .data(dimensions)
- .enter().append("g")
- .attr("class", "dimension")
- .attr("transform", function(d) { return "translate(" + x(d) + ")"; })
- .call(d3.behavior.drag()
- .origin(function(d) { return {x: x(d)}; })
- .on("dragstart", function(d) {
- dragging[d] = x(d);
- pcAppMFI.background.attr("visibility", "hidden"); })
- .on("drag", function(d) {
- dragging[d] = Math.min(width, Math.max(0, d3.event.x));
- pcAppMFI.foreground.attr("d", path);
- dimensions.sort(function(a, b) { return position(a) - position(b); });
- x.domain(dimensions);
- g.attr("transform", function(d) { return "translate(" + position(d) + ")"; }); })
- .on("dragend", function(d) {
- delete dragging[d];
- transition(d3.select(this)).attr("transform", "translate(" + x(d) + ")");
- transition(pcAppMFI.foreground).attr("d", path);
- pcAppMFI.background
- .attr("d", path)
- .transition()
- .delay(500)
- .duration(0)
- .attr("visibility", null);
- }));
-
- // Add an axis and title.
- g.append("g")
- .attr("class", "axis")
- .each(function(d) { d3.select(this).call(axis.scale(y[d])); });
- g.append("g")
- .attr("class", "xlabel")
- .append("text")
- .style("text-anchor", "middle")
- .attr("y", -9)
- .text(function(d) { return d; });
-
- // Add and store a brush for each axis.
- g.append("g")
- .attr("class", "brush")
- .each(function(d) { d3.select(this).call(y[d].brush = d3.svg.brush().y(y[d]).on("brush", brush)); })
- .selectAll("rect")
- .attr("x", -8)
- .attr("width", 16);
-
- // Control line opacity.
- $('#PCmline_opacity').on('change', (function() {
- var val = $(this).val();
- $('#plotDivPCm .foreground path').css('stroke-opacity', val.toString());
- $('#pcm_opacity').html((Math.round(val*10000)/100) + "%");
- }));
-};
-
-/*
- * Retrieve the data, then call display functions
-*/
-var displayParallelCoordinatesMFI = function() {
- var inputFile = "./csAllMFIs.tsv";
- d3.tsv(inputFile, function(error, data) {
- var allPops = 0,
- allSamples = 0;
- if (error) {
- alert("Problem Retrieving Data");
- return;
- }
- pcAppMFI.origData = $.extend(true,[],data);
- pcAppMFI.headers = Object.keys(pcAppMFI.origData[0]);
- pcAppMFI.headers.push("EditedPopName");
- pcAppMFI.origData.forEach(function(d,idx) {
- d.idx = idx;
- d.EditedPopName = d.Population;
- d.SmpName = d.SampleName;
- pcAppMFI.selectedLines.push(idx);
- pcAppMFI.lines.push(idx);
- if (!pcAppMFI.populations.includes(d.Population)){
- pcAppMFI.populations.push(d.Population);
- }
- if (!pcAppMFI.samples.includes(d.SmpName)){
- pcAppMFI.samples.push(d.SmpName);
- }
- });
- pcAppMFI.populations = pcAppMFI.populations.sort(function(a, b){return a-b});
- pcAppMFI.allLines = pcAppMFI.origData.length;
-
- allPops = pcAppMFI.populations.length;
- allSamples = pcAppMFI.samples.length;
- for (var i = 0; i < allPops; i++) {
- pcAppMFI.selectedPopulations.push(i);
- }
- for (var i = 0; i < allSamples; i++) {
- pcAppMFI.selectedSamples.push(i);
- }
- /*
- * For the plot use only the MFI information
- * for each populations. Store in flowData
- */
- pcAppMFI.flowData = $.extend(true,[],data);
- pcAppMFI.flowData.forEach(function(d) {
- delete d['Population'];
- delete d['SampleName'];
- delete d['Percentage'];
- });
-
- displayPopTablem();
- displaySmpTablem();
- displayTableGridm();
- displayParallelPlotm();
-
- $("#resetDisplayMFIpop").on("click",function() {
- var opcty = ".8";
- for (var i = 0; i < allPops; i++) {
- pcAppMFI.selectedPopulations.push(i);
- }
- for (var i = 0; i < allSamples; i++) {
- pcAppMFI.selectedSamples.push(i);
- }
- for (var i = 0; i < pcAppMFI.allLines; i++) {
- pcAppMFI.selectedLines.push(i);
- pcAppMFI.lines.push(i);
- }
-
- $("#popSelectAllPCm").prop('checked',true);
- $(".popSelectPCm").prop("checked",true);
- $("#smpSelectAllPCm").prop('checked',true);
- $(".smpSelectPCm").prop("checked",true);
-
- $('#plotDivPCm .foreground path').css('stroke-opacity', opcty);
- $('#pcm_opacity').html("80%");
- $('#PCmline_opacity').val(0.8);
-
- displayPopTablem();
- displaySmpTablem();
- displayTableGridm();
- displayParallelPlotm();
- });
-
- $(window).on('resize',function() {
- waitForFinalEvent(function() {
- displayAllm();
- }, 500, "resizePCm");
- });
- });
-};
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/images/flowtools/barssm.png
Binary file cs_overview/static/images/flowtools/barssm.png has changed
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/images/flowtools/cs_bpt.png
Binary file cs_overview/static/images/flowtools/cs_bpt.png has changed
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/images/flowtools/edit_popdistrib.png
Binary file cs_overview/static/images/flowtools/edit_popdistrib.png has changed
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/images/flowtools/pcmfi.png
Binary file cs_overview/static/images/flowtools/pcmfi.png has changed
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/images/flowtools/pcpop.png
Binary file cs_overview/static/images/flowtools/pcpop.png has changed
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/images/flowtools/popdistrib.png
Binary file cs_overview/static/images/flowtools/popdistrib.png has changed
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/images/flowtools/stackedA.png
Binary file cs_overview/static/images/flowtools/stackedA.png has changed
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/images/flowtools/stackedB.png
Binary file cs_overview/static/images/flowtools/stackedB.png has changed
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/static/images/flowtools/stackedsm.png
Binary file cs_overview/static/images/flowtools/stackedsm.png has changed
diff -r 8c17aa8032c2 -r bca68066a957 cs_overview/templates/csOverview.template
--- a/cs_overview/templates/csOverview.template Mon Feb 27 12:48:54 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-
-
-
-CrossSample Overview
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Population Distribution
-
-
- Edit population names below:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Opacity: 80%
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Opacity: 80%
-
-
-
-
-
-
-
-
-
-
-
-
-
Display values
-
Display MFI
-
-
-
-
- Only 5 markers can be displayed at most.
-
-
-
-
-
- The number of outliers is too large to display. Representation shows randomly downsampled outliers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-