CSC

 
 
Tehdyt toimenpiteet
EMBOSS: fdnapenny
fdnapenny

 

Wiki

The master copies of EMBOSS documentation are available at http://emboss.open-bio.org/wiki/Appdocs on the EMBOSS Wiki.

Please help by correcting and extending the Wiki pages.

Function

Penny algorithm for DNA

Description

Finds all most parsimonious phylogenies for nucleic acid sequences by branch-and-bound search. This may not be practical (depending on the data) for more than 10-11 species or so.

Algorithm

DNAPENNY is a program that will find all of the most parsimonious trees implied by your data when the nucleic acid sequence parsimony criterion is employed. It does so not by examining all possible trees, but by using the more sophisticated "branch and bound" algorithm, a standard computer science search strategy first applied to phylogenetic inference by Hendy and Penny (1982). (J. S. Farris [personal communication, 1975] had also suggested that this strategy, which is well-known in computer science, might be applied to phylogenies, but he did not publish this suggestion).

There is, however, a price to be paid for the certainty that one has found all members of the set of most parsimonious trees. The problem of finding these has been shown (Graham and Foulds, 1982; Day, 1983) to be NP-complete, which is equivalent to saying that there is no fast algorithm that is guaranteed to solve the problem in all cases (for a discussion of NP-completeness, see the Scientific American article by Lewis and Papadimitriou, 1978). The result is that this program, despite its algorithmic sophistication, is VERY SLOW.

The program should be slower than the other tree-building programs in the package, but useable up to about ten species. Above this it will bog down rapidly, but exactly when depends on the data and on how much computer time you have (it may be more effective in the hands of someone who can let a microcomputer grind all night than for someone who has the "benefit" of paying for time on the campus mainframe computer). IT IS VERY IMPORTANT FOR YOU TO GET A FEEL FOR HOW LONG THE PROGRAM WILL TAKE ON YOUR DATA. This can be done by running it on subsets of the species, increasing the number of species in the run until you either are able to treat the full data set or know that the program will take unacceptably long on it. (Making a plot of the logarithm of run time against species number may help to project run times).

The Algorithm

The search strategy used by DNAPENNY starts by making a tree consisting of the first two species (the first three if the tree is to be unrooted). Then it tries to add the next species in all possible places (there are three of these). For each of the resulting trees it evaluates the number of base substitutions. It adds the next species to each of these, again in all possible spaces. If this process would continue it would simply generate all possible trees, of which there are a very large number even when the number of species is moderate (34,459,425 with 10 species). Actually it does not do this, because the trees are generated in a particular order and some of them are never generated.

This is because the order in which trees are generated is not quite as implied above, but is a "depth-first search". This means that first one adds the third species in the first possible place, then the fourth species in its first possible place, then the fifth and so on until the first possible tree has been produced. For each tree the number of steps is evaluated. Then one "backtracks" by trying the alternative placements of the last species. When these are exhausted one tries the next placement of the next-to-last species. The order of placement in a depth-first search is like this for a four-species case (parentheses enclose monophyletic groups):

     Make tree of first two species:     (A,B)
          Add C in first place:     ((A,B),C)
               Add D in first place:     (((A,D),B),C)
               Add D in second place:     ((A,(B,D)),C)
               Add D in third place:     (((A,B),D),C)
               Add D in fourth place:     ((A,B),(C,D))
               Add D in fifth place:     (((A,B),C),D)
          Add C in second place:     ((A,C),B)
               Add D in first place:     (((A,D),C),B)
               Add D in second place:     ((A,(C,D)),B)
               Add D in third place:     (((A,C),D),B)
               Add D in fourth place:     ((A,C),(B,D))
               Add D in fifth place:     (((A,C),B),D)
          Add C in third place:     (A,(B,C))
               Add D in first place:     ((A,D),(B,C))
               Add D in second place:     (A,((B,D),C))
               Add D in third place:     (A,(B,(C,D)))
               Add D in fourth place:     (A,((B,C),D))
               Add D in fifth place:     ((A,(B,C)),D)

