cafferychen777 / ggpicrust2

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

issue while running pathway_errorbar() #65

Open DaliBAmor opened 8 months ago

DaliBAmor commented 8 months ago

I applied your script on my data. As you can see in the metadata I have a column called traitment with ( CTRL , TR1 ,TR2 and TR4) ko_abundance_file <- "pred_metagenome_unstrat.tsv" kegg_abundance <- ko2kegg_abundance(ko_abundance_file) # Or use data(kegg_abundance) metadata <- read_delim("metadata.txt", delim = "\t", escape_double = FALSE, trim_ws = TRUE)

when I use edgeR : daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "traitment", daa_method = "edgeR", select = NULL, p.adjust = "BH", reference = NULL)

I have this error: Sample names extracted. Identifying matching columns in metadata... Matching columns identified: sample . This is important for ensuring data consistency. Using all columns in abundance. Converting abundance to a matrix... Reordering metadata... Converting metadata to a matrix and data frame... Extracting group information... Processing data with edgeR method... Initializing edgeR object... Calculating normalization factors... Estimating common dispersions... Disp = 0.04671 , BCV = 0.2161 edgeR processing completed. Error in pathway_daa(abundance = kegg_abundance, metadata = metadata, : Notice: There are no statistical significances detected. This is not an error, but it might indicate that your data does not contain any values passing the set significance threshold (p<=0.05). You may refer to the tutorial's FAQ for further help and suggestions.

when I change the method : ALDEx2

daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "traitment", daa_method = "ALDEx2", select = NULL, p.adjust = "BH", reference = NULL) daa_annotated_results_df <- pathway_annotation(pathway = "KO", daa_results_df = daa_results_df, ko_to_kegg = TRUE) p <- pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_results_df, Group = metadata$traitment, ko_to_kegg = TRUE, p_values_threshold = 0.05, order = "pathway_class", select = NULL, p_value_bar = TRUE, colors = NULL, x_lab = "pathway_name") I have this error : The following pathways are missing annotations and have been excluded: ko05340, ko00564, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, ko00740, ko04940, ko00010, ko00195, ko03450, ko00760, ko00920, ko00311, ko00310, ko04146, ko00600, ko04141, ko04142, ko00604, ko04260, ko05142, ko04973, ko00510, ko04974, ko04976, ko00450, ko01051, ko00565, ko00524, ko00300, ko05222, ko05416, ko00260, ko00190, ko03440, ko00750, ko00950, ko00592, ko00591, ko00590, ko00061, ko03070, ko00253, ko03060, ko00380, ko00500, ko05120, ko05322, ko04964, ko00625, ko00624, ko00627, ko00626, ko00621, ko00620, ko00623, ko00622, ko00270, ko00940, ko00941, ko01053, ko00100, ko00945, ko01057, ko05016, ko00071, ko00072, ko05219, ko05215, ko05211, ko05210, ko01055, ko04910, ko00531, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko04115, ko00121, ko04914, ko00430, ko02010, ko00130, ko03050, ko00361, ko00040, ko00730, ko00362, ko01040, ko00603, ko03018, ko00281, ko00280, ko03013, ko04626, ko05200, ko00312, ko05020, ko05143, ko00523, ko00520, ko00521, ko05146, ko05145, ko00052, ko00053, ko00051, ko00401, ko00400, ko00350, ko00480, ko00643, ko00642, ko00640, ko00720, ko00960, ko02020, ko00120, ko00965, ko03008, ko00290, ko04614, ko03410, ko05010, ko05012, ko00980, ko00410, ko00983, ko05150, ko00791, ko00790, ko05131, ko00020, ko00710, ko02060, ko00340, ko00785, ko00550, ko00650, ko02030, ko03320, ko04612, ko04621, ko04622, ko00910, ko00460, ko00830, ko00780, ko00511, ko00970, ko00030, ko00232, ko00230, ko04122, ko00540, ko05014, ko03020, ko03010, ko00140, ko05100, ko00860, ko05410, ko00330, ko00908, ko04930, ko03430, ko00906, ko00900, ko00901, ko00903, ko00471, ko00472, ko00473, ko05111, ko04210, ko00240, ko04011, ko00944, ko04113, ko04070, ko04640, ko03420, ko00770, ko02040, ko00670, ko04920, ko04144, ko00930, ko04112, ko05340, ko00564, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, ko00740, ko04940, ko00010, ko00195, ko03450, ko00760, ko00920, ko00311, ko00310, ko04146, ko00600, ko04141, ko04142, ko00604, ko04260, ko05142, ko04973, ko00510, ko04974, ko04976, ko00450, ko01051, ko00565, ko00524, ko00300, ko05222, ko05416, ko00260, ko00190, ko03440, ko00750, ko00950, ko00592, ko00591, ko00590, ko00061, ko03070, ko00253, ko03060, ko00380, ko00500, ko05120, ko05322, ko04964, ko00625, ko00624, ko00627, ko00626, ko00621, ko00620, ko00623, ko00622, ko00270, ko00940, ko00941, ko01053, ko00943, ko00100, ko00945, ko01057, ko05016, ko00071, ko00072, ko05219, ko05215, ko05211, ko05210, ko01055, ko04910, ko00531, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko04115, ko00121, ko04914, ko00430, ko02010, ko00130, ko03050, ko00361, ko00040, ko00730, ko00362, ko01040, ko00603, ko03018, ko00281, ko00280, ko03013, ko04626, ko05200, ko00312, ko05020, ko05143, ko00523, ko00520, ko00521, ko05146, ko05145, ko00052, ko00053, ko00051, ko00401, ko00400, ko00350, ko00480, ko00643, ko00642, ko00640, ko00720, ko00960, ko02020, ko00120, ko00965, ko03008, ko00290, ko04614, ko03410, ko05010, ko05012, ko00980, ko00410, ko00983, ko05150, ko00791, ko00790, ko05131, ko00020, ko00710, ko02060, ko00340, ko00785, ko00550, ko00650, ko02030, ko03320, ko04612, ko04621, ko04622, ko00910, ko00460, ko00830, ko00780, ko00511, ko00970, ko00030, ko00232, ko00230, ko04122, ko00540, ko05014, ko00660, ko03020, ko00982, ko03010, ko00140, ko05100, ko00860, ko05410, ko00330, ko00908, ko04930, ko03430, ko00906, ko00900, ko00901, ko00903, ko00471, ko00472, ko00473, ko05111, ko04210, ko00240, ko04011, ko00944, ko04113, ko04070, ko04640, ko03420, ko00770, ko02040, ko00670, ko04920, ko04144, ko00930, ko04112 You can use the 'pathway_annotation' function to add annotations for these pathways. There are more than two 'group' columns in the 'daa_results_df' data frame. As a result, it is not possible to compute the log2 fold values. The 'p_value_bar' has been automatically set to FALSE. The 'method' column in the 'daa_results_df' data frame contains more than one method. Please filter it to contain only one method. The 'group1' or 'group2' column in the 'daa_results_df' data frame contains more than one group. Please filter each to contain only one group. Error in pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_results_df, : Visualization with 'pathway_errorbar' cannot be performed because there are no features with statistical significance. For possible solutions, please check the FAQ section of the tutorial.

