I am analyzing 16s microbiome data from the lung and mouth and I'm basically teaching myself R. So I made it through qiime and have uploaded two files into R. My OTU table using:
otu=import_biom('C:\Users\OneDrive\otu_table.biom')
and my sort of "map" file which just contains SampleID, Location, and Paired. For example:
SampleID Location Paired
1_L Lung 1
1_M Mouth 1
2_L Lung 2
2_M Mouth 2
code:
map=read.csv('C:\Users\OneDrive\Mouth vs lung R map_adj.csv',
header=T,row.name=1,stringsAsFactors=F)
My data is paired and I want to compare the lung vs the mouth using a heatmap. I've been having trouble with R. First off it won't let me do it by location. I've tried:
plot_heatmap(otu, sample.label="SampleType")
And I got this error:
Error in get_variable(physeq, sample.label) :
Your phyloseq data object does not have a sample-data component
Try ?sample_data for more details.
I went to ?sample_data
and I have no idea what I am missing here.
Secondly, I'd like to do it by location and paired if that makes sense.
Can anyone help me with this code and maybe explain what it is I'm missing here, because I also have data where I look at the lung microbiome at baseline and then again 2 months later so that also is paired data.
Thank you for your help!
Here is my whole code:
library("phyloseq")
packageVersion("phyloseq")
otu=import_biom('C:\Users\closed-ref-33031010\otu_table.biom')
map=read.csv('C:\Users\Qiime Maps\Mouth vs lung R map_adj.csv',
header=T,row.name=1,stringsAsFactors=F)
sampledata1=sample_data(map)
otu2=merge_phyloseq(otu,sampledata1)
plot_heatmap(otu2)
In addition, I'm unsure how to make a phyloseq object