Among these fifteen trees you will find all of the four-species rooted trees, each exactly once (the parentheses each enclose a monophyletic group). As displayed above, the backtracking depth-first search algorithm is just another way of producing all possible trees one at a time. The branch and bound algorithm consists of this with one change. As each tree is constructed, including the partial trees such as (A,(B,C)), its number of steps is evaluated. In addition a prediction is made as to how many steps will be added, at a minimum, as further species are added.

This is done by counting how many sites which are invariant in the data up the most recent species added will ultimately show variation when further species are added. Thus if 20 sites vary among species A, B, and C and their root, and if tree ((A,C),B) requires 24 steps, then if there are 8 more sites which will be seen to vary when species D is added, we can immediately say that no matter how we add D, the resulting tree can have no less than 24 + 8 = 32 steps. The point of all this is that if a previously-found tree such as ((A,B),(C,D)) required only 30 steps, then we know that there is no point in even trying to add D to ((A,C),B). We have computed the bound that enables us to cut off a whole line of inquiry (in this case five trees) and avoid going down that particular branch any farther.

The branch-and-bound algorithm thus allows us to find all most parsimonious trees without generating all possible trees. How much of a saving this is depends strongly on the data. For very clean (nearly "Hennigian") data, it saves much time, but on very messy data it will still take a very long time.

The algorithm in the program differs from the one outlined here in some essential details: it investigates possibilities in the order of their apparent promise. This applies to the order of addition of species, and to the places where they are added to the tree. After the first two-species tree is constructed, the program tries adding each of the remaining species in turn, each in the best possible place it can find. Whichever of those species adds (at a minimum) the most additional steps is taken to be the one to be added next to the tree. When it is added, it is added in turn to places which cause the fewest additional steps to be added. This sounds a bit complex, but it is done with the intention of eliminating regions of the search of all possible trees as soon as possible, and lowering the bound on tree length as quickly as possible. This process of evaluating which species to add in which order goes on the first time the search makes a tree; thereafter it uses that order.

The program keeps a list of all the most parsimonious trees found so far. Whenever it finds one that has fewer losses than these, it clears out the list and restarts it with that tree. In the process the bound tightens and fewer possibilities need be investigated. At the end the list contains all the shortest trees. These are then printed out. It should be mentioned that the program CLIQUE for finding all largest cliques also works by branch-and-bound. Both problems are NP-complete but for some reason CLIQUE runs far faster. Although their worst-case behavior is bad for both programs, those worst cases occur far more frequently in parsimony problems than in compatibility problems.

Controlling Run Times

Among the quantities available to be set from the menu of DNAPENNY, two (howoften and howmany) are of particular importance. As DNAPENNY goes along it will keep count of how many trees it has examined. Suppose that howoften is 100 and howmany is 1000, the default settings. Every time 100 trees have been examined, DNAPENNY will print out a line saying how many multiples of 100 trees have now been examined, how many steps the most parsimonious tree found so far has, how many trees of with that number of steps have been found, and a very rough estimate of what fraction of all trees have been looked at so far. When the number of these multiples printed out reaches the number howmany (say 1000), the whole algorithm aborts and prints out that it has not found all most parsimonious trees, but prints out what is has got so far anyway. These trees need not be any of the most parsimonious trees: they are simply the most parsimonious ones found so far. By setting the product (howoften times howmany) large you can make the algorithm less likely to abort, but then you risk getting bogged down in a gigantic computation. You should adjust these constants so that the program cannot go beyond examining the number of trees you are reasonably willing to pay for (or wait for). In their initial setting the program will abort after looking at 100,000 trees. Obviously you may want to adjust howoften in order to get more or fewer lines of intermediate notice of how many trees have been looked at so far. Of course, in small cases you may never even reach the first multiple of howoften, and nothing will be printed out except some headings and then the final trees. The indication of the approximate percentage of trees searched so far will be helpful in judging how much farther you would have to go to get the full search. Actually, since that fraction is the fraction of the set of all possible trees searched or ruled out so far, and since the search becomes progressively more efficient, the approximate fraction printed out will usually be an underestimate of how far along the program is, sometimes a serious underestimate.