when I use : DESeq2 daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "traitment", daa_method = "DESeq2", select = NULL, p.adjust = "BH", reference = NULL)

I have this error : Starting pathway annotation... DAA results data frame is not null. Proceeding... KO to KEGG is set to TRUE. Proceeding with KEGG pathway annotations... We are connecting to the KEGG database to get the latest results, please wait patiently.

The number of statistically significant pathways exceeds the database's query limit. Please consider breaking down the analysis into smaller queries or selecting a subset of pathways for further investigation.

Returning DAA results filtered annotation data frame...

and then when I run this command ; p <- pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_results_df, Group = metadata$traitment, ko_to_kegg = TRUE, p_values_threshold = 0.05, order = "pathway_class", select = NULL, p_value_bar = TRUE, colors = NULL, x_lab = "pathway_name") I have this error : The following pathways are missing annotations and have been excluded: ko05340, ko00564, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, ko04940, ko00010, ko00195, ko03450, ko00760, ko00920, ko00310, ko00600, ko04141, ko04142, ko00604, ko04260, ko05142, ko04973, ko00510, ko04974, ko04976, ko00450, ko01051, ko00565, ko00524, ko00300, ko05222, ko05416, ko00260, ko00190, ko03440, ko00750, ko00950, ko00592, ko00591, ko00590, ko00061, ko03070, ko00253, ko03060, ko00500, ko05322, ko04964, ko00625, ko00624, ko00627, ko00626, ko00621, ko00620, ko00623, ko00270, NA, ko00940, ko00941, ko01053, NA, ko00100, ko00945, ko01057, NA, ko00071, ko00072, ko05219, ko05215, ko05211, ko05210, ko01055, ko04910, ko00531, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko04115, ko00121, ko04914, ko03050, ko00040, ko01040, ko00603, ko03018, ko00281, ko00280, ko03013, ko04626, ko05200, ko05020, ko05143, ko00523, ko00520, ko00521, ko05146, ko05145, NA, ko00052, ko00053, ko00051, ko00400, ko00350, ko00480, ko00643, ko00642, ko00720, ko00960, ko02020, ko00120, ko00965, ko00290, ko04614, NA, ko03410, ko05010, ko05012, ko00980, ko00410, ko00983, ko05150, ko00791, ko00790, ko05131, ko00020, ko00710, ko00196, ko02060, ko00785, ko00550, ko00650, ko02030, ko03320, ko04612, ko04622, ko00910, ko00460, ko00830, ko00780, ko00511, ko00970, ko00030, ko00232, ko00230, ko04122, ko00540, ko05014, ko00660, ko03020, NA, ko00982, ko03010, ko05100, ko00860, ko05410, ko00330, ko00908, ko03430, ko00906, ko00900, ko00901, ko00903, ko00472, ko00473, ko05111, NA, ko04210, ko00240, ko04011, ko00944, ko04113, ko04070, ko04640, ko03420, ko00770, ko02040, ko00670, ko04144, ko00930, ko04112, ko00564, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, ko00740, ko04940, ko00195, ko03450, ko00760, ko00920, ko00311, ko04146, ko00600, ko04141, ko04142, ko00604, ko04260, ko05142, ko04973, ko05110, ko04974, ko04976, ko00450, ko01051, ko00565, ko00524, ko00300, ko05222, ko05416, ko00260, ko00190, ko03440, ko00750, ko00950, ko00592, ko00591, ko00590, NA, ko00061, ko03070, ko03060, ko00380, ko00500, ko05120, ko05322, ko04964, ko00625, ko00624, ko00626, ko00621, ko00622, ko00940, ko00941, ko01053, ko00943, ko00945, ko01057, ko05016, ko00071, ko00072, ko05219, ko05215, ko05211, ko05210, ko01055, ko04910, ko00531, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko04115, ko00121, ko04914, ko00430, ko02010, ko00130, ko03050, ko00361, ko00040, ko00730, ko00362, ko01040, ko00603, ko00281, ko03013, ko04626, ko05200, ko00312, ko05020, ko05143, ko00520, ko05146, ko05145, ko00052, ko00053, ko00051, ko00401, ko00400, ko00350, ko00480, ko00643, ko00640, ko00960, ko02020, ko00120, ko00965, ko03008, ko00290, ko04614, ko05010, ko05012, ko00980, ko00983, ko05150, ko00791, ko00020, ko00710, ko00196, ko02060, ko00340, ko00785, ko00650, ko02030, ko03320, ko04612, ko04621, ko04622, ko00910, ko00460, ko00830, ko00780, ko00511, ko00970, ko00232, ko00230, ko04122, ko00540, ko05014, ko00660, ko00982, ko03010, ko00140, ko05100, ko00860, ko05410, ko00330, ko00908, ko03430, ko00906, ko00900, ko00901, ko00903, ko00471, ko00472, ko00473, ko05111, ko04210, ko00240, ko04011, ko00944, ko04113, ko04070, ko04640, ko03420, ko00770, ko02040, ko00670, ko04920, ko04144, ko04112, ko05340, ko00564, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, NA, ko00740, ko04940, ko00010, ko00195, ko03450, ko00920, ko00311, ko00310, ko04146, ko00600, ko04141, ko04142, ko00604, ko04260, ko05142, ko04973, ko00510, ko04974, ko04976, ko00450, ko01051, ko00565, ko00524, ko00300, ko05222, ko05416, ko00260, ko00190, ko03440, ko00750, ko00950, ko00592, ko00591, ko00590, NA, ko00061, ko03070, ko00253, ko03060, ko00380, ko00500, ko05120, NA, ko04964, ko00625, ko00624, ko00627, ko00626, ko00621, ko00620, ko00623, ko00622, ko00270, ko00940, ko00941, ko01053, NA, ko00100, ko00945, ko01057, ko05016, ko00071, ko00072, ko05219, ko05215, ko05211, ko05210, ko01055, ko04910, ko00531, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko04115, ko00121, ko04914, ko00430, ko02010, ko00130, ko03050, ko00361, ko00040, ko00730, ko00362, ko01040, ko00603, ko03018, ko00281, ko00280, ko03013, ko04626, ko05200, ko00312, ko05020, ko05143, ko00523, ko00520, ko00521, ko05146, ko05145, ko00053, ko00051, ko00401, ko00400, ko00350, ko00480, ko00643, ko00642, ko00640, ko00960, ko02020, ko00120, ko00965, ko03008, ko00290, ko04614, ko05010, ko05012, ko00980, ko00410, ko00983, ko05150, ko00791, ko00790, ko05131, ko00020, ko00196, ko02060, ko00340, ko00785, ko00550, ko00650, ko02030, ko03320, ko04612, ko04621, ko04622, ko00460, ko00830, ko00780, ko00511, ko00970, ko00030, ko00232, ko00230, ko04122, ko00540, ko05014, ko00660, ko00982, ko03010, ko00140, ko05100, ko00860, ko05410, ko00330, ko00908, ko04930, ko03430, ko00906, ko00900, ko00901, NA, ko00903, ko00471, ko00473, ko05111, ko04210, ko00240, ko04011, ko00944, ko04113, ko04070, ko04640, ko03420, ko00770, ko02040, ko00670, ko04920, ko04144, ko00930, ko04112, ko05340, ko00564, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, NA, ko00740, ko00010, ko00195, ko00760, ko00311, ko00310, ko04146, ko04141, ko04142, ko05142, ko04973, ko00510, ko04974, ko00450, ko01051, ko00524, ko00300, ko00260, ko03440, ko00750, ko00950, ko00592, ko00590, NA, ko00061, ko03070, ko00253, ko03060, ko00380, ko00500, ko05120, NA, ko00625, ko00626, ko00621, ko00620, ko00623, ko00622, ko00270, NA, ko01053, ko00100, ko05016, NA, ko00071, ko00072, ko05219, ko05215, ko01055, ko04910, ko00531, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko00121, ko04914, ko00430, ko00040, ko00730, ko00362, ko01040, ko00603, ko03018, ko00281, ko03013, ko05200, ko00312, ko05020, ko05143, ko00523, ko00520, ko00521, ko05145, ko00052, ko00051, ko00401, ko00400, ko00480, ko00643, ko00642, ko00640, ko00720, ko00960, ko02020, ko00120, ko00290, NA, ko03410, ko05010, ko00980, ko00410, ko00983, ko05150, ko00790, ko05131, ko00020, ko00710, ko00196, ko02060, ko00340, ko00785, ko00550, ko02030, ko03320, ko04612, ko04621, ko00910, ko00460, ko00830, ko00780, ko00511, ko00970, ko00030, ko00230, ko04122, ko00540, ko05014, ko00660, ko03020, NA, ko00982, ko03010, ko00140, ko05100, ko00860, ko00908, ko03430, ko00906, ko00900, NA, ko00903, ko00471, ko00473, ko05111, NA, NA, ko04210, ko00240, ko04011, ko00944, ko03420, ko02040, ko00670, ko04920, ko00930, ko04112, ko05340, ko00564, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, ko00740, ko04940, ko00010, ko00195, ko03450, ko00760, ko00920, ko00311, ko00310, ko04146, ko00600, ko04141, ko04142, ko00604, ko04260, ko05142, ko04973, ko00510, ko04974, ko04976, ko00450, ko01051, ko00565, ko00524, ko00300, ko05222, ko05416, ko00260, ko00190, ko03440, ko00750, ko00950, ko00592, ko00591, ko00590, ko00061, ko03070, ko00253, ko03060, ko00380, ko00500, ko05120, ko05322, ko00625, ko00624, ko00627, ko00626, ko00621, ko00620, ko00623, ko00622, ko00270, ko00940, ko00941, ko01053, ko00943, ko00100, ko00945, ko01057, ko05016, ko00071, ko00072, ko05219, ko05215, ko05211, ko05210, ko01055, ko04910, ko00531, NA, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko04115, ko00121, ko04914, ko00430, ko02010, ko00130, ko03050, ko00361, ko00040, ko00730, ko00362, ko01040, ko00603, ko00281, ko00280, ko03013, ko04626, ko00312, ko05020, ko05143, ko00523, ko00521, ko05146, ko05145, ko05144, ko00052, ko00053, ko00051, ko00401, ko00400, ko00350, ko00480, ko00643, ko00642, ko00640, ko00720, ko00960, ko02020, ko00120, ko00965, ko03008, ko00290, ko04614, ko03410, ko05012, ko00980, ko00410, ko00983, ko05150, ko00791, ko00790, ko05131, ko00020, ko00710, ko02060, ko00340, ko00785, ko00550, ko00650, ko02030, ko03320, ko04612, ko04621, ko04622, ko00910, ko00830, ko00780, ko00511, ko00970, ko00030, ko00232, ko00230, ko04122, ko00540, ko05014, ko00660, ko03020, ko00982, ko03010, ko00140, ko05100, ko00860, ko05410, ko00330, ko00908, ko04930, ko03430, ko00906, ko00900, ko00901, ko00903, ko00471, ko00472, ko00473, ko05111, ko04210, ko00240, ko04011, ko00944, ko04113, ko04070, ko04640, ko03420, ko00770, ko02040, ko00670, ko04920, ko04144, ko00930, ko04112, ko05340, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, ko00740, ko04940, ko00010, ko00195, ko03450, ko00760, ko00311, ko00310, ko04146, ko00600, ko04141, ko04142, ko04260, ko05142, ko04973, ko00450, ko01051, ko00565, ko00524, ko00300, ko05222, ko05416, ko00260, ko03440, ko00750, ko00950, ko00592, ko00591, ko00590, ko00061, ko03070, ko00253, ko03060, ko05120, ko04964, ko00625, ko00624, ko00626, ko00621, ko00620, ko00623, ko00622, ko00270, ko00940, ko00941, ko01053, NA, ko00100, ko00945, ko05016, ko00071, ko00072, ko05219, ko05215, ko05211, ko05210, ko01055, ko04910, ko00531, NA, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko04115, ko00121, ko04914, ko00430, ko02010, ko00130, ko00361, ko00040, ko00730, ko00362, ko01040, ko00603, ko03018, ko00281, ko00280, ko03013, ko05200, ko00312, ko05020, ko05143, ko00523, ko00520, ko00521, ko05146, ko05145, ko00052, ko00053, ko00051, ko00401, ko00400, ko00350, ko00643, ko00642, ko00640, ko00720, ko00960, ko02020, ko00120, ko03008, ko03410, ko05010, ko05012, ko00980, ko00410, ko00983, ko05150, ko00791, ko00790, ko05131, ko00710, ko02060, ko00340, ko00550, ko00650, ko02030, ko03320, ko04612, ko04621, ko00460, ko00830, ko00780, ko00511, ko00970, ko00030, ko00230, ko00540, ko05014, ko00660, ko03020, ko00982, ko03010, ko00140, ko05100, ko00860, ko00330, ko00908, ko04930, ko03430, ko00906, ko00900, ko00903, ko00471, ko00472, ko00473, ko05111, ko04210, ko00240, ko04011, ko00944, ko04113, ko04070, ko03420, ko00770, ko02040, ko00670, ko04920, ko00930, ko04112, ko05340, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, ko00010, ko00195, ko03450, ko00920, ko00311, ko00310, ko04146, ko00600, ko04141, ko04142, ko00604, ko04260, ko05142, ko04973, ko00510, ko00450, ko01051, ko00565, ko00524, ko00300, ko05222, ko05416, ko00260, ko00190, ko03440, ko00750, ko00950, ko00592, ko00591, ko00590, ko00061, ko03070, ko00253, ko03060, ko00380, ko00500, ko05120, ko04964, ko00625, ko00624, ko00627, ko00626, ko00621, ko00620, ko00623, ko00622, ko00270, NA, ko00940, ko00941, ko01053, ko00100, ko00945, ko05016, NA, ko00071, ko00072, ko05219, ko05215, ko05211, ko05210, ko01055, ko04910, ko00531, NA, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko04115, ko00121, ko04914, ko00430, ko02010, ko00130, ko03050, ko00361, ko00040, ko00730, ko00362, ko01040, ko00603, ko03018, ko00281, ko00280, ko03013, ko04626, ko05200, ko00312, ko05020, ko05143, ko00523, ko00520, ko00521, ko05146, ko05145, ko00052, ko00053, ko00051, ko00401, ko00350, ko00480, ko00643, ko00642, ko00640, ko00720, ko00960, ko02020, ko00120, ko03008, ko00290, NA, ko03410, ko05010, ko05012, ko00980, ko00410, ko00983, ko05150, ko00791, ko00790, ko05131, ko00710, ko02060, ko00340, ko00785, ko00550, ko02030, ko03320, ko04612, ko04621, ko04622, ko00910, ko00460, ko00830, ko00780, ko00511, ko00970, ko00030, ko00230, ko04122, ko00540, ko05014, ko00660, ko03020, NA, ko00982, ko03010, ko00140, ko05100, ko00860, ko00330, ko00908, ko04930, ko03430, ko00906, ko00900, ko00903, ko00471, ko00472, ko00473, ko05111, NA, ko04210, ko00240, ko04011, ko00944, ko04113, ko04070, ko03420, ko00770, ko02040, ko00670, ko04920, ko00930, ko04112, ko05340, ko00564, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, ko00740, ko04940, ko00010, ko00195, ko03450, ko00760, ko00920, ko00311, ko00310, ko04146, ko00600, ko04141, ko04142, ko00604, ko04260, ko05142, ko04973, ko00510, ko04974, ko04976, ko00450, ko01051, ko00565, ko00524, ko00300, ko05222, ko05416, ko00260, ko03440, ko00950, ko00592, ko00591, ko00590, NA, ko00061, ko03070, ko00253, ko03060, ko00380, ko00500, ko05120, ko05322, ko04964, ko00625, ko00624, ko00627, ko00626, ko00621, ko00620, ko00623, ko00622, ko00270, ko00940, ko00941, ko01053, ko00100, ko00945, ko01057, ko05016, ko00072, ko05219, ko05215, ko05211, ko05210, ko01055, ko04910, ko00531, NA, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko04115, ko04914, ko00430, ko02010, ko00130, ko03050, ko00361, ko00040, ko00730, ko01040, ko00603, ko03018, ko00281, ko00280, ko03013, ko04626, ko05200, ko00312, ko05020, ko05143, ko00523, ko00521, ko05146, ko05145, ko00052, ko00053, ko00051, ko00401, ko00400, ko00350, ko00480, ko00643, ko00642, ko00640, ko00720, ko00960, ko02020, ko00965, ko03008, ko00290, ko04614, ko03410, ko05012, ko00980, ko00410, ko00983, ko05150, ko00791, ko00790, ko05131, ko00020, ko00710, ko02060, ko00340, ko00785, ko00550, ko00650, ko02030, ko04612, ko04621, ko04622, ko00910, ko00460, ko00830, ko00780, ko00511, ko00970, ko00030, ko00232, ko00230, ko04122, ko00540, ko05014, ko00660, ko03020, ko00982, ko03010, ko00140, ko05100, ko00860, ko05410, ko00330, ko00908, ko04930, ko03430, ko00906, ko00900, ko00901, ko00903, ko00471, ko00472, ko00473, ko05111, ko04210, ko00240, ko04011, ko00944, ko04113, ko04070, ko03420, ko00770, ko02040, ko00670, ko04920, ko04144, ko00930, ko04112, ko05340, ko00564, ko00680, ko00562, ko03030, ko00561, ko00440, ko00250, ko00740, ko04940, ko00010, ko03450, ko00760, ko00920, ko00310, ko04146, ko00600, ko04142, ko00604, ko04260, ko05142, ko00510, ko04974, ko04976, ko00450, ko01051, ko00565, ko00300, ko05222, ko05416, ko00260, ko00190, ko00750, ko00950, ko00592, ko00591, ko00590, NA, ko00061, ko03070, ko00253, ko03060, ko00500, ko05120, ko05322, ko04964, ko00625, ko00624, ko00626, ko00620, ko00623, ko00622, ko00270, ko00940, ko00941, ko01053, ko00100, ko00945, ko01057, ko05016, ko00071, ko00072, ko05219, ko05215, ko05211, ko05210, ko04910, ko00531, NA, ko00360, ko00633, ko00630, ko00363, ko00364, ko04115, ko00121, ko04914, ko00430, ko02010, ko00130, ko03050, ko00361, ko00040, ko00730, ko00362, ko01040, ko00603, ko03018, ko00281, ko00280, ko03013, ko04626, ko05200, ko05143, ko00523, ko00520, ko00521, ko05146, ko05145, ko00052, ko00053, ko00051, ko00401, ko00400, ko00350, ko00480, ko00643, ko00642, ko00640, ko00720, ko00960, ko02020, ko00120, ko00965, ko00290, ko04614, ko03410, ko05010, ko05012, ko00980, ko00410, ko05150, ko00791, ko00790, ko00020, ko00710, ko02060, ko00340, ko00785, ko00550, ko00650, ko02030, ko03320, ko04612, ko04621, ko04622, ko00910, ko00460, ko00830, ko00780, ko00511, ko00970, ko00030, ko00232, ko00230, ko04122, ko00540, ko05014, ko00660, ko03020, ko00982, ko03010, ko00140, ko00860, ko05410, ko00330, ko03430, ko00906, ko00900, ko00901, ko00903, ko00471, ko00472, ko05111, ko04210, ko04011, ko04113, ko04070, ko04640, ko03420, ko00770, ko02040, ko00670, ko04920, ko04144, ko00930, ko04112, ko05340, ko00564, ko00680, ko00562, ko03030, ko00561, ko00250, NA, ko00740, ko04940, ko00010, ko00195, ko03450, ko00920, ko00311, ko00310, ko04146, ko00600, ko04141, ko04142, ko00604, ko04260, ko05142, ko04973, ko00510, ko00450, ko01051, ko00565, ko00524, ko00300, ko05222, ko05416, ko00260, ko00190, ko03440, ko00750, ko00950, ko00592, ko00591, ko00590, NA, ko03070, ko00253, ko03060, ko00380, ko00500, ko05120, NA, ko04964, ko00625, ko00624, ko00627, ko00626, ko00621, ko00620, ko00623, ko00622, ko00270, ko00940, ko01053, ko00100, ko00945, ko05016, ko00071, ko00072, ko05219, ko05215, ko05211, ko05210, ko01055, ko04910, ko00531, NA, ko00360, ko00633, ko00630, ko00363, ko00364, ko05130, ko04115, ko00121, ko04914, ko00430, ko02010, ko00130, ko03050, ko00361, ko00040, ko00730, ko00362, ko01040, ko00603, ko03018, ko00281, ko00280, ko03013, ko04626, ko05200, ko00312, ko05020, ko05143, ko00523, ko00520, ko00521, ko05146, ko05145, ko00052, ko00053, ko00051, ko00401, ko00400, NA, ko00350, ko00480, ko00643, ko00642, ko00640, ko00720, ko00960, ko02020, ko00120, ko03008, ko00290, ko04614, ko03410, ko05010, ko05012, ko00980, ko00410, ko00983, ko05150, ko00791, ko00790, ko05131, ko00020, ko00710, ko02060, ko00340, ko00785, ko00550, ko00650, ko02030, ko03320, ko04612, ko04621, ko00910, ko00460, ko00830, ko00511, ko00970, ko00030, NA, ko00230, ko04122, ko00540, ko00660, ko03020, ko00982, ko00140, ko05100, ko00860, ko00330, ko00908, ko04930, ko03430, ko00906, ko00900, NA, ko00903, ko00471, ko00473, ko05111, ko04210, ko00240, ko04011, ko00944, ko04113, ko04070, ko03420, ko00770, ko02040, ko00670, ko00930, ko04112 You can use the 'pathway_annotation' function to add annotations for these pathways. The 'method' column in the 'daa_results_df' data frame contains more than one method. Please filter it to contain only one method. The 'group1' or 'group2' column in the 'daa_results_df' data frame contains more than one group. Please filter each to contain only one group. Error in pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_results_df, : Visualization with 'pathway_errorbar' cannot be performed because there are no features with statistical significance. For possible solutions, please check the FAQ section of the tutorial.

