Skip to contents

Write ref_seq from a microbiome_dataset to a FASTA file for use in external tools.

Usage

export_ref_seq(object, file, width = 80)

Arguments

object

A microbiome_dataset object.

file

Output FASTA path.

width

Number of letters per line in the FASTA file.

Value

Invisibly returns file.

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’
ref_seq <- Biostrings::DNAStringSet(rep("ACGT", nrow(x@variable_info)))
x <- replace_ref_seq(x, value = ref_seq)
fasta_file <- tempfile(fileext = ".fasta")
export_ref_seq(x, fasta_file)
file.exists(fasta_file)
#> [1] TRUE