<p><em>This question was also asked on <a href="https://stackoverflow.com/q/77003956/12369569">stack overflow</a></em></p>
<p>I have QIIME2 outputs (feature table, tree, taxonomy, and metadata) that I've imported into R using qiime2R (v. 0.99.6) ‘qza_to_phyloseq’ to create a phyloseq object. My QIIME feature table shows reasonable values for ASV abundance across all samples (n=16; feature table available upon request).</p>
<p>Problem: The otu_table the ASV values for an entire study (NCBI SRA accession PRJNA217520, named AS_Briggs_NGHP_17A in my data) are shown as 0. This is untrue according to QIIME2view outputs and core-metrics-results (generated following the moving pictures tutorial) and a barchart created using the phyloseq object. Additionally, some stats (alpha diversity) are calculated accurately yet other stats (core members of the microbiome) return errors citing the otu_table.</p>
<p>Ideal solution(s): 1) the otu_table from the phyloseq object is accurate, 2) I debug stats issues, and/or 3) all of the above.</p>
<p>Please see the following code and files for reproducibility below:</p>
<pre><code>library(&quot;qiime2R&quot;)
library(&quot;phyloseq&quot;)

pyro_physeq&lt;-qza_to_phyloseq(
  features=&quot;/path/pyro_sg.table.qza&quot;,
  tree=&quot;/path/pyro_sg.r.tree.qza&quot;,
  taxonomy = &quot;/path/pyro_sg.taxonomy.qza&quot;,
  metadata = &quot;/path/pyro_sg.met.short.txt&quot;)

#section out otu_table for ease
otu_table &lt;- (otu_table(pyro_physeq))
otu_table #all SRRs are the study &quot;AS_Briggs_NGHP_17A&quot; except for the first two, SRR1539064 and SRR1795474
</code></pre>
<p>I am not expecting the majority of these values to be 0's. I can create barcharts with the same phyloseq object, which use the otu_table as the input.</p>
<pre><code>plot_bar(pyro_physeq, fill=&quot;Class&quot;)
</code></pre>
<p>Alternatively, I've tried to section out the study &quot;AS_Briggs_NGHP_17A&quot; to visualize alone, and the barchart is how I'd expect. Similarly, I tried a quick shannon diversity analysis which was also calculated (and returned believable values).</p>
<pre><code>phy_briggs &lt;- subset_samples(pyro_physeq, name == &quot;AS_Briggs_NGHP_17A&quot;)
plot_bar(phy_briggs, fill=&quot;Class&quot;)
div.sh &lt;- data.frame(diversity(otu_ord, index = &quot;shannon&quot;))
</code></pre>
<p>HOWEVER, if I extract that otu_table it's all 0's. If I attempt to calculate the core microbiome using 'core_members' (<a href="https://stackoverflow.com/questions/77003956/otu-table-from-phyloseq-object-does-not-have-correct-abundance-all-asv-are-0?noredirect=1#comment135748718_77003956:%7E:text=R%20package%20microbiome">R package microbiome</a>), the 0's for all ASVs return errors.</p>
<pre><code>pseq.core &lt;- core_members(phy_briggs,prevalence = 50/100,detection = 1/100)
pseq.core
# returns 'character(0)', or to see the error:
pseq.core &lt;- core(phy_briggs,prevalence = 50/100,detection = 1/100)
Error in validObject(.Object) : invalid class “otu_table” object: 
 OTU abundance data must have non-zero dimensions.
</code></pre>
<p>This also occurs for the full phyloseq object (pyro_physeq). Thoughts?</p>
<p>Data</p>
<p>metadata: <a href="https://www.dropbox.com/scl/fi/wloiq8dze3znplmoqytzt/pyro_sg.met.short.txt?rlkey=bfsnrdqt1peh52xc2cqb3tgnd&amp;dl=0" rel="nofollow noreferrer">https://www.dropbox.com/scl/fi/wloiq8dze3znplmoqytzt/pyro_sg.met.short.txt?rlkey=bfsnrdqt1peh52xc2cqb3tgnd&amp;dl=0</a></p>
<p>tree: <a href="https://www.dropbox.com/scl/fi/oliaj1qb9annxxptlmuix/pyro_sg.r.tree.qza?rlkey=ijmjeyt77tvk63cn1tovbcgfr&amp;dl=0" rel="nofollow noreferrer">https://www.dropbox.com/scl/fi/oliaj1qb9annxxptlmuix/pyro_sg.r.tree.qza?rlkey=ijmjeyt77tvk63cn1tovbcgfr&amp;dl=0</a></p>
<p>feature table: <a href="https://www.dropbox.com/scl/fi/goav68y9osdhu6zoam2e0/pyro_sg.table.qza?rlkey=vzmbksfcpf1wvfyqy1frozxcs&amp;dl=0" rel="nofollow noreferrer">https://www.dropbox.com/scl/fi/goav68y9osdhu6zoam2e0/pyro_sg.table.qza?rlkey=vzmbksfcpf1wvfyqy1frozxcs&amp;dl=0</a></p>
<p>taxonomy: <a href="https://www.dropbox.com/scl/fi/3nmg3aobl8ck04uvm827u/pyro_sg.taxonomy.qza?rlkey=ujs4tjtzih5i6rhzj9xl4icri&amp;dl=0" rel="nofollow noreferrer">https://www.dropbox.com/scl/fi/3nmg3aobl8ck04uvm827u/pyro_sg.taxonomy.qza?rlkey=ujs4tjtzih5i6rhzj9xl4icri&amp;dl=0</a></p>

CC BY-SA 4.0
2023-08-30T16:18:12.577Z
Thanks for the detail. Is this a 16S tree? Is the underlying data set 16S metagenomics or whole genome metagenomics?
M__
CC BY-SA 4.0
2023-08-30T16:43:35.633Z
Hello, it's all 16S rRNA sequencing using primer-tagged pyrosequencing.
Geomicro
CC BY-SA 4.0
2023-08-30T16:59:23.027Z
I do understand microbial metagenomics in detail. I would just print out the tree and see what is there. ggtree should do that, i.e. for `pyro_physeq`. Maybe just post the treefile and see if it looks reasonable. I appreciate the detail of the question, but to fully resolve this appears to be a lot of work.
M__
<r><16rrna><phyloseq>
otu_table from phyloseq object does not have correct abundance: all asv are "0" for specific group of samples
# otu_table from phyloseq object does not have correct abundance: all asv are "0" for specific group of samples

(Asked by: username_0 on 2023-08-30)

This question was also asked on stack overflow
I have QIIME2 outputs (feature table, tree, taxonomy, and metadata) that I've imported into R using qiime2R (v. 0.99.6) ‘qza_to_phyloseq’ to create a phyloseq object. My QIIME feature table shows reasonable values for ASV abundance across all samples (n=16; feature table available upon request).
Problem: The otu_table the ASV values for an entire study (NCBI SRA accession PRJNA217520, named AS_Briggs_NGHP_17A in my data) are shown as 0. This is untrue according to QIIME2view outputs and core-metrics-results (generated following the moving pictures tutorial) and a barchart created using the phyloseq object. Additionally, some stats (alpha diversity) are calculated accurately yet other stats (core members of the microbiome) return errors citing the otu_table.
Ideal solution(s): 1) the otu_table from the phyloseq object is accurate, 2) I debug stats issues, and/or 3) all of the above.
Please see the following code and files for reproducibility below:
library("qiime2R")
library("phyloseq")

pyro_physeq<-qza_to_phyloseq(
  features="/path/pyro_sg.table.qza",
  tree="/path/pyro_sg.r.tree.qza",
  taxonomy = "/path/pyro_sg.taxonomy.qza",
  metadata = "/path/pyro_sg.met.short.txt")

#section out otu_table for ease
otu_table <- (otu_table(pyro_physeq))
otu_table #all SRRs are the study "AS_Briggs_NGHP_17A" except for the first two, SRR1539064 and SRR1795474

I am not expecting the majority of these values to be 0's. I can create barcharts with the same phyloseq object, which use the otu_table as the input.
plot_bar(pyro_physeq, fill="Class")

Alternatively, I've tried to section out the study "AS_Briggs_NGHP_17A" to visualize alone, and the barchart is how I'd expect. Similarly, I tried a quick shannon diversity analysis which was also calculated (and returned believable values).
phy_briggs <- subset_samples(pyro_physeq, name == "AS_Briggs_NGHP_17A")
plot_bar(phy_briggs, fill="Class")
div.sh <- data.frame(diversity(otu_ord, index = "shannon"))

HOWEVER, if I extract that otu_table it's all 0's. If I attempt to calculate the core microbiome using 'core_members' (R package microbiome), the 0's for all ASVs return errors.
pseq.core <- core_members(phy_briggs,prevalence = 50/100,detection = 1/100)
pseq.core
# returns 'character(0)', or to see the error:
pseq.core <- core(phy_briggs,prevalence = 50/100,detection = 1/100)
Error in validObject(.Object) : invalid class “otu_table” object: 
 OTU abundance data must have non-zero dimensions.

This also occurs for the full phyloseq object (pyro_physeq). Thoughts?
Data
metadata: https://www.dropbox.com/scl/fi/wloiq8dze3znplmoqytzt/pyro_sg.met.short.txt?rlkey=bfsnrdqt1peh52xc2cqb3tgnd&dl=0
tree: https://www.dropbox.com/scl/fi/oliaj1qb9annxxptlmuix/pyro_sg.r.tree.qza?rlkey=ijmjeyt77tvk63cn1tovbcgfr&dl=0
feature table: https://www.dropbox.com/scl/fi/goav68y9osdhu6zoam2e0/pyro_sg.table.qza?rlkey=vzmbksfcpf1wvfyqy1frozxcs&dl=0
taxonomy: https://www.dropbox.com/scl/fi/3nmg3aobl8ck04uvm827u/pyro_sg.taxonomy.qza?rlkey=ujs4tjtzih5i6rhzj9xl4icri&dl=0

**Tags:** r, 16rrna, phyloseq
> **Comments:**
> **username_1**: Thanks for the detail. Is this a 16S tree? Is the underlying data set 16S metagenomics or whole genome metagenomics?  
> **username_0**: Hello, it's all 16S rRNA sequencing using primer-tagged pyrosequencing.  
> **username_1**: I do understand microbial metagenomics in detail. I would just print out the tree and see what is there. ggtree should do that, i.e. for `pyro_physeq`. Maybe just post the treefile and see if it looks reasonable. I appreciate the detail of the question, but to fully resolve this appears to be a lot of work.  

---

## 0 answers

