cafferychen777 / MicrobiomeStat

Track, Analyze, Visualize: Unravel Your Microbiome's Temporal Pattern with MicrobiomeStat
https://www.microbiomestat.wiki/
31 stars 4 forks source link

"$ operator is invalid for atomic vectors" when using mStat_import_biom_as_data_obj() #51

Closed pkirti33 closed 4 months ago

pkirti33 commented 4 months ago

Describe the Bug Hello! I've been using this package as a huge resource in my project. It's incredibly easy to use and the graphs look great. However, I ran into an issue with atomic vectors when creating a mStat object from a biom object.

Reproducible Example I use the biomformat package to create my BiomData object as below:

BiomData <- make_biom(data = otu_df_biom,
                      sample_metadata = metadata_df,
                      observation_metadata = taxonomy_df_biom,
                      id = "axiom_data",
                      matrix_element_type = "int")
write_biom(BiomData, biom_file = "data_file.biom") #I truncated the filename, there is usually a full path

Then, I use the following code to create the mStat object:

biom_from_mStat <- mStat_import_biom_as_data_obj(BIOMfilename  = "data_file.biom")

Error Message Error in i$metadata$taxonomy : $ operator is invalid for atomic vectors

Environment Information:

cafferychen777 commented 4 months ago

Dear pkirti33,

Thank you for reporting this issue and providing the detailed steps to reproduce it. I really appreciate you taking the time to submit this bug report.

I have carefully reviewed the code you provided as well as the source code for the mStat_import_biom_as_data_obj() function. Based on the error message you encountered, I suspect there may be an issue with the BIOM file itself that is causing problems when mStat_import_biom_as_data_obj() tries to parse it.

To help me investigate further, would you be able to send me the "data_file.biom" file, or the original files you used as input to make_biom() and write_biom()? Having access to those files would allow me to more easily identify the root cause of the problem. Feel free to email them directly to me at cafferychen7850@gmail.com.

I realize I have not personally used the make_biom() and write_biom() functions from the biomformat package before, so being able to test with your exact input files would be very helpful for resolving this.

Please let me know if you have any other questions! I'm committed to getting to the bottom of this and will work on a fix once I can replicate the atomic vectors error you ran into.

Best regards, Caffer

pkirti33 commented 4 months ago

Hi Caffery, Thank you so much for your prompt response, and I apologize for my late one. Unfortunately, I can't send you my data to reproduce the issue, but I have solved it on my end with a workaround. Thank you!