when I use lesfer

daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "traitment", daa_method = "Lefser", select = NULL, p.adjust = "BH", reference = NULL) daa_annotated_results_df <- pathway_annotation(pathway = "KO", daa_results_df = daa_results_df, ko_to_kegg = TRUE)

I have this error : Starting pathway annotation... DAA results data frame is not null. Proceeding... KO to KEGG is set to TRUE. Proceeding with KEGG pathway annotations... Error in pathway_annotation(pathway = "KO", daa_results_df = daa_results_df, : No statistically significant biomarkers found. 'Statistically significant biomarkers' refer to those biomarkers that demonstrate a significant difference in expression between different groups, as determined by a statistical test (p_adjust < 0.05 in this case). You might consider re-evaluating your experiment design or trying alternative statistical analysis methods. Consult with a biostatistician or a data scientist if you are unsure about the next steps.

when I use LinDA:

daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "traitment", daa_method = "LinDA", select = NULL, p.adjust = "BH", reference = "CTRL")

daa_annotated_results_df <- pathway_annotation(pathway = "KO", daa_results_df = daa_results_df, ko_to_kegg = TRUE)

i HAVE THIS: Starting pathway annotation... DAA results data frame is not null. Proceeding... KO to KEGG is set to TRUE. Proceeding with KEGG pathway annotations... We are connecting to the KEGG database to get the latest results, please wait patiently.

