drisso / zinbwave

Clone of the Bioconductor repository for the zinbwave package, see https://bioconductor.org/packages/zinbwave
43 stars 10 forks source link

zinbAIC, zinbBIC functions seems to have got the rows and columns of the data matrix switched #40

Open reubenthomas opened 5 years ago

reubenthomas commented 5 years ago

Hi Davide,

I looked at the code for the functions zinbAIC and zinbBIC. It seems like the rows and columns are switched in the if function:

if ((nSamples(model) != nrow(x))|(nFeatures(model) != ncol(x))) { stop("x and model should have the same dimensions!") }

Shouldn't the rows of the x data matrix correspond to the features (genes) and columns to the samples (cells)?

Thanks, -Reuben

drisso commented 5 years ago

Hi @reubenthomas ,

internally, a lot of the zinbwave functions have features in columns and genes in rows, hence, we developed these functions thinking in the same manner. But you're right, we should change these to behave like the other user-facing functions, assuming features in rows and samples in columns.

To be clear, if you pass a matrix with features in rows and samples in columns, it will give you the right answer, but it's somewhat inconvenient that these functions expect your data in a different format. I will change them before the next Bioc release. Thanks for noticing!