microbiome / mia

Microbiome analysis
https://microbiome.github.io/mia/
Artistic License 2.0
45 stars 25 forks source link

add informative error message for strictly-negative values in rarefyAssay #563

Closed thpralas closed 4 weeks ago

thpralas commented 1 month ago

Assays with strictly-negative values are not handled by rarefyAssay.

data(GlobalPatterns)
tse <- GlobalPatterns
matrix <- assay(tse)
matrix[1,1] <- -1
assay(tse) <- matrix
rarefyAssay(tse)

Error in sample.int(length(x), size, replace, prob) : negative probability

This PR adds an informative error message.