\documentclass[a4paper, 11pt,nocolor]{report}

%%%%%%%%%%%%%%%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{a4wide}
\usepackage[nocolor]{pdfswitch}
\usepackage{texgraphicx}% Pour inclure les pstex_t
\graphicspath{{fig/}{eps/}}
\usepackage[latin1]{inputenc}% pour pouvoir taper des accents directement
\usepackage[T1]{fontenc}% jolie fontes
\usepackage{color}% Pour la couleur (mais pourquoi je l'ai mis ! :
                  % pour xfig)
%\usepackage{colortbl}% Pour faire des tableaux avec des cases colorees
\usepackage{subfigure}% Pour faire des figures en plusieurs parties
\usepackage{boxedminipage}% Pour faire des boxedminipage
\usepackage{xspace}% Pour les espaces Ã  la fin des macros
\usepackage{amssymb} %
\usepackage{times} % Pareil
\usepackage{float} % Pour le positionnement H de figure
\usepackage{vmargin} %
\usepackage{url} %
\usepackage{amsmath}
\usepackage{threeparttable} % pour les notes dans les tables
\usepackage[square]{natbib}
\usepackage{lscape}
\usepackage{placeins}
\usepackage{fancyhdr}
\usepackage{url}
\usepackage{setspace}
\usepackage{alltt}
\usepackage{tabularx}

\sloppy
%\doublespacing

