tanaylab / metacell

Metacell - Single-cell mRNA Analysis
https://tanaylab.github.io/metacell
Other
108 stars 30 forks source link

Function `mcell_mc_plot_by_factor` depends on undeclared parameter #49

Closed tzeitim closed 3 years ago

tzeitim commented 3 years ago

Calling mcell_mc_plot_by_factor in a fresh environment returns an error:

> mcell_mc_plot_by_factor(mc_id_f, meta_field = 'batch_set_id', mat_id)
Error in png(filename = sub("ps$", "png", fn), width = w, height = h,  :
  invalid 'width' argument

This seems to happen as a result of internally looking for the mcp_heatmap_width, apparently absent by default.

> tgconfig::get_param("mcp_heatmap_width", "metacell")
NULL

A workaround is to declare mcp_heatmap_width before calling mcell_mc_plot_by_factor to make it run, e.g:

> tgconfig::set_param("mcp_heatmap_width", 1000, 'metacell')
> mcell_mc_plot_by_factor(mc_id_f, meta_field = 'batch_set_id', mat_id)

A simple internal assertion in mcell_mc_plot_by_factor should solve this.

if( is.null(tgconfig::get_param("mcp_heatmap_width", "metacell")){ 
  tgconfig::set_param("mcp_heatmap_width", 1000, 'metacell')
 } 
mcp_heatmap_width = tgconfig::get_param("mcp_heatmap_width")
akhiadber commented 3 years ago

Thanks for the opening this issue. We will change the default of mcp_heatmap_width or add an assertion.

akhiadber commented 3 years ago

The mcp_heatmap_width was added to the default parameters, thanks!