Qiime2R Phyloseq Error

Hello there,

Thank you very much for qiime2R. I have managed to import my data and construct a PCOA. However, I am running into errors constructing a phyloseq object and am still familiarising myself with R. My commands are:

phyloseq<-qza_to_phyloseq(“table”, “tree”, “taxonomy”, “metadata”)

But I receved the error:
Error in unzip(file, exdir = tmp, list = TRUE) : **
** zip file ‘table’ cannot be opened

In addition: Warning message:
In unzip(file, exdir = tmp) : error 1 in extracting from zip file

I then tried:

otu_table(table$data, taxa_are_rows = T),
tax_table(as.data.frame(taxonomy) %>% select(-Confidence) %>% column_to_rownames(“Feature.ID”) %>% as.matrix()),
sample_data(metadata %>% as.data.frame() %>% column_to_rownames("#SampleID"))

But received the error:
Error in (function (…, row.names = NULL, check.rows = FALSE, check.names = TRUE, : **
** arguments imply differing number of rows: 1, 0

I cannot seem to find any problem with my imported artifacts, and would appreciate any help.

1 Like

Rather than “table” etc, you want to type the literal file name (or path) of your qiime2 artifact (.qza). For example:
phyobj<-qza_to_phyloseq("/path/to/your/qza/table.qza", ...)


Thanks for the response, @jbisanz. I should have clarified earlier - I have setwd where the qza files are and assigned names to them.

table <-read_qza(“table-no-mitochondria-no-chloroplast.qza”)

Apart from the lines in my original post, I have tried the actual names:


As well as the actual names with their file paths, but received a different kind of error:

Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : **
** line 1 did not have 2 elements

In addition: Warning messages:
1: In grepl("^#q2:types", defline) :
** input string 1 is invalid in this locale**
2: In read.table(metadata, row.names = 1, sep = “\t”, quote = “”, header = TRUE) :
** line 1 appears to contain embedded nulls**
3: In read.table(metadata, row.names = 1, sep = “\t”, quote = “”, header = TRUE) :
** line 4 appears to contain embedded nulls**

I apologise as I do not understand this error message, and am wondering what I could do to correct it? Many thanks.

It seems that it was a problem when working with xlsx. I have managed to solve the problem by changing the metadata to csv format.



1 Like