A constant at the beginning of the program that affects the result is "maxtrees", which controls the maximum number of trees that can be stored. Thus if maxtrees is 25, and 32 most parsimonious trees are found, only the first 25 of these are stored and printed out. If maxtrees is increased, the program does not run any slower but requires a little more intermediate storage space. I recommend that maxtrees be kept as large as you can, provided you are willing to look at an output with that many trees on it! Initially, maxtrees is set to 100 in the distribution copy.

Method and Options

The counting of the length of trees is done by an algorithm nearly identical to the corresponding algorithms in DNAPARS, and thus the remainder of this document will be nearly identical to the DNAPARS document.

This program carries out unrooted parsimony (analogous to Wagner trees) (Eck and Dayhoff, 1966; Kluge and Farris, 1969) on DNA sequences. The method of Fitch (1971) is used to count the number of changes of base needed on a given tree. The assumptions of this method are exactly analogous to those of DNAPARS:

  1. Each site evolves independently.
  2. Different lineages evolve independently.
  3. The probability of a base substitution at a given site is small over the lengths of time involved in a branch of the phylogeny.
  4. The expected amounts of change in different branches of the phylogeny do not vary by so much that two changes in a high-rate branch are more probable than one change in a low-rate branch.
  5. The expected amounts of change do not vary enough among sites that two changes in one site are more probable than one change in another.

Change from an occupied site to a deletion is counted as one change. Reversion from a deletion to an occupied site is allowed and is also counted as one change. That these are the assumptions of parsimony methods has been documented in a series of papers of mine: (1973a, 1978b, 1979, 1981b, 1983b, 1988b). For an opposing view arguing that the parsimony methods make no substantive assumptions such as these, see the papers by Farris (1983) and Sober (1983a, 1983b), but also read the exchange between Felsenstein and Sober (1986). Change from an occupied site to a deletion is counted as one change. Reversion from a deletion to an occupied site is allowed and is also counted as one change. Note that this in effect assumes that a deletion N bases long is N separate events.

Usage

Here is a sample session with fdnapenny


% fdnapenny 
Penny algorithm for DNA
Input (aligned) nucleotide sequence set(s): dnapenny.dat
Phylip dnapenny program output file [dnapenny.fdnapenny]: 

justweights: false
numwts: 0

How many
trees looked                                       Approximate
at so far      Length of        How many           percentage
(multiples     shortest tree    trees this short   searched
of  100):      found so far     found so far       so far
----------     ------------     ------------       ------------
      1             9.0                2                0.11
      2             8.0                3                6.67
      3             8.0                9               20.00
      4             8.0                9               86.67

Output written to file "dnapenny.fdnapenny"

Trees also written onto file "dnapenny.treefile"


Go to the input files for this example
Go to the output files for this example

Command line arguments

Penny algorithm for DNA
Version: EMBOSS:6.3.0

   Standard (Mandatory) qualifiers:
  [-sequence]          seqsetall  File containing one or more sequence
                                  alignments
  [-outfile]           outfile    [*.fdnapenny] Phylip dnapenny program output
                                  file

   Additional (Optional) qualifiers (* if not always prompted):
   -weights            properties (no help text) properties value
   -howoften           integer    [100] How often to report, in trees (Any
                                  integer value)
   -howmany            integer    [1000] How many groups of trees (Any integer
                                  value)
   -[no]simple         boolean    [Y] Branch and bound is simple
   -outgrno            integer    [0] Species number to use as outgroup
                                  (Integer 0 or more)
   -thresh             toggle     [N] Use threshold parsimony
*  -threshold          float      [1.0] Threshold value (Number 1.000 or more)
   -[no]trout          toggle     [Y] Write out trees to tree file
