I need to rename the DNA sequences of a phyloseq object with ASV1,2,3 and then attach the taxonomy to each new ASV name, so I could export the renamed sequences as a fasta file. I did this successfully with a phyloseq object of PacBio sequences generated from DADA2 in R, however, when I used the same code with a phyloseq object of MiSeq sequences generated from exported files from Qiime2, it did not work and I got the error below. I checked the sequences and they do not have character 3 as mentioned in the error. Also, this is a copy of displayed refseq that I want to rename
DNAStringSet object of length 300: width seq names  422 AATTCCAGCTCCAGTAGCGTATATTAAAGTTGTTGCA...ATTGATCAAGAACGAAGGTTAGGGGATCAAAAACGAT dbb34b29572a04b85...  256 CACCGGCGGCCCGAGTGGTGATCGTGATTATTGGGTC...GACGGTGAGGGACGAAAGCTGGGGGCACGAACCGGAT 2e526fb2f04bd2256...  256 AATACCAGCACCCCGAGTGGTCGGGACGATTATTGGG...CGACGGTGAGGGATGAAAGCTGGGGGAGCAAACCGGA 4d7c52dbb5a1ec9e1...  255 AATACCAGCACCCCGAGTGGTCGGGACGTTTATTGGG...TCGACGGTGAGGGATGAAAGCTGGGGGAGCAAACCGG ccde686df510e9ac2...  254 AATACGAGAGGGGTAAGCATTATTCATCATTAATGGG...GACGCTGAGGTACGAAAGTATGGGGAGCAAAACGGAT 930ed6799694562ae... ... ... ...  255 AATACGGAGGGTGCAAGCGTTAATCGGAATTACTGGG...CTGACGCTCAGGTGCGAAAGCGTGGGGAGCAAACAGG 16a154a51bcfba90e...  253 TACGGAGGGTGCAAGCGTTAATCGGAATTACTGGGCG...CTGACGCTCAGGTGCGAAAGCGTGGGGAGCAAACAGG 5673ae66819e3bdbb...  253 TACGGAGGGTGCAAGCGTTAATCGGAATTACTGGGCG...CTGACGCTCAGGTGCGAAAGCGTGGGGAGCAAACAGG 6110f28a1de867a99...  253 TACGGAGGGTGCAAGCGTTAATCGGAATTACTGGGCG...CTGACGCTCAGGTGCGAAAGCGTGGGGAGCAAACAGG 119b7061439276460...  253 TACGGAGGGTGCAAGCGTTAATCGGAATTACTGGGCG...CTGACGCTCAGGTGCGAAAGCGTGGGGAGCAAACAGG 945184b6386c192c0...
Code should be placed in three backticks as shown below
dna <- Biostrings::DNAStringSet(taxa_names(ps.gen)) names(dna) <- taxa_names(ps.gen) ps.gen <- merge_phyloseq(ps.gen, dna) taxa_names(ps.gen) <- paste0("ASV", seq(ntaxa(ps.gen))) ps.gen I got this error from the first line of the code Error in .Call2("new_XStringSet_from_CHARACTER", class(x0), elementType(x0), : key 51 (char '3') not in lookup table
Your help is much appreciated!