ChiLiubio / microeco

An R package for data analysis in microbial community ecology
GNU General Public License v3.0
185 stars 56 forks source link

trans_norm adding a new method? #241

Closed marwa38 closed 1 year ago

marwa38 commented 1 year ago

Hi Chi SRS is a method of normalization that is being used instead of rarefaction (which got huge debate against). Any possibility to add as an option? it also produces a curve as rarefaction "Analysis of species count data in ecology often requires normalization to an identical sample size. Rarefying (random subsampling without replacement), which is the current standard method for normalization, has been widely criticized for its poor reproducibility and potential distortion of the community structure. In the context of microbiome count data, researchers explicitly advised against the use of rarefying. Here we introduce a normalization method for species count data called scaling with ranked subsampling (SRS) and demonstrate its suitability for the analysis of microbial communities." from https://peerj.com/articles/9593/ It also has the shinyGo option: scripts Thanks Marwa

ChiLiubio commented 1 year ago

Thanks. The SRS method has been implemented in the rarefy_samples function of microtable class.

# first install SRS package
install.packages("SRS")
# example
library(microeco)
data(sample_info_16S)
data(otu_table_16S)
d1 <- microtable$new(sample_table = sample_info_16S, otu_table = otu_table_16S)
# rarefaction; default method
d2 <- clone(d1)
d2$rarefy_samples(sample.size = 10000)
View(d2$otu_table)
# SRS when method = "SRS"
d3 <- clone(d1)
d3$rarefy_samples(method = "SRS", sample.size = 10000)
View(d3$otu_table)
d3$sample_sums()
ChiLiubio commented 1 year ago

Sorry. A minor bug about feature names reassignment is found. I have fixed it in github.

marwa38 commented 1 year ago

Many thanks, Chi, it worked fine. I tried to plot a rarefaction curve using the following from the tutorial but it didn't work and it give an error (below). t1$plot_rarefy(color_values = rep("grey", 100), show_point = TRUE, add_fitting = FALSE, show_legend = FALSE) image

ChiLiubio commented 1 year ago

The plot_rarefy is in trans_rarefy class of mecodev package (https://chiliubio.github.io/microeco_tutorial/mecodev-package.html#trans_rarefy), not microtable class. Please check your steps.

marwa38 commented 1 year ago

Any possibility to transform a microtable to phyloseq object? I know that the other option is available from phyloseq to microtable. I am running some downstream analysis that I already have workflow for (ggplots for alpha diversity), but just need to run on the SRS output of microtable. Any help with that, please? I have been trying several things since three days, nothing seems to work.

ChiLiubio commented 1 year ago

Please try to use meco2phyloseq function of file2meco package (https://chiliubio.github.io/microeco_tutorial/file2meco-package.html#phyloseq).

marwa38 commented 1 year ago

Thank you so much, Chi.

wangcxv commented 4 months ago

@ChiLiubio Hi Chi, I am using the v1.5.0, but an error showed "Error in meco2phyloseq(dataset) : could not find function "meco2phyloseq"", I can not fix it, could you tell me how to deal with it? P.s. : similar errors as "Error: object 'trans_norm' not found". Thanks!

milyzhou commented 3 months ago

Hi chi, I want to use 'trans_norm' normalize data, a similar error as "Error: object 'trans_norm' not found". Can you check the function is working correctly? Thanks. I am using the v1.6.0v

ChiLiubio commented 3 months ago

Hi. Please use ?trans_norm to find the document.

milyzhou commented 3 months ago

1

ChiLiubio commented 3 months ago

Hi. trans_norm class is now in microeco package, not the mecodev. https://chiliubio.github.io/microeco_tutorial/other-examples-1.html#trans_norm