# How to format the Nexus file to create geographical maps with haplotypes in PopArt?

I'm trying to create a map in PopArt that allows me to visualise the distribution of several species. These are my Traits (=species) and GeoTags blocks:

BEGIN TRAITS;
Dimensions NTRAITS=9;
Format labels=no missing=? separator=Comma;
TraitLabels SNE Lsp A B C D 3n 4n Lep;
Matrix
SNE1 1,0,0,0,0,0,0,0,0
SNE2 1,0,0,0,0,0,0,0,0
SNE3 1,0,0,0,0,0,0,0,0
SNE4 1,0,0,0,0,0,0,0,0
SNE5 1,0,0,0,0,0,0,0,0
SNE6 1,0,0,0,0,0,0,0,0
PUR_4n 0,0,0,0,0,0,0,1,0
GRA 0,1,0,0,0,0,0,0,0
OJE 0,1,0,0,0,0,0,0,0
ESC 0,0,0,0,0,0,0,0,1
LNM 0,0,0,0,0,0,0,0,1
PIN 0,0,0,0,0,0,0,0,1
URD 0,0,0,0,0,0,0,0,1
VIS 0,0,0,0,0,0,0,0,1
LYE 0,0,0,0,0,0,0,0,1
BEN_A 0,0,1,0,0,0,0,0,0
ALJ1_A 0,0,1,0,0,0,0,0,0
ALJ2_A 0,0,1,0,0,0,0,0,0
ESP2_B 0,0,0,1,0,0,0,0,0
ESP3_B 0,0,0,1,0,0,0,0,0
ALC_C 0,0,0,0,1,0,0,0,0
AVA1_3n 0,0,0,0,0,0,1,0,0
AVA2_3n 0,0,0,0,0,0,1,0,0
PER_3n 0,0,0,0,0,0,1,0,0
TRI_3n 0,0,0,0,0,0,1,0,0
VDI_3n 0,0,0,0,0,0,1,0,0
VIL_3n 0,0,0,0,0,0,1,0,0
CVE1_4n 0,0,0,0,0,0,0,1,0
CVE2_4n 0,0,0,0,0,0,0,1,0
LNA1_4n 0,0,0,0,0,0,0,1,0
LNA2_4n 0,0,0,0,0,0,0,1,0
PRA1_4n 0,0,0,0,0,0,0,1,0
PRA2_4n 0,0,0,0,0,0,0,1,0
VEN1_4n 0,0,0,0,0,0,0,1,0
VEN2_4n 0,0,0,0,0,0,0,1,0
ZAR_4n 0,0,0,0,0,0,0,1,0
SFI1 0,0,0,0,0,0,0,0,1
SFI2 0,0,0,0,0,0,0,0,1
SIB 0,0,0,0,0,0,0,0,1
TIS1_D 0,0,0,0,0,1,0,0,0
TIS2_D 0,0,0,0,0,1,0,0,0
TIS3_D 0,0,0,0,0,1,0,0,0
TIS4_D 0,0,0,0,0,1,0,0,0
TVI_D 0,0,0,0,0,1,0,0,0
PVRFAS0001 1,0,0,0,0,0,0,0,0
PVRFAS0002 1,0,0,0,0,0,0,0,0
PVRFAS0024 1,0,0,0,0,0,0,0,0
PVRFAS0025 1,0,0,0,0,0,0,0,0
PVRFAS0027 1,0,0,0,0,0,0,0,0
PVRFAS0028 1,0,0,0,0,0,0,0,0
;
END;
Begin GeoTags;
Dimensions NClusts=29;
Format labels=no separator=Spaces;
[ClustLatitude 37.15 37.77 37.13 39.37 37.11 40.60 40.59 37.04 40.61 38.71 36.70 43.48 40.18 40.24 40.57 40.26 37.10 37.86 38.52 36.56 40.23 38.01 39.58 38.75 40.54 40.55 38.70 40.04 40.69;
ClustLongitude -3.70 -3.02 -3.52 -3.72 -3.03 -4.33 -4.33 -3.43 -2.44 0.05 -5.35 3.55 -6.55 -2.06 -4.16 0.26 -3.26 -1.56 -3.56 -4.86 -2.07 -2.87 -3.87 0.18 -4.18 -4.19 -0.49 -7.49 -2.59;]
Matrix
SNE1 37.044888 -3.135564
SNE2 37.044888 -3.135564
SNE3 37.044888 -3.135564
SNE4 37.044888 -3.135564
SNE5 37.044888 -3.135564
SNE6 37.044888 -3.135564
PUR_4n 37.133158 -3.524806
GRA 36.708272 -5.348794
OJE 36.562847 -4.853522
ESC 40.5659132 -4.2236186
LNM 40.609845 -4.344144
PIN 38.752157 0.180615
URD 39.370381 -3.720659
VIS 38.520059 -3.564201
LYE 39.580131 -3.870267
BEN_A 38.712603 0.052372
ALJ1_A 38.704010 -0.490801
ALJ2_A 38.704010 -0.490801
ESP2_B 37.865615 -1.569499
ESP3_B 37.865615 -1.569499
ALC_C 40.264366 0.267744
AVA1_3n 43.490194 3.563363
AVA2_3n 43.490194 3.563363
PER_3n 40.610461 -2.447806
TRI_3n 40.697087 -2.595488
VDI_3n 40.244599 -2.067766
VIL_3n 40.231843 -2.078962
CVE1_4n 40.559003 -4.199853
CVE2_4n 40.559003 -4.199853
LNA1_4n 40.597289 -4.330246
LNA2_4n 40.597289 -4.330246
PRA1_4n 37.113314 -3.035071
PRA2_4n 37.113314 -3.035071
VEN1_4n 37.155124 -3.703330
VEN2_4n 37.155124 -3.703330
ZAR_4n 40.547662 -4.184395
SFI1 40.042132 -7.498515
SFI2 40.042132 -7.498515
SIB 40.182598 -6.551259
TIS1_D 37.771593 -3.023286
TIS2_D 37.771593 -3.023286
TIS3_D 37.771593 -3.023286
TIS4_D 37.771593 -3.023286
TVI_D 38.0140003 -2.8751617
PVRFAS0001 37.100000 -3.260000
PVRFAS0002 37.100000 -3.260000
PVRFAS0024 37.100000 -3.260000
PVRFAS0025 37.100000 -3.260000
PVRFAS0027 37.100000 -3.260000
PVRFAS0028 37.100000 -3.260000
;
End;

