<commit_before>/**
 * Standalone Mutation View.
 *
 * This view is designed to visualize mutations in a separate page.
 *
 * options: {el: [target container]}
 *
 * @author <NAME>
 */
var StandaloneMutationView = Backbone.View.extend({
	initialize : function (options) {
		this.options = options || {};
	},
	render: function() {
		var self = this;

		// compile the template using underscore
		var template = _.template($("#standalone_mutation_view_template").html(), {});

		// load the compiled HTML into the Backbone "el"
		self.$el.html(template);

		// format after rendering
		self.format();
	},
	format: function()
	{
		var self = this;

		var fullList = self.$el.find(".mutation-data-info");
		var inputField = self.$el.find(".standalone-mutation-input");
		var visualize = self.$el.find(".submit-custom-mutations");
		var textArea = self.$el.find(".mutation-file-example");
		var toggleFullList = self.$el.find(".toggle-full-header-list");
		var toggleInputField = self.$el.find(".toggle-mutation-input-field");
		var listTriangleDown = self.$el.find(".full-header-list-expander .triangle-down");
		var inputTriangleRight = self.$el.find(".mutation-input-field-expander .triangle-right");
		var listTriangle = self.$el.find(".full-header-list-expander .triangle");
		var inputTriangle = self.$el.find(".mutation-input-field-expander .triangle");
		var inputExpander = self.$el.find(".mutation-input-field-expander");
		var loadExampleData = self.$el.find(".load-example-data-link");

		self._initInputHeaderTable();
		fullList.hide();
		inputExpander.hide();

		textArea.resizable();

		toggleFullList.click(function(event) {
			event.preventDefault();
			fullList.slideToggle();
			listTriangle.toggle();
		});

		toggleInputField.click(function(event) {
			event.preventDefault();
			inputField.slideToggle();
			inputTriangle.toggle();
		});

		listTriangleDown.hide();
		inputTriangleRight.hide();

		// make triangles clickable, too

		listTriangle.click(function(event) {
			// same as clicking on the link
			toggleFullList.click();
		});

		inputTriangle.click(function(event) {
			// same as clicking on the link
			toggleInputField.click();
		});

		loadExampleData.click(function(event) {
			event.preventDefault();
			textArea.val(_.template($("#example_mutation_data_template").html(), {}).trim());
		});

		visualize.click(function() {
			var mutationForm = self.$el.find(".mutation-file-form");

			// hide the input field and show the expander link
			inputExpander.slideDown();
			toggleInputField.click();

			// upload input data and init view
			self._postFile('echofile', new FormData(mutationForm[0]), function(data) {
				var inputVal = textArea.val();

				// if no file selected, use the text area input
				var input = _.isEmpty(data) ? inputVal : data.mutation;

				// TODO fire an event instead?
				if (_.isFunction(self._initCallback))
				{
					self._initCallback(input);
				}
			});
		});
	},
	addInitCallback: function(callback) {
		var self = this;

		self._initCallback = callback;
	},
	_initInputHeaderTable: function()
	{
		var self = this;

		// TODO add missing columns...
		var tableData = [
			{columnHeader: 'Hugo_Symbol',
				description: 'HUGO symbol for the gene',
				example: 'TP53'},
			{columnHeader: 'Protein_Change',
				description: 'Amino acid change',
				example: 'V600E'},
			{columnHeader: 'Sample_ID',
				description: 'Tumor sample barcode',
				example: 'TCGA-B5-A11E'},
			{columnHeader: 'Mutation_Type',
				description: 'Translational effect of variant allele',
				example: 'Missense_Mutation, Nonsense_Mutation, etc.'},
			{columnHeader: 'Chromosome',
				description: 'Chromosome number',
				example: 'X, Y, M, 1, 2, etc.'},
			{columnHeader: 'Start_Position',
				description: 'Lowest numeric position of the reported variant on the genomic reference sequence',
				example: '666'},
			{columnHeader: 'End_Position',
				description: 'Highest numeric position of the reported variant on the genomic reference sequence',
				example: '667'},
			{columnHeader: 'Reference_Allele',
				description: 'The plus strand reference allele at this position',
				example: 'A'},
			{columnHeader: 'Variant_Allele',
				description: 'Tumor sequencing (discovery) allele',
				example: 'C'},
			{columnHeader: 'Validation_Status',
				description: 'Second pass results from orthogonal technology',
				example: 'Valid'},
			{columnHeader: 'Mutation_Status',
				description: 'Mutation status',
				example: 'Somatic, Germline, etc.'},
			{columnHeader: 'Center',
				description: 'Genome sequencing center reporting the variant',
				example: 'mskcc.org'}
		];

		var rows = [];

		_.each(tableData, function(ele, idx) {
			rows.push([ele.columnHeader, ele.description, ele.example]);
		});
<commit_msg>changed table column descriptions for the standalone mutation page (fixed issue #593)<commit_after>/**
 * Standalone Mutation View.
 *
 * This view is designed to visualize mutations in a separate page.
 *
 * options: {el: [target container]}
 *
 * @author <NAME>
 */
var StandaloneMutationView = Backbone.View.extend({
	initialize : function (options) {
		this.options = options || {};
	},
	render: function() {
		var self = this;

		// compile the template using underscore
		var template = _.template($("#standalone_mutation_view_template").html(), {});

		// load the compiled HTML into the Backbone "el"
		self.$el.html(template);

		// format after rendering
		self.format();
	},
	format: function()
	{
		var self = this;

		var fullList = self.$el.find(".mutation-data-info");
		var inputField = self.$el.find(".standalone-mutation-input");
		var visualize = self.$el.find(".submit-custom-mutations");
		var textArea = self.$el.find(".mutation-file-example");
		var toggleFullList = self.$el.find(".toggle-full-header-list");
		var toggleInputField = self.$el.find(".toggle-mutation-input-field");
		var listTriangleDown = self.$el.find(".full-header-list-expander .triangle-down");
		var inputTriangleRight = self.$el.find(".mutation-input-field-expander .triangle-right");
		var listTriangle = self.$el.find(".full-header-list-expander .triangle");
		var inputTriangle = self.$el.find(".mutation-input-field-expander .triangle");
		var inputExpander = self.$el.find(".mutation-input-field-expander");
		var loadExampleData = self.$el.find(".load-example-data-link");

		self._initInputHeaderTable();
		fullList.hide();
		inputExpander.hide();

		textArea.resizable();

		toggleFullList.click(function(event) {
			event.preventDefault();
			fullList.slideToggle();
			listTriangle.toggle();
		});

		toggleInputField.click(function(event) {
			event.preventDefault();
			inputField.slideToggle();
			inputTriangle.toggle();
		});

		listTriangleDown.hide();
		inputTriangleRight.hide();

		// make triangles clickable, too

		listTriangle.click(function(event) {
			// same as clicking on the link
			toggleFullList.click();
		});

		inputTriangle.click(function(event) {
			// same as clicking on the link
			toggleInputField.click();
		});

		loadExampleData.click(function(event) {
			event.preventDefault();
			textArea.val(_.template($("#example_mutation_data_template").html(), {}).trim());
		});

		visualize.click(function() {
			var mutationForm = self.$el.find(".mutation-file-form");

			// hide the input field and show the expander link
			inputExpander.slideDown();
			toggleInputField.click();

			// upload input data and init view
			self._postFile('echofile', new FormData(mutationForm[0]), function(data) {
				var inputVal = textArea.val();

				// if no file selected, use the text area input
				var input = _.isEmpty(data) ? inputVal : data.mutation;

				// TODO fire an event instead?
				if (_.isFunction(self._initCallback))
				{
					self._initCallback(input);
				}
			});
		});
	},
	addInitCallback: function(callback) {
		var self = this;

		self._initCallback = callback;
	},
	_initInputHeaderTable: function()
	{
		var self = this;

		// TODO add missing columns...
		var tableData = [
			{columnHeader: 'Hugo_Symbol',
				description: 'HUGO symbol for the gene',
				example: 'TP53'},
			{columnHeader: 'Protein_Change',
				description: 'Amino acid change',
				example: 'V600E'},
			{columnHeader: 'Sample_ID',
				description: 'Tumor sample ID',
				example: 'TCGA-B5-A11E'},
			{columnHeader: 'Mutation_Type',
				description: 'Translational effect of variant allele',
				example: 'Missense_Mutation, Nonsense_Mutation, etc.'},
			{columnHeader: 'Chromosome',
				description: 'Chromosome number',
				example: 'X, Y, M, 1, 2, etc.'},
			{columnHeader: 'Start_Position',
				description: 'Lowest numeric position of the reported variant on the genomic reference sequence',
				example: '666'},
			{columnHeader: 'End_Position',
				description: 'Highest numeric position of the reported variant on the genomic reference sequence',
				example: '667'},
			{columnHeader: 'Reference_Allele',
				description: 'The plus strand reference allele at this position',
				example: 'A'},
			{columnHeader: 'Variant_Allele',
				description: 'Tumor sequencing (discovery) allele',
				example: 'C'},
			{columnHeader: 'Validation_Status',
				description: 'Second pass results from orthogonal technology',
				example: 'Valid'},
			{columnHeader: 'Mutation_Status',
				description: 'Mutation status',
				example: 'Somatic, Germline, etc.'},
			{columnHeader: 'Center',
				description: 'Center/Institute reporting the variant',
				example: 'mskcc.org'}
		];

		var rows = [];

		_.each(tableData, function(ele, idx) {
			rows.push([ele.columnHeader, ele.description, ele.example]);
		});

{'fraction_non_alphanumeric': 0.1454318158141473, 'fraction_numerical': 0.003854568184185853, 'mean_word_length': 3.987012987012987, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5045056', 'n_tokens_mistral': 3421, 'n_tokens_neox': 2874, 'n_words': 711}