bnprks / BPCells

Scaling Single Cell Analysis to Millions of Cells
https://bnprks.github.io/BPCells
Other
134 stars 11 forks source link

checking data type before merging different matrices #70

Closed Yunuuuu closed 5 months ago

Yunuuuu commented 5 months ago

fix https://github.com/bnprks/BPCells/issues/68

Yunuuuu commented 5 months ago

But it's hard to deal with [<- method since it use dgCMatrix class object as a substituted value, which only accept numeric data type, this means [<- cannot work for integer IterableMatrix with usual R matrix.

Yunuuuu commented 5 months ago

Some ways to deal with [<-

  1. always keep the data type of x, and use convert_type for value argument before proceeding.
  2. provide another argument mode or type, let user to choose the final ouput matrix_type, this can also be applied to rbind and cbind function.
bnprks commented 5 months ago

Thanks for spotting the bug and suggesting a fix! I've added a regression test to cover the fixed error, and gone with your first suggested strategy for handling [<- (convert to match x, and output a warning if value gets automatically converted)