*  -outtreefile        outfile    [*.fdnapenny] Phylip tree output file
                                  (optional)
   -printdata          boolean    [N] Print data at start of run
   -[no]progress       boolean    [Y] Print indications of progress of run
   -[no]treeprint      boolean    [Y] Print out tree
   -stepbox            boolean    [N] Print out steps in each site
   -ancseq             boolean    [N] Print sequences at all nodes of tree

   Advanced (Unprompted) qualifiers: (none)
   Associated qualifiers:

   "-sequence" associated qualifiers
   -sbegin1            integer    Start of each sequence to be used
   -send1              integer    End of each sequence to be used
   -sreverse1          boolean    Reverse (if DNA)
   -sask1              boolean    Ask for begin/end/reverse
   -snucleotide1       boolean    Sequence is nucleotide
   -sprotein1          boolean    Sequence is protein
   -slower1            boolean    Make lower case
   -supper1            boolean    Make upper case
   -sformat1           string     Input sequence format
   -sdbname1           string     Database name
   -sid1               string     Entryname
   -ufo1               string     UFO features
   -fformat1           string     Features format
   -fopenfile1         string     Features file name

   "-outfile" associated qualifiers
   -odirectory2        string     Output directory

   "-outtreefile" associated qualifiers
   -odirectory         string     Output directory

   General qualifiers:
   -auto               boolean    Turn off prompts
   -stdout             boolean    Write first file to standard output
   -filter             boolean    Read first file from standard input, write
                                  first file to standard output
   -options            boolean    Prompt for standard and additional values
   -debug              boolean    Write debug output to program.dbg
   -verbose            boolean    Report some/full command line options
   -help               boolean    Report command line options and exit. More
                                  information on associated and general
                                  qualifiers can be found with -help -verbose
   -warning            boolean    Report warnings
   -error              boolean    Report errors
   -fatal              boolean    Report fatal errors
   -die                boolean    Report dying program messages
   -version            boolean    Report version number and exit

Qualifier Type Description Allowed values Default
Standard (Mandatory) qualifiers
[-sequence]
(Parameter 1)
seqsetall File containing one or more sequence alignments Readable sets of sequences Required
[-outfile]
(Parameter 2)
outfile Phylip dnapenny program output file Output file <*>.fdnapenny
Additional (Optional) qualifiers
-weights properties (no help text) properties value Property value(s)  
-howoften integer How often to report, in trees Any integer value 100
-howmany integer How many groups of trees Any integer value 1000
-[no]simple boolean Branch and bound is simple Boolean value Yes/No Yes
-outgrno integer Species number to use as outgroup Integer 0 or more 0
-thresh toggle Use threshold parsimony Toggle value Yes/No No
-threshold float Threshold value Number 1.000 or more 1.0
-[no]trout toggle Write out trees to tree file Toggle value Yes/No Yes
-outtreefile outfile Phylip tree output file (optional) Output file <*>.fdnapenny
-printdata boolean Print data at start of run Boolean value Yes/No No
-[no]progress boolean Print indications of progress of run Boolean value Yes/No Yes
-[no]treeprint boolean Print out tree Boolean value Yes/No Yes
-stepbox boolean Print out steps in each site Boolean value Yes/No No
-ancseq boolean Print sequences at all nodes of tree Boolean value Yes/No No
Advanced (Unprompted) qualifiers
(none)
Associated qualifiers
"-sequence" associated seqsetall qualifiers
-sbegin1
-sbegin_sequence
integer Start of each sequence to be used Any integer value 0
-send1
-send_sequence
integer End of each sequence to be used Any integer value 0
-sreverse1
-sreverse_sequence
boolean Reverse (if DNA) Boolean value Yes/No N
-sask1
-sask_sequence
boolean Ask for begin/end/reverse Boolean value Yes/No N
-snucleotide1
-snucleotide_sequence
boolean Sequence is nucleotide Boolean value Yes/No N
-sprotein1
-sprotein_sequence
boolean Sequence is protein Boolean value Yes/No N
-slower1
-slower_sequence
boolean Make lower case Boolean value Yes/No N
-supper1
-supper_sequence
boolean Make upper case Boolean value Yes/No N
-sformat1
-sformat_sequence
string Input sequence format Any string  
-sdbname1
-sdbname_sequence
string Database name Any string  
-sid1
-sid_sequence
string Entryname Any string  
-ufo1
-ufo_sequence
string UFO features Any string  
-fformat1
-fformat_sequence
string Features format Any string  
-fopenfile1
-fopenfile_sequence
string Features file name Any string  
"-outfile" associated outfile qualifiers
-odirectory2
-odirectory_outfile
string Output directory Any string  
"-outtreefile" associated outfile qualifiers
-odirectory string Output directory Any string  
General qualifiers
-auto boolean Turn off prompts Boolean value Yes/No N
-stdout boolean Write first file to standard output Boolean value Yes/No N
-filter boolean Read first file from standard input, write first file to standard output Boolean value Yes/No N
-options boolean Prompt for standard and additional values Boolean value Yes/No N
-debug boolean Write debug output to program.dbg Boolean value Yes/No N
-verbose boolean Report some/full command line options Boolean value Yes/No Y
-help boolean Report command line options and exit. More information on associated and general qualifiers can be found with -help -verbose Boolean value Yes/No N
-warning boolean Report warnings Boolean value Yes/No Y
-error boolean Report errors Boolean value Yes/No Y
-fatal boolean Report fatal errors Boolean value Yes/No Y
-die boolean Report dying program messages Boolean value Yes/No Y
-version boolean Report version number and exit Boolean value Yes/No N

