TransWikia.com

Kraken2 or metaphlan2 report to phyloseq

Bioinformatics Asked on February 20, 2021

I wish to convert a kraken2 or metaphlan2 report into the R package to analyze using Phyloseq.

I have performed obtained an importation and Phyloseq analysis, but the result was not correct.

library("phyloseq")
library("biomformat") 
otu_Rat11 <- read_biom("Rat11.biom") 

otumat_Rat11 = as(biom_data(otu_Rat11), "matrix") 
OTU_Rat11 <- otu_table(otumat_Rat11, taxa_are_rows=TRUE) 
str(OTU_Rat11)
#Formal class 'otu_table' [package "phyloseq"] with 2 
#slots ..@ .Data : num [1:1018, 1] 942 433 3007 116765 15103 ... .. ..- 
#attr(*, "dimnames")=List of 2 .. .. ..:?ℎ?[1:1018]"186826""33958""1578"
#"33959".........:chr[1:1018] "186826" "33958" "1578" "33959"......... :
# chr "sa1" ..@ taxa_are_rows: logi TRUE

taxmat_Rat11 = as.matrix(observation_metadata(otu_Rat11), rownames.force=TRUE)
TAX_Rat11 = tax_table(taxmat_Rat11)

physeq_Rat11 = phyloseq(OTU_Rat11, TAX_Rat11)
str(physeq_Rat11) 
#Formal class 'phyloseq' [package "phyloseq"] with 5 slots ..@ otu_table:Formal 
#class 'otu_table' [package "phyloseq"] with 2 slots .. .. ..@ .Data : num 
#[1:1018, 1] 942 433 3007 116765 15103 ... .. .. .. ..- attr(*, "dimnames")=List
# of 2 .. .. .. .. ..:?ℎ?[1:1018]"186826""33958""1578""33959".............: chr 
#[1:7] "taxonomy1" "taxonomy2" "taxonomy3" "taxonomy4" ... ..@ sam_data : NULL ..
#@ phy_tree : NULL ..@ refseq : NULL –

Now I try to obtain @ sam_data

sampledata = sample_data(otu_Rat11) 
#Error in access(object, "sam_data", errorIfNULL) : sam_data slot is empty.

What do with sample data and how to merge several phyloseq-format datasets from different metagenomes?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP