How to merge the same data for analysis?
For my case, I have a few duplicates for the same samples
For example:
Illeum_Dose1_Sample1
Illeum_Dose1_Sample2
Illeum_Dose1_Sample3
Illeum_Dose2_Sample1
Illeum_Dose2_Sample2
Illeum_Dose2_Sample3
Ceca_Dose1_Sample1
Ceca_Dose1_Sample2
Ceca_Dose1_Sample3
Ceca_Dose2_Sample1
Ceca_Dose2_Sample2
Ceca_Dose2_Sample3
My phyloseq object:
phyloseq-class experiment-level object
otu_table() OTU Table: [ 1603 taxa and 48 samples ]
sample_data() Sample Data: [ 48 samples by 1 sample variables ]
tax_table() Taxonomy Table: [ 1603 taxa by 6 taxonomic ranks ]
My metadata:
type
Illeum_Dose1_Sample1 Illeum
Illeum_Dose1_Sample2 Illeum
Illeum_Dose1_Sample3 Illeum
Illeum_Dose2_Sample1 Illeum
Illeum_Dose2_Sample2 Illeum
Illeum_Dose2_Sample3 Illeum
Ceca_Dose1_Sample1 Ceca
Ceca_Dose1_Sample2 Ceca
Ceca_Dose1_Sample3 Ceca
Ceca_Dose2_Sample1 Ceca
Ceca_Dose2_Sample2 Ceca
Ceca_Dose2_Sample3 Ceca
Referring to the data above, may I kindly ask what should I do, to merge Illeum_Dose1_Sample1 Illeum_Dose1_Sample2 Illeum_Dose1_Sample3 into one for analysis purpose (the same for others)
I tried the tutorial from https://joey711.github.io/phyloseq/merge.html#merge_phyloseq But it doesn't work for me
It would be great if I could get some help for this Appreciate your time and help!
The simplest way would probably be to add another column to your data like so: sample_data(phy)$type_dose <- sub("_Sample.*$","",sample_names(phy))
And then you can merge on the new column (type_dose): merge_samples(phy, "type_dose")