Using CONSENSE



Introduction

CONSENSE is one of many programs of the PHYLIP package.

It takes as input a file containing a set of phylogenetic trees in NEWICK/PHYLIP format, and summarises the set of splits associated with these trees, all of which describe the relationships between the same set of OTUs, in consensus trees.

The branch lengths of the resulting consensus trees describe the number of times the split described by the branch was found in the set trees in the input file.

The information described below provides a quick guide to using PHYLIP version 3.68 using the bash shell on a UNIX system.

Online documentation

Several pages from the PHYLIP website provide detailed information relevant to using CONSENSE

Executing CONSENSE

To execute CONSENSE, ideally the directory containing the PHYLIP executables will be in your path. This allows you to execute CONSENSE by simply typing the name of the executable at the shell prompt (i.e. "consense")

(You can check this by looking for the PHYLIP executables directory in the results of this command "echo $PATH")

By default, CONSENSE operates on a file named "intree" located in the directory in which you execute CONSENSE, writing two output files ("outtree" and "outfile") to the same directory.

I suggest you work with CONSENSE by
The commands shown below were used to carry out the steps described above (although not showing the text menus used to specify and execute the CONSENSE analysis), using the file testConsenseThreeFourTaxaTrees.ph as an input, and examining the resulting "outtree" file to check the analysis has completed successfully.
myMac:test myUser$ mkdir runConsense
myMac:test myUser$ cp ../testConsenseThreeThreeTaxaTrees.ph runConsense
myMac:test myUser$ cd runConsense
myMac:runConsense myUser$ ls
testConsenseThreeThreeTaxaTrees.ph
myMac:runConsense myUser$ cp testConsenseThreeThreeTaxaTrees.ph intree
myMac:runConsense myUser$ consense

.... execute consense

myMac:runConsense myUser$ ls
intree outtree
outfile testConsenseThreeThreeTaxaTrees.ph
myMac:runConsense myUser$ cat outtree
((b:3.00,(c:3.00,d:3.00):2.00):3.00,a:3.00);

Specifying and running the CONSENSE analysis

This description of the how to use CONSENSE depends on the directory in which CONSENSE is executed containing
See the section below on "Specifying location of input and output data" if this is not the case.

For the purpose of our exercises, the only setting we need to consider is "Consensus type (MRe, strict, MR, Ml)"

On the left side of the line describing this option is the character "C" - to switch between the different options available, simply type "C" followed by return.

Once the appropriate settings have been selected, type "Y" to confirm that the settings are correct, followed by return, and the analysis will be executed.

In the example shown below, CONSENSE is run using the "Strict" consense type
Consensus tree program, version 3.68

Settings for this run:
C Consensus type (MRe, strict, MR, Ml): Majority rule (extended)
O Outgroup root: No, use as outgroup species 1
R Trees to be treated as Rooted: No
T Terminal type (IBM PC, ANSI, none): ANSI
1 Print out the sets of species: Yes
2 Print indications of progress of run: Yes
3 Print out tree: Yes
4 Write out trees onto tree file: Yes

Are these settings correct? (type Y or the letter for one to change)
c




Consensus tree program, version 3.68

Settings for this run:
C Consensus type (MRe, strict, MR, Ml): strict
O Outgroup root: No, use as outgroup species 1
R Trees to be treated as Rooted: No
T Terminal type (IBM PC, ANSI, none): ANSI
1 Print out the sets of species: Yes
2 Print indications of progress of run: Yes
3 Print out tree: Yes
4 Write out trees onto tree file: Yes

Are these settings correct? (type Y or the letter for one to change)
y

Consensus tree written to file "outtree"

Output written to file "outfile"

Done.

The resulting consensus tree can then be examined in a tree viewer, for example NJplot.

Specifying location of input and output data

What will happen after running the "consense" executable depends on whether or not:
consense: can't find input tree file "intree"
Please enter a new file name>
consense: the file "outfile" that you wanted to
     use as output file already exists.
     Do you want to Replace it, Append to it,
     write to a new File, or Quit?
     (please type R, A, F, or Q)

Avoiding the menu screen

In many cases, we already know the settings we want to use when running CONSENSE.

In such a case, it is possible to avoid directly interacting with the programs menu system as described above, by creating a file which contains the commands required to specify and execute an appropriate analysis, and providing this file to the standard input of consense.

For example, to specify creating a majority rule consensus tree when the input file "intree" is in the directory used to execute CONSENSE, and where there are no files outtree and outfile in that directory, we would need to provide the following input to CONSENSE
c  
c
y
(the first two "c"s are used to set the "Consensus type" to MR, the final "y" confirms these settings.

Thus, using the following set of UNIX commands, we could run CONSENSE without having to interact directly with the menus.

We begin by using "cat", which takes the contents of the standard input and here writes its output to the file named "consense_run_parameters" (this does not have to be the name of the file used to store the parameters)

We enter to the standard input "c" followed by return, "c" followed by return (again), "y" followed by return, and finally Control-C to close standard input.

We then check that the file "consense_run_parameters"
We then execute the CONSENSE executable "consense", directing into standard input the contents of the file "consense_run_parameters".

CONSENSE then goes ahead and executes, providing the input contained within "consense_run_parameters" to the set of text menus provided by CONSENSE, and finally executing the appropriate analysis.
myMac:runConsense myUser$ ls
intree testConsenseThreeFourTaxaTrees.ph
myMac:runConsense myUser$ cat > consense_run_parameters
c
c
y
^C
mac-gibson17-AidanLaptop:runConsense budd$ ls
consense_run_parameters intree
testConsenseThreeFourTaxaTrees.ph
mac-gibson17-AidanLaptop:runConsense budd$cat consense_run_parameters
c
c
y
mac-gibson17-AidanLaptop:runConsense budd$ consense < consense_run_parameters
Consensus tree program, version 3.68

Settings for this run:
C Consensus type (MRe, strict, MR, Ml): Majority rule (extended)
O Outgroup root: No, use as outgroup species 1
R Trees to be treated as Rooted: No
T Terminal type (IBM PC, ANSI, none): ANSI
1 Print out the sets of species: Yes
2 Print indications of progress of run: Yes
3 Print out tree: Yes
4 Write out trees onto tree file: Yes

Are these settings correct? (type Y or the letter for one to change)

Consensus tree program, version 3.68

Settings for this run:
C Consensus type (MRe, strict, MR, Ml): strict
O Outgroup root: No, use as outgroup species 1
R Trees to be treated as Rooted: No
T Terminal type (IBM PC, ANSI, none): ANSI
1 Print out the sets of species: Yes
2 Print indications of progress of run: Yes
3 Print out tree: Yes
4 Write out trees onto tree file: Yes

Are these settings correct? (type Y or the letter for one to change)

Consensus tree program, version 3.68

Settings for this run:
C Consensus type (MRe, strict, MR, Ml): Majority rule
O Outgroup root: No, use as outgroup species 1
R Trees to be treated as Rooted: No
T Terminal type (IBM PC, ANSI, none): ANSI
1 Print out the sets of species: Yes
2 Print indications of progress of run: Yes
3 Print out tree: Yes
4 Write out trees onto tree file: Yes

Are these settings correct? (type Y or the letter for one to change)

Consensus tree written to file "outtree"

Output written to file "outfile"

Done.


Author: Aidan Budd
Back To Gibson Team Training Pages