Optionally assign names to the files if `fasta_list` isn't already named or if you want to over-write the original names.
write_fasta_files(fasta_list, out_dir, fasta_names = NULL, ext = NULL, get_hash = TRUE, ...)
| fasta_list | List of DNA sequences to write out. Each item in list
must of class |
|---|---|
| out_dir | Path to directory to write out DNA sequences. |
| fasta_names | Optional character vector of file names to use when writing out DNA sequences. |
| ext | Optional character vector of length one; file extension to append to DNA sequences (e.g., "fasta"). |
| get_hash | Logical; should the MD5 hash of `fasta_list` be returned? |
| ... | Additional other arguments. Not used by this function,
but meant to be used by |
None (invisible ‘NULL’) or character vector if `hash` is `TRUE`. Externally, fasta files will be written to `out_dir`.
# Load some example DNA sequences. library(ape) data(woodmouse) # Make a temporary working directory to write out files. temp_dir <- fs::dir_create(fs::path(tempdir(), "baitfindR_example")) # Make list of DNA samples. dna_list <- list(a = woodmouse, b = woodmouse) # Write out list: # names as-is write_fasta_files(dna_list, temp_dir)#> [1] "5a3f4d3219877f7afa647fe25e8ae0a8"list.files(temp_dir)#> [1] "a" "b"# add extension write_fasta_files(dna_list, temp_dir, ext = "fasta")#> [1] "5a3f4d3219877f7afa647fe25e8ae0a8"list.files(temp_dir)#> [1] "a" "a.fasta" "b" "b.fasta"# new names and extension write_fasta_files( dna_list, temp_dir, fasta_names = c("ho", "ge"), ext = "fasta")#> [1] "d67912fe5606116cac2937adc96000eb"list.files(temp_dir)#> [1] "a" "a.fasta" "b" "b.fasta" "ge.fasta" "ho.fasta"