Retrieve Sequence from Phyloseq

fetchSequence(x, seq_id = NULL, as_DNAStringSet = TRUE)

Arguments

x

A phyloseq object

seq_id

A list of IDs matching taxa_names(phyloseq) that also have sequence information stored in refseq slot of phyloseq object.

as_DNAStringSet

Logical (Default=TRUE). If FALSE sequences are returned as character strings.

Value

Sequences for user species IDs either as vector or DNAStringSet object

Details

Retrieve sequences from refseq slot in phyloseq phyloseq object.

Author

Sudarshan A. Shetty

Examples

library(biomeUtils)
data("SprockettTHData")
ps <- SprockettTHData
seq_id <- c("ASV_30_Lachnospiraceae", "ASV_451_UC5-1-2E3", "ASV_586_CAG-56")
myseqs <- fetchSequence(ps, seq_id = seq_id, as_DNAStringSet = TRUE)
myseqs
#> DNAStringSet object of length 3:
#>     width seq                                               names               
#> [1]   233 GCAAGCGTTATCCGGATTTACTG...CGTTGAGGCTCGAAAGCGTGGGG ASV_30_Lachnospir...
#> [2]   233 GCAAGCGTTATCCGGATTTACTG...CGTTGAGGCTCGAAAGCGTGGGG ASV_451_UC5-1-2E3
#> [3]   233 GCAAGCGTTATCCGGATTTACTG...CGTTGAGGCTCGAAAGCGTGGGG ASV_586_CAG-56