I am studying the microbiome of an organism and I have sequenced 3 PCR replicates for each sample. I am working with a phyloseq object and my sample_df looks like this (simplified):
> df
phyloseq-class experiment-level object
otu_table() OTU Table: [ 28974 taxa and 112 samples ]
sample_data() Sample Data: [ 112 samples by 2 sample variables ]
tax_table() Taxonomy Table: [ 28961 taxa by 10 taxonomic ranks ]
>sample_data(df)
Sample Data: [112 samples by 2 sample variables]:
sample replicate
s1_A sample1 A
s1_B sample1 B
s1_C sample1 C
s2_A sample2 A
s2_B sample2 B
s2_C sample2 C
I want to merge my ESVs reads, but only when they appear in two out of three replicates and I have no idea how to do it.
I know about the function merge_samples to merge all the replicates, but I would like to add the condition of 2/3 replicates
df_merged<- merge_samples(df, "sample", fun=sum) #merge samples
I have no idea how to continue, so any help would be great
thanks so much!