Skip to content

Alignment Partition Conversion

Convert alignment partition data between different formats. Available partition formats:

  • RAxML
  • NEXUS
  • Charset

Charset is a nexus format that stores partition data in the same file as a NEXUS alignment.

Install PySEGUL using pip if you haven’t done it yet

Terminal window
pip install pysegul

Create a new Python script, import the library, and write python code. Example:

import pysegul
def convert_partitions():
input_paths = [
'tests/partition-data/partition_codon.txt',
'tests/partition-data/partition.txt'
]
# Available input and output format values: raxml, nexus, charset.
input_format = 'raxml'
output_format = 'nexus'
datatype = 'dna'
# Check the partition before converting. Set to False to skip checking.
check_partition = True
output_dir = 'tests/output'
convert = pysegul.PartitionConversion(
input_format,
datatype,
output_dir,
output_format,
check_partition
)
convert.from_files(input_paths)