The number of statistically significant pathways exceeds the database's query limit. Please consider breaking down the analysis into smaller queries or selecting a subset of pathways for further investigation.

Returning DAA results filtered annotation data frame...

nothing is working for me :( the input file was generated by using picrust2 pipeline metadata file: image

ko abundance file structure (pred_metagenome_unstrat.tsv) : image

cafferychen777 commented 8 months ago

Hello @DaliBAmor,

Thank you for providing the detailed error messages and analysis results. I appreciate you taking the time to share this information. However, it is still unclear exactly where you are stuck or what the core issue is that needs addressing.

The error messages you pasted seem to indicate some potential problems:

  1. No statistically significant differences detected between groups with edgeR, DESeq2, LefSeR. This could mean the groups are not different or the methods are not suitable.

  2. Large number of significant pathways with LinDA but errors in pathway_annotation. This needs more investigation into the LinDA results.

  3. Errors visualizing results with pathway_errorbar due to no significant features. This seems inconsistent with the LinDA results.

To better assist you, please help provide more details:

Providing clarification on these points will help me understand your situation better and provide more targeted suggestions. My goal is to collaborate effectively to resolve your analysis challenges. Please let me know if any part of this response needs further explanation. I look forward to your updates.

DaliBAmor commented 8 months ago

thank you for responding to my post I don't have a specific question it's just an exploratory functional analysis prediction on 16s rRNA data. what I want is no generate the same plots that you published ( pathway_errorbar , pathway_heatmap , pathway_pca).

If you want to analyze KEGG pathway abundance instead of KO within the pathway, turn ko_to_kegg to TRUE.

KEGG pathways typically have more explainable descriptions.

Load metadata as a tibble

data(metadata)

metadata <- read_delim("git2_metadata.txt", delim = "\t", escape_double = FALSE, trim_ws = TRUE)

Load KEGG pathway abundance

data(kegg_abundance)

kegg_abundance <- ko2kegg_abundance("git2_pred_metagenome_unstrat.tsv")

Perform pathway differential abundance analysis (DAA) using ALDEx2 method

Please change group to "your_group_column" if you are not using example dataset

daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "traitment", daa_method = "ALDEx2", select = NULL, reference = NULL)

