<commit_before>define([
	"dojo/_base/declare", "dojo/on", "dojo/dom-construct", "dojo/dom-attr",
	"dojo/_base/lang", "dojo/mouse", "dijit/_WidgetBase", "dijit/_WidgetsInTemplateMixin",
	"dojo/topic", "dijit/_TemplatedMixin", "dojo/text!./templates/AdvancedDownload.html",
	"dijit/Dialog", "dojo/query"

], function(declare, on, domConstruct, domAttr,
			lang, Mouse, WidgetBase, WidgetsInTemplate,
			Topic, TemplatedMixin, Template,
			Dialog){
	return declare([WidgetBase, TemplatedMixin, WidgetsInTemplate], {
		templateString: Template,
		"downloadableConfig": {
			"genome_data": {
				"label": "Genomes",
				dataType: "genome",
				tableData: true,
				downloadTypes: [
					{"label": "Genomic Sequences in FASTA (*.fna)", type: "fna", skipAnnotation: true},
					{"label": "Protein Sequences in FASTA (*.faa)", type: "faa"},
					{"label": "Genomic features in Generic Feature Format format (*.gff)", type: "gff"},
					{"label": "Genomic features in tab-delimited format (*.features.tab)", type: "features.tab"},
					{"label": "DNA Sequences of Protein Coding Genes (*.ffn)", type: "ffn"},
					{"label": "DNA Sequences of RNA Coding Genes (*.frn)", type: "frn"},
					{"label": "Pathway assignments in tab-delimited format (*.pathway.tab)", type: "pathway.tab"}
				]
			},
			"sequence_data": {
				"label": "Sequences",
				tableData: true
			},
			"feature_data": {
				"label": "Features",
				tableData: true
			},
			"spgene_data": {
				"label": "Specialty Genes",
				tableData: true
			},
			"pathway_data": {
				"label": "Pathways",
				tableData: true
			},
			"default": {
				"label": "Items",
				tableData: true
			}
		},
		download: function(){
			var ids = this.selection.map(function(x){
				return x.genome_id;
			});
			console.log("Downloading genomes: ", ids);
			var types = [];
			dojo.query("input", this.fileTypesTable).forEach(function(node){
				console.log("node: ", node, node.checked, node.value);
				if(node.checked){

					types.push(node.value);
				}
			});
			//new Dialog({content: "Download: " + ids + "\nTypes: " + types}).show();
			var baseUrl = (window.App.dataServiceURL ? (window.App.dataServiceURL) : "")
			var conf = this.downloadableConfig[this.containerType]

			var map = {}
			conf.downloadTypes.forEach(function(type){
				map[type.type] = type;
			})

			var annotation = this.annotationType.get('value');

			types = types.map(function(type){
				if(map[type] && (map[type].skipAnnotation || annotation == "all" || !annotation)){
					return "*." + type;
				}else{
					return "*" + annotation + "." + type;
				}
			})
<commit_msg>make sure at least one file type is selected.<commit_after>define([
	"dojo/_base/declare", "dojo/on", "dojo/dom-construct", "dojo/dom-attr",
	"dojo/_base/lang", "dojo/mouse", "dijit/_WidgetBase", "dijit/_WidgetsInTemplateMixin",
	"dojo/topic", "dijit/_TemplatedMixin", "dojo/text!./templates/AdvancedDownload.html",
	"dijit/Dialog", "dojo/query"

], function(declare, on, domConstruct, domAttr,
			lang, Mouse, WidgetBase, WidgetsInTemplate,
			Topic, TemplatedMixin, Template,
			Dialog){
	return declare([WidgetBase, TemplatedMixin, WidgetsInTemplate], {
		templateString: Template,
		"downloadableConfig": {
			"genome_data": {
				"label": "Genomes",
				dataType: "genome",
				tableData: true,
				downloadTypes: [
					{"label": "Genomic Sequences in FASTA (*.fna)", type: "fna", skipAnnotation: true},
					{"label": "Protein Sequences in FASTA (*.faa)", type: "faa"},
					{"label": "Genomic features in Generic Feature Format format (*.gff)", type: "gff"},
					{"label": "Genomic features in tab-delimited format (*.features.tab)", type: "features.tab"},
					{"label": "DNA Sequences of Protein Coding Genes (*.ffn)", type: "ffn"},
					{"label": "DNA Sequences of RNA Coding Genes (*.frn)", type: "frn"},
					{"label": "Pathway assignments in tab-delimited format (*.pathway.tab)", type: "pathway.tab"}
				]
			},
			"sequence_data": {
				"label": "Sequences",
				tableData: true
			},
			"feature_data": {
				"label": "Features",
				tableData: true
			},
			"spgene_data": {
				"label": "Specialty Genes",
				tableData: true
			},
			"pathway_data": {
				"label": "Pathways",
				tableData: true
			},
			"default": {
				"label": "Items",
				tableData: true
			}
		},
		download: function(){
			var ids = this.selection.map(function(x){
				return x.genome_id;
			});
			console.log("Downloading genomes: ", ids);
			var types = [];
			dojo.query("input", this.fileTypesTable).forEach(function(node){
				console.log("node: ", node, node.checked, node.value);
				if(node.checked){

					types.push(node.value);
				}
			});
			if(types.length == 0){
				var msg = "YOU NEED TO SELECT AT LEAST 1 FILE TYPE.";
				new Dialog({title: "Notice", content: msg}).show();
				return;
			}
			//new Dialog({content: "Download: " + ids + "\nTypes: " + types}).show();
			var baseUrl = (window.App.dataServiceURL ? (window.App.dataServiceURL) : "")
			var conf = this.downloadableConfig[this.containerType]

			var map = {}

			conf.downloadTypes.forEach(function(type){
				map[type.type] = type;
			})

			var annotation = this.annotationType.get('value');

			types = types.map(function(type){
				if(map[type] && (map[type].skipAnnotation || annotation == "all" || !annotation)){
					return "*." + type;
				}else{
					return "*" + annotation + "." + type;
				}
			})

{'fraction_non_alphanumeric': 0.1816326530612245, 'fraction_numerical': 0.00037105751391465676, 'mean_word_length': 3.599829351535836, 'pattern_counts': {'":': 40, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7377565', 'n_tokens_mistral': 2216, 'n_tokens_neox': 1798, 'n_words': 403}