//1 define the type of normalization to use for each heatmap analysis_specs = [ [ "QI", allQI, StraightDifference ], [ "QESV", allQESV, StraightDifference ], [ "Phi2", allPhi2, LogFoldChange ] ] //2 create and empty array to contain results, and begin looping though our analysis_specs final_results = [] for( var i = 0 ; i < analysis_specs.length ; i++ ){ paramName = analysis_specs[i][0] normalizationType = analysis_specs[i][2] phi2_raw = analysis_specs[i][1] //3 for each iteration of the loop, apply the normalization process //this is how you would load raw data from harddrive //rawDataPath = rawDataFolder + "\\multi-all" + paramName + "_FILTERED_completed_LJS.txt" //phi2_raw = GLOBAL.loadHeatMapFromPath(rawDataPath) //normalize the experimetn groups against the control groups refTable = new ReferenceTable( phi2_raw, "Flat" ) phi2_lfc = new HeatmapNormalizer( phi2_raw ).buildNormalizedMap( normalizationType, refTable ) //replace infinite values with blanks phi2_lfc.replaceInfiniteValues( NaN ) //separate control and experiment groups into different heatmaps sel_wt = phi2_lfc.searchRowLabels( "col-0" ) phi2_lfc_wt = phi2_lfc.getSubMap( sel_wt ) phi2_lfc_mt = phi2_lfc.getSubMap( phi2_lfc.invert( sel_wt ) ) //create control and experiemnt heatmaps averaged by plantName/Flat phi2_lfc_mt_avg = new HeatmapAverager( phi2_lfc_mt ).getAveragedMap( "PlantName", "flat" ) phi2_lfc_wt_avg = new HeatmapAverager( phi2_lfc_wt ).getAveragedMap( "PlantName", "flat" ) //create another heatmap averaged by AtNumber phi2_lfc_mt_avg_atg = new HeatmapAverager( phi2_lfc_mt_avg ).getAveragedMap( "AtNumber" ) //reaplcea blanks with zeroes phi2_lfc_mt_avg.replaceValues( function(x){ return x=NaN; }, 0 ) phi2_lfc_wt_avg.replaceValues( function(x){ return x=NaN; }, 0 ) phi2_lfc_mt_avg_atg.replaceValues( function(x){ return x=NaN; }, 0 ) //delete non-relevant rows phi2_lfc_mt_avg.deleteRows( phi2_lfc_mt_avg.searchRowLabels( "null" ) ) phi2_lfc_wt_avg.deleteRows( phi2_lfc_wt_avg.searchRowLabels( "null" ) ) phi2_lfc_mt_avg_atg.deleteRows( phi2_lfc_mt_avg_atg.searchRowLabels( "null" ) ) //display results in UI phi2_lfc_mt_avg.setTitle( normalizationType + " " + paramName + " - mutants averaged by PlantName/Flat" ) phi2_lfc_wt_avg.setTitle( normalizationType + " " + paramName + " - wildtypes averaged by PlantName/Flat" ) phi2_lfc_mt_avg_atg.setTitle( normalizationType + " " + paramName + " - mutants averaged by AtNumber" ) GLOBAL.display( phi2_lfc_mt_avg, phi2_lfc_wt_avg, phi2_lfc_mt_avg_atg ) //save the atnumber result for the significance analysis (outside of this loop) final_results[i] = phi2_lfc_mt_avg_atg } //4 create and display a combined figure using significance analysis sigAnalysis = new SignificanceAnalysis( final_results ) saResults = sigAnalysis.getAnalysisResult_PercentileThreshold( Absolute, Entire_Map, Distinct_Colors, false, true, 5.0, 1) GLOBAL.display( saResults )