Load a Test Dataset

Test dataset loading

This page will analyse the procedure of loading a test dataset


Load a test dataset

The test dataset list (s1TestDatasetsSelection) is populated in proteosign’s initialization by calling load_test_data.php with description_requested true. To load a test dataset hit the choose link and choose the dataset of interest. Then hitting the OK button will execute datasetDialogOK function in JS that will close the dialog box and execute postTestDatasetInfo(<dataset_description>). This will call server sided load_test_data.php with description_requested false that will force php to return all necessary information for the test dataset. postTestDatasetInfo anonymous .done function can read the returned data stored in data.queryres that might contain the following values:

"selector":["input[name='exppddata']","input[name='exptpoint']","#explbl1name_","#explbl2name_","input[name='expquantfilt']","select[name='expquantfiltlbl']","input[name='expquantfiltprot']","input[name='explbl00']","#explbl0name_","#explbl3name_","#explbl4name_","#explbl5name_","#explbl6name_"]
"value":["0","Lung_Ca_Prognosis","0","1","0","0","0","0","0","2","3","4","5"]
"file":["MQ_TMT_Stewart_et_al_evidence.txt","MQ_TMT_Stewart_et_al_proteinGroups.txt"]
"raw_file":["M456-A01-O207-T87S1-T87S2-T87S3-T88S1-T88S2-T88S3-P5329-1","M456-A02-O207-T87S1-T87S2-T87S3-T88S1-T88S2-T88S3-P5329-1","M456-A03-O207-T87S1-T87S2-T87S3-T88S1-T88S2-T88S3-P5329-1", [...]]
"brep":[1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5]
"trep":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
"frac":[1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10]
"used":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
"condition":["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"]
"option":["Rename"]
"opt_value":["0|Lung_SCC||1|Lung_SCC||2|Lung_SCC||3|Lung_ADC||4|Lung_ADC||5|Lung_ADC"]

After loading all necessary information, postTestDatasetInfo calls uploadFiles (serverSide = true) that executes uploadFiles.php server sided which copies the dataset files to the working folder of the current session. After that it does everything as when uploading manually a dataset such as defining the processing program, getting the experimental type, finding the labels contained in the files and all raw_files of the dataset. The main differenec with uploading a dataset manually is the postSuccess function of uploadFiles that is now located in postTestDatasetInfo under the .done statement. This function gets the data.queryres information to fill the dataset’s options with the predefined options fetched from testdatadb. First it gets the selector and value arrays under data.queryres and sets the relative options. The value of the DOM object associated with the first selector must take the first value under value:

$.each(data.queryres.selector, function (idx, param_selector)
	{
		// For each item denoted by [selector] set its corresponding attribute to [value]
		switch ($(param_selector).attr('type')) {
			case "checkbox":
				// Here the 0/1 means false/true
				var theval = (data.queryres.value[idx] == "0" ? false : true);
				if ($(param_selector).prop("checked") != theval) {
					$(param_selector).prop("checked", theval);
				}
				break;
			default:
				$(param_selector).val(data.queryres.value[idx]);
				break;
		}
	}); // END for each data.queryres.selector

Especially for check boxes, 0 stands for off and 1 for on. The arrays raw_files, brep, trep, frac, used, condition are also associated so that the first raw_file name stored in raw_files (raw_file[0]) has brep brep[0], trep trep[0], frac frac[0] and condition condition[0] - if the dataset is labelled the condition wil always be set to “-". Also, used[0] will tell PS if the respective raw_file is used in the analysis or not (depending on whether it is set to 1 or 0 respectively). This information is parsed to one of the most useful global arrays in PS: rawfiles_structure that is an array of associative arrays as described below:

for (var i = 0; i < data.queryres.raw_file.length; i++)
{
	// Get the rawfiles information from the database, refresh rawfile_structure
	// and then refresh the table on stage 2
	
	rawfiles_structure.push({rawfile: data.queryres.raw_file[i], biorep: data.queryres.brep[i], techrep: data.queryres.trep[i], fraction: data.queryres.frac[i], used: data.queryres.used[i]});
	if (data.queryres.condition[i] != "-")
	{
		RawFileConditions.push({name: data.queryres.raw_file[i], condition: data.queryres.condition[i]});
	}

RawFileConditions also stores all raw files with their associated conditions, this global array is also set. The following block, then, locates all entries in rawfile structure table in Stage 2 and sets the respective attributes (brep, trep etc.) one by one:

	var tds = $('tr[id="tr_' + data.queryres.raw_file[i] + '"] td');
	$(tds[1]).text(data.queryres.brep[i] == 0 ? '-' : data.queryres.brep[i]);
	$(tds[2]).text(data.queryres.trep[i] == 0 ? '-' : data.queryres.trep[i]);
	$(tds[3]).text(data.queryres.frac[i] == 0 ? '-' : data.queryres.frac[i]);
	if (data.queryres.condition[i] != "-")
	{
		$(tds[4]).text(data.queryres.condition[i]);
	}
	if (data.queryres.used[i] == 0)
	{
		$(tds[0]).css("text-decoration", "line-through");
		$(tds[1]).css("text-decoration", "line-through");
		$(tds[2]).css("text-decoration", "line-through");
		$(tds[3]).css("text-decoration", "line-through");
		if (isLabelFree == true) $(tds[4]).css("text-decoration", "line-through");
	}
}

data.queryres.option and data.queryres.opt_value are the last arrays returned from load_test_data.php. These store some special commands that might be executed to further personalize the dataset such as merging (renaming) the labels, label swapping etc. These commands are described in The web interface - main procedures - 1 and in fact set a value to some PS global arrays. In the example above, data.queryres.option[0] is set to Rename so RenameArray will be set to the array encoded in data.queryres.opt_value[0]. See the following block in JS for more information:

if (typeof data.queryres.option !== "undefined")
{
	for (var i = 0; i< data.queryres.option.length; i++)
	{
	    switch (data.queryres.option[i])
		{
	        (...)
	    }
	}
}

When the procedure described above is finished, rawfiles_structure is already set to the structure loaded by the test dataset, RawFileConditions contains all raw files associated with their respective conditions, all options in stage 3 are set to their predefined values, the datatable in stage 2 is refreshed to display the correct experimental structure and special commands might have altered global variables to further peronalize the dataset. The procedure above is described in the following diagram:

The algorithm of loading a test dataset