Giter Club home page Giter Club logo

Comments (30)

cafferychen777 avatar cafferychen777 commented on September 17, 2024

Hello @JAkorli ,

Thank you very much for your inquiry. Based on the error message you provided, it appears that the input file ko_abundance is not in the expected format. The ggpicrust2 function expects a single file as input, and the format should be a delimited text file with a single column containing the abundance data such as followings:

‘/Users/apple/Microbiome/C9orf72/Code And Data/picrust2_out/KO_metagenome_out/pred_metagenome_unstrat.tsv/pred_metagenome_unstrat.tsv’

To resolve the issue, please check the format of the ko_abundance file and ensure that it meets the requirements. Also, make sure that the file path is correct and the file is accessible.

If the file format is correct, please check if the file contains any missing or incorrect data that could be causing the error. You can try opening the file in a spreadsheet program or text editor to check the contents.

If you are still having issues, please provide more information about the format and contents of the ko_abundance file, and any other relevant details. This will help in further troubleshooting the issue.

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

Hello @cafferychen777
Thank you for your quick response. My file has the first column containing the KO functions and the first row containing sample IDs. So each cell has the abundance, as shown below. If I understand you correctly, there should be only one column? Perhaps it will be helpful to share your first few rows and columns of your pred_metagenome_unstrat.tsv file. I used a similar result file though. Thanks

function | MB100 | MB101 | MB107 | MB109 | MB10
K00001 | 3971.34 | 30103.46 | 1473.59 | 2052.09 | 138127.03
K00003 | 27797.72 | 26935.82 | 29335.81 | 4420.37 | 50152.85

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

No, I mean you should use code such as followings

results <- ggpicrust2(file = 'apple/microbiome/ko_abundance.tsv',
metadata = metadata,
group = "Vaccine",
pathway = "KO",
p_values_bar = TRUE,
daa_method = "LinDA",
order = "pathway_class",
ko_to_kegg = T,
x_lab = "pathway_name",
p.adjust = "BH",
select = NULL,
reference = NULL)

ggpicrust2 doesn't accept abundance data frame. It accepts the raw file.

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

Oh okay. I get it now.

But I now get the error below when I run with the code corrected:
Error in ko2kegg_abundance(file) :
lazy-load database '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/readr/R/readr.rdb' is corrupt
In addition: Warning messages:
1: In ko2kegg_abundance(file) : restarting interrupted promise evaluation
2: In ko2kegg_abundance(file) : internal error -3 in R_decompress1

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

Based on the error message you provided, it appears that there might be an issue with the readr package, which is a dependency of ggpicrust2. The error message suggests that the lazy-load database for the readr package is corrupt.

You can try to resolve this issue by reinstalling the readr package. You can do this by running the following command in R:

install.packages("readr", dependencies = TRUE)

If reinstalling the readr package does not resolve the issue, you can try updating all packages in your R environment by running the following command:

update.packages(ask = FALSE, dependencies = TRUE)

If the issue still persists, please provide more details about your R environment, such as the version of R and the operating system you are using, as well as any other relevant information. This will help in further troubleshooting the issue.

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

Simply re-installing "readr" solved the issue. Thank you.

You've got a great package, by the way. Been struggling to visualise my picrust results.

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

I now run this:
results <- ggpicrust2(file = "picrust2/picrust2_out/KO_metagenome_out/pred_metagenome_unstrat.tsv",
metadata = metadata,
group = "Vacc_St",
pathway = "KO",
daa_method = "limma voom",
order = "pathway_class",
ko_to_kegg = T,
x_lab = "pathway_name",
p.adjust = "BH",
select = NULL,
reference = "Harvard BRI"
)

And I get this here:

Calculation may take a long time, please be patient.
The kegg pathway with zero abundance in all the different samples has been removed.
Error in relevel.factor(Group, ref = reference) :
'ref' must be an existing level

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

Because you choose daa_method = "limma voom" which is a daa_method needs reference level, you should choose one level of your metadata[,"Vacc_St"] as reference.

Actually I suggest you use separate individual functions to complete the analysis.

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

Oh 😂, "Harvard BRI" is the reference level of my example data. Because it's experimented in "Harvard BRI" Lab.
you should use following code to check your reference and choose it.

levels(as.factor(metadata[,"Vacc_St"]))

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

😂😂😂😂
How do I now go around this information after running the code:
ggpicrust2(file = "picrust2/picrust2_out/KO_metagenome_out/pred_metagenome_unstrat.tsv",
metadata = metadata,
group = "Vacc_St",
pathway = "KO",
daa_method = "limma voom",
order = "pathway_class",
ko_to_kegg = T,
x_lab = "pathway_name",
p.adjust = "BH",
select = NULL,
reference = "NN")

