-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Datatype of feature.tab not matrix after normalization #45
Comments
Hi @pkirti33, Thank you for bringing this issue to my attention. Indeed, it was a peculiar error where the I've already pushed the update to the GitHub repository. It should be available in a few hours. Please update the MicrobiomeStat package then, and let me know if the problem persists or if there's anything else I can help you with. Best regards, |
Hello, Detach and re-install MicrobiomeStat detach("package:MicrobiomeStat", unload = TRUE)
devtools::install_github("cafferychen777/MicrobiomeStat")
library(MicrobiomeStat) Make the microbiomeData object: MicrobiomeData <- list(feature.tab = otu_table_matrix,
meta.dat = metadata_df,
feature.ann = taxonomy_matrix)
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) The error is as follows: |
Hi pkirti33, Thanks for following up and providing more details. I apologize that the issue is still not resolved. Based on the error message, it seems the root cause is that the One potential workaround is to skip the explicit normalization step. In the current version of MicrobiomeStat, almost all the functions perform "Rarefy-TSS" normalization by default under the hood. So you may be able to get the expected results without needing to call Try this simplified workflow and see if it resolves the validation error:
If the issue persists, please let me know. I'll do some further testing on my end to identify the underlying problem with Best regards, |
Thank you for your help! I'll use your recommended solution for now. |
Hi all, "Error in mStat_validate_data(MicrobiomeData_rare) : Is there any update or some alternative for Rarefy-TSS? Thank you so much! |
Hi @ctmlab4, Thanks for reaching out regarding the issue you encountered with the As a workaround for now, you have two options:
MicrobiomeData_rare <- mStat_normalize_data(data.obj = MicrobiomeData, method = "Rarefy-TSS")
MicrobiomeData_rare$feature.tab <- as.matrix(MicrobiomeData_rare$feature.tab)
mStat_validate_data(MicrobiomeData_rare) Either of these approaches should resolve the issue and allow the We appreciate your patience and understanding. We are actively working on a more permanent solution to address this issue in a future update of the MicrobiomeStat package. If you have any further questions or concerns, please don't hesitate to reach out. Best regards, |
Hi @cafferychen777, I believe I am having a similar problem as the others above. I turned my phyloseq object to a data.obj: Then I wanted to use the 'mStat_rarefy_data' command to a read depth of 100,000: Then made my rarefied_data object a matrix which passed all the rules with 'mStat_validate_data(rarefied_data)': Then I wanted to use 'mStat_calculate_alpha_diversity': So then I try: I also see this problem being addressed in #7, however reading that issue did not help me understand my issue. When I try another normalization method like "TSS": "Rule 1 passed: data.obj is a list. How do I tweak my code to be able to use different normalization methods with mStat_calculate_alpha_diversity? Should I use one of the other alpha diversity commands? Thank you for your help. MicrobiomeStat version 1.2.0 |
Hi @bark9299 @pkirti33 @ctmlab4 , I think I may have found the cause of the error. After normalizing the data using norm.data.obj <- mStat_normalize_data(data.obj, "TSS")$data.obj.norm Then, in subsequent function calls, use The reason for this is that during the normalization process, a new So your workflow should look something like this: data.obj <- mStat_convert_phyloseq_to_data_obj(physeq_final_100k)
norm.data.obj <- mStat_normalize_data(data.obj, "TSS")$data.obj.norm
mStat_validate_data(norm.data.obj)
alpha_diversity <- mStat_calculate_alpha_diversity(x = norm.data.obj$feature.tab, alpha.name = c("shannon", "simpson", "observed_species")) By using Please give this a try and let me know if it resolves the issues you were encountering. If you have any further questions or need additional assistance, don't hesitate to ask. Best regards, |
Hi Caffery, I tried it and I could do it without any problems! Thank you very much for your help! Kind regards, |
Hi @cafferychen777 , That worked for me as well. Thank you for your help and speedy reply! Best, E |
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.)
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.
Environment Information:
The text was updated successfully, but these errors were encountered: