Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot_cpdb() error #110

Closed
rosanababu opened this issue May 15, 2024 · 5 comments
Closed

plot_cpdb() error #110

rosanababu opened this issue May 15, 2024 · 5 comments

Comments

@rosanababu
Copy link

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

@zktuong zktuong transferred this issue from zktuong/ktplotspy May 16, 2024
@zktuong
Copy link
Owner

zktuong commented May 16, 2024

hi @rosanababu , can i ask you to check if the column names for both your means_stat and pvals_stat are similar?

Also are the dimensions the same/similar?

@biobirds9
Copy link

hi @rosanababu , can i ask you to check if the column names for both your and are similar?means_stat``pvals_stat

Also are the dimensions the same/similar?

Hi, I have also encountered this problem and I have confirmed that the column names of both files are exactly the same, how can I fix this error?

@zktuong
Copy link
Owner

zktuong commented May 22, 2024

what if you remove the genes option?

@rosanababu
Copy link
Author

hi @rosanababu , can i ask you to check if the column names for both your means_stat and pvals_stat are similar?

Also are the dimensions the same/similar?

Hi, Thanks for your reply. Yes, the dimension and the column names for both means_stat and ovals_stat are similar. I could run it without any errors when I filtered out cells that has no UMIs using: seurat_subset <- subset(seurat, nCount_RNA > 10). Then, I created the metadata and counts matrices from seurat_subset to input CellPhoneDB. Now the outputs of CellphoneDB pvals_stat and means_stat is working fine even when I set splitkey for conditions. Thank you

@zktuong
Copy link
Owner

zktuong commented Oct 28, 2024

no more issues so i'm going to assume it working now.

@zktuong zktuong closed this as completed Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants