Converting multiple files from Clustal to MEGA format
1
0
Entering edit mode
15 months ago

Hi,

I have ~2000 alignments of a few MB each in Clustal format. I intend to use MEGA (megacc) to calculate pairwise distances for each of these alignments. However, I cannot give the alignment files directly to MEGA without converting them to the .meg format.

Since I have so many files, it is unfeasible to open each and single one in the MEGA GUI and save them as .meg.

Is there any way of calling this function from the command line? Alternatively, is there some other software that can convert clustal (or fasta) to MEGA?

Thanks for your help!

alignment clustalw mega • 1.0k views
ADD COMMENT
0
Entering edit mode

is there some other software that can convert clustal (or fasta) to MEGA?

Since the MEGA format is probably used only by MEGA you are not likely to find and other software that will do that conversion.

I have not used MEGA on the command line but perhaps there are utils in the command line version of MEGA that can do this.

ADD REPLY
2
Entering edit mode
15 months ago
Mensur Dlakic ★ 27k

If megacc can't do the conversion you want, I can't think of any other program that would be able to do it.

If you don't mind re-aligning from the scratch, Clustal Omega can do what you want. It is multi-threaded, so it may not take much longer than actually converting the files you already have. It is one of the best multiple aligners out there, so it is possible that it would also improve the alignments you have.

clustalo -i my-in-seqs.fa -o my-out-seqs.aln -v --outfmt=clu --distmat-out=my-out-seqs.dist --threads=20
ADD COMMENT
0
Entering edit mode

Thanks for the Clustal Omega tip! However, it calculates the distance with a very simple metric, while I needed MEGA precisely for the K2P-based distance. For anyone else with similar issues, I found an R library that calculates the K2P distance from a DNA alignment in FASTA format:

library(ape)
aln <- read.FASTA("seq.aln")
dist <- dist.dna(aln, model = "k80", as.matrix = TRUE, pairwise.deletion = T)

The output is the same as I get from MEGA with no need to convert to their format.

ADD REPLY

Login before adding your answer.

Traffic: 1642 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