ps_to_fasta: output a FASTA file from a phyloseq object

View source: R/helper_functions.R

ps_to_fastaR Documentation

output a FASTA file from a phyloseq object

Description

This function outputs a FASTA-formatted text file from a phyloseq object. This code was modified from reltools package https://github.com/DanielSprockett/reltools by Daniel Sprocket

Usage

ps_to_fasta(ps, out.file = NULL, seqnames = "unique", width = 1000, ...)

Arguments

ps

A phyloseq object that contains refseq. If there the refseq slot is not filled, this function will try pull the sequences from get_taxa

seqnames

(optional) A taxonomic rank from the tax_table which will be used to name the sequences. alternatively "unique" will uniquely name the sequences as ASV_#, "sequence" will name the sequences in the fasta exactly the same same as the sequence, usfull for LULU curation.

width

(Default 1000) The number of characters in each fasta line before wrapping occurs

...

(Optional) Any further paramaters to be passed to writeXStringSet

file

(optional) A file name that ends in ".fasta" or ".fa". If a file name is not supplied, the file will be named after the phyloseq object.

Value

This function saves a FASTA-formatted text file from the input phyloseq object.

Examples

save_fasta(ps)
save_fasta(ps = ps, file = "sequences.fasta", rank = "Genus")

alexpiper/seqateurs documentation built on July 9, 2023, 7:21 a.m.