Filter results for ALDEx2_Welch's t test method

Please check the unique(daa_results_df$method) and choose one

daa_sub_method_results_df <- daa_results_df[daa_results_df$method == "ALDEx2_Kruskal-Wallace test", ]

Annotate pathway results using KO to KEGG conversion

daa_annotated_sub_method_results_df <- pathway_annotation(pathway = "KO", daa_results_df = daa_sub_method_results_df, ko_to_kegg = TRUE)

but it didn't work : Starting pathway annotation... DAA results data frame is not null. Proceeding... KO to KEGG is set to TRUE. Proceeding with KEGG pathway annotations... We are connecting to the KEGG database to get the latest results, please wait patiently.

The number of statistically significant pathways exceeds the database's query limit. Please consider breaking down the analysis into smaller queries or selecting a subset of pathways for further investigation.

Returning DAA results filtered annotation data frame...

cafferychen777 commented 8 months ago

Hi @DaliBAmor,

I must be candid with you:

  1. Referring to your statement about wanting to generate the same plots based on the 16s rRNA data: It's essential to grasp that not every dataset, even if seemingly similar, will produce identical visuals. For instance, pathway_errorbar is tailored for visualizing statistically significant pathways. If your dataset doesn't contain pathways with distinct statistical differences, then you cannot generate this visualization. This isn't a point of contention; it's basic logic.

  2. Regarding your error following the 16S rRNA Gene Sequencing process: If you can't ensure your input files are correctly formatted and compatible, you're naturally going to run into issues. Proper diligence in data preparation is not optional; it's fundamental.

  3. Many of the messages you've encountered during your analysis are transparent indicators of your data's shortcomings:

    • The message about exceeding the database's query limit due to the number of statistically significant pathways is an explicit directive: simplify your data or be more selective.
    • Similarly, the message indicating the absence of statistically significant biomarkers speaks volumes. It's making it abundantly clear that your dataset lacks markers meeting the set statistical parameters.