Input file format

fdnapenny reads any normal sequence USAs

Input files for usage example

File: dnapenny.dat

    8    6
Alpha1    AAGAAG
Alpha2    AAGAAG
Beta1     AAGGGG
Beta2     AAGGGG
Gamma1    AGGAAG
Gamma2    AGGAAG
Delta     GGAGGA
Epsilon   GGAAAG

Output file format

fdnapenny output is standard: if option 1 is toggled on, the data is printed out, with the convention that "." means "the same as in the first species". Then comes a list of equally parsimonious trees, and (if option 2 is toggled on) a table of the number of changes of state required in each character. If option 5 is toggled on, a table is printed out after each tree, showing for each branch whether there are known to be changes in the branch, and what the states are inferred to have been at the top end of the branch. If the inferred state is a "?" or one of the IUB ambiguity symbols, there will be multiple equally-parsimonious assignments of states; the user must work these out for themselves by hand. A "?" in the reconstructed states means that in addition to one or more bases, a deletion may or may not be present. If option 6 is left in its default state the trees found will be written to a tree file, so that they are available to be used in other programs. If the program finds multiple trees tied for best, all of these are written out onto the output tree file. Each is followed by a numerical weight in square brackets (such as [0.25000]). This is needed when we use the trees to make a consensus tree of the results of bootstrapping or jackknifing, to avoid overrepresenting replicates that find many tied trees.

Output files for usage example

File: dnapenny.fdnapenny


Penny algorithm for DNA, version 3.69
 branch-and-bound to find all most parsimonious trees


requires a total of              8.000

     9 trees in all found




  +--------------------Alpha1    
  !  
  !        +-----------Alpha2    
  !        !  
  1  +-----4        +--Epsilon   
  !  !     !  +-----6  
  !  !     !  !     +--Delta     
  !  !     +--5  
  +--2        !     +--Gamma2    
     !        +-----7  
     !              +--Gamma1    
     !  
     !              +--Beta2     
     +--------------3  
                    +--Beta1     

  remember: this is an unrooted tree!





  +--------------------Alpha1    
  !  
  !        +-----------Alpha2    
  !        !  
  1  +-----4  +--------Gamma2    
  !  !     !  !  
  !  !     +--7     +--Epsilon   
  !  !        !  +--6  
  +--2        +--5  +--Delta     
     !           !  
     !           +-----Gamma1    
     !  
     !              +--Beta2     
     +--------------3  
                    +--Beta1     



  [Part of this file has been deleted for brevity]

              +--5  +--Delta     
                 !  
                 +-----Gamma1    

  remember: this is an unrooted tree!





  +--------------------Alpha1    
  !  
  !              +-----Alpha2    
  1  +-----------2  
  !  !           !  +--Beta2     
  !  !           +--3  
  !  !              +--Beta1     
  +--4  
     !           +-----Gamma2    
     !        +--7  
     !        !  !  +--Epsilon   
     +--------5  +--6  
              !     +--Delta     
              !  
              +--------Gamma1    

  remember: this is an unrooted tree!





  +--------------------Alpha1    
  !  
  !              +-----Alpha2    
  1  +-----------2  
  !  !           !  +--Beta2     
  !  !           +--3  
  !  !              +--Beta1     
  +--4  
     !              +--Epsilon   
     !        +-----6  
     !        !     +--Delta     
     +--------5  
              !     +--Gamma2    
              +-----7  
                    +--Gamma1    

  remember: this is an unrooted tree!


