jbisanz / qiime2R

Import qiime2 artifacts to R
MIT License
156 stars 53 forks source link

qiime2 to Phyloseq #46

Closed amrvx4 closed 2 years ago

amrvx4 commented 2 years ago

Hi, I was running into an issue when I tried to convert QIIME2 to phyloseq. See below.

physeq<-qza_to_phyloseq( features="mergerep.qza") Error in validObject(.Object) : invalid class “otu_table” object: Non-numeric matrix provided as OTU table. Abundance is expected to be numeric.

Then I checked the Type and it shows "Sequence" instead of "Frequency".

SVs$type [1] "FeatureData[Sequence]"

So I was wondering if there is any way to convert the type to Frequency before I import into phyloseq?

Thanks,

jbisanz commented 2 years ago

I think this means that your qza contains a fasta file of the representative sequences rather than feature abundances. If you want to import the sequences, you can do it manually with something like:

pdata<-
read_qza("mergerep.qza")$data %>%
refseq(.) %>%
phyloseq()

Off the top of my head, I'm not sure how helpful phyloseq would be with the representative sequences. I have the sneaking thought that this isn't what are actually wanting to do. I think you are wanting to import the table of feature abundances which means you need to go back to qiime and make sure you are getting the correct data to import.