%%%%%%%%%%%%%%%%% COMMANDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\mysinglespace}{\def\baselinestretch{1.1}}
\newcommand{\mydoublespace}{\def\baselinestretch{1.6}}
\newcommand{\treevolve}{\texttt{TREEVOLVE}\xspace}
\newcommand{\phase}{\texttt{phase}\xspace}
\newcommand{\famhap}{\texttt{FamHap}\xspace}
\newcommand{\paup}{\texttt{paup}\xspace}
\newcommand{\phylip}{\texttt{phylip}\xspace}
\newcommand{\paml}{\texttt{paml}\xspace}
%TODO est-ce que phyml s'écrit comme ça ?
\newcommand{\phyml}{\texttt{phyml}\xspace}
\newcommand{\altree}{\texttt{ALTree}\xspace}
\renewcommand{\thetable} {\rm\Roman{table}}
\renewcommand{\thefigure} {\rm\Roman{figure}}
\newcommand{\newchitree}{\texttt{ALTree}\xspace}
\newcommand{\etHTname}{altree-add-S}
\newcommand{\etHT}{\texttt{ALTree-add-S}\xspace}
\newcommand{\rechaploname}{altree-convert}
\newcommand{\rechaplo}{\texttt{ALTree-convert}\xspace}
\newcommand{\acctran}{\texttt{acctran}\xspace}
\newcommand{\deltran}{\texttt{deltran}\xspace}
\newcommand{\chisquare}{chi-square\xspace}
\newcommand{\chisquares}{chi-squares\xspace}
\newcommand{\cmd}[1]{\textit{#1}}
\newcommand{\fn}[1]{\textbf{#1}}
\newcommand{\prog}[1]{\texttt{#1}}
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\ucode}[1]{\code{\textit{#1}}}
\newcommand{\ccode}[1]{\code{\textbf{#1}}}

\newcommand{\commande}[1]{\texttt{#1}}

\newenvironment{source}{%
\begin{alltt}%
}{%
\end{alltt}%
}

\newenvironment{options}[1][l]{%
  \noindent%
  \bgroup%
  \newcommand{\option}[2]{%
    \code{##1}& ##2 \\%
  }
  \tabularx{\linewidth}{@{}#1X@{}}
}{%
  \endtabularx
  \egroup%
}

%%%%%%%%%%%%%%%%%
\begin{document}
\pagestyle{empty}
\pagestyle{myheadings}
\title{ALTree: Association and Localisation tests using haplotype
  phylogenetic Trees }
\author{Claire Bardel, Vincent Danjean, Pierre Darlu and Emmanuelle Génin}

\date{Version 1.2}
\maketitle

\tableofcontents



\chapter{Introduction}

\section{What's new?}
\paragraph{Problem with PAUP*}
It seems that PAUP* does not run anymore on recent versions of Linux. We have not tested windows or MacOS version. If PAUP* does not work on your system, example files using PAUP* (in the paup directory) will not run because PAUP* output files will not be produced.
\paragraph{Version 1.1.0: modification of \newchitree and \etHT to deal with quantitative data}
The software now deals with quantitative data. For the association test, series of one-way ANOVA are performed instead of the homogeneity tests. For the localisation test, only the definition of the S character is different for quantitative traits. Currently, \rechaplo has not been modified and does not deal with quantitative data.


\section{Overview of the software}

 This software is designed to perform phylogeny-based analysis: first,
it allows the detection of an association between a candidate gene and
a disease or a quantitative trait, and second, it enables us to make hypothesis about the
susceptibility loci.

%\section{Copyright}


It contains three programs: \newchitree, \rechaplo and
\etHT. The connections between these programs are described in Figure~\ref{fig:altree}
%\section{Short description of the programs available in \altree}
\begin{figure}[htbp]
  \includegraphics[width=\linewidth]{overview.fig}\centering
  \caption{\altree programs}
  \label{fig:altree}
\end{figure}
  
This program is copyrighted (c) by Claire Bardel and Vincent Danjean
and is distributed under the GNU General Public License. You are
free to re-distribute it under the same license.

This software comes with no warranty whatsoever. If you encounter any
problem, please, send a bug report to Claire Bardel at the following
e-mail: Claire.Bardel@univ-lyon1.fr
                                %The complete text of the GNU General Public
                                %License can be found in the annexe~\ref{GPL} on page~\pageref{GPL}.
  

\subsection{\newchitree}
\subsubsection{Association test}
The test consists in performing series of nested tests at different level of a phylogenetic tree. These tests compare either the number of cases and controls (for case/control data) in the different groups (or clades) defined on the tree or the variance of the trait within each clade to the variance between these different clades (for quantitative data). The nested algorithm is detailed
on Figure~\ref{fig:nesting_algo} (figure from \citet{Bardel05},
slightly modified). Then, a global p-value is calculated
for the tree by using a permutation procedure such as the one
described by \citet{Ge03} and \citet{Becker04}.

\begin{figure}[h]
  \begin{center}
    \includegraphics[width=0.8\linewidth]{altree-q.fig}
    \caption{Description of the nested clade analysis (without the
      permutation procedure)}
    \label{fig:nesting_algo}
  \end{center}
  \vspace{-0.4cm}
  {\small (A) shows the homogeneity test or the ANOVA performed at level k (between clades
    $C_1$ and $C_2$). Then (B), a test will be
    performed at the following level (k+1), between all the sub-clades
    descending from clades $C_1$ and $C_2$, i.e between clades $C_{1.1}$,
    $C_{1.2}$, $C_{2.1}$ and $C_{2.2}$.
% If it is
%    significant the analysis ends because an association is detected.
%    When the permutation procedure is used, all the tests are considered
%    as non significant and the p-values are evaluated \textit{a posteriori}.
  }
\end{figure}

\subsubsection{Localisation of the susceptibility loci}
To perform the localisation analysis, for each haplotype $h$, the user
must previously define a new character (called character $S$) whose
state depends on the proportion of cases (resp. individual with high quantitative trait values) carrying haplotype $h$ and
optimise it on the haplotype phylogeny.  The program \newchitree then
looks for sites that co-mutates with the character $S$ by calculating a
co-mutation index called $V_{i}$ for each site $i$ and for each
character state transition ($0 \rightarrow 1$ for example). The
higher the $V_{i}$, the higher the probability of $i$ being the
susceptibility site.

\bigskip The method implemented in \newchitree has been fully
described in~\citet{Bardel05}. Please refer to this article for a more
complete description.

\subsection{\rechaplo}
Before running \newchitree, you will generally have to reconstruct
haplotypes %(see section \ref{sec:require} for a description of usable
%programs). 
The output of the haplotype reconstruction programs are
totally different from the input files necessary for the phylogenetic
reconstruction programs. \rechaplo was then written to convert the
outputs of haplotype reconstruction programs to input files for
phylogenetic reconstruction programs. It may be particularly useful if
you want to use \paup because \paup has a very high number of options.
If you use \rechaplo, an input file with all the options necessary to
further run \newchitree is produced.

Currently, \rechaplo can deal with two haplotype reconstruction
programs: \phase~\citep{Stephens01, Stephens03} and
\famhap~\citep{Becker04} and can produce files for three phylogeny
reconstruction programs: \paup~\citep{Swofford02},
\phylip~\citep{Felsenstein04} and \paml~\citep{YangPAML}.

\subsection{\etHT}\label{description_etiquette}
\enlargethispage{1cm}
To perform the localisation analysis, a new character $S$ must be
added to each haplotype $h$. The state of $S$ depends on the
proportion of cases (resp. individual with high quantitative trait values) carrying the haplotype $h$. You can use your own
criterion to determine the state of $S$ and add it manually to the
input file of the phylogeny reconstruction program that will optimise
the character states changes on the tree.

If you do not want to add the character $S$ manually, you can use \etHT.
For case/control data, the state of the character $S$ is allocated depending on the
proportion ($p_h$) of cases carrying the haplotype $h$ compared to the
proportion $p_0$ of cases in the whole sample.

\begin{itemize}
\item if $p_h < p_0-\epsilon\sqrt{\frac{p_h\times(1-p_h)}{n_h}}$, $S$
  is coded ``C'' or ``0'' (high number of controls);
\item if $p_h > p_0+\epsilon\sqrt{\frac{p_h\times(1-p_h)}{n_h}}$, $S$
  is coded ``G'' or ``1'' (high number of cases);
\item else, $S$ is coded ``?'' (undetermined).
\end{itemize}
with $n_h$ being the number of individuals carrying the haplotype $h$.

For quantitative data, the state of ``S''  depends on  the mean of the quantitative trait in a given branch of the
tree $\mu$, the mean of the quantitative trait in the whole data
set $\mu_0$  and  the standard deviation of the quantitative trait in
the whole data set,  $\sigma_0$. 
\begin{itemize}
\item if $\mu> \mu_0 + \epsilon \times \displaystyle{\frac{\sigma_0}{\sqrt{n}}}\quad$ ``S''  is coded ``H'' (high level);
\item if $\mu< \mu_0 - \epsilon \times \displaystyle{\frac{\sigma_0}{\sqrt{n}}}\quad$ ``S''   is coded ``L'' (low level);
 \item else, ``S'' is coded ``?'' (undetermined)
\end{itemize}
$n$ being the sample size, and $\epsilon$, an inflation coefficient to be chosen by the user.


\subsection{Computation time  (in 2005)}

We measured the computation time on a Pentium III, 930 MHz, 512 Mo of
RAM. We used a data set of 363 individuals (cases and controls)
genotyped for 7 SNPs defining 33 different haplotypes. The
reconstructed phylogenetic tree had 6 levels. On this data set, the
association test runs in about 24 hours (p-value evaluated by 100~000
permutations, the complexity of the program being linear with respect
to the number of permutations). The localisation test runs in about 10
seconds (2~000 equiparsimonious trees analysed, the complexity of the
program being linear with respect to the number of analysed trees).

In fact, for the association test, the computation time increases with
the number of permutation and with the number of levels in the tree
(the number of levels being tightly linked to the number of haplotypes
in the data sets, which depends on the number of SNPs and of the LD
between the SNPs). We tested the software for up to 1000 SNPs
corresponding to 417 haplotypes. In this case, the association test
runs in about 6 minutes (for one permutation only). Three to four
minutes should be added per supplementary permutation. With such a
data set, we can see that the evaluation of the p-values with the
permutation procedure (10~000 to 100~000 are required) is not
realistic on this kind of computer. However, the software can be used
to look for association without using the permutation procedure. 

The localisation test runs very quickly and depends on the number of
equiparsimonious trees analysed. On the data set with 1000 SNPs, the
localisation test runs in 10 seconds for one tree. 


\chapter{Installing the software}

The software can run on various Linux/Unix platform. %and on MacOS X.

\section{Requirements}
\label{sec:require}

\subsection{Phylogeny reconstruction programs}
Before using \altree, you must build a phylogeny of the haplotypes.
Three phylogeny software are compatible with our program:
\begin{itemize}
\item \paup~\cite{Swofford02}: available at
  \url{http://paup.csit.fsu.edu/}. This software is not free software
  and must be purchased (100\$ for the unix version).
\item \phylip~\cite{Felsenstein04}: freely available at
  \url{http://evolution.genetics.washington.edu/phylip.html} (only
  usable for the association test)
\item \paml~\cite{YangPAML}: freely available at
  \url{http://abacus.gene.ucl.ac.uk/software/paml.html}. As stated by
  its author, \paml is not good at tree making. So we advise you to
  use another software to build the tree (for example,
  \phyml~\cite{Guindon03} and then to use \paml to estimate the
  character states at each node.
\end{itemize}

\textit{\paragraph{Note:}
Currently, only the outputs from the parsimony method implemented in
\paup (command \texttt{set}, option \texttt{criterion} set to
``parsimony'') and in \phylip (program \texttt{mix}) are compatible
with our software.  If you want to use maximum likelihood (ML), we
suggest you to use your favorite software to compute the ML tree and
then, to use \paml to estimate the character states at each node.
}

\subsection{Required tools}
\prog{perl} is required to run \altree. \prog{perl} version 5.8.7 or
higher should work. Lower versions can work, but they have not been
tested.

If you want to build the program from sources, you will also need a
C compiler such as \prog{gcc} and the GNU \prog{make} program. They
are available on most Unix plateforms. Otherwise, a debian package
containing the binary files is available.%For MacOS X, \prog{gcc} and
%\prog{make} are available with other tools on the development CD of
%the OS.

\section{Installation on a linux platform} 
To install this module type the following:\\

\begin{source}
perl Makefile.PL
make
make test
make install
\end{source}

\noindent If you prefer to install it in your home directory, then
type the following:
\begin{source}
perl Makefile.PL PREFIX=~ 
make
make test
make install
\end{source}

\noindent In this case, do not forget to add \verb+~+\prog{/bin} in your
\prog{PATH} and \verb+~+\prog{/lib/perl/\textit{perl\_version}/} in
\prog{PERL5LIB} if they are not already present. For example:
\begin{source}
PATH=~/bin:$PATH
export PATH
PERL5LIB=~/lib/perl/5.8.7/:$PERL5LIB
export PERL5LIB
\end{source}

\vspace{0.5cm}

%Inclure les differentes platformes sur lesquelles ça tourne.\\
%Voir avec Vince; installation des bibliothèques perl, installation de la bibliothèque C. Avec Linux, paquet debian dispo sur page Vince. Voir si on peut compiler le C pour windows et/ou macOSX.

\chapter{\rechaplo }
This program converts the output of the haplotype reconstruction
programs to input for phylogeny reconstruction programs. Each option
has a long name (which must be preceded by -{}-) and some of them also
have a short name (which must be preceded by -).
\section{Summary of the different options}

\begin{options}
  \option{-{}-version}{program version}
  \option{-{}-short-help|-h}{brief help message}
  \option{-{}-help}{help message with option descriptions}
  \option{-{}-man}{full documentation}
  \option{-{}-first-input-file|-i \ucode{file}}{Input file 1}
  \option{-{}-second-input-file|-j \ucode{file}}{Input file 2 (not mandatory, see
    explanations below)}
  \option{-{}-output-file|-o \ucode{file}}{Output file 1} 
  \option{-{}-case-control-output|-c  \ucode{file}}{Output containing the
    number of cases/controls}
  \option{-{}-reconstruct-prog|-r \ccode{phase|famhap}}{Name of the haplotype
    reconstruction program}
  \option{-{}-phylo-prog|-p \ccode{paup|phylip}}{Name of the phylogeny reconstruction program}
  \option{-{}-data-type|-t \ccode{DNA|NUM}}{Type of data: DNA (ATGCU) or NUM (0-9)}
\end{options}

\section{How to get help?}\label{help}

\subsection{option -{}-short-help or -h}
This option displays a short help message which recapitulates all the
options available.

\subsection{option -{}-help} 
This option displays a message with a description of the different options.

\subsection{option -{}-man}
This option displays the man page for the program.

\subsection{option -{}-version}
This option gives the number of the version currently used.

\section{Input files}
This program takes as input files the output files of the haplotype
recontruction programs. Currently, only \phase (for case/control data)
and \famhap (for family data) output files are allowed, but we plan to
extend the number of haplotype recontruction programs usable. The name
of the haplotype reconstruction program used to generate the input files must be specified after the -r option.

\subsection{Using \phase output file}
Two different cases must be considered:
\begin{itemize} 
\item The case-control status of each individual has been specified in the input file for phase and phase has been run with the -c-1 option. In this case only one input file is necessary for \rechaplo: the phase output file (let's call it out.phase). In this case, the program must be run like this: \\
\begin{source} 
  \rechaploname -r \ccode{phase} -i \ucode{out.phase} -other\_options   
\end{source}
\item The case-control status of each individual has not been specified in the input file for phase. In this case, two input files are necessary: the phase output file (out.phase) and another file which specifies the disease status for each individual (status.phase). This file consists in two rows: the first contains the individual's ID and the second, their disease status (0=control, 1=case). In this case, the program must be run like this: \\
\begin{source}   
  \rechaploname -r \ccode{phase} -i \ucode{out.phase} -j
  \ucode{status.phase}  -other\_options 
\end{source}
\end{itemize}

\subsection{Using \famhap output files}
The program \rechaplo is designed to use files generated with
\famhap15 (and not with \famhap12!), \famhap16 has not been tested
yet. Two options are necessary:
\begin{description}
\item [dp] : to take the disease status into account in the haplotype reconstruction
\item [P] : to make sure that all the haplotypes are present in the output file
\end{description}

Two input files are necessary for \rechaplo: the \famhap output file whose name has been chosen by the user (let's call it out.famhap), and the output file called input\_name\_H1\_HAPLOTYPES. In this case, the program must be run like this: \\
\begin{source} 
  \rechaploname -r \ccode{famhap} -i \ucode{out.famhap} -j
  \ucode{H1\_HAPLOTYPES} -other\_options
\end{source}

\section{Output files}
Two different output files are generated:
\begin{description}
\item [The main output file. ] Its name should follow the -o
  option. This file is an input file for the phylogeny reconstruction
  programs \paup, \paml or \phylip.
  \item [The second output file. ] Its name should follow the -c
    option. It contains the number of times a given haplotype is
    carried by case and control individuals.
\end{description}

%wo kinds of output files can be generated depending on the phylogeny
%econstruction program you want to use (\paml and \phylip use the same
%ype of input files). The name of the phylogeny reconstruction program should follow the -p option.

\subsection{Generating \paup input files (*.paup)}
The file generated is a nexus file containing the options for \paup
necessary to run \newchitree after \paup. This is only an example of a
paup file: we choose to root the tree using an ancestral sequence, but
this is not necessary and this file should be modified according to
your data. Examples of \paup input files can be found in the test
directory: they are labeled *.paup.  

%In the output file, the name of each haplotype is formed by the
%concatenation of an haplotype number (Hxxx), and of the number of
%cases (mxxx) and controls (cxxx) carrying this haplotype. 
%A character
%is added to each haplotype: its state is 2 or C for all the haplotypes
%and must be set to 1 or G for the ancestral sequence. This character
%is set only to be sure that the phylogeny reconstruction program
%correctly draw the tree. It does not change the results of the
%analysis, and it can be removed from the file.

The output file is not a valid \paup input file.  Some options are
indicated within square brackets and must be specified by the user before
running \paup:
\begin{itemize}
\item the sequence of the ancestral haplotype
\item the maximum number of trees \paup must find 
\item the method to optimise character state changes (\acctran/\deltran)
\item the name of the different files generated
\item the number of trees described by paup in the log file (we advise
  you to keep all the trees, and to limit the number of trees that are
  analysed later, when running \newchitree).
\end{itemize}
The chosen option must be put out of the square brackets because \paup
ignores what is written within square brackets. 



\subsection{Generating \phylip or \paml input files (*.phy)}
The file generated is the simplest phylip (also used by \paml) format.
The first line contains the number of haplotypes and the number of
sites and the following lines contains an identifier for the haplotype
(Hxxx) and the haplotype sequence. %A character is added to each
%haplotype: its state is 0 or C for all the haplotypes and must be set
%to 1 or G for the ancestral sequence. This character is set only to be sure that the phylogeny reconstruction program correctly draw the tree. It does not change the results of the analysis, and it can be removed from the file. 


%In this file, you must either add the sequence of the ancestral haplotype in
%the file out.phylip and prepare a file named ``ancestors'' containing this
%sequence (don't forget to add the character 1 at the end of the
%sequence), or eliminate this sequence and modify the number of
%sequences accordingly if you want to use an outgroup to root the tree.

\subsection{The second output file}\label{description_correspond} 

The name of the second output file must follow the -c option. This
file contains the number of times a given haplotype is found in cases
and controls. The file format is the following: the label of each
haplotype and the number of cases and controls carrying it are
specified, separated by spaces or tabulations. The number of cases
carrying a given haplotype is preceded by the letter ``m'' and the
number of controls is preceded by the letter ``c''.

Example of such a file: \\
\begin{tabular}{ccc}
H002 &   m015 &   c001\\
H003 &   m000 &   c001\\
H001 &   m000 &   c002\\
%H000\_anc & m000 & c000\\
\end{tabular}

Other examples may be found in the test directory. These files are
always labeled ``nb\_cas\_control.txt''.

\section{Other options}
\subsection{The phylogeny reconstruction program}
You must specify the name of the phylogeny reconstruction software
that will be used  after the option -p or -{}-phylo-prog option so that the
corresponding output file can be generated.

\subsection{The haplotype reconstruction program}
The name of the haplotype reconstruction program (\famhap or \phase)
must be specified after the option -r or -{}-recontruct-prog.

\subsection{The type of data}
The user must specify if the data are of type DNA (ATGC) or NUM
(number from 0 to 9, for the current version of the program, numbers
superior to 9 cannot be used). It must be specified after the -r option. 

%\subsection{Name of the main output file}
%With the -o option, the user chooses the name of the output file. If -o is omitted, the standard output will be used.


 
\chapter{\etHT}
This program adds a new character (named $S$) to each haplotype
corresponding to its disease status. Each option has a long name
(which must be preceded by -{}-) and some of them also have a short
name (which must be preceded by -).

\section{Summary of the different options}

\begin{options}
  \option{-{}-version}{program version}
  \option{-{}-short-help|-h}{brief help message}
  \option{-{}-help}{help message with option descriptions}
  \option{-{}-man}{full documentation}
  \option{-{}-first-input-file|-i \ucode{file}}{Input file 1}
  \option{-{}-second-input-file|-j \ucode{file}}{Input file 2: nb cases/controls per haplotype}
  \option{-{}-output-file|-o \ucode{file}}{Output file} 
  %-r & Haplotype reconstruction program\\
  \option{-{}-epsilon|-e \ucode{number}}{$\epsilon$ parameter}
  \option{-{}-data-type|-t \ccode{DNA|SNP}}{data type: SNP or DNA}
  \option{-{}-proportion|-p \ucode{number}}{proportion of cases in the sample}  
  \option{-{}-data-qual|q \ccode{qualitative|quantitative}}{data type: qualitative or quantitative}
  \option{-{}-outgroup|-g \ucode{outgroup\_name}} {Name of the
    outgroup (if necessary)} 
  \option{-{}-low|-l}{forces the state of character $S$ to be ``?'' for haplotypes carried by 1 individual}
\end{options}

%\section{Description}
%This program use a paup input file (input.paup) as input file, and generate a new paup input file (input\_et.paup) after having added a new character S to each haplotype. 
%
%S excluded from the reconstruction of the tree, but included for the apomorphy recontrsuction -> modif of the paup block

%les 2 facon de coder le caractere S.

%Pb pour 1 ind.

\section{How to get help?}
See the same section for the program \rechaplo (page \pageref{help}).
\section{Input files }
\subsection{The sequence file (-i option)}
The name of the input file containing the sequences must be specified
after the -i option.  This input file must be a valid \paup (nexus) or
\phylip/\paml input file. If it is a \paup file, make sure that the
line following the description of the last haplotype in the data block
includes a semi colon only.

\subsection{The trait file (-j option)}
The name of the file containing informations about the trait must be specified after the -j option. 
\begin{itemize}
\item If your trait is quantitative, the file must contain haplotype labels followed by the quantitative values measured for the individuals carrying these haplotypes. or homozygous individuals, quantitative values must be repeated twice; 
\item If your data are qualitative, the file must contain haplotype
  labels folled by the number of cases and controls carrying this
  haplotype separated by spaces or tabulations. The number of cases
  should be preceded by a "m" (or the word "case", possibly followed
  by a "$\_$"), the number of controls should be preceded by the letter
  "c" (or the word "control", possibly followed by a "$\_$").
\end{itemize}
Examples:
\begin{minipage}{0.45\linewidth}
  \begin{center}
    \begin{tabular}{ccc}
       \multicolumn{3}{c}{Case/control data}\\
      H002 & m12 & c5 \\
      H019 & m2  & c6 \\
      H007 & m54 & c78 \\
    \end{tabular}
  \end{center}
\end{minipage}
\begin{minipage}{0.45\linewidth}
  \begin{center}
    \begin{tabular}{ccccc}
      \multicolumn{3}{c}{Quantitative data}\\
      H008 &    9.54 &   11.45\\   
      H005 &   7.73  &  11.43 &  10.6 &   13.8\\
      H018 &  8.98 \\
    \end{tabular}
  \end{center}
\end{minipage}



\section{Output file (-o option)}
The name of the output file can be specified after the -o option. If
the -o option is not present, the standard output is used.

The output file is a \paup or \paml input file. The character $S$ is
coded ``G'' or ``1'' for cases or high values of the quantitative
trait and ``C'' or ``0'' for controls or low values of the
quantitative trait.  In the \paup input file generated, a new command
is added, which excludes the character $S$ from the tree
reconstruction process, and includes it in the table of
apomorphies. If you want to use \paml, no such command exists. We
advise you to reconstruct the phylogeny on the data set without the
character $S$ by using your favorite phylogeny reconstruction
program. Then, you give that tree and the data-set with the
S-character to \paml to obtain the apomorphie list.

\section{Other options}


\subsection{Proportion of cases in the sample (qualitative data only)}
The proportion of cases in the sample must be specified after the -p option. 

\subsection{The epsilon value}
It corresponds to the parameter $\epsilon$ (see the description of the
program in section \ref{description_etiquette}, page
\pageref{description_etiquette}). If $\epsilon$ is high, haplotypes
will more often have a character $S$ coded ``?''. To give an idea, in our article~\citep{Bardel05}, $\epsilon$ was set to 1.

\subsection{Data type: sequence}
The -t option must be followed either by \cmd{SNP} or by \cmd{DNA}. \cmd{SNP}
should be used if you have numerical data (characters coded from 0 to 9).
 \cmd{DNA} must be used if you have DNA data (A, T, G, C).

\subsection{Data type: trait}
The software can deal with qualitative data (case/control) or quantitative data. The -q (or --data-qual) option must be followed by either \cmd{qualitative} or \cmd{quantitative}, depending on your data.

 \subsection{Haplotypes carried by only 1 individual}
 The -l option is not mandatory: if it is present, $S$ is coded ``?''
 for all the haplotypes present only once in the sample, whatever the
 disease status of the individual carrying it. If -l is not specified,
 the state of $S$ will be chosen according to the formula (see section
 \ref{description_etiquette}, page \pageref{description_etiquette}).

\subsection{Name of the outgroup}
If the outgroup  is not specified in the file containing the number of cases an
controls but is in the file containing the sequences, the name of the
outgroup must be provided to \etHT so that the program can identify
the outgroup sequence. For this sequence, the state of the character
$S$ will be ``?''.

\chapter{\newchitree}
This program can perform either an association test or a localisation
test. Each option has a long name (which must be preceded by -{}-) and
some of them also have a short name (which must be preceded by -).

\section{Summary of the different options}
\begin{options}[p{.54\linewidth}]
\option{-{}-version}{program version}
\option{-{}-short-help|-h}{brief help message}
\option{-{}-help}{help message with option descriptions}
\option{-{}-man}{full documentation}
\option{-{}-association|-a}{perform the association test}
\option{-{}-s-localisation|-l}{perform the localisation test}
\option{-{}-first-input-file|-i \ucode{file}}{output file from phylogeny program}
\option{-{}-second-input-file|-j \ucode{file}}{nb cases/controls per haplotype}
\option{-{}-output-file|-o \ucode{file}}{output file}
\option{-{}-data-type|-t \ccode{DNA}|\ccode{SNP}}{type of data}
\option{-{}-data-qual|-q \hspace*{\fill}\ccode{qualitative|quantitative}}{data type: qualitative or quantitative}

\option{-{}-remove-outgroup  }{remove the outgroup
  sequence for the analysis}
\option{-{}-outgroup \ucode{outgroup\_name}}{specify the name of the
  outgroup sequence}

\option{-{}-anc-seq \ucode{ancestral\_sequence}}{ancestral sequence (only
  useful with \phylip)}
\option{-{}-tree-building-program|-p \hspace*{\fill}\ccode{PHYLIP}|\ccode{PAUP}|\ccode{PAML}}{phylip or paup or paml}
%\option{-{}-splitmode|-s \ccode{nosplit}|\ccode{chi2split}}{}
\option{-{}-no-prolongation}{no prolongation of branches}
\option{-{}-chi2-threshold|-n \ucode{value}}{threshold value}
\option{-{}-permutations|-r \ucode{number}}{number of permutations to perform}
\option{-{}-number-of-trees-to-analyse \ucode{number}}{total number of trees to analyse}
\option{-{}-tree-to-analyse \ucode{number}}{number of the tree to analyse}
\option{-{}-s-site-number \ucode{number}}{position of the $S$ character in the sequence}
\option{-{}-s-site-characters
  \hspace*{\fill}\ucode{anc\_state}\ccode{->}\ucode{der\_state}}{ancestral state -> derived state for $S$}
\option{-{}-co-evo|-e \ccode{simple}|\ccode{double}}{simple or double}
\option{-{}-print-tree}{print the tree with the character state changes in the output file}

\end{options}


\section{How to get help?}
See the same section for the program \rechaplo (page \pageref{help}).

\section{General options}
These options are used both for association and for localisation test.

\subsection{First input file (option -{}-first-input-file or -i)}
 This file is the output file of the phylogeny reconstruction
 program.  

\subsubsection{If \paup is used}
To run \newchitree, some informations must be present in the input
file for \newchitree (=output file of \paup). In particular, the
apomorphy list and a table contining branch lengths must be present
(though branch lengths are not taken into account in the analysis,
they are juste used to check if they are consistent with the apomorphy
list). For these information to be present, in the \cmd{describetrees}
command you must use the following options: \cmd{brlens=yes} and
\cmd{apolist=yes}.


Examples of \paup input files containing the options necessary to
run \newchitree are provided in the \code{test/paup} directory. These
files are labeled \fn{*.paup}.

\subsubsection{If \phylip is used}
The input file for \newchitree is the output file named ``outfile'' by
\phylip. Currently, \newchitree only works with output data from the program
\texttt{MIX} (0/1 data). We plan to adapt it to other reconstruction
program. 

To generate a correct input file for \newchitree, you must use different
options for \phylip depending on your rooting method:
\begin{itemize}
\item If you want to root the tree using an outgroup: you must root the tree on the chosen outgroup by using the option \cmd{o}.
\item If you want to root the tree using the ancestral character states: you have to prepare a file named \fn{ancestors} containing the ancestral sequence. Then, when running \phylip, you must use the option \cmd{a} (see the \phylip manual for more information).\\
  %To run \newchitree, the ancestral sequence must be present in the sample, so we advise you to root the tree using this ancestral sequence as outgroup by using the option \cmd{o}. \\
 % In this case, you will have to use the option ``-{}-anc-seq'' when running \newchitree.
\end{itemize}

Moreover, the states at all nodes of the tree must appear in the output file, so you must set the option \cmd{5} to \cmd{yes}.

\subsubsection{If \paml is used}
The input file for \newchitree is the output file named ``rst'' by
\paml.

\subsection{The trait input file (option -{}-second-input-file or -j)}
If you analyze case/control data, this input file consists in lines containing the label of each
haplotype followed by the number of cases and controls carrying it
separated by spaces or tabulations. The number of cases should be
preceded by a ``m``(or the word ``case'', possibly followed by a
``\_''), the number of controls should be preceded by the letter ``c''
(or the word ``control'', possibly followed by a ``\_'').\\
Example of such files are given in the test directory. These files are
always labeled \fn{nb\_cas\_control.txt}.

If your trait is quantitative, the file must contain haplotype labels followed by the quantitative  values measured for the individuals carrying these haplotypes. or homozygous individuals, quantitative values must be repeated twice.


\subsection{Output file (option -{}-output-file or -o)}
You can choose the name of the output file by using the -{}-output-file or -o option. If this option is not specified, the standard output is used. 

\subsection{Name of the phylogeny program used (option -{}-tree-building-program or  -p )}
After the option -p, you must specify which phylogeny reconstruction
program (\paup, \phylip or \paml) was used to generate the first input file.

\subsection{Data type: sequence (option -{}-data-type or -t)}
The option -t must be followed either by \cmd{SNP} or by \cmd{DNA}. \cmd{SNP}
should be used if you have numerical data (from 0 to 9).
 \cmd{DNA} must be used if you have DNA data (A, T, G, C).
Warning: the DNA option currently does not work if you have
reconstructed the phylogeny with phylip.

\subsection{Data type: trait (option -{}-data-qual or -q)}
The software can deal with qualitative data (case/control) or quantitative data. The -q (or ­{}-data-qual) option must be followed by either qualitative or quantitative, depending on your data.

\subsection{Print tree (option -{}-print-tree)}
If this option is specified, the tree with the character state changes
along the branches will be written in the output file. It may
especially be useful when you are performing the localisation
analysis, because in this case, the tree is not written in the output
file by default.

\textit{Warning: if several trees are analysed, with the -{}-print-tree option,
they will \emph{all} be printed in the output file.}



\section{Association test (option  -{}-association or -a)}
When the -a option is used, the program will perform the phylogeny-based association test. 
 
\subsection{Options specific to the association test}

%\subsubsection{Root method (-{}-root-method)}
%To perform the association test, the tree must be rooted. Depending on your data, you may want to root either on an ancetral sequence (-{}-root-method ancestor) or on an outgroup (-{}-root-method outgroup).

%\begin{center}
%%\begin{boxedminipage}[width=0.5\linewidth]
%\includegraphics[width=0.45\linewidth]{anc_outg.fig}
%%\end{boxedminipage}
%\end{center}

%\subsubsection{Name of the root (-{}-root)}
%This option must be followed by the name of the sequence you choose to root the tree (either the outgroup or the ancestor).
\subsubsection{Removing the outgroup (option -{}-remove-outgroup)}
The outgroup may either be a sequence of the sample for which the
number of cases and controls carrying it is defined or a sequence for
which we don't have any cases or controls (for example, an ape
sequence). In this last case, the outgroup must be removed from the
sample before the analysis. It is possible by specifying the option
-{}-remove outgroup.

\subsubsection{Name of the outgroup (option -{}-outgroup)}
This option will be useful in two cases:
\begin{itemize}
\item If you work on an unrooted tree (with \paml or \paup): for the
  association test, the tree \emph{must be rooted} because the
  analysis starts from the root. You must then specify the name of the
  sequence you choose as outgroup after the option -{}-outgroup and
  \newchitree will perform the rooting.
\item If you want to remove an outgroup from the analysis: if you work
  with \phylip, you will have to specify the name of the outgroup
  which should be removed after the option -{}-outgroup. This is not necessary
  with \paup because the outgroup is identified by a star in the paup
  output file, so \newchitree can find it.
\end{itemize}

\subsubsection{Number of permutations (option -{}-permutations or -r)}
The program can compute a type I error corrected for multiple testing
associated with the test by using a permutation procedure such as the
one described in~\citet{Ge03} and in~\citet{Becker04}. In this case,
the user must define the number of permutations to perform to evaluate
the type I error by using the -{}-permutation (or -r) option. This
number should be high, but the higher it is, the longer the
computation time will be. Depending on the studied data sets, we
suggest this number to be chosen between 10000 and 100000.

\subsubsection{Threshold for chi-square significance (option chi2-threshold or -n)}
If you do not want to compute the exact type I error by permutation, a
significance threshold for the \chisquares can be chosen by the user
using the -{}-chi2-threshold (or -n) option. In this case, you must
put the -{}-permutation option to zero.
 
\subsubsection{Branch prolongation (option -{}-no-prolongation)}
If the -{}-no-prolongation option is specified in the command line, the different
branches of the tree will not be prolonged. (see
figure~\ref{fig:option_b}). 


\begin{figure}[htb]
\begin{tabular}{|l|c|c|}
  \cline{2-3}
\multicolumn{1}{c|}{}& \includegraphics[width=0.4\linewidth, subfig=1]{option_b.fig} &
\includegraphics[width=0.4\linewidth, subfig=2]{option_b.fig} \\
\cline{2-3}
\multicolumn{1}{c|}{}& With the -{}-no-prolongation option & Without the -{}-no-prolongation option \\
\cline{2-3}
\multicolumn{1}{c|}{}&\multicolumn{2}{|c|}{The \chisquares are calculated between\footnote{The
    nosplit pattern of \chisquare is used}:} \\
\hline
  Level 1:& 1 - 2 and 3 & 1 2 and 3 \\
  Level 2:& 2.1 - 2.2 - 3.1 - 3.2 & 1 - 2.1 - 2.2 - 3.1 and 3.2 \\
  Level 3:& 3.2.1 and 3.2.2 & 1 - 2.1 - 2.2 - 3.1 - 3.2.1 and 3.2.2\\
  \hline
\end{tabular}

\caption{Effect of the -b option}
\label{fig:option_b}
\end{figure}

\textit{Warning: This option is currently  under development. At present, the
  program has only been tested \emph{without} the
  \fn{-{}-no-prolongation} option specified.
If you choose not to, you may encounter some problems.}


\subsubsection{Ancestral sequence (option -{}-anc-seq)}
This option is only necessary when the tree is rooted using an
ancestral sequencce with \phylip. In this case, the ancestral sequence
not being in the output file of \phylip, \newchitree cannot read it
directly. So, you have to enter it manually after the -{}-anc-seq
option.

\subsubsection{Choice of the tree that will be analysed (option
  -{}-tree-to-analyse)}
This option enables the user to specify the number of the tree that
will be analysed among all the equiparsimonious trees present in the
input file (the  -{}-tree-to-analyse must be followed by the number of
the chosen tree in the input file). If this option is not specified,
the tree will be randomly drawn among all the equiparsimonious trees.

\subsection{Description of the output file}
Examples of output files are displayed in the test directory. They are
labelled *.asso.

The output file shows the tree, with the number of cases an controls at each nodes. At the root of the tree, there is a list of the different tests performed on the tree: the level of the test is indicated within square brackets, followed by the number of degrees of freedom  (df=), the value of the \chisquare test and the corresponding p-value. In a second part of the file, a list of the p-values estimated by permutations (but non corrected for multiple testing) for each level of the tree is provided. Then, the last line gives the corrected p-value for the test.


\section{Localisation test (option -{}-s-localisation or -l)}

\subsection{Options specific to the localisation}
\subsubsection{Number of trees (option -{}-number-of-trees-to-analyse)}
With this option, you choose the number of trees to
use in the localisation test. These trees are randomly sampled without
replacement among all the equiparsimonious trees in the first input file. 

\subsubsection{-{}-s-site-number }
With this option, you specify the position of the character $S$ in the haplotypes. The first site is numbered 1.  

\subsubsection{ -{}-s-site-characters ancestral state -> derived state}
With this option, you specify which state is the ancestral state and
which state is the derived state for the character $S$. The two states
must be separated by the symbol ``->''. For example, if the character $S$ has two states 1 and 2, 1 being the ancestral state, you will use the option as follows: \\
\newchitree [other options ] -{}-s-site-characters ``1->2''\\
Be careful: this option is \emph{case sensitive} and the \emph{quotes
  are mandatory}.

\subsubsection{ -{}-co-evo|e simple|double}
This option enables the user to choose how the $V_{i}$ are calculated. 

\paragraph{option ''simple''}
This option corresponds to the calculation of $V_{i}$ described in \citet{Bardel05}. Please refer to this publication for more information.


\paragraph{option ''double''} 
This option corresponds to a new method to calculate $V_{i}$. This method seems to be more appropriate because it takes into account the two senses of character state changes. \\
Here is a short description of this new calculation method (one  studied tree):
\begin{itemize}
\item Let $E^{0 \rightarrow 1}_{i}$ be the number of expected co-mutations of $S$ (2 character states: T [control] and M [case]) and $i$ (2 character states 0 and 1)
  $$E^{0 \rightarrow 1}_{i}=\frac{(m^{0 \rightarrow 1}_{i}\times
    s^{T \rightarrow M})+(m^{1 \rightarrow 0}_{i}\times
    s^{M \rightarrow T})}{b}$$  \\
  where:
  \begin{description}
  \item[$m^{0 \rightarrow 1}_{i}$ (resp. $m^{1 \rightarrow 0}_{i}$)~:]
    nb transitions $0 \rightarrow 1$ (resp. $1 \rightarrow 0$) of $i$
  \item[$s^{T \rightarrow M}$ (resp.$ s^{M \rightarrow T}$)~:] nb
    transitions $T \rightarrow M$ (resp. $M \rightarrow T$) of $S$
  \item[$b$~:] nb branches of tree $t$
  \end{description}
\item Let $R^{0 \rightarrow 1}_{i}$ be the number of observed co-mutations of $S$ and $i$ on tree $t$
\item $V^{0 \rightarrow 1}_{i}$ is calculated as defined in \cite{Bardel05}:
\end{itemize}

$$\boxed{
  \left\{\begin{array}{ll}
      V^{0 \rightarrow 1}_{i}=0 & if\ E^{0 \rightarrow 1}_{i}=0 \\
      V^{0 \rightarrow 1}_{i}=\frac{\displaystyle{R^{0 \rightarrow 1}_{i}-E^{0 \rightarrow 1}_{i}}}%
      {\displaystyle{\sqrt{E^{0 \rightarrow 1}_{i}}}}
      & if \ E^{0 \rightarrow 1}_{i} \ne 0
    \end{array}
  \right.
}$$

If more than one tree is studied, the $V^{0 \rightarrow 1}_{i}$ must be summed for all the trees.

\subsection{Description of the output file}
The output file contains only a list of the different $V_i$ (in
ascending order) for the different sites and the different character
state transitions. The sites with the highest $V_i$ are putative
susceptibility sites.


\chapter{Example files}

The  \fn{test} directory contains example files for the three phylogeny
reconstruction programs. The files are grouped  in four directories:
\begin{itemize}
\item \fn{create\_file} which contains files and instructions necessary to
  obtain \paup or \paml/\phylip file formats from output files of the
haplotype reconstruction program. 
\item \fn{\paup}, \fn{\phylip} and \fn{\paml} which contain files and
  instructions necessary to perfom association and localisation tests  
\end{itemize}

In each directory, all the input and output files for all the programs
and a bash script containing the different command lines are provided.
 % TODO Ajouter le changement des chemins!! 

\section{Obtention of input files for phylogeny reconstruction
  programs}

The \fn{create\_file} directory is divided into 2 sub-directories:
\fn{paup\_file} and \fn{phy-paml\_file}. In these directories, we
present how to obtain input files for \paup and \phylip (or \paml)
from output files of the haplotype reconstruction programs \phase
and \famhap.

\subsection{Creating \paup input files from \phase output file}
The \fn{paup\_file} directory contains case/control data (12 SNPs
genotyped for 100 case and 100 control individuals). The haplotypes
are reconstructed using \phase and the \paup input file is generated
using \rechaplo. The different files available in this directory are
the following:
\begin{description}
\item [caco.phase~:] an input file for \phase containing the disease
  status for each individual
\item [caco.phase.out~:] the main \phase output file. It is used
  as the input file for \rechaplo
\item [caco.phase.out\_*~:] other \phase output files. They are not
  useful to run \altree
\item [caco.prepaup~:] the main \rechaplo output file. It must be
  completed to become a valid \paup input file
\item [nb\_cas\_control.txt~:] the \rechaplo output file containing the
  number of cases and controls carrying each haplotype
\item [create\_file~:] a bash script containing the two command lines to
  run respectively \phase and \rechaplo
\end{description}
\begin{figure}[htb]
  \includegraphics[width=\linewidth]{create_file_paup.fig}\centering  
  \caption{Summary of the files and programs used to obtain input
    files for \paup}
  \label{fig:create_paup}
\end{figure}


\subsection{Creating \phylip/\paml input files from \famhap output files}
The \fn{phy-paml\_file} directory contains family data (10 SNPs
genotyped for 100 trios: 2 parents + 1 affected child). The haplotypes
are reconstructed using \famhap and the \phylip/\paml input file is
generated using \rechaplo. The different files available in this
directory are the following:
\begin{description}
\item [fam19\_0~:] an input file for \famhap (linkage format without headers)
\item [trio.fmh and fam19\_0\_H1\_HAPLOTYPES~:] the two \famhap output
  files used by \rechaplo
\item [fam19\_0\_*~:] all other \famhap output files. They are not
  useful to run \altree
\item [trio.phy~:] the main \rechaplo output file. It is an input file
  for \phylip
\item [nb\_cas\_control.txt~:] the \rechaplo output file containing the
  number of cases and controls carrying each haplotype
\item [create\_file~:] a bash script containing the two command lines to
  run respectively \famhap and \rechaplo 
\end{description}
% These example files correspond to two
%situations:
%\begin{itemize}
%\item case/control data (100 case and 100 control individuals): they are analysed using \paup
%\item family data (100 trios: 2 parents + 1 affected child): they are analysed using \phylip or \paml 
%\end{itemize}

\begin{figure}[htb]
  \includegraphics[width=0.9\linewidth]{create_file_phy.fig}\centering  
  \caption{Summary of the files and programs used to obtain input
    files for \phylip or \paml}
  \label{fig:create_phy}
\end{figure}


\section{Analysing \paup files}
In the \fn{``test/paup/''} directory, six sub-directories can be found,
each corresponding to a different way to root (or not) the tree using
\paup:
\begin{itemize}
\item \fn{ancestor\_absent}: In this directory, the tree is
  rooted using an ancestral sequence which is not in the data set (it can be
  a consensus sequence for example)
\item \fn{ancestor\_present}: In this directory, the tree is
  rooted using an ancestral sequence which is in the data set (it can
  be the most frequent haplotype in the sample for example)
\item \fn{outgr\_absent}: In this directory, the tree is
  rooted using an outgroup which is not carried by case or control
  individuals (it can be an ape sequence for example)
\item \fn{outgr\_present}: In this directory, the tree is
  rooted using an outgroup which is in the data set
\item \fn{unrooted\_absent}: In this directory, the tree is
  not rooted with \paup. For the analysis, \newchitree roots the tree
  using an outgroup (we choose the sequence H000), but \emph{do not} take the
  outgroup into account for the association test 
\item \fn{unrooted\_present}: In this directory, the tree is
  not rooted with \paup. For the analysis, \newchitree roots the tree
  using an outgroup (we choose the sequence H000), and this haplotype
  \emph{is} taken into account for the association test
\end{itemize}

All these directories are split in two sub-directories containing the
files used to perform the association test (directory
\fn{association}) or the localisation test (directory \fn{localisation}) 

\emph{Warning: For the localisation test, as the rooting is not necessary,
the question of the presence or not of an outgroup is irrelevant
put the -{}-permutation to zero(directories unrooted\_absent and unrooted\_present). The
two localisation sub-directories thus only correspond to two different data
sets analysed with \altree.}

\subsection{Association test}
All the association directories contain the same files:
\begin{description}
\item [caco.paup~:] the valid \paup file
\item [nb\_cas\_control.txt~:] the file containing the number of time
  each haplotype is carried by case and control individuals
\item [test.res.log~:] the \paup output file which is used as an
  \newchitree input file
\item [test.tree:~] the other \paup output file, which is not useful
  for \newchitree
\item [1\_caco.asso:~] the \newchitree output file. The number of
  permutation being limited to 1, the corrected p-value doesn't mean
  anything!
\item [run\_altree:~] a bash script containing the two command lines to
  run respectively \paup and \newchitree (association test)
\end{description}

\begin{figure}[htb]
  \includegraphics[width=0.95\linewidth]{association_paup.fig}\centering  
  \caption{Summary of the different files and programs  used for the
    association test (using \paup)}
  \label{fig:paup_asso}
\end{figure}


\subsection{Localisation test}
All the localisation directories contain the same files:
\begin{description}
\item [caco.paup:~]  the valid \paup file
\item [nb\_cas\_control.txt~:] the file containing the number of time
  each haplotype is carried by case and control individuals
\item [et\_caco.paup:~] the output file of \etHT. It is a valid \paup
  input file in which the character $S$ has been added
 \item [test.res.log~:] the \paup output file which is used as an
  \newchitree input file
\item [test.tree:~] the other \paup output file, which is not useful
  for \newchitree
\item [caco.loc:~] the \newchitree output file, result of the
  localisation test
\item [run-prog:~] a bash script containing the three command lines to
  run respectively \etHT, \paup and then \newchitree (localisation test)
\end{description}

\begin{figure}[htb]
  \includegraphics[width=\linewidth]{localisation_paup.fig}\centering  
  \caption{Summary of the different files and programs  used for the
    localisation test (using \paup)}
  \label{fig:paup_loc}
\end{figure}

\section{Analysing \phylip files}
In the \fn{\phylip} directory, four sub-directories can be found,
corresponding to various rooting methods. These directories are
similar to the ones described for \paup. They contains only one
sub-directory named \fn{association}. For the moment, \altree cannot
deal with \phylip files as input files for the localisation test
because when there are  ambiguities in the apomorphie reconstructions,
\phylip keeps them in the output file and the state ``?'' is assigned
to the ambiguous character. At present, \altree cannot deal with
these ambiguities.


\subsection{Association test}
All the association directories contain almost the same files:
\begin{description}
\item [trio.phy:~] the \phylip input file 
\item [nb\_cas\_controls.txt:~] it contains the number of time
  each haplotype is carried by case and control individuals
\item [outfile:~]  the \phylip output file which is used as an
  \newchitree input file
  \item [outtre:~] the other \phylip output file, which is not useful
  for \newchitree
  \item [1\_trio\_phy.asso:~] the \newchitree output file, result of the
    localisation test
\item [run-altree:~] a bash script containing the two command lines to
  run respectively \phylip and  \newchitree (association test)
\item [ancestors:~] it contains the ancestral sequence. This file is
  needed only if the tree is rooted using an ancestral sequence (\fn{ancestor\_absent} and \fn{ancestor\_present} directories)
\end{description}

\begin{figure}[htb]
  \centering  
  \includegraphics[width=0.9\linewidth]{association_phylip.fig}  
  \caption{Summary of the different files and programs  used for the
    association test (using \phylip)}
  \label{fig:phylip_asso}
\end{figure}


\section{Analysing \paml files}

In the directory \fn{\paml}, three sub-directories can be found:
\begin{description}
\item [tree\_building\_using\_phyML:~]   as stated by its author, \paml is not a very good tool for tree
  reconstruction. In this example, we choose to reconstruct the
  phylogenetic tree using the software \phyml~\citep{Guindon03}. The
  phylogenetic reconstruction step has been performed in this directory
\item[\fn{unrooted\_absent} and \fn{unrooted\_present}:~] which are
  similar to ones described for \paup.  
\end{description}

\subsection{Phylogenetic tree reconstruction using \phyml}
The files necessary for the phylogenetic reconstruction can be found
in the directory \fn{tree\_building\_using\_phyML}. The input file for
\phyml is the phylip format file named \fn{trio2.phy}. The options
used to run \phyml are specified in the file \fn{run\_phyml}. The
other files in the directory are \phyml output files. In the
following, we will only use the file \fn{trio2.phy\_phyml\_tree.txt}
which contains the reconstructed phylogenetic tree.

\subsection{Association test}
The two \fn{association} directories contain the same files:
\begin{description}
\item [trio2.phy:~] the \phylip format file containing the
  sequences. It is used as an input file for \paml
\item [nb\_cas\_controls.txt:~] it contains the number of time
  each haplotype is carried by case and control individuals
\item [trio2.phy\_phyml\_tree.txt:~] the output file of \phyml. It
  is also used as an input file for \paml
\item [baseml.ctl:~] the parameter file used by \paml
\item [rst:~] the \paml output file which will be used by
  \newchitree. It contains the apomorphy list and the tree structure
\item[2base.t, lnf, mlb, rst1 and rub:~]  all the other \paml
  output files. They are not useful for \newchitree
\item [1\_trio\_ML.asso:~] the \newchitree output file, result of the
    association test 
\item [run\_altree:~] a bash script containing the two command lines to
  run respectively \paml and  \newchitree (association test)
\end{description}

\begin{figure}[htb]
  \includegraphics[width=0.9\linewidth]{association_paml.fig}\centering  
  \caption{Summary of the different files and programs  used for the
    association test (using \paml)}
  \label{fig:paml_asso}
\end{figure}


\subsection{Localisation test}
With \paml, only unrooted trees are obtained. These unrooted trees can
be directly analysed with \newchitree, so the question of the presence
or absence of an outgroup is irrelevant. Only one localisation
directory exists, it is located in the directory \fn{unrooted\_present}. 

The \fn{localisation} directory contains the following files:
\begin{description}
\item[trio2.phy:~] the \phylip format file without the character $S$
\item [et\_trio2.phy:~] the \phylip format file including the character
  $S$. It is one of the input file for \paml
\item [nb\_cas\_controls.txt:~] contains the number of time
  each haplotype is carried by case and control individuals
\item [trio2.phy\_phyml\_tree.txt:~] the output file of \phyml (tree
  reconstructed without taking the character $S$ into account). It
  is also an input file for \paml
\item [baseml.ctl:~] the parameter file used by \paml
\item [rst:~] the \paml output file which will be used by
  \newchitree. It contains the apomorphy list and the tree structure
\item[2base.t, lnf, mlb, rst1 and rub:~]  all the other \paml
  output files. They are not useful for \newchitree
\item [trio2.loc:~] the \newchitree output file, result of the
  localisation test
\item [run-prog:~] a bash script containing the three command lines to
  run respectively \etHT, \paml and  \newchitree (localisation test) 
\end{description}

\begin{figure}[htb]
  \includegraphics[width=\linewidth]{localisation_paml.fig}\centering  
  \caption{Summary of the different files and programs  used for the
    localisation test (using \paml)}
  \label{fig:paml_loc}
\end{figure}

\chapter{URLs where programs can be downloaded}
\section{Haplotype reconstruction programs}
\famhap \url{http://www.uni-bonn.de/%7Eumt70e/becker.html}

\phase \url{http://www.stat.washington.edu/stephens/software.html}

\section{Phylogeny reconstruction programs}
\paup  \url{http://paup.csit.fsu.edu/}

\phylip \url{http://evolution.genetics.washington.edu/phylip.html}

\paml  \url{http://abacus.gene.ucl.ac.uk/software/paml.html}

\phyml \url{http://atgc.lirmm.fr/phyml/}

\bibliographystyle{plainnat}
\bibliography{stage}

\end{document}
\annexe 
\chapter{GNU GENERAL PUBLIC LICENSE}
\label{GPL}
\begin{center}
  {\Large GNU GENERAL PUBLIC LICENSE} \\
  Version 2, June 1991                         
\end{center}
Copyright (C) 1989, 1991 Free Software Foundation, Inc. \\
59 Temple Place, Suite 330, Boston, MA  02111-1307  USA \\
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

\section{Preamble}

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

\section{GNU GENERAL PUBLIC LICENSE}
\subsection{TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION}

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

\newpage

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
\newpage
  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
\newpage
  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

\section{NO WARRANTY}

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) year  name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.

\end{document}

% LocalWords:  outgroup paup