Moreover, and this is crucial, a large portion of the questions you're raising have already been addressed in previously resolved issues and our FAQ section. It's imperative that you thoroughly review the tutorial and previously addressed issues before reaching out. Many of your concerns are not new and have been answered multiple times.

I urge you to be more diligent in your approach. Invest time in understanding feedback, refine your data accordingly, and do your due diligence by reviewing available resources before flagging issues.

I trust you'll find this feedback constructive and hope you'll take a more systematic approach moving forward.

Regards,

Chen YANG

cafferychen777 commented 8 months ago

Hello @DaliBAmor,

You can use the following code

library(readr)
library(ggpicrust2)
library(tibble)
library(tidyverse)
library(ggprism)
library(patchwork)
library(KEGGREST)
library(ggh4x)

# If you want to analyze KEGG pathway abundance instead of KO within the pathway, turn ko_to_kegg to TRUE.
# KEGG pathways typically have more explainable descriptions.

# Load metadata as a tibble
# data(metadata)
metadata <- read_delim("/Users/apple/Microbiome/ggpicrust2总/ggpicrust2测试/ggpicrust2_test/DaliBAmor/git2_metadata.txt", delim = "\t", escape_double = FALSE, trim_ws = TRUE) 

# Load KEGG pathway abundance
# data(kegg_abundance)
kegg_abundance <- ko2kegg_abundance("/Users/apple/Microbiome/ggpicrust2总/ggpicrust2测试/ggpicrust2_test/DaliBAmor/git2_pred_metagenome_unstrat.tsv") 

# Perform pathway differential abundance analysis (DAA) using ALDEx2 method
# Please change group to "your_group_column" if you are not using example dataset
daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "traitment", daa_method = "ALDEx2", select = NULL, reference = NULL) 

# Filter results for ALDEx2_Welch's t test method
# Please check the unique(daa_results_df$method) and choose one
daa_sub_method_results_df <- daa_results_df[daa_results_df$method == "ALDEx2_Kruskal-Wallace test", ]

daa_sub_method_results_df1 <- daa_sub_method_results_df %>% filter(p_adjust < 0.05) %>% slice(1:29)

# Annotate pathway results using KO to KEGG conversion
daa_annotated_sub_method_results_df1 <- pathway_annotation(pathway = "KO", daa_results_df = daa_sub_method_results_df1, ko_to_kegg = TRUE)

# Generate pathway error bar plot
# Please change Group to metadata$your_group_column if you are not using example dataset
p <- pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_sub_method_results_df1, Group = metadata$traitment, p_values_threshold = 0.05, order = "pathway_class", select = NULL, ko_to_kegg = TRUE, p_value_bar = TRUE, colors = NULL, x_lab = "pathway_name")

p1 <- pathway_pca(kegg_abundance, metadata, "traitment")

p2 <- pathway_heatmap(kegg_abundance %>% rownames_to_column("feature") %>% filter(feature %in% daa_annotated_sub_method_results_df1$feature) %>% column_to_rownames("feature"), metadata, "traitment")

Regards,

Screenshot 2023-10-24 at 14 59 24 Screenshot 2023-10-24 at 14 59 40 Screenshot 2023-10-24 at 14 59 59
DaliBAmor commented 8 months ago

@cafferychen777 thank you very much I'm really greatful. I still have 2 more little quesitons :

cafferychen777 commented 8 months ago

Hello @DaliBAmor,

Because the log 2 fold change is only available when comparing two groups, we do not have log 2 fold change visualization for multiple groups.

Regards,

DaliBAmor commented 8 months ago

image

another question : is there a way to add sample name in metadata.txt file to pca and heatmap ?

p1 <- pathway_pca(kegg_abundance, metadata, "traitment") p2 <- pathway_heatmap(kegg_abundance %>% rownames_to_column("feature") %>% filter(feature %in% daa_annotated_sub_method_results_df1$feature) %>% column_to_rownames("feature"), metadata, "traitment")

cafferychen777 commented 8 months ago

In response to your queries:

  1. Regarding limma voom: limma is designed to perform pairwise comparisons between groups. As such, it will provide you with a log 2 fold change value. If you've correctly subsetted your data to compare just the two groups, CTRL and C12, then yes, a p-value greater than 0.05 indicates that the difference between these groups is not statistically significant.

  2. On adding sample names in metadata.txt to PCA and heatmap: I believe that adding sample names below isn't aesthetically pleasing, so I removed them from the visualization. If you'd like to resolve this, you can either search on Google or consult ChatGPT for potential solutions.

ScarlettPegany commented 7 months ago

@cafferychen777, Thank you again for these clarifications and this solution. to solve this issue, you applied the command daa_sub_method_results_df1 <- daa_sub_method_results_df %>% filter(p_adjust < 0.05) %>% slice(1:29). What's the purpose of using this slice operation? I encountered a similar issue before using it. How did you decide to use these specific values (1:29)? What about the other values in the dataset?

cafferychen777 commented 7 months ago

Hi @ScarlettPegany,

Thank you for reaching out with your questions. Let me clarify the purpose and rationale behind the slice(1:29) operation.

The command daa_sub_method_results_df %>% filter(p_adjust < 0.05) is used to filter the dataset based on a significance threshold, retaining only the rows where the adjusted p-value is less than 0.05.

The subsequent slice(1:29) operation is applied to further subset this filtered dataset by selecting the first 29 rows. The choice of "29" was arbitrary in this context and was used as an example. The main purpose of using slice here was to provide a smaller, more manageable subset for demonstration or visualization purposes.

