<commit_before>window.cbioportal_client = (function() {
	var raw_service = (function() {
		var getApiCallPromise = function(endpt, args) {
			var arg_strings = [];
			for (var k in args) {
				if (args.hasOwnProperty(k)) {
					arg_strings.push(k + '=' + [].concat(args[k]).join(","));
				}
			}
			var arg_string = arg_strings.join("&") || "?";
			return $.ajax({
				type: "POST",
				url: endpt,
				data: arg_string,
				dataType: "json"
			});
		};
		var functionNameToEndpoint = {
			'CancerTypes':'api/cancertypes',
			'SampleClinicalData':'api/clinicaldata/samples',
			'PatientClinicalData':'api/clinicaldata/patients',
			'SampleClinicalAttributes':'api/clinicalattributes/samples',
			'PatientClinicalAttributes':'api/clinicalattributes/patients',
			'Genes':'api/genes',
			'GeneticProfiles':'api/geneticprofiles',
			'PatientLists':'api/patientlists',
			'Patients':'api/patients',
			'GeneticProfileData':'api/geneticprofiledata',
			'Samples':'api/samples',
			'Studies':'api/studies'
		};
		var ret = {};
		for (var fn_name in functionNameToEndpoint) {
			if (functionNameToEndpoint.hasOwnProperty(fn_name)) {
				ret['get'+fn_name] = (function(endpt) {
					return function(args) {
						return getApiCallPromise(endpt, args);
					};
				})(functionNameToEndpoint[fn_name]);
			}
		}
		return ret;
	})();
	function Index(key) {
		var map = {};
		var stringSetDifference = function (A, B) {
			// In A and not in B
			var in_A_not_in_B = {};
			var i, _len;
			for (i = 0, _len = A.length; i < _len; i++) {
				in_A_not_in_B[A[i]] = true;
			}
			for (i = 0, _len = B.length; i < _len; i++) {
				in_A_not_in_B[B[i]] = false;
			}
			var ret = [];
			for (i = 0, _len = A.length; i < _len; i++) {
				if (in_A_not_in_B[A[i]]) {
					ret.push(A[i]);
				}
			}
			return ret;
		};
		this.clear = function(data, args) {
			var i;
			var _len = data.length;
			// Clear existing data for touched keys
			for (i = 0; i < _len; i++) {
				var datum_key = key(data[i], args);
				map[datum_key] = [];
			}
		};
		this.addData = function (data, args, append) {
			var i;
			var _len = data.length;
			if (!append) {
				// Clear existing data for touched keys
				for (i = 0; i < _len; i++) {
					var datum_key = key(data[i], args);
					map[datum_key] = [];
				}
			}
			// Add data
			for (i = 0; i < _len; i++) {
				var d = data[i];
				map[key(d, args)].push(d);
			}
		};
		this.getData = function (keys, datumFilter) {
			keys = keys || Object.keys(map);
			keys = [].concat(keys);
			var i, datum;
			var ret = [], _len = keys.length;
			for (i = 0; i < _len; i++) {
				datum = map[keys[i]];
				if (typeof datum !== 'undefined' && (!datumFilter || datumFilter(datum))) {
					ret = ret.concat(datum);
				}
			}
			return ret;
		};

		this.missingKeys = function (keys) {
			return stringSetDifference([].concat(keys), Object.keys(map));
		};
	};
	var keyCombinations = function(key_list_list, list_of_lists) {
		var ret = [[]];
		for (var i=0; i<key_list_list.length; i++) {
			var intermediate_ret = [];
			var key_list = key_list_list[i];
			for (var j=0; j<key_list.length; j++) {
				for (var k=0; k<ret.length; k++) {
					intermediate_ret.push(ret[k].concat([(list_of_lists ? [].concat(key_list[j]) : key_list[j])]));
				}
			}
			ret = intermediate_ret;
		}
		return ret;
	};
	function HierIndex(key) {
		var fully_loaded = {};
		var map = {};
		this.markFullyLoaded = function(key) {
			var curr_obj = fully_loaded;
			for (var i=0; i<key.length; i++) {
				if (curr_obj === true) {
					break;
				}
				var sub_key = key[i];
				if (i < key.length - 1) {
					curr_obj[sub_key] = curr_obj[sub_key] || {};
					curr_obj = curr_obj[sub_key];
				} else {
					curr_obj[sub_key] = true;
				}
			}
		};
		this.isFullyLoaded = function(key) {
			var curr_obj = fully_loaded;
			for (var i=0; i<key.length; i++) {
				if (curr_obj === true || typeof curr_obj === "undefined") {
					break;
				}
				var sub_key = key[i];
				curr_obj = curr_obj[sub_key];
			}
			return (curr_obj === true);
		};
		this.addData = function(data, args) {
			var i, _len=data.length, j;
			// Clear existing data for touched keys, and initialize map locations
			for (i = 0; i < _len; i++) {
				var datum_key = key(data[i], args);
				var map_entry = map;
				for (j = 0; j < datum_key.length; j++) {
					var sub_key = datum_key[j];
					if (j < datum_key.length - 1) {
						map_entry[sub_key] = map_entry[sub_key] || {};
					} else {
						map_entry[sub_key] = [];
					}
					map_entry = map_entry[sub_key];
				}
			}
			// Add data
			for (i = 0; i < _len; i++) {
				var datum_key = key(data[i], args);
				var map_entry = map;
				for (j = 0; j < datum_key.length; j++) {
					map_entry = map_entry[datum_key[j]];
				}
				map_entry.push(data[i]);
			}
		};
		this.getData = function (key_list_list) {
			var intermediate = [map];
			var ret = [];
			var i, j, k;
			key_list_list = key_list_list || [];
			var key_list_index = 0;
			while (intermediate.length > 0) {
				var tmp_intermediate = [];
				for (i = 0; i<intermediate.length; i++) {
					var obj = intermediate[i];
					if (Object.prototype.toString.call(obj) === '[object Array]') {
						ret = ret.concat(obj);
					} else {
                                                var keys = key_list_list[key_list_index] || Object.keys(obj);
                                                for (k = 0; k<keys.length; k++) {
                                                        if (obj.hasOwnProperty(keys[k])) {
                                                                tmp_intermediate.push(obj[keys[k]]);
                                                        }
                                                }
					}
				}
				intermediate = tmp_intermediate;
				key_list_index += 1;
			}<commit_msg>Fix bug in client cache where if you don't specify all the keys, it doesn't give everything below<commit_after>window.cbioportal_client = (function() {
	var raw_service = (function() {
		var getApiCallPromise = function(endpt, args) {
			var arg_strings = [];
			for (var k in args) {
				if (args.hasOwnProperty(k)) {
					arg_strings.push(k + '=' + [].concat(args[k]).join(","));
				}
			}
			var arg_string = arg_strings.join("&") || "?";
			return $.ajax({
				type: "POST",
				url: endpt,
				data: arg_string,
				dataType: "json"
			});
		};
		var functionNameToEndpoint = {
			'CancerTypes':'api/cancertypes',
			'SampleClinicalData':'api/clinicaldata/samples',
			'PatientClinicalData':'api/clinicaldata/patients',
			'SampleClinicalAttributes':'api/clinicalattributes/samples',
			'PatientClinicalAttributes':'api/clinicalattributes/patients',
			'Genes':'api/genes',
			'GeneticProfiles':'api/geneticprofiles',
			'PatientLists':'api/patientlists',
			'Patients':'api/patients',
			'GeneticProfileData':'api/geneticprofiledata',
			'Samples':'api/samples',
			'Studies':'api/studies'
		};
		var ret = {};
		for (var fn_name in functionNameToEndpoint) {
			if (functionNameToEndpoint.hasOwnProperty(fn_name)) {
				ret['get'+fn_name] = (function(endpt) {
					return function(args) {
						return getApiCallPromise(endpt, args);
					};
				})(functionNameToEndpoint[fn_name]);
			}
		}
		return ret;
	})();
	function Index(key) {
		var map = {};
		var stringSetDifference = function (A, B) {
			// In A and not in B
			var in_A_not_in_B = {};
			var i, _len;
			for (i = 0, _len = A.length; i < _len; i++) {
				in_A_not_in_B[A[i]] = true;
			}
			for (i = 0, _len = B.length; i < _len; i++) {
				in_A_not_in_B[B[i]] = false;
			}
			var ret = [];
			for (i = 0, _len = A.length; i < _len; i++) {
				if (in_A_not_in_B[A[i]]) {
					ret.push(A[i]);
				}
			}
			return ret;
		};
		this.clear = function(data, args) {
			var i;
			var _len = data.length;
			// Clear existing data for touched keys
			for (i = 0; i < _len; i++) {
				var datum_key = key(data[i], args);
				map[datum_key] = [];
			}
		};
		this.addData = function (data, args, append) {
			var i;
			var _len = data.length;
			if (!append) {
				// Clear existing data for touched keys
				for (i = 0; i < _len; i++) {
					var datum_key = key(data[i], args);
					map[datum_key] = [];
				}
			}
			// Add data
			for (i = 0; i < _len; i++) {
				var d = data[i];
				map[key(d, args)].push(d);
			}
		};
		this.getData = function (keys, datumFilter) {
			keys = keys || Object.keys(map);
			keys = [].concat(keys);
			var i, datum;
			var ret = [], _len = keys.length;
			for (i = 0; i < _len; i++) {
				datum = map[keys[i]];
				if (typeof datum !== 'undefined' && (!datumFilter || datumFilter(datum))) {
					ret = ret.concat(datum);
				}
			}
			return ret;
		};

		this.missingKeys = function (keys) {
			return stringSetDifference([].concat(keys), Object.keys(map));
		};
	};
	var keyCombinations = function(key_list_list, list_of_lists) {
		var ret = [[]];
		for (var i=0; i<key_list_list.length; i++) {
			var intermediate_ret = [];
			var key_list = key_list_list[i];
			for (var j=0; j<key_list.length; j++) {
				for (var k=0; k<ret.length; k++) {
					intermediate_ret.push(ret[k].concat([(list_of_lists ? [].concat(key_list[j]) : key_list[j])]));
				}
			}
			ret = intermediate_ret;
		}
		return ret;
	};
	function HierIndex(key) {
		var fully_loaded = {};
		var map = {};
		this.markFullyLoaded = function(key) {
			var curr_obj = fully_loaded;
			for (var i=0; i<key.length; i++) {
				if (curr_obj === true) {
					break;
				}
				var sub_key = key[i];
				if (i < key.length - 1) {
					curr_obj[sub_key] = curr_obj[sub_key] || {};
					curr_obj = curr_obj[sub_key];
				} else {
					curr_obj[sub_key] = true;
				}
			}
		};
		this.isFullyLoaded = function(key) {
			var curr_obj = fully_loaded;
			for (var i=0; i<key.length; i++) {
				if (curr_obj === true || typeof curr_obj === "undefined") {
					break;
				}
				var sub_key = key[i];
				curr_obj = curr_obj[sub_key];
			}
			return (curr_obj === true);
		};
		this.addData = function(data, args) {
			var i, _len=data.length, j;
			// Clear existing data for touched keys, and initialize map locations
			for (i = 0; i < _len; i++) {
				var datum_key = key(data[i], args);
				var map_entry = map;
				for (j = 0; j < datum_key.length; j++) {
					var sub_key = datum_key[j];
					if (j < datum_key.length - 1) {
						map_entry[sub_key] = map_entry[sub_key] || {};
					} else {
						map_entry[sub_key] = [];
					}
					map_entry = map_entry[sub_key];
				}
			}
			// Add data
			for (i = 0; i < _len; i++) {
				var datum_key = key(data[i], args);
				var map_entry = map;
				for (j = 0; j < datum_key.length; j++) {
					map_entry = map_entry[datum_key[j]];
				}
				map_entry.push(data[i]);
			}
		};
		this.getData = function (key_list_list) {
			var intermediate = [map];
			var ret = [];
			var i, j, k;
			key_list_list = key_list_list || [];
			var key_list_index = 0;
			while (intermediate.length > 0) {
				var tmp_intermediate = [];
				for (i = 0; i<intermediate.length; i++) {
					var obj = intermediate[i];
					if (Object.prototype.toString.call(obj) === '[object Array]') {
						ret = ret.concat(obj);
					} else {
						var keys = (key_list_index < key_list_list.length && key_list_list[key_list_index]) || Object.keys(obj);
						for (k = 0; k<keys.length; k++) {
							if (obj.hasOwnProperty(keys[k])) {
								tmp_intermediate.push(obj[keys[k]]);
							}
						}
					}
				}
				intermediate = tmp_intermediate;
				key_list_index += 1;
			}
{'fraction_non_alphanumeric': 0.1674682990817665, 'fraction_numerical': 0.004022737210319195, 'mean_word_length': 2.5681747269890796, 'pattern_counts': {'":': 0, '<': 44, '<?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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2645651', 'n_tokens_mistral': 5224, 'n_tokens_neox': 4200, 'n_words': 911}