Closed arihelrnan closed 3 years ago
Looking at your OTU table, it is not clear to me what kind of data you are using for abundance of OTUs. Are you sure they are count?
You can transform your data to relative abundance so it looks like read counts:
# Transform read counts into % relative abundances: multiply by 1000 and transform to next integer so it looks like read count
datathatyouwant = transform_sample_counts(yourtable, function(x) 100000 * x/sum(x))
otu_table(datathatyouwant) = ceiling(otu_table(datathatyouwant, "matrix")) # transform to next integer so it looks like read count
otu_table(datathatyouwant) # check otu table
Did you check the format of your tables? OTU abundance is a matrix and metadata is a table. The format need to correspond to the example given by metacoder.
Taking this workshop as a reference https://grunwaldlab.github.io/metacoder_documentation/example.html we note that the format of the otus table is different
Do you need to have the same format as in the example? in case you do, notice that to match the format you need to have the taxonomy (lineage) at the beginning before the counts. Right now you have the taxonomy after the counts
50 warnings were observed in the metamapa$data$diff_table
cannot compute exact p-value with ties
This is related to the adjustment of the multiple comparisons for p values: example
"As stated in the help page ?wilcox.test, by default wilcox.test() calculates an exact p-value if the samples contain less than 50 finite values and there are no ties. Otherwise, a normal approximation is used. In our example, the sample contains less than 50 finite values but there are ties. That’s why we see the warning message “cannot compute exact p-value with ties” above. R uses normal approximation to calculate the p-value. However, the returned p-value is different from our step-by-step calculation above, which uses the normal approximation. The reason is that the p-value is adjusted by the continuity correction which is supposed to be more accurate. We will not go into detail the concept of continuity correction here. To get the p-value we calculated above, we can use the option correct=FALSE to turn off the continuity correction:"
wilcox.test(final ~ group, correct=FALSE)
Warning in wilcox.test.default(x = c(11, 70, 75, 85, 88, 92, 96), y =
c(60, : cannot compute exact p-value with ties
Wilcoxon rank sum test
data: final by group
W = 28.5, p-value = 0.9538
alternative hypothesis: true location shift is not equal to 0
You can transform your data to relative abundance so it looks like read counts:
# Transform read counts into % relative abundances: multiply by 1000 and transform to next integer so it looks like read count datathatyouwant = transform_sample_counts(yourtable, function(x) 100000 * x/sum(x)) otu_table(datathatyouwant) = ceiling(otu_table(datathatyouwant, "matrix")) # transform to next integer so it looks like read count otu_table(datathatyouwant) # check otu table
From this step on we realized we were proposing changes and modifying the script without trying if each of the changes was working. So at this point we already changed many different things without testing them. Important that you make the change and right after you try it before going to change a new thing.
Check if the format to import the tables is correct
https://grunwaldlab.github.io/analysis_of_microbiome_community_data_in_r/03--parsing.html
I transform my data with according function calc_obs_props
which divides each sample’s counts by the total number of counts observed for each sample, resulting in a proportion. Also, it doesn't necessarily make a correction for multiple comparisons because I have only three groups. I obtain this plot:
I want to use
metacoder
library (https://grunwaldlab.github.io/metacoder_documentation/index.html) to show pairwise comparisons of communities and analyze taxonomic variables among my sample groups.The input file is OTUs_Table-norm-tax.tab and mapping-file.txt
My R script is this:
My final graphic with comparisons among groups is this:
This is an example of how must be my heat tree matrix: