ShellyCoder / cellcall

inferring cell-cell communication from scRNA-seq of ligand-receptor
73 stars 20 forks source link

LR2TF error #43

Closed Felixillion closed 1 year ago

Felixillion commented 1 year ago

Hi!

When I run LR2TF I get the following error: Error in xtfrm.data.frame(x) : cannot xtfrm data frames

It has worked previously but I think it's become a problem when I recently updated from R 4.2.0 to 4.3.0. I think the error relates to using order on a data frame? https://www.r-bloggers.com/2021/02/it-has-always-been-wrong-to-call-order-on-a-data-frame/

Thanks in advance!

ShellyCoder commented 1 year ago

Hello,

Sorry for reply lately. I have changed the bug with order() in R/LR2TF.R. It seems like order can't not be use with a dataframe varible. What I have done as followed:

Original code (line 54-):

 interest_group <- myData[,paste(sender_cell, recevier_cell, sep = "-"), drop=F]
 interest_df <- interest_group[order(interest_group,decreasing = T),,drop=F]

Modified code:

  interest_group <- myData[, paste(sender_cell, recevier_cell, sep = "-"), drop = FALSE]
  sort_col <- paste(sender_cell, recevier_cell, sep = "-")
  interest_df <- interest_group[order(interest_group[[sort_col]], decreasing = TRUE), , drop = FALSE]

Thanks for your useful comment and if any problems, do not hestitate to contact with us.

Felixillion commented 1 year ago

Awesome, thanks for the fix (and the great package)!