ktplots icon indicating copy to clipboard operation
ktplots copied to clipboard

plot_cpdb() error

Open rosanababu opened this issue 9 months ago • 4 comments

Hi,

Many thanks for the amazing tool. I'm using ktplots and cellphoneDB for the first time. I've used cpdb_statistical_analysis_method from latest cellphoneDB v5 to run statistical analysis. plot_cpdb_heatmap() works fine on the results, unfortunately dot plot plot_cpdb() is showing error. Please could you help to solve the following error from plot_cpdb().

Dot plot

plot_cpdb(

  • scdata=sce, 
    
  • cell_type1="Pericyte",
    
  • cell_type2=".",  
    
  • celltype_key="Cell_type",
    
  • means=means_stat,
    
  • pvals=pvals_stat,
    
  • genes=c("TNFRSF13B", "STAT5A"),
    
  • title="interacting interactions!",
    
  • ) Error in dplyr::left_join(): ! Can't join x$Var2 with y$Var2 due to incompatible types. ℹ x$Var2 is a . ℹ y$Var2 is a <factor<4887b>>. Run rlang::last_trace() to see where the error occurred.

rlang::last_trace() <error/dplyr_error_join_incompatible_type> Error in dplyr::left_join(): ! Can't join x$Var2 with y$Var2 due to incompatible types. ℹ x$Var2 is a . ℹ y$Var2 is a <factor<4887b>>.


Backtrace: ▆

  1. └─ktplots::plot_cpdb(...)
  2. ├─dplyr::left_join(df_means, df_pvals, by = c("Var1", "Var2"))
  3. └─dplyr:::left_join.data.frame(df_means, df_pvals, by = c("Var1", "Var2")) Run rlang::last_trace(drop = FALSE) to see 22 hidden frames.

rlang::last_trace(drop = FALSE) <error/dplyr_error_join_incompatible_type> Error in dplyr::left_join(): ! Can't join x$Var2 with y$Var2 due to incompatible types. ℹ x$Var2 is a . ℹ y$Var2 is a <factor<4887b>>.


Backtrace: ▆

  1. ├─ktplots::plot_cpdb(...)
  2. │ ├─dplyr::left_join(df_means, df_pvals, by = c("Var1", "Var2"))
  3. │ └─dplyr:::left_join.data.frame(df_means, df_pvals, by = c("Var1", "Var2"))
  4. │ └─dplyr:::join_mutate(...)
  5. │ └─dplyr:::join_cast_common(x_key, y_key, vars, error_call = error_call)
  6. │ ├─rlang::try_fetch(...)
  7. │ │ └─base::withCallingHandlers(...)
  8. │ └─vctrs::vec_ptype2(x, y, x_arg = "", y_arg = "", call = error_call)
  9. ├─vctrs (local) <fn>()
  10. │ └─vctrs::vec_default_ptype2(...)
  11. │ ├─base::withRestarts(...)
  12. │ │ └─base (local) withOneRestart(expr, restarts[[1L]])
  13. │ │ └─base (local) doWithOneRestart(return(expr), restart)
  14. │ └─vctrs::stop_incompatible_type(...)
  15. │ └─vctrs:::stop_incompatible(...)
  16. │ └─vctrs:::stop_vctrs(...)
  17. │ └─rlang::abort(message, class = c(class, "vctrs_error"), ..., call = call)
  18. │ └─rlang:::signal_abort(cnd, .file)
  19. │ └─base::signalCondition(cnd)
  20. └─rlang (local) <fn>(<vctrs__2>)
  21. └─handlers[1L]
  22. └─dplyr:::rethrow_error_join_incompatible_type(cnd, vars, error_call)
    
  23.   └─dplyr:::stop_join(...)
    
  24.     └─dplyr:::stop_dplyr(...)
    
  25.       └─rlang::abort(...)
    

Kind regards, RB

rosanababu avatar May 15 '24 17:05 rosanababu