Alignment Concatenation
SEGUL CLI provides an easy way to concatenate multiple alignments and generate the partition setting simultaneously.
segul align concat <input-argument> [input-path] --input-format [sequence-format]For example, we will concat all the alignments in this folder:
alignments/├── locus_1.nexus├── locus_2.nexus└── locus_3.nexusWe can do it in two ways. First, use --dir argument to input alignment files:
segul align concat --dir alignments/Second, we can use the --input argument to input the alignment files. We will rely on Wildcard (*) and the OS to find all the alignment files.
segul align concat --input alignments/*.nexussegul will generate two files saved in the Align-Concat directory, consisting of the concatenated alignments and the partition settings:
Align-Concat/├── Align-Concat.nex└── Align-Concat_partition.nexTo specify the name of the output directory, use the --output or -o option. Below, we will name our output directory aln-concat.
segul align concat --input alignments/*.nexus --output aln-concatTo specify the prefix of the file names, use the --prefix option. Below, our output filenames will start with concat:
segul align concat --input alignments/*.nexus --output aln-concat --prefix concatThe resulting output directory will contain the files below:
aln-concat/├── concat.nex└── concat_partition.nexBy default, the partition format is in nexus:
#nexusbegin sets;charset 'locus-1' = 1-666;charset 'locus-2' = 667-1473;charset 'locus-3' = 1474-2000;end;You can specify the partition format using the --partition-format or -p option.
For example, to use RaXML format:
segul align concat --input alignments/*.nexus --output concat --prefix concat --partition-format raxmlThe resulting partition will be formatted in RaXML style:
DNA, locus_1 = 1-666DNA, locus_2 = 667-1473DNA, locus_3 = 1474-2000If the input is amino acid sequences, the partition will not contain the datatype:
locus_1 = 1-666locus_2 = 667-1473locus_3 = 1474-2000You can also use charset format. In this format, the partition will be written at the end of the sequence and only available for the nexus output. This format is usually required for phylogenetic programs, such as PAUP and BEAST. To use charset format:
segul align concat --input alignments/*.nexus --output concat --prefix concat --partition-format charsetYou can also write the partition to a codon model format using the flag --codon. You may not need this option for genomic datasets. We reserve this function for Sanger datasets.
To sort the sequences in the output by their IDs, add the --sort flag.
All options
Section titled “All options”| Option | Description |
|---|---|
-d, --dir |
Directory with alignments |
-i, --input |
Alignment files. Allows wildcards |
-f, --input-format |
Input format: auto (default), fasta, nexus, or phylip |
--datatype |
Data type: dna (default), aa, or ignore |
-F, --output-format |
Output format: nexus (default), phylip, fasta, nexus-int, phylip-int, or fasta-int |
-p, --partition-format |
Partition format: nexus (default), charset, or raxml |
--codon |
Write the partition as a codon model |
--sort |
Sort sequences by ID |
-o, --output |
Output directory. Default: Align-Concat |
--prefix |
Prefix of the output files. Default: Align-Concat |
--force |
Overwrite an existing output directory |
--log |
Log file path. Default: segul.log |
Copyright © 2026 H. Handika & J. A. Esselstyn.