ChiLiubio / microeco

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

Query Regarding Paired Sample Analysis with `trans_diff` Function #379

Open learn-lx-zhu opened 2 days ago

learn-lx-zhu commented 2 days ago

Dear Author,

I am currently using your R package for analyzing paired microbial sample data, where each pair consists of two samples from the same patient. I noticed that the trans_diff function provides the group_choose_paired parameter, which supports the "metastat" or "metagenomeSeq" methods for selecting the required groups for paired testing. However, I could not find any examples or documentation in the help page or tutorial on what input should be provided for this parameter.

Additionally, I would like to know if other methods, such as ALDEx2_kw, lefse, and maaslin2, have parameters that support paired testing.

Could you please provide some guidance or examples on how to properly use the group_choose_paired parameter and clarify if paired testing is supported for the other methods provided in trans_diff function?

Thank you very much for your assistance.

ChiLiubio commented 2 days ago

Hi. Sorry for the unclear description in the help document. group_choose_paired is used to select fewer groups instead of all paired combinations across groups for those methods that only can be used when input groups are two (e.g., metastat metagenomeSeq, edgeR, ALDEx2_t). So this parameter may be not what you need. According to your info, it is better to use some methods like paired t-test. The method 'ALDEx2_t' is a good choice. The orginal function aldex in ALDEx2 package has a parameter paired.test. So you can use parameter passing like this (paired.test = TRUE is passed to the dependent aldex function):

t1 <- trans_diff$new(dataset = dataset, method = "ALDEx2_t", group = "Group", paired.test = TRUE)

As the function select the feature abundance table and sample table sequentially, so to do paired test, you just need to prepare sample infomation table to be well-organized like this.

SampleID   Group   ID
S1                T          Patient1
S2                C          Patient1
S3                T          Patient2
S4                C          Patient2
.......

Or

SampleID   Group   ID
S1                T          Patient1
S2                T          Patient2
S3                T          Patient3
S4                C          Patient1
S5                C          Patient2
S6                C          Patient3
.......

Please have a try and feel free to tell me if it is not solved.

learn-lx-zhu commented 3 hours ago

Hi! Thank you very much for your reply! I would like to further confirm which methods provided by the trans_diff function support differential testing for paired design samples?

ChiLiubio commented 40 minutes ago

Hi. "ALDEx2_t" and "t.test". For t.test, the by_ID parameter should be provided.