funkyheatmap = (await require('d3@7').then(d3 => {
window.d3 = d3;
window._ = _;
//return import('https://unpkg.com/funkyheatmapjs@0.2.5');
//return import('https://github.com/SydneyBioX/SpatialSimbench_website/blob/main/js/funkyheatmap.js')
return import("../../js/funkyheatmap.js")
})).default;
Results
final_data_raw = FileAttachment("./data/final_data3.csv").csv()
column_info = await FileAttachment("./data/column_info_v2.csv").csv()
column_groups = await FileAttachment("./data/column_groups.JSON").json()
palettes = [
{
overall: "Greys",
palette1: "Blues",
palette2: "Reds",
palette3: "Yellows",
palette4: "YlOrBr",
NA: "Greys",
white6black4: "Greys",
error_reason: {
colors: ["#8DD3C7", "#FFFFB3", "#BEBADA", "#FFFFFF"],
names: ["Memory limit exceeded", "Time limit exceeded", "Execution error", "No error"]
}
}
][0]
function removeSuffix(data, column, suffix) {
return data.map(row => {
if (row[column].endsWith(suffix)) {
row[column] = row[column].replace(new RegExp(suffix + '$'), ''); // Remove the suffix
}
return row;
});
}
function removeLastNColumns(data, n) {
if (data.length === 0 || n <= 0) return data;
// Extract the keys of the columns
const keys = Object.keys(data[0]);
// Determine the columns to keep
const columnsToKeep = keys.slice(0, -n);
// Filter columns for each row
return data.map(row => {
const newRow = {};
columnsToKeep.forEach(key => {
newRow[key] = row[key];
});
return newRow;
});
}
final_data = removeSuffix(final_data_raw, "method", "_rf");
//console.log(final_data)
// Remove the last 4 columns from the data
filteredData = removeLastNColumns(final_data, 6);
//console.log(filteredData)
function removeLastNItems(array, n) {
return array.slice(0, -n);
}
// Remove the last 4 items
filteredColumnInfo = removeLastNItems(column_info, 12);
filteredColumnGroups = removeLastNItems(column_groups, 2);
Results - Heatmap
function transpose_list_of_objects(list) {
return Object.fromEntries(Object.keys(list[0]).map(key => [key, list.map(d => d[key])]))
}
funkyheatmap(
transpose_list_of_objects(final_data),
transpose_list_of_objects(column_info),
[],
transpose_list_of_objects(column_groups),
[],
palettes,
{
fontSize: 12,
rowHeight: 26,
rootStyle: 'max-width: none',
colorByRank: true
}
);
Results - Table
:::