convertAlign

Convert any format of DNA alignment into another format
catGenes::convertAlign()

Description

Convert one or multiple DNA alignments in FASTA, NEXUS or PHYLIP format into each other.

Arguments

Argument Description
filepath Path to the directory where the DNA alignments are stored.
format Define either “NEXUS”, “FASTA” or “PHYLIP” format for writing the resulting newly converted files.
rmfiles Logical, if TRUE, the original input file(s) are removed from the directory and only the newly converted files are kept.
dir The path to the directory where the newly converted files should be saved. If no directory is given, then the files will saved in a subfolder named after the current date under the folder named RESULTS_convertAlign.

Examples

library(catGenes)

data(GenBank_accessions)

todaydate <- format(Sys.time(), "%d%b%Y")
folder_mined_seqs <- paste0("RESULTS_mineSeq/", todaydate)
folder_aligned_seqs <- paste0("RESULTS_alignSeqs/", todaydate)

mineSeq(inputdf = GenBank_accessions,
        gb.colnames = c("ITS", "matK"),
        as.character = FALSE,
        verbose = TRUE,
        save = TRUE,
        dir = "RESULTS_mineSeq",
        filename = "GenBanK_seqs")

alignSeqs(filepath = folder_mined_seqs,
          method = "ClustalW",
          gapOpening = "default",
          format = "NEXUS",
          verbose = TRUE,
          dir = "RESULTS_alignSeqs")

convertAlign(filepath = folder_aligned_seqs,
          format = "PHYLIP",
          rmfiles = FALSE,
          verbose = TRUE,
          dir = "RESULTS_convertAlign")