borenstein-lab / fishtaco

FishTaco (Functional Shifts Taxonomic Contributors) is a metagenomic computational framework that aims to identify the driver taxa of microbiome functional shifts
Other
23 stars 4 forks source link

Error when visualizing output with fishtaco plot #12

Open aboderinf opened 3 years ago

aboderinf commented 3 years ago

Hi,

I have been trying to visualize the results from running fishtaco but while running the MultiFunctionTaxaContributionPlots function I get the following error:

Error in if (taxa_da[taxa_da$Taxa == curr_taxa, "StatValue"] > 0) { : missing value where TRUE/FALSE needed

I would be grateful for any suggestions on how to fix this error.

Thank you!

engal commented 3 years ago

Can you provide any more information on how you ran MultiFunctionTaxaContributionPlots? Did you make any changes to the defaults?

aboderinf commented 3 years ago

I did make changes to the defaults. Here is the what I ran:

p <- MultiFunctionTaxaContributionPlots(input_dir="~/Microbiome/Fish-Taco_Test/LDRN-Dermis3", input_prefix="fishtaco_out", input_taxa_taxonomy="~/Microbiome/Fish-Taco_Test/LDRN-Dermis3/Taxa_Taxonomy.txt", sort_by="list", plot_type="bars", input_permutation="single_taxa", input_score="t_test", input_function_filter_list=c("ko00020"), add_predicted_da_markers=TRUE, add_original_da_markers=TRUE)

engal commented 3 years ago

Hmm, any chance you could share the first ~5 lines of your taxonomy differential abundance data file? It should be named something like fishtaco_out_STAT_DA_taxaSCORE*.

aboderinf commented 3 years ago

Here are the first few lines.

Taxa100054 0.0 4.961968566423876e-05 -1.637583706890878 0.17685043104529263 -0.7523938773229989 1.0 NA Taxa100054 Taxa1000547 0.0013182165477067756 0.0009624921344565471 0.5150304414990695 0.6336855616027759 0.19812618807387297 1.0 NA Taxa1000547 Taxa1006600 0.0 3.444571244501851e-05 -1.0 0.373900966300059 -0.42724341246481967 1.0 NA Taxa1006600 Taxa100870 0.0 0.0 NA NA NA NA NA Taxa100870 Taxa101033 0.0 1.3433351186257056e-05 -0.9999999999999999 0.373900966300059 -0.42724341246481967 1.0 NA Taxa101033 Taxa1011502 0.0 5.227933239230535e-05 -1.0000000000000002 0.3739009663000589 -0.4272434124648198 1.0 NA Taxa1011502

I've also tried filtering out the NAs from this file but I get another error that reads: Error in if (taxa_da[taxa_da$Taxa == curr_taxa, "StatValue"] >= 0) { : argument is of length zero

engal commented 3 years ago

When you originally ran FishTaco, did you have any taxa that were at 0 abundance across all samples? Specifically, looking at the data you sent, it looks like Taxa100870 was at 0 abundance across all case and control samples (the first two numeric columns indicate case mean abundance and control mean abundance respectively). This causes the differential abundance statistic value to be NA (third numeric column), which I believe is causing your original issue.

To test this, you might be able to just remove all rows where the StatValue column is NA, though I'm not entirely sure if this will cause problems elsewhere. If this approach fails (you encounter a different error), then you may need to rerun FishTaco after filtering out taxa that are at zero abundance across all samples.

Please let me know what happens if you try this.

aboderinf commented 3 years ago

Rerunning FishTaco after filtering out taxa that are at zero abundance worked! Thank you so much for your help!