The Drivers module is currently incompatible with certain user submitted groups. I was unable to figure out the root cause. But the problem starts here:
Using Alfredo's file the above df ends up empty. I added the below lines to return an empty df instead of triggering an error during the rest of the function:
######### needs to account for when this df has now rows ###############################
if(nrow(df) == 0) return(df)
validate(
need(!is.null(scatter_plot_df()), "Group choices incompatible with mutation choice"))
So when the df is empty the above warning message is shown instead of the image. I relaize now this is a bad warning message since the user picks a response variable, not a mutation.
Two things need to happen:
Pick a better warning.
Figure out why the function gets an empty df after filtering for complete.cases.
The Drivers module is currently incompatible with certain user submitted groups. I was unable to figure out the root cause. But the problem starts here:
build_filtered_mutation_df_per_group <- function(df,group_column,count_threshold){
df <- df %>% .[complete.cases(.),]
Using Alfredo's file the above df ends up empty. I added the below lines to return an empty df instead of triggering an error during the rest of the function:
######### needs to account for when this df has now rows ############################### if(nrow(df) == 0) return(df)
I also added the first line in this reactive.
scatter_plot_df <- reactive({ if (nrow(df_for_regression()) == 0) return(NULL) df_for_plot <- compute_driver_associations( df_for_regression(), response_var = input$response_variable, group_column = group_internal_choice(), group_options = get_unique_column_values( group_internal_choice(), subset_df())) %>% rename(label="combo",y="neglog_pval",x="effect_size") })
And finally:
validate( need(!is.null(scatter_plot_df()), "Group choices incompatible with mutation choice"))
So when the df is empty the above warning message is shown instead of the image. I relaize now this is a bad warning message since the user picks a response variable, not a mutation.
Two things need to happen: