Skip to content

Alignment Splitting

Split an alignment into multiple alignments based on partition information.

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

import pysegul
def split_alignment():
input_alignment = 'tests/split-data/split-data.nex'
input_format = 'nexus'
datatype = 'dna'
partition_format = 'nexus'
output_format = 'fasta'
# Check the partition before splitting. Set to False to skip checking.
check_partition = True
input_partition = 'tests/split-data/split-data_partition.nex'
output_dir = 'tests/output'
split = pysegul.AlignmentSplitting(
input_alignment,
input_format,
datatype,
output_dir,
output_format,
partition_format,
check_partition,
input_partition = input_partition
)
split.split()

If input_partition is not set, PySEGUL reads the partition from the input alignment.

This material is based upon work supported by the National Science Foundation under grant numbers: DEB-1754393 and DEB-2244754. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.