How To Convert A Fasta Or Alignment File To Nexus (.Nex) File That Is To Be Used In The Beast Program
4
2
Entering edit mode
11.3 years ago

Dear fellow scientists!

I'm new in the field and need some help with a small problem.

I have an .aln and .fas files of aligned nucleotide samples.

For phylogenetical analysis, I'm using BEAST program which requires the input file to be in NEXUS format (especially .nex not .nxs).

I've tried many options but just keep getting errors.

Do you know how can I properly convert FASTA or alignment file to NEXUS file?

Triin

• 44k views
ADD COMMENT
7
Entering edit mode
10.6 years ago
csmall ▴ 70

You might want to try using seqmagick. It's a command line utility inspired by imagemagick that provides a number of very handy utilities for modifying sequence files. You can accomplish the desired conversion using

seqmagick convert --output-format nexus --alphabet dna input.fasta output.nex
ADD COMMENT
2
Entering edit mode

this looks really cool, never heard of it before, needs to be a default install on every bio system

ADD REPLY
3
Entering edit mode
11.3 years ago
Hamish ★ 3.3k

I assume that by '.aln' you mean Clustal alignment format and that your '.fas' is a fasta sequence format alignment. In which case the following options suggest themselves for reformatting the alignment:

However your comments suggest that you need to add additional information, beyond just the sequence alignment, to the NEXUS file to get something that will work with BEAUti and thus generate the XML file to input to BEAST. For an overview of some of the information that can be included in a NEXUS file see:

The example NEXUS files provided in the BEAST distribution may provide suggestions as to the missing information.

ADD COMMENT
0
Entering edit mode

Namely, conversion using seqret would be seqret -sequence input.fadta -outseq output.nex -osformat nexus

ADD REPLY
0
Entering edit mode
10.6 years ago
Prakki Rama ★ 2.7k

another online sequence conversion tool.

ADD COMMENT
0
Entering edit mode
10.4 years ago
Irene • 0

You can now import FASTA files to BEAST 2, but I still needed to use a NEXUS file because I wanted to link the trees of different partitions and this isn't possible if you import the partitions as separated FASTA files, only if they are partitions within a NEXUS file. I recommend Sequence Matrix (https://code.google.com/p/sequencematrix/downloads/list) to solve this problems. It's written in Java, very easy to use, and if you have different FASTA files with different sequences from the same samples you can import all of them and if the names (>name) are the same, then you can export it as a NEXUS file that records the partitions, so if you use this file as input for Beauti the partitions are automatically recognised and you can link their trees. Of course if you import a single FASTA file and export it as NEXUS it will be acting as a converter.

ADD COMMENT

Login before adding your answer.

Traffic: 1321 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6