File: dnapenny.treefile

(Alpha1,((Alpha2,((Epsilon,Delta),(Gamma2,Gamma1))),(Beta2,Beta1)))[0.1111];
(Alpha1,((Alpha2,(Gamma2,((Epsilon,Delta),Gamma1))),(Beta2,Beta1)))[0.1111];
(Alpha1,((Alpha2,((Gamma2,(Epsilon,Delta)),Gamma1)),(Beta2,Beta1)))[0.1111];
(Alpha1,(Alpha2,((Gamma2,((Epsilon,Delta),Gamma1)),(Beta2,Beta1))))[0.1111];
(Alpha1,(Alpha2,(((Epsilon,Delta),(Gamma2,Gamma1)),(Beta2,Beta1))))[0.1111];
(Alpha1,(Alpha2,(((Gamma2,(Epsilon,Delta)),Gamma1),(Beta2,Beta1))))[0.1111];
(Alpha1,((Alpha2,(Beta2,Beta1)),(Gamma2,((Epsilon,Delta),Gamma1))))[0.1111];
(Alpha1,((Alpha2,(Beta2,Beta1)),((Gamma2,(Epsilon,Delta)),Gamma1)))[0.1111];
(Alpha1,((Alpha2,(Beta2,Beta1)),((Epsilon,Delta),(Gamma2,Gamma1))))[0.1111];

Data files

None

Notes

None.

References

None.

Warnings

None.

Diagnostic Error Messages

None.

Exit status

It always exits with status 0.

Known bugs

None.

See also

Program name Description
distmat Create a distance matrix from a multiple sequence alignment
ednacomp DNA compatibility algorithm
ednadist Nucleic acid sequence Distance Matrix program
ednainvar Nucleic acid sequence Invariants method
ednaml Phylogenies from nucleic acid Maximum Likelihood
ednamlk Phylogenies from nucleic acid Maximum Likelihood with clock
ednapars DNA parsimony algorithm
ednapenny Penny algorithm for DNA
eprotdist Protein distance algorithm
eprotpars Protein parsimony algorithm
erestml Restriction site Maximum Likelihood method
eseqboot Bootstrapped sequences algorithm
fdiscboot Bootstrapped discrete sites algorithm
fdnacomp DNA compatibility algorithm
fdnadist Nucleic acid sequence Distance Matrix program
fdnainvar Nucleic acid sequence Invariants method
fdnaml Estimates nucleotide phylogeny by maximum likelihood
fdnamlk Estimates nucleotide phylogeny by maximum likelihood
fdnamove Interactive DNA parsimony
fdnapars DNA parsimony algorithm
fdolmove Interactive Dollo or Polymorphism Parsimony
ffreqboot Bootstrapped genetic frequencies algorithm
fproml Protein phylogeny by maximum likelihood
fpromlk Protein phylogeny by maximum likelihood
fprotdist Protein distance algorithm
fprotpars Protein parsimony algorithm
frestboot Bootstrapped restriction sites algorithm
frestdist Distance matrix from restriction sites or fragments
frestml Restriction site maximum Likelihood method
fseqboot Bootstrapped sequences algorithm
fseqbootall Bootstrapped sequences algorithm

Author(s)

This program is an EMBOSS conversion of a program written by Joe Felsenstein as part of his PHYLIP package.

Please report all bugs to the EMBOSS bug team (emboss-bug © emboss.open-bio.org) not to the original author.

History

Written (2004) - Joe Felsenstein, University of Washington.

Converted (August 2004) to an EMBASSY program by the EMBOSS team.

Target users

This program is intended to be used by everyone and everything, from naive users to embedded scripts.