The pathways with statistically significance are too many. The database cannot execute the query request in a single time. Please seperate it.
Error in pathway_errorbar(abundance = abundance, daa_results_df = daa_sub_method_results_df_sorted, :
The feature with statistically significance are more than 30, the visualization will be terrible.
Please use select to reduce the number.
Now you have "ko05340", "ko00564", "ko03030", "ko00561", "ko00250", "ko04111", "ko04940", "ko05412", "ko00195", "ko00760", "ko00310", "ko00600", "ko00604", "ko04260", "ko04110", "ko04973", "ko00510", "ko00524", "ko05222", "ko05416", "ko03440", "ko00590", "ko03060", "ko00380", "ko00500", "ko05322", "ko00625", "ko00624", "ko00627", "ko00626", "ko00621", "ko00270", "ko01053", "ko00100", "ko05016", "ko00071", "ko00072", "ko05210", "ko01055", "ko04910", "ko00531", "ko04916", "ko00360", "ko00633", "ko00630", "ko00364", "ko04115", "ko03050", "ko00361", "ko00362", "ko01040", "ko00603", "ko03018", "ko00281", "ko00280", "ko03013", "ko05200", "ko05020", "ko00523", "ko00520", "ko00521", "ko05146", "ko05145", "ko00052", "ko00053", "ko00051", "ko00401", "ko00400", "ko00350", "ko00480", "ko00643", "ko00640", "ko02020", "ko00120", "ko00965", "ko03008", "k

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

But what if you want to see all the significant pathways? That is not possible?

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

So I specify select="Top30", as advised and now get the message below:

Calculation may take a long time, please be patient.
The kegg pathway with zero abundance in all the different samples has been removed.
We are connecting to the KEGG database to get the latest results, please wait patiently.
The pathways with statistically significance are too many. The database cannot execute the query request in a single time. Please seperate it.
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'physeq' in selecting a method for function 'taxa_are_rows': invalid class “otu_table” object:
OTU abundance data must have non-zero dimensions.

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

May be you can try setting select = "Top 10" , "Top 20", "Top 30",sorry for the delayed response.

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

Or you can set p.adjust = "bonferroni", it’s a more strict p.adjust method.

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

Kindly find the files attached:

pred_metagenome_unstrat.tsv.gz
pi_metadata_copy.csv

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

I tried using set p.adjust = "bonferroni" as you suggested and now got the message below:

Calculation may take a long time, please be patient.
The kegg pathway with zero abundance in all the different samples has been removed.
We are connecting to the KEGG database to get the latest results, please wait patiently.
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'physeq' in selecting a method for function 'taxa_are_rows': invalid class “otu_table” object:
OTU abundance data must have non-zero dimensions.

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

Can you look at the paper and use seperate functions? ggpicrust2() is a integrative function so it's not easy to debug? https://www.researchgate.net/publication/369380349_ggpicrust2_an_R_package_for_PICRUSt2_predicted_functional_profile_analysis_and_visualization

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

Please set select=c("ko05340", "ko00564", "ko03030", "ko00561", "ko00250", "ko04111", "ko04940", "ko05412", "ko00195") which KOs you want to explore. 发送自 Outlook for iOShttps://aka.ms/o0ukef

Such using of select parameter only can be used in pathway_errorbar() since select parameter in ggpicrust2() only uses NULL, Top 30, Top 20, Top10.

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

So I have successfully run these commands:
daa_results_df <- pathway_daa(abundance = kegg_abundance,
metadata = metadata,
group = "Vacc_St" ,
daa_method = "LinDA",
select = c("ko05340","ko03030", "ko00561","ko00250",
"ko04940", "ko05412","ko00310", "ko00600",
"ko04260", "ko00510", "ko05222", "ko03440",
"ko00590","ko03060","ko00380", "ko05322",
"ko00625","ko00626","ko00621", "ko00270",
"ko01053","ko00100", "ko05016","ko00072",
"ko05210", "ko0105", "ko04916", "ko00360",
"ko00633", "ko00630", "ko04115", "ko03050",
"ko01040", "ko03018", "ko03013", "ko05200",
"ko05020", "ko05146", "ko05145", "ko00052",
"ko00051", "ko00480", "ko00640", "ko02020",
"ko00965", "ko03008", "ko05414", "ko05010",
"ko05012", "ko00980"),
p.adjust = "BH",
reference = "NN")

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

I go on to do this:
pathway_errorbar(abundance = kegg_abundance,
daa_results_df = daa_results_df,
Group = metadata$Vacc_St,
ko_to_kegg = TRUE,
p_values_threshold = 0.05,
order = "pathway_class",
select = c("ko05340","ko03030", "ko00561","ko00250",
"ko04940", "ko05412","ko00310", "ko00600",
"ko04260", "ko00510", "ko05222", "ko03440"),
p_value_bar = TRUE,
colors = NULL,
x_lab = NULL)

and I get this:
Registered S3 method overwritten by 'GGally':
method from
+.gg ggplot2
Error in get(as.character(FUN), mode = "function", envir = envir) :
object 'guide_prism_offset_minor' of mode 'function' was not found

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

Kindly help me understand something on the resulting plot of the pathway_errorbar().

What is the log2 foldchange plot on the right in reference to? I presume it Is fold change in reference to what I specify in pathway_daa(reference)? If yes, if there are 4 groups and I specify 1 of them as the reference, then which of the 3 other groups is the fold change referring to?

from ggpicrust2.

JAkorli avatar JAkorli commented on September 17, 2024

Hello @cafferychen777,
Find below my files:
pi_metadata_NP_VP_copy.csv
pred_metagenome_unstrat_NPVP.tsv.zip

from ggpicrust2.

cafferychen777 avatar cafferychen777 commented on September 17, 2024

It means nothing. If you use multiple groups comparasion, log 2 fold change means nothing, you should set p_values_bar to FALSE.

from ggpicrust2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.