write_fasta_files: Write out a list of fasta files to a directory

Description Usage Arguments Value Examples

Description

Optionally assign names to the files if ‘fasta_list' isn’t already named or if you want to over-write the original names.

Usage

1
2
3
4
5
6
7
8
write_fasta_files(
  fasta_list,
  out_dir,
  fasta_names = NULL,
  ext = NULL,
  get_hash = TRUE,
  ...
)

Arguments

fasta_list

List of DNA sequences to write out. Each item in list must of class DNAbin.

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 drake_plan for tracking during workflows.

Value

None (invisible ‘NULL’) or character vector if 'hash' is 'TRUE'. Externally, fasta files will be written to 'out_dir'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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)
list.files(temp_dir)

# add extension
write_fasta_files(dna_list, temp_dir, ext = "fasta")
list.files(temp_dir)

# new names and extension
write_fasta_files(
  dna_list,
  temp_dir,
  fasta_names = c("ho", "ge"),
  ext = "fasta")
list.files(temp_dir)

# Cleanup
fs::file_delete(temp_dir)

joelnitta/baitfindR documentation built on May 7, 2020, 6:21 p.m.