Read a FASTA file into ref_seq and optionally align sequence names to the
current dataset.
Arguments
- object
A
microbiome_datasetobject.- file
Input FASTA path.
- format
Sequence format passed to
Biostrings::readDNAStringSet().- align
Should imported sequences be aligned to
variable_info?
Examples
data("global_patterns", package = "microbiomedataset")
x0 <- prune_taxa(global_patterns, variable_id = global_patterns@variable_info$variable_id[1:80])
x <- microbiomedataset::convert2microbiome_dataset(
microbiomedataset::convert2phyloseq(x0)
)
#> Found more than one class "phylo" in cache; using the first, from namespace 'phyloseq'
#> Also defined by ‘tidytree’
#> Found more than one class "phylo" in cache; using the first, from namespace 'phyloseq'
#> Also defined by ‘tidytree’
#> Found more than one class "phylo" in cache; using the first, from namespace 'phyloseq'
#> Also defined by ‘tidytree’
#> Found more than one class "phylo" in cache; using the first, from namespace 'phyloseq'
#> Also defined by ‘tidytree’
fasta_file <- tempfile(fileext = ".fasta")
ref_seq <- Biostrings::DNAStringSet(rep("ACGT", nrow(x@variable_info)))
names(ref_seq) <- x@variable_info$variable_id
Biostrings::writeXStringSet(ref_seq, fasta_file, format = "fasta")
x <- import_ref_seq(x, fasta_file)
length(x@ref_seq)
#> [1] 80
