MicrobiomeStat
MicrobiomeStat copied to clipboard
Datatype of feature.tab not matrix after normalization
Describe the Bug When I use mStat_normalize_data() with the Rarefy-TSS method, the mStat_validate_data() function no longer passes because it doesn't recognize feature.tab as a matrix (Rule 5). When I don't use mStat_normalize_data(), all the tests pass.
Example
The following code fails at step 5 (Rule 5 failed: feature.tab should be a matrix.)
MicrobiomeData <- list(feature.tab = otu_table_matrix,
meta.dat = metadata_df,
feature.ann = taxonomy_matrix)
#normalize the data using rarefaction and total sum scaling
MicrobiomeData <- mStat_normalize_data(data.obj = MicrobiomeData, method = "Rarefy-TSS")
MicrobiomeData$data.obj.norm$feature.tab <- as.matrix(MicrobiomeData$data.obj.norm$feature.tab)
mStat_validate_data(MicrobiomeData)
However, the following code passes all validations. Furthermore, when I rarefy the data with mStat_rarefy_data(data.obj = MicrobiomeData) prior to validation, all validations pass.
MicrobiomeData <- list(feature.tab = otu_table_matrix,
meta.dat = metadata_df,
feature.ann = taxonomy_matrix)
#normalize the data using rarefaction and total sum scaling
#MicrobiomeData <- mStat_normalize_data(data.obj = MicrobiomeData, method = "Rarefy-TSS")
#MicrobiomeData$data.obj.norm$feature.tab <- as.matrix(MicrobiomeData$data.obj.norm$feature.tab)
mStat_validate_data(MicrobiomeData)
Environment Information:
- R Version: 4.2.3
- Package Version: 1.1.3