To your question about the specific values (1:29): the range can be adjusted based on your needs. However, it's essential to note that I recommend not using a range larger than 30. When visualizing pathways, displaying too many at once can compromise the clarity and effectiveness of the visualization. To ensure optimal visual results, I've set a constraint that if there are more than 30 pathways, the visualization would be declined.

Regarding other values in the dataset: The choice to use the first 29 rows was simply for illustrative purposes, and there's no inherent significance to these specific rows. If you have a particular reason or criteria to focus on certain rows, you should adjust the slicing operation to reflect that.

I hope this provides clarity on the matter. Please let me know if you have any further questions!

Best regards, Chen YANG

ScarlettPegany commented 7 months ago

Biologically speaking, does it make sense to sort significant p_adjust values and then select the top 29? I asked this because when I ran the command without the slice daa_sub_method_results_df1 <- daa_results_df %>% filter(p_adjust < 0.05), I had 425 observations. Therefore, it didn't seem logical to visualize all 425 observations by setting slices of 29 each time. This is why I used the sort option by applying this script:

metadata <- read_delim("metadata.txt", delim = "\t", escape_double = FALSE, trim_ws = TRUE)

kegg_abundance <- ko2kegg_abundance("pred_metagenome_unstrat.tsv")

daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "exp", daa_method = "LinDA", select = NULL, reference = "control")

Sort the data frame by the 'p_adjust' column

sorted_daa_results_df <- daa_results_df %>% filter(p_adjust < 0.05) %>% arrange(p_adjust, .desc = FALSE)

Take the top 29 rows

daa_sub_method_results_df1 <- sorted_daa_results_df %>% slice(1:29)

Annotate pathway results using KO to KEGG conversion

daa_annotated_sub_method_results_df1 <- pathway_annotation(pathway = "KO", daa_results_df = daa_sub_method_results_df1, ko_to_kegg = TRUE)

Generate pathway error bar plot

p <- pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_sub_method_results_df1, Group = metadata$exp, p_values_threshold = 0.05, order = "pathway_class", select = NULL, ko_to_kegg = TRUE, p_value_bar = TRUE, colors = NULL, x_lab = "pathway_name") However I have this error when pathway_error bar plot command : Error in levels<-(*tmp*, value = as.character(levels)) : factor level [5] is duplicated

DaliBAmor commented 7 months ago

Biologically speaking, does it make sense to sort significant p_adjust values and then select the top 29? I asked this because when I ran the command without the slice daa_sub_method_results_df1 <- daa_results_df %>% filter(p_adjust < 0.05), I had 425 observations. Therefore, it didn't seem logical to visualize all 425 observations by setting slices of 29 each time. This is why I used the sort option by applying this script:

metadata <- read_delim("metadata.txt", delim = "\t", escape_double = FALSE, trim_ws = TRUE)

kegg_abundance <- ko2kegg_abundance("pred_metagenome_unstrat.tsv")

daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "exp", daa_method = "LinDA", select = NULL, reference = "control")

Sort the data frame by the 'p_adjust' column

sorted_daa_results_df <- daa_results_df %>% filter(p_adjust < 0.05) %>% arrange(p_adjust, .desc = FALSE)

Take the top 29 rows

daa_sub_method_results_df1 <- sorted_daa_results_df %>% slice(1:29)

Annotate pathway results using KO to KEGG conversion

daa_annotated_sub_method_results_df1 <- pathway_annotation(pathway = "KO", daa_results_df = daa_sub_method_results_df1, ko_to_kegg = TRUE)

Generate pathway error bar plot

p <- pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_sub_method_results_df1, Group = metadata$exp, p_values_threshold = 0.05, order = "pathway_class", select = NULL, ko_to_kegg = TRUE, p_value_bar = TRUE, colors = NULL, x_lab = "pathway_name") However I have this error when pathway_error bar plot command : Error in levels<-(*tmp*, value = as.character(levels)) : factor level [5] is duplicated

@ScarlettPegany Good question , I'm also curious to know how to deal with all data

ScarlettPegany commented 7 months ago

Biologically speaking, does it make sense to sort significant p_adjust values and then select the top 29? I asked this because when I ran the command without the slice daa_sub_method_results_df1 <- daa_results_df %>% filter(p_adjust < 0.05), I had 425 observations. Therefore, it didn't seem logical to visualize all 425 observations by setting slices of 29 each time. This is why I used the sort option by applying this script:

metadata <- read_delim("metadata.txt", delim = "\t", escape_double = FALSE, trim_ws = TRUE)

kegg_abundance <- ko2kegg_abundance("pred_metagenome_unstrat.tsv")

daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "exp", daa_method = "LinDA", select = NULL, reference = "control")

Sort the data frame by the 'p_adjust' column

sorted_daa_results_df <- daa_results_df %>% filter(p_adjust < 0.05) %>% arrange(p_adjust, .desc = FALSE)

Take the top 29 rows

daa_sub_method_results_df1 <- sorted_daa_results_df %>% slice(1:29)

Annotate pathway results using KO to KEGG conversion

daa_annotated_sub_method_results_df1 <- pathway_annotation(pathway = "KO", daa_results_df = daa_sub_method_results_df1, ko_to_kegg = TRUE)

Generate pathway error bar plot

p <- pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_sub_method_results_df1, Group = metadata$exp, p_values_threshold = 0.05, order = "pathway_class", select = NULL, ko_to_kegg = TRUE, p_value_bar = TRUE, colors = NULL, x_lab = "pathway_name") However I have this error when pathway_error bar plot command : Error in levels<-(*tmp*, value = as.character(levels)) : factor level [5] is duplicated

@cafferychen777 could you PLEASE answer my question and give me a solution as soon as you have time

cafferychen777 commented 7 months ago

@ScarlettPegany Yeah

ScarlettPegany commented 7 months ago

@ScarlettPegany Yeah thank you in advance because I really need it

saassli21 commented 7 months ago

Biologically speaking, does it make sense to sort significant p_adjust values and then select the top 29? I asked this because when I ran the command without the slice daa_sub_method_results_df1 <- daa_results_df %>% filter(p_adjust < 0.05), I had 425 observations. Therefore, it didn't seem logical to visualize all 425 observations by setting slices of 29 each time. This is why I used the sort option by applying this script: metadata <- read_delim("metadata.txt", delim = "\t", escape_double = FALSE, trim_ws = TRUE) kegg_abundance <- ko2kegg_abundance("pred_metagenome_unstrat.tsv") daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "exp", daa_method = "LinDA", select = NULL, reference = "control")

Sort the data frame by the 'p_adjust' column

sorted_daa_results_df <- daa_results_df %>% filter(p_adjust < 0.05) %>% arrange(p_adjust, .desc = FALSE)

