joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
586 stars 186 forks source link

When using phyloseq_merge, get Error in access(object, "sam_data", errorIfNULL) : sam_data slot is empty. #1675

Open icbarron opened 1 year ago

icbarron commented 1 year ago

Hello, I am trying to use phyloseq to generate alpha and beta diversity plots from kraken2 and bracken data. The kreports were converted to .biom format with kraken-biom, and I manually added the metadata, which I will attach here. I cannot seem to get the individual phyloseq objects to properly merge. I've attached here the metadata file and a few examples of the .biom files. Thank you!

library(dplyr)
library(microbiome)
library(rbiom)
library(phyloseq)
library(ggplot2)
library(knitr)
library(hrbrthemes)
library(gcookbook)
library(tidyverse)
sb106mb <- read_phyloseq("106bracken.biom", type = "biom")
sb103bmb <- read_phyloseq("103bbracken.biom", type = "biom")
sb103mb <- read_phyloseq("103bracken.biom", type = "biom")
sb95mb <- read_phyloseq("95bracken.biom", type = "biom")
sb92mb <- read_phyloseq("92bracken.biom", type = "biom")
sb86mb <- read_phyloseq("86bracken.biom", type = "biom")
sb81mb <- read_phyloseq("81bracken.biom", type = "biom")
sb73mb <- read_phyloseq("73bracken.biom", type = "biom")
sb69mb <- read_phyloseq("69bracken.biom", type = "biom")
sb67mb <- read_phyloseq("67bracken.biom", type = "biom")
sb63mb <- read_phyloseq("63bracken.biom", type = "biom")
sb53mb <- read_phyloseq("53bracken.biom", type = "biom")
sb48mb <- read_phyloseq("48bracken.biom", type = "biom")
sb44mb <- read_phyloseq("44bracken.biom", type = "biom")
sb41mb <- read_phyloseq("41bracken.biom", type = "biom")
sb35mb <- read_phyloseq("35bracken.biom", type = "biom")
sb30mb <- read_phyloseq("30bracken.biom", type = "biom")
sb25mb <- read_phyloseq("25bracken.biom", type = "biom")
sb21mb <- read_phyloseq("21bracken.biom", type = "biom")
sb19mb <- read_phyloseq("19bracken.biom", type = "biom")
sb13mb <- read_phyloseq("13bracken.biom", type = "biom")
sb12mb <- read_phyloseq("12bracken.biom", type = "biom")
sb4mb <- read_phyloseq("4bracken.biom", type = "biom")
JMTmetadata <- read.csv("C:/Users/Admin/OneDrive/JMTmetadata.csv", sep="")
sample_data <-JMTmetadata
sample_data(sb106mb) <- sample_data
sample_data(sb103bmb) <- sample_data
sample_data(sb103mb) <- sample_data
sample_data(sb95mb) <- sample_data
sample_data(sb92mb) <- sample_data
sample_data(sb86mb) <- sample_data
sample_data(sb81mb) <- sample_data
sample_data(sb73mb) <- sample_data
sample_data(sb69mb) <- sample_data
sample_data(sb67mb) <- sample_data
sample_data(sb63mb) <- sample_data
sample_data(sb53mb) <- sample_data
sample_data(sb48mb) <- sample_data
sample_data(sb44mb) <- sample_data
sample_data(sb41mb) <- sample_data
sample_data(sb35mb) <- sample_data
sample_data(sb30mb) <- sample_data
sample_data(sb25mb) <- sample_data
sample_data(sb21mb) <- sample_data
sample_data(sb19mb) <- sample_data
sample_data(sb13mb) <- sample_data
sample_data(sb12mb) <- sample_data
sample_data(sb4mb) <- sample_data
sample_names(sb106mb)<-106
sample_names(sb103bmb)<-103.1
sample_names(sb103mb)<-103
sample_names(sb95mb)<-95
sample_names(sb92mb)<-92
sample_names(sb86mb)<-86
sample_names(sb81mb)<-81
sample_names(sb73mb)<-73
sample_names(sb69mb)<-69
sample_names(sb67mb)<-67
sample_names(sb63mb)<-63
sample_names(sb53mb)<-53
sample_names(sb48mb)<-48
sample_names(sb44mb)<-44
sample_names(sb41mb)<-41
sample_names(sb35mb)<-35
sample_names(sb30mb)<-30
sample_names(sb25mb)<-25
sample_names(sb21mb)<-21
sample_names(sb19mb)<-19
sample_names(sb13mb)<-13
sample_names(sb12mb)<-12
sample_names(sb4mb)<-4
plot_richness(sb106mb)
plot_richness(sb103mb)
plot_richness(sb103bmb)
plot_richness(sb95mb)
plot_richness(sb92mb)
plot_richness(sb86mb)
plot_richness(sb81mb)
plot_richness(sb73mb)
plot_richness(sb69mb)
plot_richness(sb67mb)
plot_richness(sb63mb)
plot_richness(sb53mb)
plot_richness(sb48mb)
plot_richness(sb44mb)
plot_richness(sb41mb)
plot_richness(sb35mb)
plot_richness(sb30mb)
plot_richness(sb25mb)
plot_richness(sb21mb)
plot_richness(sb19mb)
plot_richness(sb13mb)
plot_richness(sb12mb)
plot_richness(sb4mb)
sb_all <- merge_phyloseq(sb106mb, sb103bmb, sb103mb, sb95mb, sb92mb, sb86mb, sb81mb, sb73mb, sb69mb, sb67mb, sb63mb, sb53mb, sb48mb, sb44mb, sb41mb, sb35mb, sb30mb, sb25mb, sb21mb, sb19mb, sb13mb, sb12mb, sb4mb)

JMTmetadata.csv samples.zip