# Error when creating a phyloseq object

**URL:** https://forum.qiime2.org/t/error-when-creating-a-phyloseq-object/33471
**Category:** Other Bioinformatics Tools
**Created:** [July 20, 2025, 12:44am UTC](https://forum.qiime2.org/t/error-when-creating-a-phyloseq-object/33471 "2025-07-20T00:44:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![e\_flat\_minor](https://forum.qiime2.org/user_avatar/forum.qiime2.org/e_flat_minor/32/15093_2.png) [@e\_flat\_minor](https://forum.qiime2.org/u/e_flat_minor)
#### Post date: [July 20, 2025, 12:44am UTC](https://forum.qiime2.org/t/error-when-creating-a-phyloseq-object/33471/1 "2025-07-20T00:44:45Z")

</div>

Hello,

this might be a question not directly towards qiime2 but related to creating a phyloseq object in R with the output created by qiime2.  
I am importing the output with qime2R:

> otu \<- read\_qza("otutable.qza")$data  
> metadata \<- read\_q2metadata("samplemetadata\_master.tsv")  
> tree \<- read\_qza("rooted\_tree.qza")$data  
> taxonomy \<- read\_qza("taxonomy-silva-primer.qza")$data %\>%  
> separate(Taxon, into = c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Species"), sep = ";") %\>%  
> column\_to\_rownames("Feature.ID") %\>% as.matrix() %\>% tax\_table()

This all works fine until I want to call the phyloseq command:

`ps <- phyloseq(otu_table(otu_transformed, taxa_are_rows = TRUE), taxonomy, metadata, phy_tree(tree))`

which returns the following error:

`Error: unable to find an inherited method for function ‘prune_samples’ for signature ‘samples = "array", x = "phyloseq"’`

I am really clueless and couldn't really find a solution/ explanation online. I am using R 4.5.1

Thank you!

---

<div class="post-metadata">

### Author: ![salias](https://forum.qiime2.org/user_avatar/forum.qiime2.org/salias/32/18594_2.png) [@salias](https://forum.qiime2.org/u/salias)
#### Post date: [July 21, 2025, 7:51am UTC](https://forum.qiime2.org/t/error-when-creating-a-phyloseq-object/33471/2 "2025-07-21T07:51:26Z")

</div>

I'm not a regular phyloseq user, but I've seen this error mentioned in their GitHub: [unable to find an inherited method for function ‘prune\_samples’ for signature ‘"array", "phyloseq"’ · Issue #1356 · joey711/phyloseq · GitHub](https://github.com/joey711/phyloseq/issues/1356)

I hope this helps!

Best,

Sergio

---

<div class="post-metadata">

### Author: ![e\_flat\_minor](https://forum.qiime2.org/user_avatar/forum.qiime2.org/e_flat_minor/32/15093_2.png) [@e\_flat\_minor](https://forum.qiime2.org/u/e_flat_minor)
#### Post date: [July 21, 2025, 11:14am UTC](https://forum.qiime2.org/t/error-when-creating-a-phyloseq-object/33471/3 "2025-07-21T11:14:45Z")

</div>

Thank you - funny - thats also the solution I used. I tried to be as verbose as possible. And it worked.

Thanks!
