This function concatenate sequences from alignments present in the working directory based on a correspondence table and saves the output in a new directory

concatipede(
  df = NULL,
  filename = NULL,
  format = c("fasta", "nexus", "phylip"),
  dir,
  plotimg = FALSE,
  out = NULL,
  remove.gaps = TRUE,
  write.outputs = TRUE,
  save.partitions = TRUE,
  excel.sheet = 1
)

Arguments

df

The user-defined correspondence table, as a data frame or equivalent. This is used only if no filename argument is provided.

filename

Filename of input correspondence table. Alternatively, if no filename is provided, the user can provide their own correspondence table as the df argument.

format

a string specifying in what formats you want the alignment

dir

Optional, path to the directory containing the fasta files. This argument has an effect only if fasta files names are taken from the columns of the df argument, and that df does not have an attribute dir_name itself. If no dir is provided and df does not have a dir_name attribute, the current working directory is ued with a warning.

plotimg

Logical, save a graphical representation of the alignment in pdf format. Default: FALSE.

out

specify outputs filenames

remove.gaps

Logical, remove gap only columns. Useful if not using all sequences in the alignments. Default: TRUE.

write.outputs

Logical, save concatenated alignment, partitions position table and graphical representation. If FALSE it overrides plotimg. Default: TRUE.

save.partitions

Logical, save in the concatenated alignmeent directory a text file with partitions limits for the concatenated alignment. Default: TRUE.

excel.sheet

specify what sheet from the excel spreadsheet has to be read. Either a string (the name of a sheet), or an integer (the position of the sheet).

Value

The concatenated alignment (invisibly if out is not NULL).

Examples

dir <- system.file("extdata", package = "concatipede")
z <- concatipede(filename = paste0(dir,"/Macrobiotidae_seqnames.xlsx"), dir = dir,
                 write.outputs = FALSE)
z
#> 13 DNA sequences in binary format stored in a matrix.
#> 
#> All sequences of same length: 2945 
#> 
#> Labels:
#> Macrobiotus_hannae
#> Macrobiotus_wandae
#> Macrobiotus_caelestis
#> Macrobiotus_polonicus
#> Macrobiotus_kamilae
#> Macrobiotus_noongaris
#> ...
#> 
#> Base composition:
#>     a     c     g     t 
#> 0.248 0.218 0.260 0.274 
#> (Total: 38.28 kb)