Skip to content

Commit

Permalink
fixed rendering of un-clustered heatmaps (modified dendrogram rendering)
Browse files Browse the repository at this point in the history
  • Loading branch information
cornhundred committed Mar 14, 2018
1 parent 3e51200 commit bf9eeb2
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 53 deletions.
39 changes: 27 additions & 12 deletions clustergrammer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11523,10 +11523,20 @@ var Clustergrammer =

viz = make_cat_params(params, viz, predefined_cat_colors);

// // always make group level dict
// params.group_level = {};

if (_.has(params, 'group_level') == false) {
if (viz.show_dendrogram) {
params.group_level = {};
}

// preventing error when un-clustered, above statement
// preserves dendro state while updating
if (_.has(params, 'group_level') == false) {
params.group_level = {};
}

params.group_level.row = 5;
params.group_level.col = 5;
}
Expand Down Expand Up @@ -14221,10 +14231,9 @@ var Clustergrammer =
if (params.viz.show_dendrogram) {
make_row_dendro(cgm);
make_col_dendro(cgm);
make_row_dendro_spillover(cgm);
}

make_row_dendro_spillover(cgm);

make_col_label_container(cgm);

// initial trim text
Expand Down Expand Up @@ -14254,8 +14263,10 @@ var Clustergrammer =
generate_super_labels(params);
}

// sliders should go above super labels
make_svg_dendro_sliders(cgm);
if (params.viz.show_dendrogram) {
// sliders should go above super labels
make_svg_dendro_sliders(cgm);
}

function border_colors() {
var inst_color = params.viz.super_border_color;
Expand Down Expand Up @@ -15677,14 +15688,16 @@ var Clustergrammer =

var dendro_info;

if (inst_rc === 'row') {
dendro_info = calc_row_dendro_triangles(params);
} else {
dendro_info = calc_col_dendro_triangles(params);
}
if (params.viz.show_dendrogram) {
if (inst_rc === 'row') {
dendro_info = calc_row_dendro_triangles(params);
} else {
dendro_info = calc_col_dendro_triangles(params);
}

if (d3.select(cgm.params.root + ' .' + inst_rc + '_dendro_crop_buttons').empty() === false) {
make_dendro_crop_buttons(cgm, inst_rc);
if (d3.select(cgm.params.root + ' .' + inst_rc + '_dendro_crop_buttons').empty() === false) {
make_dendro_crop_buttons(cgm, inst_rc);
}
}

// constant dendrogram opacity
Expand Down Expand Up @@ -19805,7 +19818,9 @@ var Clustergrammer =
y_offset = 0;
b_spill_container.append('g').classed('col_dendro_icons_container', true).attr('transform', 'translate(' + x_offset + ',' + y_offset + ')').append('g').classed('col_dendro_icons_group', true);

make_dendro_crop_buttons(cgm, 'col');
if (params.viz.show_dendrogram) {
make_dendro_crop_buttons(cgm, 'col');
}

var x_offset = viz.clust.margin.left + viz.clust.dim.width;
var y_offset = viz.clust.margin.top + viz.clust.dim.height;
Expand Down
14 changes: 7 additions & 7 deletions clustergrammer.min.js

Large diffs are not rendered by default.

39 changes: 27 additions & 12 deletions clustergrammer.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -11608,10 +11608,20 @@ module.exports =

viz = make_cat_params(params, viz, predefined_cat_colors);

// // always make group level dict
// params.group_level = {};

if (_.has(params, 'group_level') == false) {
if (viz.show_dendrogram) {
params.group_level = {};
}

// preventing error when un-clustered, above statement
// preserves dendro state while updating
if (_.has(params, 'group_level') == false) {
params.group_level = {};
}

params.group_level.row = 5;
params.group_level.col = 5;
}
Expand Down Expand Up @@ -14361,10 +14371,9 @@ module.exports =
if (params.viz.show_dendrogram) {
make_row_dendro(cgm);
make_col_dendro(cgm);
make_row_dendro_spillover(cgm);
}

make_row_dendro_spillover(cgm);

make_col_label_container(cgm);

// initial trim text
Expand Down Expand Up @@ -14394,8 +14403,10 @@ module.exports =
generate_super_labels(params);
}

// sliders should go above super labels
make_svg_dendro_sliders(cgm);
if (params.viz.show_dendrogram) {
// sliders should go above super labels
make_svg_dendro_sliders(cgm);
}

function border_colors() {
var inst_color = params.viz.super_border_color;
Expand Down Expand Up @@ -15873,14 +15884,16 @@ module.exports =

var dendro_info;

if (inst_rc === 'row') {
dendro_info = calc_row_dendro_triangles(params);
} else {
dendro_info = calc_col_dendro_triangles(params);
}
if (params.viz.show_dendrogram) {
if (inst_rc === 'row') {
dendro_info = calc_row_dendro_triangles(params);
} else {
dendro_info = calc_col_dendro_triangles(params);
}

if (d3.select(cgm.params.root + ' .' + inst_rc + '_dendro_crop_buttons').empty() === false) {
make_dendro_crop_buttons(cgm, inst_rc);
if (d3.select(cgm.params.root + ' .' + inst_rc + '_dendro_crop_buttons').empty() === false) {
make_dendro_crop_buttons(cgm, inst_rc);
}
}

// constant dendrogram opacity
Expand Down Expand Up @@ -20054,7 +20067,9 @@ module.exports =
y_offset = 0;
b_spill_container.append('g').classed('col_dendro_icons_container', true).attr('transform', 'translate(' + x_offset + ',' + y_offset + ')').append('g').classed('col_dendro_icons_group', true);

make_dendro_crop_buttons(cgm, 'col');
if (params.viz.show_dendrogram) {
make_dendro_crop_buttons(cgm, 'col');
}

var x_offset = viz.clust.margin.left + viz.clust.dim.width;
var y_offset = viz.clust.margin.top + viz.clust.dim.height;
Expand Down
14 changes: 7 additions & 7 deletions clustergrammer.node.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion json/mult_view.json
Original file line number Diff line number Diff line change
Expand Up @@ -9967,5 +9967,5 @@
"rankvar": 13
}
],
"enrichrgram": true
"enrichrgram": false
}
3 changes: 2 additions & 1 deletion make_clustergrammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
# net.dendro_cats('row', 5)

