ggloor / ALDEx2_dev

ALDEx tool to examine compositional high-throughput sequence data with Welch's t-test
GNU Affero General Public License v3.0
12 stars 6 forks source link

code for obtaining all pairwise comparisons under glm module #33

Closed carburator closed 1 year ago

carburator commented 2 years ago

Hi,

I'm using the glm functionality to analyze a microbiome dataset which has 3 factors: fed/unfed (2 levels), time (9 levels), and location within the GI tract (4 levels). I would like to implement a model similar to a 3-way ANOVA, and create plots which show the number of differentially abundant taxa for each factor.

Here are summaries of my asv and metadata dataframes:

str(asv_trans) 'data.frame': 651 obs. of 367 variables: $ AC1 : int 0 0 0 0 0 0 0 0 0 0 ... $ AC10 : int 0 0 0 0 0 0 0 0 0 803 ... $ AC109: int 0 0 0 0 0 0 0 0 0 0 ... $ AC11 : int 0 0 25 0 0 0 0 0 0 0 ... $ AC110: int 0 0 0 0 0 0 0 0 0 0 ...

str(meta) 'data.frame': 367 obs. of 4 variables: $ sample : chr "AC1" "AC10" "AC109" "AC11" ... $ days : chr "d01" "d01" "d01" "d02" ... $ treatment: chr "NF" "F" "NF" "NF" ... $ tissue : chr "CE_C" "CE_C" "IL_C" "CE_C" ...

So far I ran:

mm<-model.matrix(~meta$treatment + meta$tissue + meta$days) x <- aldex.clr(asv_trans, mm, mc.samples=128, denom="all", verbose=T) glm.test <- aldex.glm(x, mm) glm.effect <- aldex.glm.effect(x)

I believe results contain metrics for each model term coefficient (which are also pairwise comparisons for all levels of a treatment against the first treatment level). However, I am interested in:

  1. Creating a plot of taxa which are differentially abundant across each factor (3 plots total: time, fed/unfed, gut location)

  2. Obtaining results from all pairwise comparisons, not just those against the reference level. I see in a prior post that obtaining a complete set of results may be achievable by changing how the model is specified, but I am unsure how to code this using glm, I have only ever done a similar analysis using anova functions in R. Could you please provide an example of how to run this in aldex2?

Many thanks!

LeandroD94 commented 1 year ago

Hi everybody,

I was going to ask the same exact thing! I hope that this old issue (2022) will get a reply soon.

ggloor commented 1 year ago

Unfortunately, I'm not able to consult on experimental design. If you consult with a statistician and give an example in code or pseudocode on what you want I may be able to help.

Please post in ALDEx_bioc as this repository is not monitored

LeandroD94 commented 1 year ago

Dear Greg Gloor, As requested, I posted the question under the new issue in ALDEx2_bioc ( https://github.com/ggloor/ALDEx_bioc/issues/58 ).

In any case, I just want to thank you for reading my question and answering me. We will continue this discussion on the forum.

Best regards, Leandro

Il giorno ven 23 giu 2023 alle ore 14:59 Greg Gloor < @.***> ha scritto:

Closed #33 https://github.com/ggloor/ALDEx2_dev/issues/33 as completed.

— Reply to this email directly, view it on GitHub https://github.com/ggloor/ALDEx2_dev/issues/33#event-9617613833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVIGWLIYFSBVP2NSXDJKOPLXMWHLFANCNFSM56MNXTXA . You are receiving this because you commented.Message ID: @.***>