Generates a fasta file from a metabarlist object, typically for a subset of MOTUs of interest.

fasta_generator(
  metabarlist,
  id = rownames(metabarlist$motus),
  output_file = NULL,
  annotation = NULL,
  annot_sep = ";"
)

Arguments

metabarlist

a metabarlist object.

id

a character vector containing identifiers for the MOTUs of interest. Default is the row names of table `motus`

output_file

the path/name of the output file.

annotation

a data frame containing the additional information to be added in the sequence header. Each row name is a MOTU identifier and each column header is the information key (correspond to "key=" in the fasta header). Default: NULL

annot_sep

the annotation separator. Default is ";"

Value

a fasta file

Details

Creates a fasta file from a set of sequences of interest. A single or multiple pieces of sequence information can be added to the sequence header via the `annotation` table. Using the default parameters, the resulting fasta file will have the following format:

>Seq_id1 abundance=83079; GC=47 tcaatctcgtgtgactaaacgccacttgtccctctaagaagttacgccgacagaatgcgatcggcgaactatttagcaggctagagtctcgttcgttat >Seq_id2 abundance=120520; GC=55 ctcaaacttccttggcctggaaggccatagtccctctaagaagctggccgcggagggtcacctccgcatagctagttagcaggctgaggtctcgttcgttaa

Author

Lucie Zinger, Clément Lionnet

Examples


data(soil_euk)
dir <- tempdir()
fasta_file_path <- file.path(dir, "Dominants.fasta")

## Export in fasta format the 10 most abundant MOTUs
idx <- order(soil_euk$motus$count, decreasing = TRUE)[1:10]
fasta_generator(soil_euk, rownames(soil_euk$motus)[idx],
  fasta_file_path
)

## Export in fasta format the 10 most abundant MOTUs, their abundance and the GC content
# of the corresponding sequence
annotation <- data.frame(
  abundance = soil_euk$motus$count[idx],
  GC_content = soil_euk$motus$GC_content[idx],
  row.names = rownames(soil_euk$motus)[idx]
)

fasta_generator(
  soil_euk, rownames(soil_euk$motus)[idx],
   fasta_file_path,
  annotation
)