Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in access(object, "otu_table", errorIfNULL) : otu_table slot is empty. #148

Open
chrstraub opened this issue Apr 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@chrstraub
Copy link

Hi,

I have a problem plotting relative abundance for some of my samples.
This is my phyloseq object, which definitely has an OTU table:

> p2
phyloseq-class experiment-level object
otu_table()   OTU Table:         [ 14 taxa and 38 samples ]
sample_data() Sample Data:       [ 38 samples by 5 sample variables ]
tax_table()   Taxonomy Table:    [ 14 taxa by 6 taxonomic ranks ]

when I run:

> p2 %>%  comp_barplot(tax_level = "Family", palette = distinct_palette(20, pal = "kelly", add = "grey90"), tax_order = prev, merge_other = FALSE) +
+   coord_flip()
Error in access(object, "otu_table", errorIfNULL) : 
  otu_table slot is empty.

any idea why this is not working?
There are highly abundant OTU in this dataset - e.g

 |             | JMF.2401.06.0012B.nifH | JMF.2401.06.0013B.nifH | JMF.2401.06.0014B.nifH | JMF.2401.06.0015B.nifH |
|-------------|------------------------|------------------------|------------------------|------------------------|
| ASV_1gz_w59 | 0                      | 0                      | 0                      | 154                    |
| ASV_3mk_b1p | 11                     | 6                      | 6                      | 0                      |
| ASV_3rm_ons | 0                      | 0                      | 0                      | 0                      |
| ASV_ayc_4tn | 0                      | 0                      | 0                      | 0                      |
| ASV_bwq_05c | 83                     | 91                     | 68                     | 0                      |
| ASV_eho_sfq | 20053                  | 14661                  | 10056                  | 0                      |
| ASV_f1f_h9i | 0                      | 0                      | 0                      | 0                      |
| ASV_fym_g4q | 0                      | 0                      | 0                      | 37                     |
| ASV_gx2_inw | 0                      | 0                      | 0                      | 5                      |
| ASV_itd_swl | 49                     | 54                     | 43                     | 0                      |
| ASV_m16_dra | 0                      | 0                      | 0                      | 0                      |
| ASV_mq8_9mw | 18                     | 15                     | 10                     | 0                      |
| ASV_myz_xef | 0                      | 0                      | 1                      | 0                      |
| ASV_tli_pvo | 0                      | 0                      | 0                      | 25815                  |

but that shouldn't be a problem, right?

The dataset I am presenting above - is one sample type of two in the overall dataset. If I plot both sample types together using the same command as above, it works. If I plot only the other sample type (soil) it works. But if I try the one above, it doesn't and I can't quite pinpoint why.

Thanks!

@david-barnett
Copy link
Owner

Hi!
that is strange, and probably a bug in comp_barplot.

To investigate, can we simplify the problem a little?

Are you able to use comp_barplot on this dataset with any other settings? e.g. with no unnecessary customisation arguments:

p2 %>% comp_barplot(tax_level = "Family")

Try with a different rank? your dataset has unusually few distinct taxa, so one hypothesis I have is maybe you are running into a bug because of this. Are they perhaps all ASVs in the same Family? Try Genus, if you have that, and/or maybe change n_taxa from the default 8 to 2, or even 1

p2 %>% comp_barplot(tax_level = "Genus", n_taxa = 2)

Another possibility is that a dependency update has broken something 😬

can you copy paste the output of sessionInfo() ? Run all your code up to the line before the error, then run sessionInfo()

@david-barnett david-barnett added the bug Something isn't working label Apr 6, 2024
@chrstraub
Copy link
Author

Hi David,

ah yes - I thought I had tried that, but changing the taxonomic level worked.
Yes, there is only two different genera in this subset of samples and changing the level from "Family" to "Genus" worked.

Maybe you could build in an error message for a case like that, as that would be helpful for troubleshooting.

Thanks for your help,
Christina

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants