Convert a Clustal alignment sequence file to PHYLIP alignment (interleaved).
Turning a Clustal alignment into an interleaved PHYLIP file
Yes, this page converts a Clustal alignment to PHYLIP alignment (interleaved). The aligned rows carry over, but names longer than 10 characters are cut, and the consensus line and any scores are left behind. The file must hold exactly one alignment.
What the PHYLIP file keeps, changes, and leaves out
| Data in your file | In the output | Details |
|---|---|---|
| Aligned sequence rows | Kept | Written as the rows of one interleaved alignment. |
| Row names (record IDs) | Changed if needed | Names longer than 10 characters are cut to 10; a colon or semicolon becomes a vertical bar. Names of 10 characters or fewer are not cut; in the sample, seq1 to seq3 come through unchanged. |
| Consensus line and alignment scores | Lost | Alignment annotations are not kept. |
The sample on this page, three rows of 39 letters, converts with its letters unchanged.
Names, gap symbols, and the one-alignment rule
The converter checks the file before writing anything, and it refuses the file rather than repairing it:
- Names that become identical after shortening to 10 characters are refused. The message asks you to rename the rows so that their first 10 characters differ.
- A period in a sequence row is refused. The message asks you to replace each
.with-, the gap symbol, and convert again. - Every row must have the same length, and no row may be empty. A row of a different length is refused, and the message names it and gives both lengths. The converter does not align sequences.
- A file with several alignments is refused. The message gives the count and suggests splitting the file, or choosing FASTA output to keep every row as a separate sequence.
No sequence-type question is asked for this pair.
Longer names, sequential layout, or several alignments
Clustal alignment to PHYLIP alignment (relaxed names) accepts names longer than 10 characters, provided every name is present, unique, and free of spaces or other whitespace; it still drops the consensus line and scores. Clustal alignment to PHYLIP alignment (sequential) writes the sequential layout with the same 10-character rule as this page. Clustal alignment to FASTA accepts a file with several alignments and writes every row as a separate sequence. The sample on this page converts on all three routes.
The reverse route, PHYLIP alignment (interleaved) to Clustal alignment, is available. Clustal keeps the first 30 characters of each name and replaces spaces with underscores, so names already cut to 10 characters here stay cut.
If the file cannot be read, or is too large
If the file cannot be read at all, the page says only that it could not be read as a Clustal alignment and asks you to check that it is a valid file; no cause is given. A file over 50 MB is refused with the message "The file is too large. The limit is 50 MB."
The converter writes one alignment per PHYLIP alignment (interleaved) file, so upload one alignment at a time. A file with several alignments (for example several MAF blocks or Stockholm sections) is refused rather than merged into one.
Run it with Biopython
For batch work, you can use Biopython's SeqIO.convert function. This pair needs no molecule type argument.
from Bio import SeqIO
count = SeqIO.convert("input.clustal", "clustal",
"output.phylip", "phylip")
print("Converted %i records" % count)
Sample input file: Clustal alignment
Copy this example into a file, or download it, to try a Clustal alignment conversion.
Download sample (sample.aln, 277 bytes)
Samples are small illustrative files. Some come from the Biopython test suite (see the project's sample notes); they are not real study data.