PHYLIP_Species_Name_length

By default PHYLIP limits species names to 10 characters. This is a problem for us as most species names and taxon labels will be longer than this and we do not want to lose data when passing data through PHYLIP. There is a way to fix this in PHYLIP (method courtesy of Joe Felsenstein via Liya Wang).

To adjust the species name to more than 10 characters:

1) go to the PHYLIP source code (phylip-3.69/src)
2) edit phylip.h

/*** Static memory parameters ***/

#define FNMLNGTH        200  /* length of array to store a file name */
#define nmlngth         10   /* number of characters in species name    */
#define MAXNCH          10   /* must be greater than or equal to nmlngth */
#define maxcategs       9    /* maximum number of site types */
#define maxcategs2     11    /* maximum number of site types + 2 */
  • change nmllngth to a higher number (say 30)
  • change MAXNCH to be >= nmlngth
#define nmlngth         30   /* number of characters in species name    */
#define MAXNCH          30   /* must be greater than or equal to nmlngth */

3) recompile the binaries

$ make all

4) edit data files so that each taxon label is 30 chars long (right pad with white space as required)

  • example contrast input
     49 2
    Ursus_maritimus               2.423245874       2.062957834
    Ursus_arctos                  2.400192489       1.918030337
    Ursus_americanus              1.970346876       1.754348336
    Nasua_narica                  0.6434526765      0.0211892991
    Procyon_lotor                 0.84509804        0.0569048513
    Mephitis_mephitis             0.3979400087      0.3979400087
    Meles_meles                   1.064457989       -0.060480747
    Canis_lupus                   1.547774705       2.307067951
    Canis_latrans                 1.123851641       1.653212514
    Lycaeon_picturs               1.301029996       2.204119983
    Canis_aureus                  0.9444826722      0.9590413923
    Urocyon_cinereoargenteus      0.5682017241      0.0413926852
    etc...
    
  • a perl incantation to adjust label length
    # $taxon is the orginal species name, defined somewhere above...
    my $label = (length $taxon) < 30 ? sprintf('%-30s',$taxon) : substr $taxon, 0, 30;
    

Note1: The treefile does not need right-padded species names, but make sure the names match those in the file with the trait data.

Note2: Each species name in the traits input file now needs to be 30 characters long, so pad as required