Take the top 29 rows

daa_sub_method_results_df1 <- sorted_daa_results_df %>% slice(1:29)

Annotate pathway results using KO to KEGG conversion

daa_annotated_sub_method_results_df1 <- pathway_annotation(pathway = "KO", daa_results_df = daa_sub_method_results_df1, ko_to_kegg = TRUE)

Generate pathway error bar plot

p <- pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_sub_method_results_df1, Group = metadata$exp, p_values_threshold = 0.05, order = "pathway_class", select = NULL, ko_to_kegg = TRUE, p_value_bar = TRUE, colors = NULL, x_lab = "pathway_name") However I have this error when pathway_error bar plot command : Error in levels<-(*tmp*, value = as.character(levels)) : factor level [5] is duplicated

@ScarlettPegany Good question , I'm also curious to know how to deal with all data

I'm also interested since I used the same code

ScarlettPegany commented 7 months ago

@cafferychen777 when you wrote :# If you have more than 3 group levels and want to use the LinDA, limma voom, or Maaslin2 methods, you should provide a reference. do you mean >3 or >= 3 please ??

cafferychen777 commented 3 months ago

Hi,

Thank you for reaching out with your issue. To resolve the error you're encountering with the pathway_heatmap function, please ensure that you have the ggh4x library loaded in your R session. You can do this by running the following command:

library(ggh4x)

After loading the ggh4x library, try running the pathway_heatmap function again. This should resolve the issue with the strip_nested function not being found.

Best regards, Chen YANG

On Mon, 11 Mar 2024 at 16:37, bingli @.***> wrote:

when I run

p2 <- pathway_heatmap(kegg_abundance %>% rownames_to_column("feature") %>% filter(feature %in% daa_annotated_sub_method_results_df1$feature) %>% column_to_rownames("feature"), metadata, "traitment")

but found Error in strip_nested(background_x = elem_list_rect(fill = colors)) : could not find function "strip_nested" .

kegg_abundance %>% rownames_to_column("feature") %>% filter(feature %in% daa_annotated_sub_method_results_df1$feature) %>% column_to_rownames("feature")

which data is as below ko00562 133199.66 87151.94 964830 964830 ko00440 47559.87 34380.27 321248 321248 ko03450 799.00 1302.50 160804 160804 ko00920 236932.87 171255.67 1205954 1205954 ko00311 2965.93 1066.31 80402 80402 ko00310 70223.18 48289.78 964748 964748 ko04142 32453.61 53711.05 0 0 ko00604 3977.28 14443.95 0 0 ko05142 4283.30 8552.00 0 0 ko04973 7946.40 2994.99 80402 80402 ko00510 22471.67 13291.76 80402 80402 ko04974 4061.76 9299.03 0 0 ko04976 800.00 328.00 0 0 ko00565 1104.05 1351.60 0 0 ko00524 60179.73 36244.91 80402 80402 ko00592 1959.74 614.00 80402 80402 ko00590 4362.86 4467.72 241206 241206 ko00061 430315.43 272664.76 1768838 1768838 ko00253 136884.29 72787.51 482412 482412 ko00380 91758.66 67117.93 1286394 1286394 ko00624 98.00 62.33 0 0 ko00627 51844.07 40743.59 723498 723498 ko00620 928864.13 623760.29 3618014 3618014 ko00940 105989.42 86276.50 0 0 ko00941 1219.80 710.00 0 0 ko01053 4466.33 4212.18 482412 482412 ko00945 28.00 18.33 0 0 ko00071 172354.12 142680.81 1447002 1447002 ko00072 17074.32 7887.71 482412 482412

function pathway_errorbar and pathway_pca is work except pathway_heatmap.

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

bingli2019 commented 3 months ago

Thank you for your reply. I found this problem and fixed.

ycliang22 commented 2 months ago

Hello @DaliBAmor,

You can use the following code

library(readr)
library(ggpicrust2)
library(tibble)
library(tidyverse)
library(ggprism)
library(patchwork)
library(KEGGREST)
library(ggh4x)

# If you want to analyze KEGG pathway abundance instead of KO within the pathway, turn ko_to_kegg to TRUE.
# KEGG pathways typically have more explainable descriptions.

# Load metadata as a tibble
# data(metadata)
metadata <- read_delim("/Users/apple/Microbiome/ggpicrust2总/ggpicrust2测试/ggpicrust2_test/DaliBAmor/git2_metadata.txt", delim = "\t", escape_double = FALSE, trim_ws = TRUE) 

# Load KEGG pathway abundance
# data(kegg_abundance)
kegg_abundance <- ko2kegg_abundance("/Users/apple/Microbiome/ggpicrust2总/ggpicrust2测试/ggpicrust2_test/DaliBAmor/git2_pred_metagenome_unstrat.tsv") 

# Perform pathway differential abundance analysis (DAA) using ALDEx2 method
# Please change group to "your_group_column" if you are not using example dataset
daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "traitment", daa_method = "ALDEx2", select = NULL, reference = NULL) 

# Filter results for ALDEx2_Welch's t test method
# Please check the unique(daa_results_df$method) and choose one
daa_sub_method_results_df <- daa_results_df[daa_results_df$method == "ALDEx2_Kruskal-Wallace test", ]

daa_sub_method_results_df1 <- daa_sub_method_results_df %>% filter(p_adjust < 0.05) %>% slice(1:29)

# Annotate pathway results using KO to KEGG conversion
daa_annotated_sub_method_results_df1 <- pathway_annotation(pathway = "KO", daa_results_df = daa_sub_method_results_df1, ko_to_kegg = TRUE)

# Generate pathway error bar plot
# Please change Group to metadata$your_group_column if you are not using example dataset
p <- pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_sub_method_results_df1, Group = metadata$traitment, p_values_threshold = 0.05, order = "pathway_class", select = NULL, ko_to_kegg = TRUE, p_value_bar = TRUE, colors = NULL, x_lab = "pathway_name")

p1 <- pathway_pca(kegg_abundance, metadata, "traitment")

p2 <- pathway_heatmap(kegg_abundance %>% rownames_to_column("feature") %>% filter(feature %in% daa_annotated_sub_method_results_df1$feature) %>% column_to_rownames("feature"), metadata, "traitment")

Regards, Screenshot 2023-10-24 at 14 59 24 Screenshot 2023-10-24 at 14 59 40 Screenshot 2023-10-24 at 14 59 59

Hi, I encountered the same problem. but when I applied "daa_sub_method_results_df1 <- daa_sub_method_results_df %>% filter(p_adjust < 0.05) %>% slice(1:29)" it showed error: Error in h(simpleError(msg, call)) : 在为'slice'函数选择方法时评估'x'参数出了错: Rle of type 'list' is not supported .

how could I deal with it? Looking farword to your reply! thank you so much in advance