tpq / propr

[OFFICIAL] [CoDA] An R package to calculate proportionality and other measures for compositional data
69 stars 10 forks source link

Error in propr(counts, metric = "rho", ...) : Data may not contain negative measurements. #26

Closed JemmaSun closed 3 years ago

JemmaSun commented 3 years ago

Hello @tpq !

I am new to propr and is trying to calculate rho values for my data. I simply used rho_otu_mw <- perb(otu_mw, select=keep) and it works well with my test data table, which has 58 OTUs and 12 samples.

Then I used the same code for my data table, which has 1551 samples and 28710 OTUs. This time I received an error message: Error in propr(counts, metric = "rho", ...) : Data may not contain negative measurements.

I was wondering why does this happen? What should I do to fix the error?

Thank you in advance!

tpq commented 3 years ago

Thanks for your interest in propr. This error message seems to suggest to me that you have negative values in your matrix. Most often, this occurs because you have already log-transformed the data (e.g., using a DESeq2-like normalization or a CLR transformation). Could you check something like any(counts < 0)?

JemmaSun commented 3 years ago

Thanks for your interest in propr. This error message seems to suggest to me that you have negative values in your matrix. Most often, this occurs because you have already log-transformed the data (e.g., using a DESeq2-like normalization or a CLR transformation). Could you check something like any(counts < 0)?

Yes I found a negative number in my table which shouldn't been in there. Many thanks Thom!