net.cluster(dist_type='cos',views=['N_row_sum', 'N_row_var'] , dendro=True,
sim_mat=True, filter_sim=0.1, calc_cat_pval=False, enrichrgram=True)
sim_mat=True, filter_sim=0.1, calc_cat_pval=False, enrichrgram=
False, run_clustering=True)

# write jsons for front-end visualizations
net.write_json_to_file('viz', 'json/mult_view.json', 'indent')
Expand Down
18 changes: 11 additions & 7 deletions src/dendrogram/make_dendro_triangles.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ module.exports = function make_dendro_triangles(cgm, inst_rc, is_change_group =

var dendro_info;

if (inst_rc === 'row'){
dendro_info = calc_row_dendro_triangles(params);
} else {
dendro_info = calc_col_dendro_triangles(params);
}
if (params.viz.show_dendrogram){
if (inst_rc === 'row'){
dendro_info = calc_row_dendro_triangles(params);
} else {
dendro_info = calc_col_dendro_triangles(params);
}

if (d3.select(cgm.params.root+' .'+ inst_rc +'_dendro_crop_buttons').empty() === false){
make_dendro_crop_buttons(cgm, inst_rc);
}

if (d3.select(cgm.params.root+' .'+ inst_rc +'_dendro_crop_buttons').empty() === false){
make_dendro_crop_buttons(cgm, inst_rc);
}


// constant dendrogram opacity
var inst_dendro_opacity = params.viz.dendro_opacity;

Expand Down
11 changes: 6 additions & 5 deletions src/make_viz.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ module.exports = function make_viz(cgm) {
if (params.viz.show_dendrogram){
make_row_dendro(cgm);
make_col_dendro(cgm);
make_row_dendro_spillover(cgm);
}

make_row_dendro_spillover(cgm);

make_col_label_container(cgm);

// initial trim text
Expand All @@ -64,7 +63,6 @@ module.exports = function make_viz(cgm) {
trim_text(params, this, inst_rc);
});
}

});
}

Expand All @@ -81,8 +79,11 @@ module.exports = function make_viz(cgm) {
generate_super_labels(params);
}

// sliders should go above super labels
make_svg_dendro_sliders(cgm);

if (params.viz.show_dendrogram){
// sliders should go above super labels
make_svg_dendro_sliders(cgm);
}

function border_colors() {
var inst_color = params.viz.super_border_color;
Expand Down
10 changes: 10 additions & 0 deletions src/params/calc_viz_params.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,20 @@ module.exports = function calc_viz_params(params, predefined_cat_colors=true){

viz = make_cat_params(params, viz, predefined_cat_colors);

// // always make group level dict
// params.group_level = {};

if (_.has(params, 'group_level') == false){
if (viz.show_dendrogram){
params.group_level = {};
}

// preventing error when un-clustered, above statement
// preserves dendro state while updating
if (_.has(params, 'group_level') == false){
params.group_level = {};
}

params.group_level.row = 5;
params.group_level.col = 5;
}
Expand Down
4 changes: 3 additions & 1 deletion src/spillover/main_spillover.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ module.exports = function Spillover(cgm) {
.append('g')
.classed('col_dendro_icons_group', true);

make_dendro_crop_buttons(cgm, 'col');
if (params.viz.show_dendrogram){
make_dendro_crop_buttons(cgm, 'col');
}

var x_offset = viz.clust.margin.left + viz.clust.dim.width;
var y_offset = viz.clust.margin.top + viz.clust.dim.height;
Expand Down

0 comments on commit bf9eeb2

Please sign in to comment.