Description Usage Arguments Value Examples
Top hits and original fasta files are matched based on the first part of the filename separated by periods (i.e., the filename without any extension).
1 2 3 4 5 6 7  | realign_with_best_hits(
  best_hits_dir,
  best_hits_pattern = "bestmatch",
  fasta_dir,
  fasta_pattern = "\\.fa$",
  ...
)
 | 
best_hits_dir | 
 Path to directory containing top blast hits.  | 
best_hits_pattern | 
 Pattern used for matching with grep. Only files with names matching the pattern will be included as the top blast hit.  | 
fasta_dir | 
 Path to directory containing fasta files for realignment.  | 
fasta_pattern | 
 Pattern used for matching with grep. Only files with names matching the pattern will be included for realignment.  | 
... | 
 Additional other arguments. Not used by this function,
but meant to be used by   | 
List of lists, each of which is of class 'DNAbin'.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43  | library(ape)
# Make temp dir for storing files
temp_dir <- fs::dir_create(fs::path(tempdir(), "baitfindR_example"))
# Write out ape::woodmouse dataset as DNA
data(woodmouse)
ape::write.FASTA(woodmouse, fs::path(temp_dir, "woodmouse.fasta"))
ape::write.FASTA(woodmouse, fs::path(temp_dir, "woodmouse2.fasta"))
# Make blast database
build_blast_db(
  fs::path(temp_dir, "woodmouse.fasta"),
  db_type = "nucl",
  out_name = "wood",
  parse_seqids = TRUE,
  wd = temp_dir)
# Blast the original sequences against the database
blast_n_list(
  fasta_folder = temp_dir,
  fasta_pattern = "fasta",
  database_path = fs::path(temp_dir, "wood")
)
# Extract the top BLAST hit for each fasta file.
extract_blast_hits(
  blast_results_dir = temp_dir,
  blast_results_pattern = "\\.tsv$",
  database_path = fs::path(temp_dir, "wood"),
  out_dir = temp_dir,
  out_ext = "bestmatch"
)
realign_with_best_hits(
  best_hits_dir = temp_dir,
  best_hits_pattern = "bestmatch",
  fasta_dir = temp_dir,
  fasta_pattern = "fasta"
)
# Cleanup.
fs::file_delete(temp_dir)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.