• If I upload my Nexus file like this, the program throws an error saying "Too many rows in GeoTags block." However, I have 50 samples in both Traits and GeoTags. The same happens if I uncomment (in Nexus format, comments are in brackets) the ClustLatitude and ClustLongitude files.
• If I set the "labels" flag on "yes", it takes the traits as the geographical locations and tries to find locations in the world starting with the trait names.
• If I comment the "GeoTags" block, PopArt correctly outputs a network.

What am I missing? Does somebody have a Nexus example where the traits do not correspond to geographical location of the samples?

• I don't know this format but you seem to have two BEGIN and two ENDs. To me it looks like you have two datasets in one. Also one is in caps and the other is not. Are you sure that the file is in the right format? Did you check it (if there is any tool to do that) ? – llrs Sep 19 '18 at 7:10
• This program uses a custom version of the Nexus format. Here is the manual: popart.otago.ac.nz/doc/popart.pdf and it uses exactly the "begin" and "end" blocks I'm using - weird format, I know, but I'm trying to stick as much as possible to the example given... – LinuxBlanket Sep 19 '18 at 9:24
• @Llopis Additional info here (Supplementary data of the PopArt paper) and here (Nexus example in the PopArt site) – LinuxBlanket Sep 19 '18 at 9:26
• In the pdf you link in the first comment the traits data is formatted different (see the corresponding section of "Traits Tables"). Are you sure you should provide all these data in a single file? The error seems to imply that when an END is found it should be the end of the file or something alike. – llrs Sep 19 '18 at 9:32
• Ah you mean the indent? That's a copy-paste error, I'll edit that. In the original file I indented the block between "BEGIN TRAITS" and "Matrix". Note that if I comment the GeoTags block, a network is produced correctly. The manual notes: " I've separated the individual blocks with text describing the important points, but they should all be included in a single text file, as shown in here." – LinuxBlanket Sep 19 '18 at 9:36