<commit_before>'use strict';

var getLabel = require('./getLabel');
require('../css/chart.css');

var {hexToRGB, colorStr} = require ('./color_helper');
var d3 = require('d3-scale');
var domHelper = require('./dom_helper');
var highcharts = require('./highcharts');
var Highcharts = highcharts.Highcharts;
var highchartsHelper =  require ('./highcharts_helper');
var _ = require('./underscore_ext');
var colorScales = require ('./colorScales');
var customColors = {};
var jStat = require('jStat').jStat;

var getCustomColor = (fieldSpecs, fields, datasets) =>
	(fieldSpecs.length === 1 && fields.length === 1) ?
		_.getIn(datasets, [fieldSpecs[0].dsID, 'customcolor', fieldSpecs[0].fields[0]], null) : null;

module.exports = function (root, callback, sessionStorage) {
	var xdiv, ydiv, // x y and color axis dropdown
		colorDiv, colorElement,
		leftContainer, rightContainer,
		xenaState = sessionStorage.xena ? JSON.parse(sessionStorage.xena) : undefined,
		cohort, samplesLength, cohortSamples, updateArgs, update,
		normalizationState = {},
		expState = {};

		if (xenaState)	{
			cohort = xenaState.cohort;
			samplesLength = xenaState.samples.length;
			cohortSamples = xenaState.cohortSamples;
			normalizationState = _.getIn(xenaState, ['chartState', 'normalizationState'], {});
			expState = _.getIn(xenaState, ['chartState', 'expState'], {});
		}
		updateArgs = [cohort, samplesLength, cohortSamples];

	function setStorage(state) {
		sessionStorage.xena = JSON.stringify(state);
		callback(['chart-set-state', state.chartState]);
	}

	function columnLabel (i, colSetting) {
		var label = colSetting.user.fieldLabel;
		if (colSetting.fieldType === "genes" || colSetting.fieldType === "segmented") {
			label += " (gene average)";
		}
		return "column " + getLabel(i) + ": " + label;
	}

	function buildNormalizationDropdown() {
		var dropDownDiv, option,
			dropDown = [{
					"value": "none",
					"text": "off",
					"index": 0
				}, //no normalization
				{
					"value": "subset",<commit_msg>chart wording change "gene average"-> "average"<commit_after>'use strict';

var getLabel = require('./getLabel');
require('../css/chart.css');

var {hexToRGB, colorStr} = require ('./color_helper');
var d3 = require('d3-scale');
var domHelper = require('./dom_helper');
var highcharts = require('./highcharts');
var Highcharts = highcharts.Highcharts;
var highchartsHelper =  require ('./highcharts_helper');
var _ = require('./underscore_ext');
var colorScales = require ('./colorScales');
var customColors = {};
var jStat = require('jStat').jStat;

var getCustomColor = (fieldSpecs, fields, datasets) =>
	(fieldSpecs.length === 1 && fields.length === 1) ?
		_.getIn(datasets, [fieldSpecs[0].dsID, 'customcolor', fieldSpecs[0].fields[0]], null) : null;

module.exports = function (root, callback, sessionStorage) {
	var xdiv, ydiv, // x y and color axis dropdown
		colorDiv, colorElement,
		leftContainer, rightContainer,
		xenaState = sessionStorage.xena ? JSON.parse(sessionStorage.xena) : undefined,
		cohort, samplesLength, cohortSamples, updateArgs, update,
		normalizationState = {},
		expState = {};

		if (xenaState)	{
			cohort = xenaState.cohort;
			samplesLength = xenaState.samples.length;
			cohortSamples = xenaState.cohortSamples;
			normalizationState = _.getIn(xenaState, ['chartState', 'normalizationState'], {});
			expState = _.getIn(xenaState, ['chartState', 'expState'], {});
		}
		updateArgs = [cohort, samplesLength, cohortSamples];

	function setStorage(state) {
		sessionStorage.xena = JSON.stringify(state);
		callback(['chart-set-state', state.chartState]);
	}

	function columnLabel (i, colSetting) {
		var label = colSetting.user.fieldLabel;
		if (colSetting.fieldType === "genes" || colSetting.fieldType === "segmented") {
			label += " (average)";
		}
		return "column " + getLabel(i) + ": " + label;
	}

	function buildNormalizationDropdown() {
		var dropDownDiv, option,
			dropDown = [{
					"value": "none",
					"text": "off",
					"index": 0
				}, //no normalization
				{
					"value": "subset",
{'fraction_non_alphanumeric': 0.16275043284689586, 'fraction_numerical': 0.003957457333663122, 'mean_word_length': 4.648044692737431, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1616473', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1281, 'n_words': 289}