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/
567 stars 187 forks source link

Give same ASV names between 3 datasets #1706

Open pailloufat-stack opened 9 months ago

pailloufat-stack commented 9 months ago

Hi, I ran DADA2 on my 3 datasets, then I got 3 "ps" phyloseq objetcs. I have the absolute abundaces for these 3 datasets. The thing I need is to convert the ASV sequences by "names" , and to keep the same names between the 3 datasets (to do some comparisons).

I have my 3 ps objects, from which I cleaned the "mitochondrial" and "chloroplastic" ASVs and filtered ASVs with low abundance < 2. I only show for one dataset what I did :

> ps.clean.p0.pool1
phyloseq-class experiment-level object
otu_table()   OTU Table:         [ 436 taxa and 79 samples ]
sample_data() Sample Data:       [ 79 samples by 12 sample variables ]
tax_table()   Taxonomy Table:    [ 436 taxa by 6 taxonomic ranks ]

Then, I converted the DNA sequences of the ASVs by names :

dna <- Biostrings::DNAStringSet(taxa_names(ps.clean.p0.pool1))
names(dna) <- taxa_names(ps.clean.p0.pool1)
ps.clean.p0.pool1 <- merge_phyloseq(ps.clean.p0.pool1, dna)
taxa_names(ps.clean.p0.pool1) <- paste0("ASV", seq(ntaxa(ps.clean.p0.pool1)))

taxa_names(ps.clean.p0.pool1)
  [1] "ASV1"   "ASV2"   "ASV3"   "ASV4"   "ASV5"   "ASV6"   "ASV7"   "ASV8"   "ASV9"  
 [10] "ASV10"  "ASV11"  "ASV12"  "ASV13"  "ASV14"  "ASV15"  "ASV16"  "ASV17"  "ASV18" 
 [19] "ASV19"  "ASV20"  "ASV21"  "ASV22"  "ASV23"  "ASV24"  "ASV25"  "ASV26"  "ASV27"
...

ASV1" will not correspond to the same DNA sequence between the 3 datasets. How to get the same "ASV names" for the same sequences between the datasets?

Best