Skip to contents

Write alignment partitions as separate alignment files for various data types

Usage

write_partitioned_alignments2(
  x,
  cluster_df,
  partition_file,
  in_format = NULL,
  in_type = NULL,
  out_file,
  out_type = "standard"
)

Arguments

x

concatenated alignment file in Nexus or Phyllip format read directly from local directory

cluster_df

cluster partitions as outputted by make.clusters

partition_file

name of text file with user provided partitions, with names and start&end positions

in_format

Format of the input alignment file. One of "phylip", "interleaved", "sequential", "clustal", "fasta", or "nexus", or any unambiguous abbreviation. Passed to phangorn::read.phyDat.

in_type

Type of input sequences. One of "DNA", "AA", "CODON" or "USER". Passed to phangorn::read.phyDat.

out_file

Path to save the alignments. If out_file = "example.nex", files will be saved as "example_part1.nex", "example_part2.nex", etc.

out_type

Output format type. One of "dna" (default), "protein", "standard", or "continuous".

Value

No return value. This function is called for its side effect of writing alignment files to disk.

See also

write_partitioned_alignments for the older version supporting morphological data only.

Examples

# Load example phylogenetic data matrix
data("characters")

# Create distance matrix
Dmatrix <- get_gower_dist(characters)

# Find optimal partitioning scheme using PAM under k=3 partitions
cluster_df <- make_clusters(Dmatrix, k = 3)

# Write morphological partitions into multiple Nexus files
if (FALSE) write_partitioned_alignments2(x = "characters.nex",
                             cluster_df = cluster_df,
                             out_file = "test", out_type = "standard") # \dontrun{}

# Write to molecular partitions into multiple Phyllip files
if (FALSE) write_partitioned_alignments2(x = "alignments.phy",
                             partition_file = "sorted_partitions_50genes.txt",
                             in_format = "phylip", in_type = "dna",
                             out_file = "test", out_type = "dna") # \dontrun{}