error in file conversion with mega software
2
1
Entering edit mode
8.8 years ago

Hello everyone!

Hope all of you doing great.

For my y-str project I wanted to do the phylogenetic analysis using mega. My input file is in .phy format (phylip format) which is the output of the McGee's Y- utility software. I was trying to use this in mega software but during file conversion from phylip to mega format was getting the error that: "there was a problem converting your file to the MEGA format. Error: Expected number of sites, no number found".

Please can you help me to overcome from this problem.

Here is the phylip file that I wanted to convert to mega format.

11
     modal 0 3510 4320 4320 1560 1560 2820 3510 3510 2820 4320
M9890_J-L8 3510 0 6390 5280 4320 4320 4320 7860 3510 3510 6390
394465_J-M 4320 6390 0 2820 3510 5280 5280 3510 7860 4320 4320
69065_J-M2 4320 5280 2820 0 3510 5280 4320 5280 6390 4320 4320
394467_J-M 1560 4320 3510 3510 0 2160 2160 2820 4320 3510 4320
357617_J-Z 1560 4320 5280 5280 2160 0 2160 2820 4320 3510 5280
M7801_J-M2 2820 4320 5280 4320 2160 2160 0 2820 4320 5280 6390
M8031_J-FG 3510 7860 3510 5280 2820 2820 2820 0 7860 5280 6390
M9061_J-M2 3510 3510 7860 6390 4320 4320 4320 7860 0 3510 4320
235231_J-Z 2820 3510 4320 4320 3510 3510 5280 5280 3510 0 2820
M9060_J-M2 4320 6390 4320 4320 4320 5280 6390 6390 4320 2820 0

Thank you very much

phylogenetics phylip mega • 4.3k views
ADD COMMENT
1
Entering edit mode
8.8 years ago
Brice Sarver ★ 3.8k

The PHYLIP format requires two pieces of information at the top of each file: the number of individuals and the number of sites in the alignment. However, I'm not sure what kind of data you're working with. I would recommend making sure you know what a PHYLIP file is and what one looks like for what you want to do first.

ADD COMMENT
0
Entering edit mode
4.2 years ago

Using R, it is very simple, Here is my R script.

https://github.com/amarinderthind/phlyip-distance-to-Mega-distance/blob/master/distane_matrix_conversion.r

library(readr)
dist1 <- read_table2("input_file_phylip_distance.txt",  col_names = FALSE, skip = 1)

names1 <- dist1$X1
dist1 <- dist1[,-1]

dist1[upper.tri(dist1,diag=TRUE)] <- NA  #lower.tri

lin1 <- paste0("#mega","\n","!Title: Concatenated Files;", "\n","!Format DataType=Distance DataFormat=LowerLeft;","\n", sep = '')

write.table(lin1,"new_distance1.meg", col.names = FALSE, row.names = FALSE,quote = FALSE)
write.table(paste('#',names1, sep = ''),"new_distance1.meg", sep="\t",append = TRUE, col.names = FALSE, row.names = FALSE,quote = FALSE)
write.table("\n","new_distance1.meg", sep="\t",append = TRUE, col.names = FALSE, row.names = FALSE,quote = FALSE)
write.table(mt,"new_distance1.meg", sep="\t", append = TRUE,col.names = FALSE, row.names = FALSE)
ADD COMMENT

Login before adding your answer.

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