cafferychen777 / ggpicrust2

Make Picrust2 Output Analysis and Visualization Easier
https://cafferychen777.github.io/ggpicrust2/
Other
92 stars 11 forks source link

pathway_daa(): Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels #26

Open andressamv opened 1 year ago

andressamv commented 1 year ago

Hi, I have another question, now about the function pathway_daa

I am running the following codes. While the first works normally, I receive the following error in the second:

daa_results <- pathway_daa(kegg_abundance, meta_table, 'Day', daa_method = 'ALDEx2', select = NULL, p.adjust = 'bonferroni', reference = NULL)

daa_results2 <- pathway_daa(ko_abundance, meta_table, 'Day', daa_method = 'ALDEx2', select = NULL, p.adjust = 'bonferroni', reference = NULL)

ALDEx2 takes a long time to complete the calculation, please wait patiently. operating in serial mode computing center with all features operating in serial mode Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels

I am confused about this error, since the only difference between the codes is the first dataframe. Can you please help me with this too?

cafferychen777 commented 1 year ago

Hi,

Thank you for reaching out. Regarding the error you received with the second code block, it seems that there might be an issue with the data structure of ko_abundance. It should be a data frame with row names as "ko" and column names as "sample".

I would suggest checking the data structure of ko_abundance to ensure that it is indeed a data frame with the correct row and column names. If the data structure is correct, you may want to try running the code again to see if the error persists.

Please let me know if you have any further questions or concerns.

Best, Chen Yang

[image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality11& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality11& 23/05/10 下午12:27:44

andressamv @.***> 于2023年5月10日周三 06:59写道:

Hi, I have another question, now about the function pathway_daa

I am running the following codes. While the first works normally, I receive the following error in the second:

daa_results <- pathway_daa(kegg_abundance, meta_table, 'Day', daa_method = 'ALDEx2', select = NULL, p.adjust = 'bonferroni', reference = NULL)

daa_results2 <- pathway_daa(ko_abundance, meta_table, 'Day', daa_method = 'ALDEx2', select = NULL, p.adjust = 'bonferroni', reference = NULL)

ALDEx2 takes a long time to complete the calculation, please wait patiently. operating in serial mode computing center with all features operating in serial mode Error in contrasts<-(tmp, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels

I am confused about this error, since the only difference between the codes is the first dataframe. Can you please help me with this too?

— Reply to this email directly, view it on GitHub https://github.com/cafferychen777/ggpicrust2/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATZEQTSVXBLEC464FIJYJSDXFLD5LANCNFSM6AAAAAAX35YKJ4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

andressamv commented 1 year ago

Thanks! Yes, the error is still persisting.

My ko_abundance dataframe was created based on the pred_metagenome_unstrat.tsv file. The rownames are the kos (K00001, K00002, etc.) and the columns are the samples.

cafferychen777 commented 1 year ago

Hi,

Based on the information you provided, it appears that the issue is related to the ko_abundance dataframe that you created using the pred_metagenome_unstrat.tsv file. Please note that this could be a problem with the ALDEx2 package itself and unfortunately, there may not be a straightforward solution to this issue.

In some cases, the same dataset may work on one computer but not on another, which can be frustrating. However, I suggest that you try using the LinDA method as an alternative. This is a very robust and widely recognized method that you may find helpful in your analysis.

I hope this helps, and please let me know if you have any further questions or concerns.

Best regards, Chen YANG

andressamv @.***> 于2023年5月10日周三 13:05写道:

Thanks! Yes, the error is still persisting.

My ko_abundance dataframe was created based on the pred_metagenome_unstrat.tsv file. The rownames are the kos (K00001, K00002, etc.) and the columns are the samples.

— Reply to this email directly, view it on GitHub https://github.com/cafferychen777/ggpicrust2/issues/26#issuecomment-1541358295, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATZEQTWY75TZGREYRHTEBPTXFMO2JANCNFSM6AAAAAAX35YKJ4 . You are receiving this because you commented.Message ID: @.***>

andressamv commented 1 year ago

Thanks! In this case, I need to add a reference, and that would be a level of the 'group' variable?

I just tried with Deseq2, and now it is running well! I am just curious that I thought Deseq2 would do the reference vs everything else, but it seems that all comparisons were made.

cafferychen777 commented 1 year ago

Yes, reference should be a level of "group" variable. The reason why DESEQ2 do the all comparisons is that I loop all the group combinationsin the code.

andressamv @.***> 于2023年5月10日周三 13:50写道:

Thanks! In this case, I need to add a reference, and that would be a level of the 'group' variable?

I just tried with Deseq2, and now it is running well! I am just curious that I thought Deseq2 would do the reference vs everything else, but it seems that all comparisons were made.

— Reply to this email directly, view it on GitHub https://github.com/cafferychen777/ggpicrust2/issues/26#issuecomment-1541389608, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATZEQTSMZ7ZGZFL7DCY7VETXFMUDHANCNFSM6AAAAAAX35YKJ4 . You are receiving this because you commented.Message ID: @.***>

andressamv commented 1 year ago

great, thanks!