[med-svn] [populations] 01/13: Import Upstream version 1.2.32
Andreas Tille
tille at debian.org
Sat Nov 18 21:01:23 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository populations.
commit 5c82c63c20306f283d85f2aec8a2465ab453be88
Author: Andreas Tille <tille at debian.org>
Date: Fri Nov 17 21:45:49 2017 +0100
Import Upstream version 1.2.32
---
.cproject | 63 +
CMakeLists.txt | 158 ++
COPYING | 340 +++
ChangeLog | 0
INSTALL | 167 ++
README | 0
debian.orig/changelog | 42 +
debian.orig/compat | 1 +
debian.orig/control | 16 +
debian.orig/copyright | 13 +
debian.orig/rules | 91 +
html/formules/cavali_sforza.xhtml | 86 +
html/formules/das.xhtml | 227 ++
html/formules/latter_fst.xhtml | 70 +
html/formules/nei_da.xhtml | 77 +
html/formules/nei_dm.xhtml | 67 +
html/formules/nei_ds.xhtml | 66 +
html/formules/prevosti.xhtml | 68 +
html/formules/reynold_dru.xhtml | 784 +++++++
html/formules/reynold_drw.xhtml | 306 +++
html/formules/reynold_general.mml | 86 +
html/formules/reynold_least_square.xhtml | 480 ++++
html/formules/roger.xhtml | 79 +
html/index.html | 284 +++
html/libcss/main.css | 50 +
html/libcss/mathematica.css | 39 +
html/libjs/entity.js | 1529 +++++++++++++
html/libjs/viewmath.js | 161 ++
html/math/math1.mml | 36 +
html/math/math1.odf | Bin 0 -> 5279 bytes
html/old/formules/das.xhtml | 230 ++
html/old/formules/das_a.mml | 29 +
html/old/formules/das_b.mml | 30 +
html/old/formules/das_c.mml | 59 +
html/old/formules/formules.html | 132 ++
html/old/formules/img1.gif | Bin 0 -> 648 bytes
html/old/formules/img1.png | Bin 0 -> 225 bytes
html/old/formules/img10.gif | Bin 0 -> 292 bytes
html/old/formules/img10.png | Bin 0 -> 1085 bytes
html/old/formules/img11.gif | Bin 0 -> 287 bytes
html/old/formules/img11.png | Bin 0 -> 357 bytes
html/old/formules/img12.gif | Bin 0 -> 287 bytes
html/old/formules/img12.png | Bin 0 -> 355 bytes
html/old/formules/img13.gif | Bin 0 -> 676 bytes
html/old/formules/img13.png | Bin 0 -> 353 bytes
html/old/formules/img14.gif | Bin 0 -> 695 bytes
html/old/formules/img14.png | Bin 0 -> 915 bytes
html/old/formules/img15.gif | Bin 0 -> 161 bytes
html/old/formules/img15.png | Bin 0 -> 916 bytes
html/old/formules/img16.gif | Bin 0 -> 730 bytes
html/old/formules/img16.png | Bin 0 -> 232 bytes
html/old/formules/img17.gif | Bin 0 -> 981 bytes
html/old/formules/img17.png | Bin 0 -> 972 bytes
html/old/formules/img18.gif | Bin 0 -> 825 bytes
html/old/formules/img18.png | Bin 0 -> 1490 bytes
html/old/formules/img19.gif | Bin 0 -> 1305 bytes
html/old/formules/img19.png | Bin 0 -> 1079 bytes
html/old/formules/img2.gif | Bin 0 -> 650 bytes
html/old/formules/img2.png | Bin 0 -> 766 bytes
html/old/formules/img20.gif | Bin 0 -> 208 bytes
html/old/formules/img20.png | Bin 0 -> 2768 bytes
html/old/formules/img21.gif | Bin 0 -> 925 bytes
html/old/formules/img21.png | Bin 0 -> 286 bytes
html/old/formules/img22.gif | Bin 0 -> 188 bytes
html/old/formules/img22.png | Bin 0 -> 1207 bytes
html/old/formules/img23.gif | Bin 0 -> 1007 bytes
html/old/formules/img23.png | Bin 0 -> 258 bytes
html/old/formules/img24.gif | Bin 0 -> 522 bytes
html/old/formules/img24.png | Bin 0 -> 1218 bytes
html/old/formules/img25.gif | Bin 0 -> 514 bytes
html/old/formules/img25.png | Bin 0 -> 868 bytes
html/old/formules/img26.gif | Bin 0 -> 124 bytes
html/old/formules/img26.png | Bin 0 -> 730 bytes
html/old/formules/img27.gif | Bin 0 -> 840 bytes
html/old/formules/img27.png | Bin 0 -> 1024 bytes
html/old/formules/img28.gif | Bin 0 -> 1021 bytes
html/old/formules/img28.png | Bin 0 -> 748 bytes
html/old/formules/img29.gif | Bin 0 -> 809 bytes
html/old/formules/img29.png | Bin 0 -> 752 bytes
html/old/formules/img3.gif | Bin 0 -> 738 bytes
html/old/formules/img3.png | Bin 0 -> 773 bytes
html/old/formules/img30.gif | Bin 0 -> 982 bytes
html/old/formules/img30.png | Bin 0 -> 296 bytes
html/old/formules/img31.gif | Bin 0 -> 979 bytes
html/old/formules/img31.png | Bin 0 -> 849 bytes
html/old/formules/img32.gif | Bin 0 -> 1022 bytes
html/old/formules/img32.png | Bin 0 -> 490 bytes
html/old/formules/img33.gif | Bin 0 -> 208 bytes
html/old/formules/img33.png | Bin 0 -> 1113 bytes
html/old/formules/img34.gif | Bin 0 -> 201 bytes
html/old/formules/img34.png | Bin 0 -> 2638 bytes
html/old/formules/img35.gif | Bin 0 -> 226 bytes
html/old/formules/img35.png | Bin 0 -> 2119 bytes
html/old/formules/img36.gif | Bin 0 -> 216 bytes
html/old/formules/img36.png | Bin 0 -> 2398 bytes
html/old/formules/img37.gif | Bin 0 -> 784 bytes
html/old/formules/img37.png | Bin 0 -> 1169 bytes
html/old/formules/img38.gif | Bin 0 -> 1105 bytes
html/old/formules/img38.png | Bin 0 -> 1500 bytes
html/old/formules/img39.gif | Bin 0 -> 621 bytes
html/old/formules/img39.png | Bin 0 -> 583 bytes
html/old/formules/img4.gif | Bin 0 -> 205 bytes
html/old/formules/img4.png | Bin 0 -> 809 bytes
html/old/formules/img40.gif | Bin 0 -> 961 bytes
html/old/formules/img40.png | Bin 0 -> 619 bytes
html/old/formules/img41.gif | Bin 0 -> 949 bytes
html/old/formules/img41.png | Bin 0 -> 597 bytes
html/old/formules/img42.gif | Bin 0 -> 327 bytes
html/old/formules/img42.png | Bin 0 -> 285 bytes
html/old/formules/img43.gif | Bin 0 -> 253 bytes
html/old/formules/img43.png | Bin 0 -> 2171 bytes
html/old/formules/img44.png | Bin 0 -> 605 bytes
html/old/formules/img45.png | Bin 0 -> 613 bytes
html/old/formules/img46.png | Bin 0 -> 185 bytes
html/old/formules/img47.png | Bin 0 -> 1100 bytes
html/old/formules/img48.png | Bin 0 -> 1471 bytes
html/old/formules/img49.png | Bin 0 -> 1035 bytes
html/old/formules/img5.gif | Bin 0 -> 214 bytes
html/old/formules/img5.png | Bin 0 -> 279 bytes
html/old/formules/img50.png | Bin 0 -> 1350 bytes
html/old/formules/img51.png | Bin 0 -> 1323 bytes
html/old/formules/img52.png | Bin 0 -> 1421 bytes
html/old/formules/img53.png | Bin 0 -> 278 bytes
html/old/formules/img54.png | Bin 0 -> 271 bytes
html/old/formules/img55.png | Bin 0 -> 301 bytes
html/old/formules/img56.png | Bin 0 -> 290 bytes
html/old/formules/img57.png | Bin 0 -> 1047 bytes
html/old/formules/img58.png | Bin 0 -> 1233 bytes
html/old/formules/img59.png | Bin 0 -> 697 bytes
html/old/formules/img6.gif | Bin 0 -> 214 bytes
html/old/formules/img6.png | Bin 0 -> 282 bytes
html/old/formules/img60.png | Bin 0 -> 1103 bytes
html/old/formules/img61.png | Bin 0 -> 1089 bytes
html/old/formules/img62.png | Bin 0 -> 413 bytes
html/old/formules/img63.png | Bin 0 -> 334 bytes
html/old/formules/img7.gif | Bin 0 -> 499 bytes
html/old/formules/img7.png | Bin 0 -> 278 bytes
html/old/formules/img8.gif | Bin 0 -> 554 bytes
html/old/formules/img8.png | Bin 0 -> 531 bytes
html/old/formules/img9.gif | Bin 0 -> 814 bytes
html/old/formules/img9.png | Bin 0 -> 665 bytes
html/old/formules/index.html | 132 ++
html/old/formules/nei_dm.mml | 36 +
html/old/formules/nei_dm.xhtml | 67 +
html/old/formules/nei_ds.mml | 37 +
html/old/formules/nei_ds.xhtml | 66 +
html/old/formules/next_motif.gif | Bin 0 -> 172 bytes
html/old/formules/next_motif_gr.gif | Bin 0 -> 172 bytes
html/old/formules/node1.html | 138 ++
html/old/formules/node10.html | 86 +
html/old/formules/node11.html | 86 +
html/old/formules/node12.html | 142 ++
html/old/formules/node13.html | 180 ++
html/old/formules/node14.html | 82 +
html/old/formules/node15.html | 139 ++
html/old/formules/node16.html | 106 +
html/old/formules/node17.html | 83 +
html/old/formules/node18.html | 86 +
html/old/formules/node19.html | 106 +
html/old/formules/node2.html | 159 ++
html/old/formules/node20.html | 145 ++
html/old/formules/node21.html | 102 +
html/old/formules/node22.html | 73 +
html/old/formules/node3.html | 131 ++
html/old/formules/node4.html | 83 +
html/old/formules/node5.html | 83 +
html/old/formules/node6.html | 86 +
html/old/formules/node7.html | 83 +
html/old/formules/node8.html | 86 +
html/old/formules/node9.html | 83 +
html/old/formules/previous_motif.gif | Bin 0 -> 220 bytes
html/old/formules/previous_motif_gr.gif | Bin 0 -> 220 bytes
html/old/formules/up_motif.gif | Bin 0 -> 145 bytes
html/old/formules/up_motif_gr.gif | Bin 0 -> 145 bytes
html/old/index.php.html | 229 ++
html/old/index.php_fichiers/basdepage.css | 18 +
html/old/index.php_fichiers/bioinfo.css | 68 +
html/old/index.php_fichiers/menu.css | 132 ++
html/old/index.php_fichiers/pge.css | 141 ++
html/old/index.php_fichiers/valid-css.png | Bin 0 -> 1134 bytes
html/old/index.php_fichiers/valid-xhtml11.png | Bin 0 -> 1917 bytes
html/old/index_en.php.html | 354 +++
html/old/index_en.php_fichiers/basdepage.css | 18 +
html/old/index_en.php_fichiers/bioinfo.css | 68 +
html/old/index_en.php_fichiers/menu.css | 132 ++
html/old/index_en.php_fichiers/pge.css | 141 ++
html/old/index_en.php_fichiers/valid-css.png | Bin 0 -> 1134 bytes
html/old/index_en.php_fichiers/valid-xhtml11.png | Bin 0 -> 1917 bytes
src/CMakeLists.txt | 40 +
src/allele.cpp | 140 ++
src/allele.h | 88 +
src/applications.cpp | 448 ++++
src/applications.h | 78 +
src/applpop.cpp | 273 +++
src/applpop.h | 65 +
src/applpopulations.cpp | 1859 ++++++++++++++++
src/applpopulations.h | 109 +
src/arbre.cpp | 1866 ++++++++++++++++
src/arbre.h | 346 +++
src/arbreplus.cpp | 175 ++
src/arbreplus.h | 83 +
src/chaineficpop.cpp | 250 +++
src/chaineficpop.h | 86 +
src/config.h | 8 +
src/config.h.cmake | 8 +
src/couleur.cpp | 117 +
src/couleur.h | 96 +
src/distgnt.cpp | 2286 +++++++++++++++++++
src/distgnt.h | 177 ++
src/fstat.cpp | 131 ++
src/fstat.h | 61 +
src/individu.cpp | 415 ++++
src/individu.h | 107 +
src/internat.h | 52 +
src/jeupop.cpp | 1676 ++++++++++++++
src/jeupop.h | 229 ++
src/jeupopexp.cpp | 401 ++++
src/jeupopexp.h | 97 +
src/locus.cpp | 420 ++++
src/locus.h | 87 +
src/matrices.cpp | 2597 ++++++++++++++++++++++
src/matrices.h | 468 ++++
src/metapop.cpp | 373 ++++
src/metapop.h | 93 +
src/population.cpp | 231 ++
src/population.h | 66 +
src/populations | Bin 0 -> 610263 bytes
src/populations.cpp | 48 +
src/qtpop/qtpopulations.cpp | 24 +
src/strucpop.cpp | 443 ++++
src/strucpop.h | 222 ++
src/vecteurs.cpp | 497 +++++
src/vecteurs.h | 232 ++
233 files changed, 27421 insertions(+)
diff --git a/.cproject b/.cproject
new file mode 100644
index 0000000..1909180
--- /dev/null
+++ b/.cproject
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="converted.config.1281490292">
+<storageModule moduleId="scannerConfiguration">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="false" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="false"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="false" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="false"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="false" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="false"/>
+</scannerInfoProvider>
+</profile>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path=""/>
+<pathentry kind="out" path=""/>
+<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/>
+</storageModule>
+<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="converted.config.1281490292" moduleId="org.eclipse.cdt.core.settings" name="convertedConfig">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+</extensions>
+</storageModule>
+</cconfiguration>
+</storageModule>
+</cproject>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..77fd74a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,158 @@
+#http://www.cmake.org/Wiki/CMake:Packaging_With_CPack
+cmake_minimum_required(VERSION 2.6)
+PROJECT(populations CXX C)
+
+#cpack -G TGZ --config CPackSourceConfig.cmake
+# cpack -G TGZ --config CPackSourceConfig.cmake
+
+
+#.dput.cf
+#[olivier-langella]
+#fqdn = ppa.launchpad.net
+#method = ftp
+#incoming = ~olivier-langella/ppa/ubuntu/
+#login = olivier-langella
+#allow_unsigned_uploads = 0
+#
+# debuild -S -sa
+# dput -f olivier-langella *changes
+
+
+
+
+message ("compiler : ${CMAKE_BASE_NAME}")
+
+
+# cross compilation Win32 :
+#cd build_win32
+#export CC=/usr/bin/i586-mingw32msvc-gcc
+#export CXX=/usr/bin/i586-mingw32msvc-g++
+#INCLUDE(${populations_SOURCE_DIR}/win32/Toolchain-mingw32.cmake)
+#cmake -DCMAKE_TOOLCHAIN_FILE=../win32/Toolchain-mingw32.cmake ..
+
+#IF (MINGW32)
+# ADD_DEFINITIONS(-DCOMPILATION_MINGW32)
+# MESSAGE(coucou)
+# SET( CMAKE_BUILD_TYPE "Debug")
+# SET(CMAKE_CXX_FLAGS_DEBUG "-g")
+#ELSE (MINGW32)
+# SET( CMAKE_BUILD_TYPE "Release")
+#ENDIF(MINGW32)
+
+
+IF ( CMAKE_BASE_NAME MATCHES "cl")
+ message ("on est sous Windows")
+ SET( CMAKE_BUILD_TYPE "Release")
+ SET( WIN32 "windows")
+ELSE (CMAKE_BASE_NAME MATCHES "cl")
+ SET( CMAKE_BUILD_TYPE "Release")
+ #SET( CMAKE_BUILD_TYPE "Debug")
+ENDIF(CMAKE_BASE_NAME MATCHES "cl")
+
+IF ( CMAKE_BUILD_TYPE MATCHES "Release")
+ MESSAGE("compiling as release version")
+ ADD_DEFINITIONS("-DQT_NO_DEBUG_OUTPUT")
+ELSE ( CMAKE_BUILD_TYPE MATCHES "Release" )
+ MESSAGE("compiling as debug version")
+ENDIF( CMAKE_BUILD_TYPE MATCHES "Release" )
+
+
+#CMAKE_CXX_FLAGS
+#CMAKE_CXX_FLAGS_DEBUG -g
+#CMAKE_CXX_FLAGS_MINSIZEREL -Os -DNDEBUG
+#CMAKE_CXX_FLAGS_RELEASE -O3 -DNDEBUG
+#CMAKE_CXX_FLAGS_RELWITHDEBINFO -O2 -g
+
+
+SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
+SET(CPACK_GENERATOR "STGZ;TGZ;TZ")
+#SET(CPACK_INSTALL_CMAKE_PROJECTS "/tmp;Populations;src;/src")
+#SET(CPACK_NSIS_DISPLAY_NAME "CMake 2.5")
+SET(CPACK_OUTPUT_CONFIG_FILE "./CPackConfig.cmake")
+SET(CPACK_PACKAGE_DESCRIPTION_FILE ${populations_SOURCE_DIR}/COPYING)
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Populations is population genetic software")
+SET(CPACK_PACKAGE_EXECUTABLES "populations")
+SET(CPACK_PACKAGE_FILE_NAME "populations-1.2.32-Linux-i686")
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "populations 1.2.32")
+SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "populations 1.2.32")
+SET(CPACK_PACKAGE_NAME "populations")
+SET(CPACK_PACKAGE_VENDOR "CNRS")
+SET (POPULATIONS_VERSION "1.2.32")
+SET(CPACK_PACKAGE_VERSION ${POPULATIONS_VERSION})
+SET(CPACK_PACKAGE_VERSION_MAJOR "1")
+SET(CPACK_PACKAGE_VERSION_MINOR "2")
+SET(CPACK_PACKAGE_VERSION_PATCH "32")
+SET(CPACK_RESOURCE_FILE_LICENSE ${populations_SOURCE_DIR}/COPYING)
+SET(CPACK_RESOURCE_FILE_README ${populations_SOURCE_DIR}/README)
+SET(CPACK_RESOURCE_FILE_WELCOME ${populations_SOURCE_DIR}/INSTALL)
+SET(CPACK_RESOURCE_FILE_LICENSE ${populations_SOURCE_DIR}/ChangeLog)
+SET(CPACK_SOURCE_GENERATOR "TGZ;TZ")
+SET(CPACK_SOURCE_OUTPUT_CONFIG_FILE "./CPackSourceConfig.cmake")
+SET(CPACK_SOURCE_PACKAGE_FILE_NAME "populations-1.2.32")
+SET(CPACK_SOURCE_STRIP_FILES "")
+SET(CPACK_STRIP_FILES "bin/populations")
+SET(CPACK_SYSTEM_NAME "Linux-i686")
+SET(CPACK_TOPLEVEL_TAG "Linux-i686")
+
+
+SET(CPACK_SOURCE_IGNORE_FILES
+ "/devel_archives/"
+ "/figures/"
+ "/Soumis/"
+ "Makefile"
+ "install_manifest.txt"
+ "cmake_install.cmake"
+ "cmake_install.cmake"
+ "CMakeCache.txt"
+ "CPackConfig.cmake"
+ "CPackSourceConfig.cmake"
+ "install_manifest.txt"
+ "/CMakeFiles/"
+ "/_CPack_Packages/"
+ "/Debug/"
+ "/Release/"
+ "/\\\\.externalToolBuilders/"
+ "/\\\\.svn/"
+ "/\\\\.settings/"
+ "Makefile"
+ "\\\\.cdtbuild"
+ "\\\\.cdtproject"
+ "\\\\.project"
+ "/win32/"
+)
+# cpack -G TGZ --config CPackSourceConfig.cmake
+# dpkg-buildpackage -rfakeroot
+configure_file (${populations_SOURCE_DIR}/src/config.h.cmake ${populations_SOURCE_DIR}/src/config.h)
+
+#SET(CPACK_SOURCE_IGNORE_FILES "/CMakeFiles/;/_CPack_Packages/;/templates/;/debug/;/Debug/;/Release/;/\\\\.svn/;/\\\\.settings/;Makefile;\\\\.cdtbuild;\\\\.cdtproject;\\\\.project")
+# cpack -G TGZ --config CPackSourceConfig.cmake
+SET(CPACK_PACKAGE_EXECUTABLES "populations" "populations")
+
+
+SET(CPACK_STRIP_FILES "src/populations")
+
+
+
+# for debian package :
+SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Olivier Langella <olivier.langella at moulon.inra.fr>")
+SET(DEBIAN_PACKAGE_BUILDS_DEPENDS "Olivier Langella <olivier.langella at moulon.inra.fr>")
+
+
+
+INCLUDE(CPack)
+
+# The name of our project is "HELLO". CMakeLists files in this project can
+# refer to the root source directory of the project as ${HELLO_SOURCE_DIR} and
+# to the root binary directory of the project as ${HELLO_BINARY_DIR}.
+project (populations)
+
+# Recurse into the "Hello" and "Demo" subdirectories. This does not actually
+# cause another cmake executable to run. The same process will walk through
+# the project's entire directory structure.
+add_subdirectory (src)
+if (NOT CMAKE_INSTALL_PREFIX)
+ SET (CMAKE_INSTALL_PREFIX /usr/local)
+endif (NOT CMAKE_INSTALL_PREFIX)
+INSTALL(PROGRAMS src/populations DESTINATION bin)
+#INSTALL(DIRECTORY doc/man1 DESTINATION share/man/man1)
+#INSTALL(FILES doc/man1/beads.1 DESTINATION share/man/man1)
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..5b6e7c6
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ 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.
+
+ 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.
+
+ GNU GENERAL PUBLIC LICENSE
+ 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.)
+
+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.
+
+ 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.
+
+ 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.
+
+ 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.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..02a4a07
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,167 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes a while. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 4. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/README b/README
new file mode 100644
index 0000000..e69de29
diff --git a/debian.orig/changelog b/debian.orig/changelog
new file mode 100644
index 0000000..4d95be8
--- /dev/null
+++ b/debian.orig/changelog
@@ -0,0 +1,42 @@
+populations (1.2.32-2~maverick1) maverick; urgency=low
+
+ * maverick package
+
+ -- Olivier Langella <Olivier.Langella at moulon.inra.fr> Fri, 19 Feb 2010 10:18:51 +0200
+
+populations (1.2.32-2~lucid1) lucid; urgency=low
+
+ * lucid package
+
+ -- Olivier Langella <Olivier.Langella at moulon.inra.fr> Fri, 19 Feb 2010 10:18:51 +0200
+
+populations (1.2.32-2~karmic1) karmic; urgency=low
+
+ * qt 4.6 introduced for xmlstreamwriter
+ * fixed problems reading symetric matrix (Alan Meerow warning)
+
+ -- Olivier Langella <Olivier.Langella at moulon.inra.fr> Fri, 19 Feb 2010 10:18:51 +0200
+
+populations (1.2.31-1~karmic1) karmic; urgency=low
+
+ * repackaging for Ubuntu Karmic Koala
+
+ -- Olivier Langella <Olivier.Langella at moulon.inra.fr> Sun, 18 Sep 2009 10:18:51 +0200
+
+populations (1.2.31-1) unstable; urgency=low
+
+ * version number updated.
+
+ -- Olivier Langella <Olivier.Langella at moulon.inra.fr> Wed, 03 Feb 2009 11:18:51 +0200
+
+populations (1.2.30-1~hardy1) hardy; urgency=low
+
+ * hardy version
+
+ -- Olivier Langella <Olivier.Langella at moulon.inra.fr> Wed, 26 Nov 2008 11:18:51 +0200
+
+populations (1.2.30-1) unstable; urgency=low
+
+ * Initial release.
+
+ -- Olivier Langella <Olivier.Langella at moulon.inra.fr> Wed, 24 Oct 2001 11:18:51 +0200
diff --git a/debian.orig/compat b/debian.orig/compat
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/debian.orig/compat
@@ -0,0 +1 @@
+4
diff --git a/debian.orig/control b/debian.orig/control
new file mode 100644
index 0000000..f4f2408
--- /dev/null
+++ b/debian.orig/control
@@ -0,0 +1,16 @@
+Source: populations
+Section: science
+Priority: optional
+Maintainer: Olivier Langella <olivier.langella at moulon.inra.fr>
+XSBC-Original-Maintainer: Olivier Langella <olivier.langella at moulon.inra.fr>
+Standards-Version: 1.2
+Build-Depends: debhelper (>= 5), cmake (>= 2), libqt4-dev (>= 4.5.2)
+Homepage: http://bioinformatics.org/~tryphon/populations/
+
+
+Package: populations
+Architecture: any
+Depends: ${shlibs:Depends}, libqt4-xml (>= 4.5.2)
+Description: population genetic software
+ Populations is a population genetic software. It computes genetic distances between
+ populations or individuals. It builds phylogenetic trees (NJ or UPGMA) with bootstrap values.
diff --git a/debian.orig/copyright b/debian.orig/copyright
new file mode 100644
index 0000000..4a015a4
--- /dev/null
+++ b/debian.orig/copyright
@@ -0,0 +1,13 @@
+X-Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat
+X-Debianized-By: Olivier Langella <olivier.langella at moulon.inra.fr>
+X-Debianized-Date: Wed, 24 Oct 2001 11:18:51 +0200
+X-Source-Downloaded-From:
+X-Upstream-Author:
+
+Files: debian/*
+Copyright: © 2001 Olivier Langella <olivier.langella at moulon.inra.fr>
+License: GPL
+
+Files: *
+Copyright: © 2001 Olivier Langella <olivier.langella at moulon.inra.fr>
+License: GPL
diff --git a/debian.orig/rules b/debian.orig/rules
new file mode 100755
index 0000000..c12a304
--- /dev/null
+++ b/debian.orig/rules
@@ -0,0 +1,91 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+configure: configure-stamp
+configure-stamp:
+ cmake -DCMAKE_INSTALL_PREFIX=/usr .
+ dh_testdir
+ # Add here commands to configure the package.
+
+ touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ #docbook-to-man debian/populations.sgml > populations.1
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp CMakeCache.txt
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/populations.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/populations install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs ChangeLog
+ dh_installdocs
+ dh_installexamples
+# dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/html/formules/cavali_sforza.xhtml b/html/formules/cavali_sforza.xhtml
new file mode 100644
index 0000000..378dcdb
--- /dev/null
+++ b/html/formules/cavali_sforza.xhtml
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Cavalli-Sforza and Edwards, Dc (1967)</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Cavalli-Sforza and Edwards, Dc (1967)"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+Cavalli-Sforza and Edwards, Dc (1967)
+</h2>
+
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mi math:fontstyle="italic">Dc</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mn>2</math:mn>
+ <math:mrow>
+ <math:mo math:stretchy="false">Π</math:mo>
+ <math:mi>r</math:mi>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:mrow>
+ <math:munderover>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>j</math:mi>
+ <math:mi>r</math:mi>
+ </math:munderover>
+ <math:msqrt>
+ <math:mrow>
+ <math:mn>2</math:mn>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mrow>
+ <math:munderover>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>i</math:mi>
+ <math:msub>
+ <math:mi>m</math:mi>
+ <math:mi>j</math:mi>
+ </math:msub>
+ </math:munderover>
+ <math:msqrt>
+ <math:mrow>
+ <math:msub>
+ <math:mi>x</math:mi>
+ <math:mi math:fontstyle="italic">ij</math:mi>
+ </math:msub>
+ <math:msub>
+ <math:mi>y</math:mi>
+ <math:mi math:fontstyle="italic">ij</math:mi>
+ </math:msub>
+ </math:mrow>
+ </math:msqrt>
+ </math:mrow>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ </math:msqrt>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">Dc={2}over{{%PI}r} sum from{j} to{r} sqrt{2(1 - sum from i to m_j sqrt{x_ij y_ij} )} </math:annotation>
+ </math:semantics>
+</math:math>
+
+</body>
+</html>
diff --git a/html/formules/das.xhtml b/html/formules/das.xhtml
new file mode 100755
index 0000000..f9dbed3
--- /dev/null
+++ b/html/formules/das.xhtml
@@ -0,0 +1,227 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Shared allele distance (Chakraborty and Jin, 1993) [Jin, L. 93]</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Shared allele distance (Chakraborty and Jin, 1993) [Jin, L. 93]"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+Shared allele distance (Chakraborty and Jin, 1993) [<a
+ href="../index.html#pubdas">Jin, L. 93</a>]
+</h2>
+
+<div>
+between individuals:
+<br/>
+<!-- MATH
+ $D_{SA_{I}}=1-P_{SA_{I}}$
+ -->
+
+ <math mode="display" xmlns="&mathml;">
+ <semantics>
+ <mrow>
+ <msub>
+ <mi>D</mi>
+ <msub>
+ <mi>SA</mi>
+ <mi>I</mi>
+ </msub>
+ </msub>
+ <mo>=</mo>
+ <mrow>
+ <mn>1</mn>
+ <mo>−</mo>
+ <msub>
+ <mi>P</mi>
+ <msub>
+ <mi>SA</mi>
+ <mi>I</mi>
+ </msub>
+ </msub>
+ </mrow>
+
+ <!--
+ </mrow>
+ <annotation encoding="StarMath 5.0">D_{SA_{I}}=1-P_{SA_{I}}</annotation>
+
+<IMG
+ WIDTH="127" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img8.png"
+ ALT="\( D_{SA_{I}}=1-P_{SA_{I}} \)">
+ -->
+
+ , with
+
+ <msub>
+ <mi>P</mi>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>I</mi>
+ </msub>
+ </msub>
+ <mo stretchy="false">=</mo>
+ <mfrac>
+ <mrow>
+ <msubsup>
+ <mo stretchy="false">∑</mo>
+ <mi>j</mi>
+ <mi>r</mi>
+ </msubsup>
+ <mi>S</mi>
+ </mrow>
+ <mn>2r</mn>
+ </mfrac>
+ </mrow>
+ <annotation encoding="StarMath 5.0">P_{SA_{I}}={sum ^{r}_{j}S} over {2r}
+
+</annotation>
+ </semantics>
+</math>
+ <!--
+<IMG
+ WIDTH="98" HEIGHT="54" ALIGN="MIDDLE" BORDER="0"
+ SRC="img9.png"
+ ALT="\( P_{SA_{I}}=\frac{\sum ^{r}_{j}S}{2r} \)">
+-->
+<div>
+where the number of shared alleles S is sumed over all loci r.
+</div>
+<div>
+
+between populations:
+</div>
+<div>
+<math mode="display" xmlns="&mathml;" >
+ <semantics>
+ <mrow>
+ <msub>
+ <mi>D</mi>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>B</mi>
+ </msub>
+ </msub>
+ <mo stretchy="false">=</mo>
+ <mrow>
+ <mn>1</mn>
+ <mo stretchy="false">−</mo>
+ <mfrac>
+ <mrow>
+ <mn>2</mn>
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>B</mi>
+ </msub>
+ </msub>
+ </mrow>
+ <mrow>
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>X</mi>
+ </msub>
+ </msub>
+ <mo stretchy="false">+</mo>
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>Y</mi>
+ </msub>
+ </msub>
+ </mrow>
+ </mfrac>
+ </mrow>
+ </mrow>
+ <annotation encoding="StarMath 5.0">D_{SA_{B}}=1-{2{bar{P}}_{SA_{B}}}over{{bar{P}}_{SA_{X}}+{bar{P}}_{SA_{Y}}}</annotation>
+ </semantics>
+</math>
+ <!--
+<IMG
+ WIDTH="194" HEIGHT="48" BORDER="0"
+ SRC="img10.png"
+ ALT="\begin{displaymath}
+D_{SA_{B}}=1-\frac{2\overline{P}_{SA_{B}}}{\overline{P}_{SA_{X}}+\overline{P}_{SA_{Y}}}\end{displaymath}"/>
+</DIV>
+<br/>
+<P></P>
+-->
+</div>
+<div>
+where the average proportion of shared alleles between and within
+populations X and Y (
+<math xmlns="&mathml;">
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>B</mi>
+ </msub>
+ </msub>
+ </math>
+ ,
+ <math xmlns="&mathml;" class="inclus">
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>X</mi>
+ </msub>
+ </msub>
+ </math>
+ ,
+ <math class="inclus" xmlns="&mathml;">
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>Y</mi>
+ </msub>
+ </msub>
+ </math>
+ <!--
+<IMG
+ WIDTH="45" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
+ SRC="img13.png"
+ ALT="\( \overline{P}_{SA_{Y}} \)"/>
+ -->
+respectively) is computed overall possible combinations of individuals
+sampled.
+
+</div>
+</div>
+</body>
+</html>
diff --git a/html/formules/latter_fst.xhtml b/html/formules/latter_fst.xhtml
new file mode 100644
index 0000000..a31f076
--- /dev/null
+++ b/html/formules/latter_fst.xhtml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Latter's (1972) Fst (=ɸ*) distance</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Latter's (1972) Fst (=ɸ*) distance"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+Latter's (1972) Fst (=ɸ*) distance
+</h2>
+
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mi math:fontstyle="italic">Fst</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mfrac>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:msub>
+ <math:mi>J</math:mi>
+ <math:mi>X</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mi>J</math:mi>
+ <math:mi>Y</math:mi>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mn>2</math:mn>
+ </math:mfrac>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:msub>
+ <math:mi>J</math:mi>
+ <math:mi math:fontstyle="italic">XY</math:mi>
+ </math:msub>
+ </math:mrow>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:msub>
+ <math:mi>J</math:mi>
+ <math:mi math:fontstyle="italic">XY</math:mi>
+ </math:msub>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">Fst = {{(J_X + J_Y)} over 2 - J_XY} over {1 - J_XY}</math:annotation>
+ </math:semantics>
+</math:math>
+
+</body>
+</html>
diff --git a/html/formules/nei_da.xhtml b/html/formules/nei_da.xhtml
new file mode 100644
index 0000000..8147735
--- /dev/null
+++ b/html/formules/nei_da.xhtml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Nei et al's (1983)</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Nei et al's (1983)"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+Nei et al's (1983) D<sub>A</sub> distance
+</h2>
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mi>D</math:mi>
+ <math:mi>A</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mfrac>
+ <math:mn>1</math:mn>
+ <math:mi>r</math:mi>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:munderover>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>j</math:mi>
+ <math:mi>r</math:mi>
+ </math:munderover>
+ <math:mrow>
+ <math:munderover>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>i</math:mi>
+ <math:msub>
+ <math:mi>m</math:mi>
+ <math:mi>j</math:mi>
+ </math:msub>
+ </math:munderover>
+ <math:msqrt>
+ <math:mrow>
+ <math:msub>
+ <math:mi>x</math:mi>
+ <math:mi math:fontstyle="italic">ij</math:mi>
+ </math:msub>
+ <math:msub>
+ <math:mi>y</math:mi>
+ <math:mi math:fontstyle="italic">ij</math:mi>
+ </math:msub>
+ </math:mrow>
+ </math:msqrt>
+ </math:mrow>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">D_A = 1 - {1} over {r} sum from j to r sum from i to m_j sqrt{x_ij y_ij} </math:annotation>
+ </math:semantics>
+</math:math>
+
+
+</body>
+</html>
diff --git a/html/formules/nei_dm.xhtml b/html/formules/nei_dm.xhtml
new file mode 100755
index 0000000..fde61c7
--- /dev/null
+++ b/html/formules/nei_dm.xhtml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+ Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]
+</h2>
+
+<div>
+
+<math mode="display" xmlns="&mathml;">
+ <semantics>
+ <mrow>
+ <msub>
+ <mi>D</mi>
+ <mi>m</mi>
+ </msub>
+ <mo >=</mo>
+ <mrow>
+ <mfrac>
+ <mrow>
+ <mfenced open="(" close=")">
+ <mrow>
+ <msub>
+ <mi>J</mi>
+ <mi>X</mi>
+ </msub>
+ <mo>+</mo>
+ <msub>
+ <mi>J</mi>
+ <mi>Y</mi>
+ </msub>
+ </mrow>
+ </mfenced>
+ </mrow>
+ <mn>2</mn>
+ </mfrac>
+ <mo>-</mo>
+ <msub>
+ <mi>J</mi>
+ <mi >XY</mi>
+ </msub>
+ </mrow>
+ </mrow>
+ <annotation encoding="StarMath 5.0">Dm=(J_X + J_Y)over 2 - J_XY</annotation>
+ </semantics>
+
+</math>
+
+</div>
+</body>
+</html>
diff --git a/html/formules/nei_ds.xhtml b/html/formules/nei_ds.xhtml
new file mode 100755
index 0000000..9b7f667
--- /dev/null
+++ b/html/formules/nei_ds.xhtml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+ Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]
+</h2>
+
+<div>
+
+<math mode="display" xmlns="&mathml;">
+ <semantics>
+ <mrow>
+ <mrow>
+ <mi fontstyle="italic">Ds</mi>
+ <mo stretchy="false">=</mo>
+ <mrow>
+ <mo stretchy="false">−</mo>
+ <mi>ln</mi>
+ </mrow>
+ </mrow>
+ <mfenced open="[" close="]">
+ <mrow>
+ <mfrac>
+ <msub>
+ <mi>J</mi>
+ <mi>XY</mi>
+ </msub>
+ <msqrt>
+ <mrow>
+ <msub>
+ <mi>J</mi>
+ <mi>X</mi>
+ </msub>
+ <msub>
+ <mi>J</mi>
+ <mi>Y</mi>
+ </msub>
+ </mrow>
+ </msqrt>
+ </mfrac>
+ </mrow>
+ </mfenced>
+ </mrow>
+ <annotation encoding="StarMath 5.0">Ds=-ln {left[ {J_{XY}}over{sqrt{J_{X}J_{Y}}} right]}</annotation>
+ </semantics>
+</math>
+
+</div>
+</body>
+</html>
diff --git a/html/formules/prevosti.xhtml b/html/formules/prevosti.xhtml
new file mode 100644
index 0000000..25a7b50
--- /dev/null
+++ b/html/formules/prevosti.xhtml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Prevosti et al's (1975) distance</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Prevosti et al's (1975) distance"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+Prevosti et al's (1975) distance [Takezaki, N. 96] has a statistical property similar to that of Dr and is defined as
+</h2>
+
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mi math:fontstyle="italic">Cp</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>j</math:mi>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>i</math:mi>
+ <math:msub>
+ <math:mi>m</math:mi>
+ <math:mi>j</math:mi>
+ </math:msub>
+ </math:msubsup>
+ <math:mfenced math:open="∣" math:close="∣">
+ <math:mrow>
+ <math:msub>
+ <math:mi>x</math:mi>
+ <math:mi math:fontstyle="italic">ij</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:msub>
+ <math:mi>y</math:mi>
+ <math:mi math:fontstyle="italic">ij</math:mi>
+ </math:msub>
+ </math:mrow>
+ </math:mfenced>
+ </math:mrow>
+ </math:mrow>
+ <math:mn>2r</math:mn>
+ </math:mfrac>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">Cp = {sum _j ^r sum _i ^{m_j} abs{x_ij - y_ij}} over 2r</math:annotation>
+ </math:semantics>
+</math:math>
+
+</body>
+</html>
diff --git a/html/formules/reynold_dru.xhtml b/html/formules/reynold_dru.xhtml
new file mode 100644
index 0000000..4ca15cd
--- /dev/null
+++ b/html/formules/reynold_dru.xhtml
@@ -0,0 +1,784 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Reynold's genetic distance</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Reynold's genetic distance"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+ Reynold's genetic distance for short-term evolution (1983) [Reynolds, J. 83]
+</h2>
+
+<div>
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mi math:fontstyle="italic">DReynold</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mi>ln</math:mi>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mo math:stretchy="false">θ</math:mo>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">DReynold = -ln (1 - %theta)</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+
+
+
+<div>
+the following notation is used, for all 𝚹 estimators:
+</div>
+
+<div>
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mfrac>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ </math:msub>
+ <math:mi>r</math:mi>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ <math:mi>,</math:mi>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>c</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mfrac>
+ <math:msubsup>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:mi>,</math:mi>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">lu</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ </math:msub>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">ilu</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:mi>,</math:mi>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">α</math:mo>
+ <math:mi math:fontstyle="italic">il</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>u</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:msub>
+ <math:mi>v</math:mi>
+ <math:mn>1</math:mn>
+ </math:msub>
+ </math:msubsup>
+ <math:mover math:accent="true">
+ <math:msubsup>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">ilu</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mrow>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">bar n = sum _{i=1} ^r {{n_i} over r } , n_c = (r bar n - sum _{i=1} ^r {n^2 _i over {r bar n}}) over (r-1), tilde p _lu = sum _{i=1} ^r {n_i tilde p _ilu} over {r bar n},
+tilde %alpha _il = 1 - sum ^{v_1} _{u=1} tilde p _ilu ^2</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+
+
+
+<h2>
+ unweighted average of single-locus ratio estimators, ̃𝛉
+<sub>U</sub>:
+</h2>
+
+
+<div>
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>U</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mn>1</math:mn>
+ <math:mi>m</math:mi>
+ </math:mfrac>
+ </math:mrow>
+ <math:mrow>
+ <math:munderover>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>l</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>m</math:mi>
+ </math:munderover>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>l</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">tilde %theta _U = 1 over m sum from l=1 to m tilde %theta _{l}</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+
+<div>
+ , with <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:msub>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>l</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:msub>
+ <math:mi>a</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ <math:mrow>
+ <math:msub>
+ <math:mi>a</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mi>b</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">%theta _{l} = {a_l} over {a_l + b_l}</math:annotation>
+ </math:semantics>
+</math:math>. The estimates of the components of variance of interest for the lth locus are within populations, r is the number of populations examined:
+</div>
+
+<div>
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mi>b</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>2</math:mn>
+ </math:mrow>
+ <math:mrow>
+ <math:munderover>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:munderover>
+ <math:mfrac>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ </math:msub>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">α</math:mo>
+ <math:mi math:fontstyle="italic">il</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mn>2</math:mn>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">b_l = 2 sum from {i=1} to r {{ n_i tilde %alpha _{il}} over {r(2 bar n - 1)}}</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+
+
+<div>and between populations: </div>
+<div>
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:msub>
+ <math:mi>a</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mo math:stretchy="false">[</math:mo>
+ <math:mrow>
+ <math:mn>2</math:mn>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ </math:msub>
+ </math:mrow>
+ <math:mrow>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>u</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:msub>
+ <math:mi>v</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ </math:msubsup>
+ <math:msup>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">ilu</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">lu</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mn>2</math:mn>
+ </math:msup>
+ </math:mrow>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ <math:msub>
+ <math:mi>b</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">]</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:mn>2</math:mn>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>c</math:mi>
+ </math:msub>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">a_{l}= {[
+2 sum ^{r}_{i=1} n_{i} sum ^{v_{l}}_{u=1} ( tilde{p}_{ilu} - tilde{p}_{lu}) ^{2} - ( r - 1) b_{l}]
+} over {2 (r - 1) n_c}</math:annotation>
+ </math:semantics>
+</math:math>
+
+</div>
+
+
+<div>
+ When there are just two populations, r = 2, the usual genetic distance situation obtains, and the most convenient computing formulas for the variance components are (used in Populations)
+</div>
+
+<div>
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mi>a</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mn>1</math:mn>
+ <math:mn>2</math:mn>
+ </math:mfrac>
+ </math:mrow>
+ <math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>u</math:mi>
+ </math:msub>
+ <math:msup>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mn>1lu</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mn>2lu</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mn>2</math:mn>
+ </math:msup>
+ </math:mrow>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>1</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>2</math:mn>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>1</math:mn>
+ </math:msub>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">α</math:mo>
+ <math:mn>1l</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>2</math:mn>
+ </math:msub>
+ </math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">α</math:mo>
+ <math:mn>2l</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mn>4n</math:mn>
+ <math:mn>1</math:mn>
+ </math:msub>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>2</math:mn>
+ </math:msub>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>1</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>2</math:mn>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">a_{l}={1} over {2} sum _{u} ( tilde{p}_{1lu}-tilde{p}_{2lu}) ^{2} - {( n_{1}+n_{2}) ( n_{1} tilde{%alpha }_{1l}+n_{2} tilde{%alpha }_{2l}) } over {4n_{1}n_{2} ( n_{1}+n_{2}-1 ) }</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+
+
+
+
+<div>
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mi>a</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mi>b</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mn>1</math:mn>
+ <math:mn>2</math:mn>
+ </math:mfrac>
+ </math:mrow>
+ <math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>u</math:mi>
+ </math:msub>
+ <math:msup>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mn>1lu</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mn>2lu</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mn>2</math:mn>
+ </math:msup>
+ </math:mrow>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:msub>
+ <math:mn>4n</math:mn>
+ <math:mn>1</math:mn>
+ </math:msub>
+ <math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>2</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>1</math:mn>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>2</math:mn>
+ </math:msub>
+ </math:mrow>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>1</math:mn>
+ </math:msub>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">α</math:mo>
+ <math:mn>1l</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>2</math:mn>
+ </math:msub>
+ </math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">α</math:mo>
+ <math:mn>2l</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mn>4n</math:mn>
+ <math:mn>1</math:mn>
+ </math:msub>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>2</math:mn>
+ </math:msub>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>1</math:mn>
+ </math:msub>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mn>2</math:mn>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">a_{l}+b_{l} = {1} over {2} sum _{u} ( tilde{p}_{1lu}- tilde{p}_{2lu}) ^{2} + {( 4n_{1}n_{2}-n_{1}-n_{2}) ( n_{1} tilde{%alpha }_{1l}+n_{2} tilde{%alpha }_{2l}) } over {4n_{1}n_{2} ( n_{1}+n_{2}-1) }</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+</body>
+</html>
diff --git a/html/formules/reynold_drw.xhtml b/html/formules/reynold_drw.xhtml
new file mode 100644
index 0000000..6177f6b
--- /dev/null
+++ b/html/formules/reynold_drw.xhtml
@@ -0,0 +1,306 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Reynold's genetic distance</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Reynold's genetic distance"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+ Reynold's genetic distance for short-term evolution (1983) [Reynolds, J. 83]
+</h2>
+
+<div>
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mi math:fontstyle="italic">DReynold</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mi>ln</math:mi>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mo math:stretchy="false">θ</math:mo>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">DReynold = -ln (1 - %theta)</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+
+
+
+<div>
+the following notation is used, for all 𝚹 estimators:
+</div>
+
+<div>
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mfrac>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ </math:msub>
+ <math:mi>r</math:mi>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ <math:mi>,</math:mi>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>c</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mfrac>
+ <math:msubsup>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:mi>,</math:mi>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">lu</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ </math:msub>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">ilu</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:mi>,</math:mi>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">α</math:mo>
+ <math:mi math:fontstyle="italic">il</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>u</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:msub>
+ <math:mi>v</math:mi>
+ <math:mn>1</math:mn>
+ </math:msub>
+ </math:msubsup>
+ <math:mover math:accent="true">
+ <math:msubsup>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">ilu</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mrow>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">bar n = sum _{i=1} ^r {{n_i} over r } , n_c = (r bar n - sum _{i=1} ^r {n^2 _i over {r bar n}}) over (r-1), tilde p _lu = sum _{i=1} ^r {n_i tilde p _ilu} over {r bar n},
+tilde %alpha _il = 1 - sum ^{v_1} _{u=1} tilde p _ilu ^2</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+
+
+
+<h2>
+ weighted average of single-locus ratio estimators :
+</h2>
+
+
+
+<div>
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>W</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>l</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>m</math:mi>
+ </math:msubsup>
+ <math:msub>
+ <math:mi>a</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>l</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>m</math:mi>
+ </math:msubsup>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:msub>
+ <math:mi>a</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mi>b</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0"> tilde{%theta }_{W}= {( sum ^{m}_{l=1}a_{l}) } over {sum ^{m}_{l=1}( a_{l}+b_{l}) }</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+
+</body>
+</html>
diff --git a/html/formules/reynold_general.mml b/html/formules/reynold_general.mml
new file mode 100644
index 0000000..417b66e
--- /dev/null
+++ b/html/formules/reynold_general.mml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN" "math.dtd">
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mi>R</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mrow>
+ <math:mn>2x</math:mn>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mi>y</math:mi>
+ </math:mrow>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mi>z</math:mi>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msubsup>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>L</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>2</math:mn>
+ </math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>x</math:mi>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mi>z</math:mi>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>L</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mi>z</math:mi>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>2</math:mn>
+ </math:mrow>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>L</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mn>2</math:mn>
+ </math:mrow>
+ <math:mover math:accent="true">
+ <math:msubsup>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>L</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">R={ ( 2x+y+z ) tilde{%theta }_{L}^{2}-2 ( x+z ) tilde{%theta }_{L}+z} over {1-2 tilde{%theta }_{L}+2 tilde{%theta }_{L}^{2}}</math:annotation>
+ </math:semantics>
+</math:math>
\ No newline at end of file
diff --git a/html/formules/reynold_least_square.xhtml b/html/formules/reynold_least_square.xhtml
new file mode 100644
index 0000000..aa71546
--- /dev/null
+++ b/html/formules/reynold_least_square.xhtml
@@ -0,0 +1,480 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Reynold's genetic distance</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Reynold's genetic distance"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+ Reynold's genetic distance for short-term evolution (1983) [Reynolds, J. 83]
+</h2>
+
+<div>
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mi math:fontstyle="italic">DReynold</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mi>ln</math:mi>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mo math:stretchy="false">θ</math:mo>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">DReynold = -ln (1 - %theta)</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+
+
+
+<div>
+the following notation is used, for all 𝚹 estimators:
+</div>
+
+<div>
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mfrac>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ </math:msub>
+ <math:mi>r</math:mi>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ <math:mi>,</math:mi>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>c</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mfrac>
+ <math:msubsup>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:mi>,</math:mi>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">lu</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>i</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mrow>
+ <math:msub>
+ <math:mi>n</math:mi>
+ <math:mi>i</math:mi>
+ </math:msub>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">ilu</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:mi>r</math:mi>
+ <math:mover math:accent="true">
+ <math:mi>n</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:mi>,</math:mi>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">α</math:mo>
+ <math:mi math:fontstyle="italic">il</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>u</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:msub>
+ <math:mi>v</math:mi>
+ <math:mn>1</math:mn>
+ </math:msub>
+ </math:msubsup>
+ <math:mover math:accent="true">
+ <math:msubsup>
+ <math:mi>p</math:mi>
+ <math:mi math:fontstyle="italic">ilu</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mrow>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">bar n = sum _{i=1} ^r {{n_i} over r } , n_c = (r bar n - sum _{i=1} ^r {n^2 _i over {r bar n}}) over (r-1), tilde p _lu = sum _{i=1} ^r {n_i tilde p _ilu} over {r bar n},
+tilde %alpha _il = 1 - sum ^{v_1} _{u=1} tilde p _ilu ^2</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+
+
+<h2>
+ least squares 𝛉 estimator :
+</h2>
+
+
+
+<div>
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>L</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mrow>
+ <math:mrow>
+ <math:mn>2x</math:mn>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mi>y</math:mi>
+ </math:mrow>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mi>z</math:mi>
+ </math:mrow>
+ <math:mo math:stretchy="false">±</math:mo>
+ <math:msqrt>
+ <math:mrow>
+ <math:msup>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>z</math:mi>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mi>y</math:mi>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mn>2</math:mn>
+ </math:msup>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msup>
+ <math:mn>4x</math:mn>
+ <math:mn>2</math:mn>
+ </math:msup>
+ </math:mrow>
+ </math:msqrt>
+ </math:mrow>
+ <math:mrow>
+ <math:mn>2</math:mn>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>y</math:mi>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mi>z</math:mi>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">tilde{%theta }_{L} = {2x+y-z +- sqrt{( z-y) ^{2}+4x^{2}}} over {2( y-z) }</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+<div>
+ where: <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mi>z</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>l</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>m</math:mi>
+ </math:msubsup>
+ <math:msubsup>
+ <math:mi>a</math:mi>
+ <math:mi>l</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">z= sum ^{m}_{l=1}a_{l}^{2}</math:annotation>
+ </math:semantics>
+</math:math>
+ ,
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mi>x</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>l</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>m</math:mi>
+ </math:msubsup>
+ <math:msub>
+ <math:mi>a</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ </math:mrow>
+ </math:mrow>
+ <math:msub>
+ <math:mi>b</math:mi>
+ <math:mi>l</math:mi>
+ </math:msub>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">x= sum ^{m}_{l=1}a_{l}b_{l}</math:annotation>
+ </math:semantics>
+</math:math>
+ and
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mi>y</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mrow>
+ <math:mi>l</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mn>1</math:mn>
+ </math:mrow>
+ <math:mi>m</math:mi>
+ </math:msubsup>
+ <math:msubsup>
+ <math:mi>b</math:mi>
+ <math:mi>l</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">y= sum ^{m}_{l=1}b_{l}^{2}</math:annotation>
+ </math:semantics>
+</math:math>
+ .
+
+to check which of the two solutions for ̃𝛉
+
+<sub>L</sub> provides the minimum, the residual sum of squares, R, should be calculated for each where:
+</div>
+
+<div>
+ <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mi>R</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mrow>
+ <math:mn>2x</math:mn>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mi>y</math:mi>
+ </math:mrow>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mi>z</math:mi>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msubsup>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>L</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>2</math:mn>
+ </math:mrow>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:mi>x</math:mi>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mi>z</math:mi>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>L</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mi>z</math:mi>
+ </math:mrow>
+ </math:mrow>
+ <math:mrow>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mn>2</math:mn>
+ </math:mrow>
+ <math:mrow>
+ <math:mover math:accent="true">
+ <math:msub>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>L</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:mn>2</math:mn>
+ </math:mrow>
+ <math:mover math:accent="true">
+ <math:msubsup>
+ <math:mo math:stretchy="false">θ</math:mo>
+ <math:mi>L</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ <math:mo math:stretchy="false">˜</math:mo>
+ </math:mover>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">R={ ( 2x+y+z ) tilde{%theta }_{L}^{2}-2 ( x+z ) tilde{%theta }_{L}+z} over {1-2 tilde{%theta }_{L}+2 tilde{%theta }_{L}^{2}}</math:annotation>
+ </math:semantics>
+</math:math>
+</div>
+</body>
+</html>
diff --git a/html/formules/roger.xhtml b/html/formules/roger.xhtml
new file mode 100644
index 0000000..62fb6a0
--- /dev/null
+++ b/html/formules/roger.xhtml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Rogers' (1972) distance</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Rogers' (1972) distance"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+Rogers' (1972) distance [Takezaki, N. 96]
+</h2>
+
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mi math:fontstyle="italic">Dr</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mn>1</math:mn>
+ <math:mi>r</math:mi>
+ </math:mfrac>
+ </math:mrow>
+ <math:mrow>
+ <math:munderover>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>j</math:mi>
+ <math:mi>r</math:mi>
+ </math:munderover>
+ <math:msqrt>
+ <math:mfrac>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>i</math:mi>
+ <math:mi>m</math:mi>
+ </math:msubsup>
+ <math:msup>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:msub>
+ <math:mi>x</math:mi>
+ <math:mi math:fontstyle="italic">ij</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:msub>
+ <math:mi>y</math:mi>
+ <math:mi math:fontstyle="italic">ij</math:mi>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mn>2</math:mn>
+ </math:msup>
+ </math:mrow>
+ <math:mn>2</math:mn>
+ </math:mfrac>
+ </math:msqrt>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">Dr = 1 over r sum from j to r sqrt{{sum _i ^m (x_ij - y_ij)^2} over 2}</math:annotation>
+ </math:semantics>
+</math:math>
+
+
+</body>
+</html>
diff --git a/html/index.html b/html/index.html
new file mode 100644
index 0000000..1f6d05c
--- /dev/null
+++ b/html/index.html
@@ -0,0 +1,284 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Populations </title>
+ <link rel="stylesheet" href="./libcss/main.css" type="text/CSS"/>
+ <!-- <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+ </head>
+ <body>
+ <div>
+
+ <h1>Populations 1.2.31</h1>
+ <div class="paragraphe">Population genetic software (individuals or populations
+ distances, phylogenetic trees)</div>
+ <ul class="plan">
+ <li>
+ <a href="#ancre_fonctionnalites">Contents</a>
+ </li>
+ <li>
+ <a href="#ancre_telechargement">Download</a>
+ </li>
+ <li>
+ <a href="#ancre_distances">Distances</a>
+ </li>
+ <li>File <a href="#ancre_formats">formats</a></li>
+ <li>
+ <a href="#ancre_ligne_de_commande">Command line</a>
+ </li>
+ <li>
+ <a href="#ancre_bibliographie">Bibliography</a>
+ </li>
+ <li>
+ <a href="http://localhost/pge/bioinfo/populations/formules">Formula</a>
+ </li>
+ </ul>
+
+ <a id="ancre_fonctionnalites"/>
+ <h2>Contents</h2>
+ <ul class="enumeration">
+ <li>haploids, diploids or polyploids genotypes (see input <a href="#ancre_formats"
+ >formats</a>)</li>
+ <li>structured populations (see input files <a href="#ancre_pop_struct">structured
+ populations</a>
+ </li>
+ <li>No limit of populations, loci, alleles per loci (see input <a
+ href="#ancre_formats">formats</a>) </li>
+ <li>Distances between individuals (15 different <a href="#ancre_distances"
+ >methods</a>)</li>
+ <li>Distances between populations (15 <a href="#ancre_distances">methods</a>)</li>
+ <li>Bootstraps on loci OR individuals</li>
+ <li>Phylogenetic trees (individuals or populations), using Neighbor Joining or UPGMA
+ (PHYLIP tree format)</li>
+ <li>Allelic diversity</li>
+ <li>Converts data files from Genepop to different formats (Genepop, Genetix, Msat,
+ Populations...)</li>
+ </ul>
+ <a id="ancre_telechargement"/>
+ <h2>Download</h2>
+ <div class="information">Populations, 1.2.30 Copyright (C) 1999, Olivier
+ Langella, CNRS UPR9034 </div>
+ <div class="paragraphe">This program is free software; you can redistribute it and/or
+ modify it under the terms of the <a href="http://www.gnu.org/copyleft/gpl.html"> GNU
+ General Public License</a> as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version licence</div>
+ <div class="paragraphe">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 <a
+ href="http://www.gnu.org/copyleft/gpl.html">GNU General Public License</a> for
+ more details.</div>
+ <div class="paragraphe">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.</div>
+ <div class="information">Authors</div>
+ <div class="paragraphe">Olivier Langella</div>
+ <div class="paragraphe">
+ <h3>all systems</h3>
+ <a
+ href="http://bioinformatics.org/project/?group_id=84"
+ >download populations</a>
+
+ </div>
+ <div class="paragraphe">
+ <h3>Ubuntu packages</h3>
+ If you are using Ubuntu, you can find "populations" and "treeplot" packages here :<br/>
+ <a href="https://launchpad.net/~olivier-langella/+archive">
+ https://launchpad.net/~olivier-langella/+archive</a><br/>
+ Please modify your source list entries to add the repositorie that corresponds to your Ubuntu version (
+ <a href="https://help.ubuntu.com/community/Repositories/Ubuntu#Adding%20Repositories%20in%20Ubuntu">
+ Adding Repositories in Ubuntu how to</a>
+ )
+
+ </div>
+ <a id="ancre_distances"/>
+ <h2>Distances</h2>
+ <ul class="enumeration">
+ <li>
+ <a href="./formules/das.xhtml">DAS,
+ shared allele distance</a> (Chakraborty et Jin., 1993)</li>
+ <li><a href="./formules/nei_ds.xhtml">Nei, minimum genetic distance</a>, Dm (Nei,1987)</li>
+ <li><a href="./formules/nei_dm.xhtml">Nei, standard genetic distance</a>, Ds (Nei, 1987)</li>
+ <li><a href="./formules/cavali_sforza.xhtml">Cavalli-Sforza and Edwards</a>, Dc (1967)</li>
+ <li><a href="./formules/nei_da.xhtml">Nei et al's</a>, D<sub>A</sub> (1983)</li>
+ <li><a href="./formules/latter_fst.xhtml">Latter</a>, Fst (1972)</li>
+ <li><a href="./formules/prevosti.xhtml">Prevosti et al.'s</a>, Cp (1975)</li>
+ <li><a href="./formules/roger.xhtml">Roger's</a>, Dr (1972)</li>
+ <li><a href="./formules/reynold_dru.xhtml">Reynolds J. unweighted</a>, Dru (1983)</li>
+ <li><a href="./formules/reynold_drw.xhtml">Reynolds J. weighted</a>, Drw (1983)</li>
+ <li><a href="./formules/reynold_least_square.xhtml">Reynolds J. least squares</a>, Drl (1983)</li>
+ <li>Microsatellites distances</li>
+ <li>Goldstein et al., dmu2 (1995a)</li>
+ <li>Average Square Distance ( ASD , Goldstein, Slatkin 1995)</li>
+ <li>Shriver et al's, Dsw (1995)</li>
+ <li>Lev A. Zhivotovsky, DR (1999)
+ </li>
+ </ul>
+ <a id="ancre_formats"/>
+ <h2>Formats</h2>
+ <div class="plan">- <a href="#ancre_formats_entree">input</a></div>
+ <div class="plan">- <a href="#ancre_formats_sortie">output</a></div>
+ <a id="ancre_formats_entree"/>
+ <h3>input files</h3>
+ <div class="paragraphe">"Populations" accepts file from other population genetic
+ softwares:</div>
+ <div class="enumeration">- <a href="http://www.cefe.cnrs-mop.fr/">Genepop</a></div>
+ <div class="enumeration">- <a
+ href="http://www.univ-montp2.fr/%7Egenetix/genetix/genetix.htm">Génétix</a>
+ </div>
+ <div class="paragraphe"> and it has its own format:<br/>"Populations" format allows to
+ use unlimited number of alleles, of haploids, diploids or nploids. The format is
+ close to Genepop but alleles at a given locus are separated by ":". Thus, man can
+ code alleles with all ASCII characters.</div>
+ <div class="paragraphe">Diploid population example:</div>
+ <div class="script"> "Grape populations in southern France"<br/> ADHLocus1<br/>
+ ADH#2<br/> ADHthree<br/> ADH-4<br/> ADH-5<br/> Pop Montpellier<br/> Montpellier1 ,
+ 02:01 03:03 01:02 03:02 10:11<br/> Montpellier2 , 02:02 03:01 01:02 03:03 11:11<br/>
+ Montpellier3 , 01:02 04:01 02:02 01:02 10:10<br/> Montpellier4 , 01:03 02:02 01:01
+ 02:02 10:11<br/> Montpellier5 , 02:03 02:04 01:01 01:02 10:10<br/> POP Gigondas<br/>
+ Gigondas1 , 01:02 02:02 02:01 04:05 08:07<br/> Gigondas2 , 01:02 02:01 02:01 04:05
+ 03:07<br/> Gigondas3 , 02:01 02:03 01:01 05:05 04:02<br/> Gigondas4 , 02:01 03:03
+ 03:01 03:03 06:03<br/> Gigondas5 , 01:01 02:01 03:01 05:05 08:07<br/>
+ </div>
+
+ <div class="paragraphe">Haploid example :</div>
+ <div class="script"> "Grape populations in southern France"<br/> ADHLocus1<br/>
+ ADH#2<br/> ADHthree<br/> ADH-4<br/> ADH-5<br/> Pop Montpellier<br/> Montpellier1 ,
+ 02 03 01 03 10<br/> Montpellier2 , 02 03 01 03 11<br/> Montpellier3 , 01 04 02 01
+ 10<br/> Montpellier4 , 01 02 01 02 10<br/> Montpellier5 , 02 02 01 01 10<br/> POP
+ Gigondas<br/> Gigondas1 , 01 02 02 04 08<br/> Gigondas2 , 01 02 02 04 03<br/>
+ Gigondas3 , 02 02 01 05 04<br/> Gigondas4 , 02 03 03 03 06<br/> Gigondas5 , 01 02 03
+ 05 08<br/>
+ </div>
+
+ <div class="paragraphe">example of haploid, using any ASCII character: no space in
+ allele names:</div>
+ <div class="script"> "Grape populations in southern France"<br/> ADHLocus1<br/>
+ ADH#2<br/> ADHthree<br/> ADH-4<br/> ADH-5<br/> Pop Montpellier<br/> Montpellier1 ,
+ all2 03 01 03 10<br/> Montpellier2 , all2 03 01 03 11<br/> Montpellier3 , all1 04 02
+ 01 miss<br/> Montpellier4 , all1 02 01 02 10<br/> Montpellier5 , all2 02 01 01
+ 10<br/> POP Gigondas<br/> Gigondas1 , all1 02 02 04 08<br/> Gigondas2 , all1 02 02
+ 04 miss<br/> Gigondas3 , all2 02 01 05 04<br/> Gigondas4 , all2 03 03 03 06<br/>
+ Gigondas5 , all1 02 03 05 08<br/>
+ </div>
+
+ <a id="ancre_pop_struct"/>
+ <h3>Structured population</h3>
+ <div class="paragraphe">To code metapopulations, you can choose either "Genepop" or
+ "Populations" format. You only need to give the name of population after the keyword
+ "POP " (separator = "/")</div>
+ <div class="paragraphe">example:</div>
+ <div class="script"> exemple de populations structurées<br/> locus1<br/> locus2<br/>
+ locus3<br/> POP Rennes/immeuble_sud/pop_3emeetage<br/> ind1, (description des
+ individus)<br/> ind2, ...<br/> ind3, ...<br/> ind4, ...<br/> POP
+ Rennes/immeuble_sud/pop_2emeetage<br/> ind1, (description des individus)<br/> ind2,
+ ...<br/> ind3, ...<br/> ind4, ...<br/>
+ </div>
+
+ <a id="ancre_formats_sortie"/>
+ <h3>Output files</h3>
+ <div class="paragraphe">Populations is able to produce various population genetic
+ software formats:</div>
+ <div class="enumeration">
+ <a href="http://www.cefe.cnrs-mop.fr/">Genepop</a>
+ </div>
+ <div class="enumeration">
+ <a href="http://www.univ-montp2.fr/%7Egenetix/genetix/genetix.htm">Génétix</a>
+ </div>
+ <div class="enumeration">Populations</div>
+ <div class="enumeration">
+ Lea
+ </div>
+ <div class="enumeration">
+ <a href="http://www.rannala.org/docs/immanc.html">Immanc</a>
+ </div>
+ <div class="enumeration">microsat</div>
+ <div class="enumeration">
+ <a href="http://www.unife.it/genetica/Giorgio/giorgio_soft.html#ADMIX">Admix (G.
+ Bertorelle)</a>
+ </div>
+ <div class="enumeration">
+ <a href="http://www.unil.ch/izea/softwares/fstat.html">Fstat (Jerome Goudet)</a>
+ </div>
+ <div class="paragraphe">Phylogenetic trees are coded using the "Phylip" format. " <a
+ href="http://taxonomy.zoology.gla.ac.uk/rod/treeview.html">Treeview</a>" can be
+ used for Windows or Linux, and you can use ">Treeplot" to
+ convert the phylip format into postscript, adobe illustrator, gif... with colors for
+ each populations</div>
+ <div class="paragraphe">Matrix distances files are "Excel (gnumeric compatible)",
+ "Phylip", "xgobi", "NTsys" or any text editor compliant.</div>
+ <a id="ancre_ligne_de_commande"/>
+ <h3>Command line</h3>
+ <div class="paragraphe">You can use "Populations" as a command line programm (very
+ useful for batch treatment) to infer phylogenetic trees:</div>
+ <div class="commande">populations name_of_input_file -"arguments"</div>
+ <div class="paragraphe">Available arguments:</div>
+ <div class="enumeration">-phylogeny ind ou pop (default) for phylogenetic trees based on
+ individuals or populations</div>
+ <div class="enumeration">-dist method (default: Nei standard, Ds) you can choose among:
+ DAS, Dm, Ds, Dc, Da, dmu2, Fst, Cp, Dr, ASD, Dsw, Dr, Dru, Drw, Drl. see distances
+ for details.</div>
+ <div class="enumeration">-construct method (default: upgma) possibilities upgma or nj
+ (Neighbor Joining)</div>
+ <div class="enumeration">-bootstrap_ind number to indicate the number of bootstraps to
+ perform on individuals</div>
+ <div class="enumeration">-bootstrap_locus number to indicate the number of bootstraps to
+ perform on loci</div>
+ <div class="enumeration">-output name_of_treeview_file to indicate the name of the tree
+ file (phylip tree format)</div>
+ <div class="enumeration">-level number , structured populations allows to choose the
+ structuration factor (in the example: town level is 1, building level is 2...).</div>
+ <div class="paragraphe">example:</div>
+ <div class="script">populations toutc2.txt -phylogeny pop -dist Dm -bootstrap_locus
+ 10000 -output toutc2_10000_Dm.tre</div>
+ <div class="paragraphe">Commands can be write in a .bat file (for DOS) or a script file
+ (for UNIX).</div>
+ <a id="ancre_bibliographie"/>
+ <h2>Bibliography</h2>
+ <div class="article"><strong>Bruce Ranala and Joanna L. Mountain.</strong> Detecting
+ immigration by using multilocus genotypes. Proc.Natl. Acad. Sci. USA, 94:9197-9201,
+ 13/6/1997. </div>
+ <div class="article"><strong>David B. Goldstein, Andres Ruiz Linares, Luigi Luca
+ Cavalli-Sforza and Marcus W. Feldman.</strong> An Evaluation of Genetic
+ Distances for Use With Microsatellite Loci. Genetics, 139:463-471, 5/10/1994. </div>
+ <div class="article"><strong>D. B. Goldstein and D. D. Pollock.</strong> Launching
+ Microsatellites: A Review of Mutation Processes and Methods of Phylogenetic
+ Inference. Journal of Heredity, 88(335-342):0022-1503, 31/3/1997. </div>
+ <div class="article" id="pubdas"><strong>Li Jin and Ranajit Chakraborty.</strong> Estimation of
+ Genetic Distance and Coefficient of Gene Diversity from Single-Probe Multilocus DNA
+ Fingerprinting Data. Mol. Biol. Evol, 11(1):120-127, 13/9/1993. </div>
+ <div class="article"><strong>Mark D. Shriver, Li Jin, Eric Boerwinkle, Ranjan Deka,
+ Robert E. Ferrel and Ranajit Chakraborty.</strong> A Novel Measure of Genetic
+ Distance for Highly Polymorphic Tandem Repeat Loci. Mol. Biol. Evol, 12(5):914-920,
+ 13/4/1995. </div>
+ <div class="article"><strong>Montgomery Slatkin.</strong> A Measure of Population
+ Subdivision on Microsatellite Allele Frequencies. Genetics, (139):457-462,
+ 19/6/1994. </div>
+ <div class="article"><strong>Naruya Saitou and Masatoshi Nei.</strong> The
+ Neigbhor-joining Method: A New Method for Reconstructing Phylogenetic Trees. Mol.
+ Biol. Evol, 4(4):406-425, 18/2/1987. </div>
+ <div class="article"><strong>Naoko Takezaki and Masatoshi Nei.</strong> Genetic
+ Distances and Reconstruction of Phylogenetic Trees From Microsatellite DNA.
+ Genetics, (144):189-399, 6/6/1996. </div>
+ <div class="article"><strong>William J. Bruno, Nicholas D. Socci and Aaron L.
+ Halpern.</strong> Weighted Neigbhor Joining: A Likelihood-Based Approach to
+ Distance-Based Phylogeny Reconstruction. Mol. Biol. Evol, 17(1):189-197, 11/10/1999. </div>
+
+<!--
+ <hr/>
+
+
+ <a href="http://validator.w3.org/">
+ <img src="index_en.php_fichiers/valid-xhtml11.png" alt="validation xhtml1.1"
+ title=""/>
+ </a>
+ <div class="bas_de_page">Viewable With <a
+ href="http://localhost/pge/bioinfo/xhtml/index.php?lang=en"
+ >Any Browser.</a></div>
+ <a href="http://jigsaw.w3.org/css-validator/">
+ <img src="index_en.php_fichiers/valid-css.png" alt="validation xhtml1.1" title=""/>
+ </a>
+ -->
+ </div>
+ </body>
+</html>
diff --git a/html/libcss/main.css b/html/libcss/main.css
new file mode 100644
index 0000000..0981a4a
--- /dev/null
+++ b/html/libcss/main.css
@@ -0,0 +1,50 @@
+* {
+margin: 0;
+padding: 0;
+border: 0;
+font-family: "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif;
+font-size: 1em;
+font-weight: normal;
+font-style: normal;
+text-decoration: none;
+}
+
+
+h1 {
+ font-size: 2em;
+ font-weight: bold;
+ margin: 1em;
+}
+
+h2 {
+ font-size: 2em;
+ font-weight: normal;
+ margin-top: 1em;
+ margin-left: 3em;
+}
+
+h3 {
+ font-size: 1.2em;
+ font-weight: bold;
+ margin-top: 1em;
+ margin-left: 4em;
+}
+
+body {
+ margin-left: 3%;
+}
+
+
+ul.plan {
+ list-style : disc;
+ margin-top: 1em;
+ margin-left: 3%;
+ margin-bottom:1em;
+}
+
+ul.enumeration {
+ list-style : square;
+ margin-top: 1em;
+ margin-left: 3%;
+ margin-bottom:1em;
+}
\ No newline at end of file
diff --git a/html/libcss/mathematica.css b/html/libcss/mathematica.css
new file mode 100644
index 0000000..b7e999b
--- /dev/null
+++ b/html/libcss/mathematica.css
@@ -0,0 +1,39 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla MathML Project.
+ *
+ * The Initial Developer of the Original Code is The University Of
+ * Queensland. Portions created by The University Of Queensland are
+ * Copyright (C) 1999 The University Of Queensland. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Roger B. Sidje <rbs at maths.uq.edu.au>
+ */
+
+
+/*******************************************************/
+/* namespace for MathML elements */
+/*******************************************************/
+
+ at namespace url(http://www.w3.org/1998/Math/MathML);
+
+/*******************************************************/
+/* CSS rules to use Mathematica fonts */
+/*******************************************************/
+
+/* old: compatible with pre-1.4 builds */
+:-moz-math-font-style-stretchy {
+ font-family: Math1, Math2, Math4;
+}
+::-moz-math-stretchy {
+ font-family: Math1, Math2, Math4;
+}
diff --git a/html/libjs/entity.js b/html/libjs/entity.js
new file mode 100644
index 0000000..a555e34
--- /dev/null
+++ b/html/libjs/entity.js
@@ -0,0 +1,1529 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla MathML Project.
+ *
+ * The Initial Developer of the Original Code is The University of
+ * Queensland. Portions created by The University of Queensland are
+ * Copyright (C) 2002 The University of Queensland. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Roger B. Sidje <rbs at maths.uq.edu.au>
+ */
+
+var gEntityTable = new Array(1480);
+gEntityTable["0009"] = "Tab";
+gEntityTable["000A"] = "NewLine";
+gEntityTable["0021"] = "excl";
+gEntityTable["0022"] = "quot";
+gEntityTable["0023"] = "num";
+gEntityTable["0024"] = "dollar";
+gEntityTable["0025"] = "percnt";
+gEntityTable["0027"] = "apos";
+gEntityTable["0028"] = "lpar";
+gEntityTable["0029"] = "rpar";
+gEntityTable["002A"] = "midast";
+gEntityTable["002B"] = "plus";
+gEntityTable["002C"] = "comma";
+gEntityTable["002E"] = "period";
+gEntityTable["002F"] = "sol";
+gEntityTable["003A"] = "colon";
+gEntityTable["003B"] = "semi";
+gEntityTable["003D"] = "equals";
+gEntityTable["003F"] = "quest";
+gEntityTable["0040"] = "commat";
+gEntityTable["005B"] = "lbrack";
+gEntityTable["005C"] = "bsol";
+gEntityTable["005D"] = "rbrack";
+gEntityTable["005E"] = "circ";
+gEntityTable["005F"] = "lowbar";
+gEntityTable["0060"] = "DiacriticalGrave";
+gEntityTable["007B"] = "lbrace";
+gEntityTable["007C"] = "VerticalLine";
+gEntityTable["007D"] = "rbrace";
+gEntityTable["00A0"] = "NonBreakingSpace";
+gEntityTable["00A1"] = "iexcl";
+gEntityTable["00A2"] = "cent";
+gEntityTable["00A3"] = "pound";
+gEntityTable["00A4"] = "curren";
+gEntityTable["00A5"] = "yen";
+gEntityTable["00A6"] = "brvbar";
+gEntityTable["00A7"] = "sect";
+gEntityTable["00A8"] = "DoubleDot";
+gEntityTable["00A9"] = "copy";
+gEntityTable["00AA"] = "ordf";
+gEntityTable["00AB"] = "laquo";
+gEntityTable["00AC"] = "not";
+gEntityTable["00AD"] = "shy";
+gEntityTable["00AE"] = "circledR";
+gEntityTable["00AF"] = "OverBar";
+gEntityTable["00B0"] = "deg";
+gEntityTable["00B1"] = "PlusMinus";
+gEntityTable["00B2"] = "sup2";
+gEntityTable["00B3"] = "sup3";
+gEntityTable["00B4"] = "DiacriticalAcute";
+gEntityTable["00B5"] = "micro";
+gEntityTable["00B6"] = "para";
+gEntityTable["00B7"] = "CenterDot";
+gEntityTable["00B8"] = "Cedilla";
+gEntityTable["00B9"] = "sup1";
+gEntityTable["00BA"] = "ordm";
+gEntityTable["00BB"] = "raquo";
+gEntityTable["00BC"] = "frac14";
+gEntityTable["00BD"] = "frac12";
+gEntityTable["00BE"] = "frac34";
+gEntityTable["00BF"] = "iquest";
+gEntityTable["00C0"] = "Agrave";
+gEntityTable["00C1"] = "Aacute";
+gEntityTable["00C2"] = "Acirc";
+gEntityTable["00C3"] = "Atilde";
+gEntityTable["00C4"] = "Auml";
+gEntityTable["00C5"] = "Aring";
+gEntityTable["00C6"] = "AElig";
+gEntityTable["00C7"] = "Ccedil";
+gEntityTable["00C8"] = "Egrave";
+gEntityTable["00C9"] = "Eacute";
+gEntityTable["00CA"] = "Ecirc";
+gEntityTable["00CB"] = "Euml";
+gEntityTable["00CC"] = "Igrave";
+gEntityTable["00CD"] = "Iacute";
+gEntityTable["00CE"] = "Icirc";
+gEntityTable["00CF"] = "Iuml";
+gEntityTable["00D0"] = "ETH";
+gEntityTable["00D1"] = "Ntilde";
+gEntityTable["00D2"] = "Ograve";
+gEntityTable["00D3"] = "Oacute";
+gEntityTable["00D4"] = "Ocirc";
+gEntityTable["00D5"] = "Otilde";
+gEntityTable["00D6"] = "Ouml";
+gEntityTable["00D7"] = "times";
+gEntityTable["00D8"] = "Oslash";
+gEntityTable["00D9"] = "Ugrave";
+gEntityTable["00DA"] = "Uacute";
+gEntityTable["00DB"] = "Ucirc";
+gEntityTable["00DC"] = "Uuml";
+gEntityTable["00DD"] = "Yacute";
+gEntityTable["00DE"] = "THORN";
+gEntityTable["00DF"] = "szlig";
+gEntityTable["00E0"] = "agrave";
+gEntityTable["00E1"] = "aacute";
+gEntityTable["00E2"] = "acirc";
+gEntityTable["00E3"] = "atilde";
+gEntityTable["00E4"] = "auml";
+gEntityTable["00E5"] = "aring";
+gEntityTable["00E6"] = "aelig";
+gEntityTable["00E7"] = "ccedil";
+gEntityTable["00E8"] = "egrave";
+gEntityTable["00E9"] = "eacute";
+gEntityTable["00EA"] = "ecirc";
+gEntityTable["00EB"] = "euml";
+gEntityTable["00EC"] = "igrave";
+gEntityTable["00ED"] = "iacute";
+gEntityTable["00EE"] = "icirc";
+gEntityTable["00EF"] = "iuml";
+gEntityTable["00F0"] = "eth";
+gEntityTable["00F1"] = "ntilde";
+gEntityTable["00F2"] = "ograve";
+gEntityTable["00F3"] = "oacute";
+gEntityTable["00F4"] = "ocirc";
+gEntityTable["00F5"] = "otilde";
+gEntityTable["00F6"] = "ouml";
+gEntityTable["00F7"] = "divide";
+gEntityTable["00F8"] = "oslash";
+gEntityTable["00F9"] = "ugrave";
+gEntityTable["00FA"] = "uacute";
+gEntityTable["00FB"] = "ucirc";
+gEntityTable["00FC"] = "uuml";
+gEntityTable["00FD"] = "yacute";
+gEntityTable["00FE"] = "thorn";
+gEntityTable["00FF"] = "yuml";
+gEntityTable["0100"] = "Amacr";
+gEntityTable["0101"] = "amacr";
+gEntityTable["0102"] = "Abreve";
+gEntityTable["0103"] = "abreve";
+gEntityTable["0104"] = "Aogon";
+gEntityTable["0105"] = "aogon";
+gEntityTable["0106"] = "Cacute";
+gEntityTable["0107"] = "cacute";
+gEntityTable["0108"] = "Ccirc";
+gEntityTable["0109"] = "ccirc";
+gEntityTable["010A"] = "Cdot";
+gEntityTable["010B"] = "cdot";
+gEntityTable["010C"] = "Ccaron";
+gEntityTable["010D"] = "ccaron";
+gEntityTable["010E"] = "Dcaron";
+gEntityTable["010F"] = "dcaron";
+gEntityTable["0110"] = "Dstrok";
+gEntityTable["0111"] = "dstrok";
+gEntityTable["0112"] = "Emacr";
+gEntityTable["0113"] = "emacr";
+gEntityTable["0116"] = "Edot";
+gEntityTable["0117"] = "edot";
+gEntityTable["0118"] = "Eogon";
+gEntityTable["0119"] = "eogon";
+gEntityTable["011A"] = "Ecaron";
+gEntityTable["011B"] = "ecaron";
+gEntityTable["011C"] = "Gcirc";
+gEntityTable["011D"] = "gcirc";
+gEntityTable["011E"] = "Gbreve";
+gEntityTable["011F"] = "gbreve";
+gEntityTable["0120"] = "Gdot";
+gEntityTable["0121"] = "gdot";
+gEntityTable["0122"] = "Gcedil";
+gEntityTable["0124"] = "Hcirc";
+gEntityTable["0125"] = "hcirc";
+gEntityTable["0126"] = "Hstrok";
+gEntityTable["0127"] = "hstrok";
+gEntityTable["0128"] = "Itilde";
+gEntityTable["0129"] = "itilde";
+gEntityTable["012A"] = "Imacr";
+gEntityTable["012B"] = "imacr";
+gEntityTable["012E"] = "Iogon";
+gEntityTable["012F"] = "iogon";
+gEntityTable["0130"] = "Idot";
+gEntityTable["0131"] = "inodot";
+gEntityTable["0132"] = "IJlig";
+gEntityTable["0133"] = "ijlig";
+gEntityTable["0134"] = "Jcirc";
+gEntityTable["0135"] = "jcirc";
+gEntityTable["0136"] = "Kcedil";
+gEntityTable["0137"] = "kcedil";
+gEntityTable["0138"] = "kgreen";
+gEntityTable["0139"] = "Lacute";
+gEntityTable["013A"] = "lacute";
+gEntityTable["013B"] = "Lcedil";
+gEntityTable["013C"] = "lcedil";
+gEntityTable["013D"] = "Lcaron";
+gEntityTable["013E"] = "lcaron";
+gEntityTable["013F"] = "Lmidot";
+gEntityTable["0140"] = "lmidot";
+gEntityTable["0141"] = "Lstrok";
+gEntityTable["0142"] = "lstrok";
+gEntityTable["0143"] = "Nacute";
+gEntityTable["0144"] = "nacute";
+gEntityTable["0145"] = "Ncedil";
+gEntityTable["0146"] = "ncedil";
+gEntityTable["0147"] = "Ncaron";
+gEntityTable["0148"] = "ncaron";
+gEntityTable["0149"] = "napos";
+gEntityTable["014A"] = "ENG";
+gEntityTable["014B"] = "eng";
+gEntityTable["014C"] = "Omacr";
+gEntityTable["014D"] = "omacr";
+gEntityTable["0150"] = "Odblac";
+gEntityTable["0151"] = "odblac";
+gEntityTable["0152"] = "OElig";
+gEntityTable["0153"] = "oelig";
+gEntityTable["0154"] = "Racute";
+gEntityTable["0155"] = "racute";
+gEntityTable["0156"] = "Rcedil";
+gEntityTable["0157"] = "rcedil";
+gEntityTable["0158"] = "Rcaron";
+gEntityTable["0159"] = "rcaron";
+gEntityTable["015A"] = "Sacute";
+gEntityTable["015B"] = "sacute";
+gEntityTable["015C"] = "Scirc";
+gEntityTable["015D"] = "scirc";
+gEntityTable["015E"] = "Scedil";
+gEntityTable["015F"] = "scedil";
+gEntityTable["0160"] = "Scaron";
+gEntityTable["0161"] = "scaron";
+gEntityTable["0162"] = "Tcedil";
+gEntityTable["0163"] = "tcedil";
+gEntityTable["0164"] = "Tcaron";
+gEntityTable["0165"] = "tcaron";
+gEntityTable["0166"] = "Tstrok";
+gEntityTable["0167"] = "tstrok";
+gEntityTable["0168"] = "Utilde";
+gEntityTable["0169"] = "utilde";
+gEntityTable["016A"] = "Umacr";
+gEntityTable["016B"] = "umacr";
+gEntityTable["016C"] = "Ubreve";
+gEntityTable["016D"] = "ubreve";
+gEntityTable["016E"] = "Uring";
+gEntityTable["016F"] = "uring";
+gEntityTable["0170"] = "Udblac";
+gEntityTable["0171"] = "udblac";
+gEntityTable["0172"] = "Uogon";
+gEntityTable["0173"] = "uogon";
+gEntityTable["0174"] = "Wcirc";
+gEntityTable["0175"] = "wcirc";
+gEntityTable["0176"] = "Ycirc";
+gEntityTable["0177"] = "ycirc";
+gEntityTable["0178"] = "Yuml";
+gEntityTable["0179"] = "Zacute";
+gEntityTable["017A"] = "zacute";
+gEntityTable["017B"] = "Zdot";
+gEntityTable["017C"] = "zdot";
+gEntityTable["017D"] = "Zcaron";
+gEntityTable["017E"] = "zcaron";
+gEntityTable["0192"] = "fnof";
+gEntityTable["01F5"] = "gacute";
+gEntityTable["025B"] = "varepsilon";
+gEntityTable["02C6"] = "circ";
+gEntityTable["02C7"] = "Hacek";
+gEntityTable["02D8"] = "Breve";
+gEntityTable["02D9"] = "DiacriticalDot";
+gEntityTable["02DA"] = "ring";
+gEntityTable["02DB"] = "ogon";
+gEntityTable["02DC"] = "DiacriticalTilde";
+gEntityTable["02DD"] = "DiacriticalDoubleAcute";
+gEntityTable["0302"] = "Hat";
+gEntityTable["0311"] = "DownBreve";
+gEntityTable["0332"] = "UnderBar";
+gEntityTable["0391"] = "Alpha";
+gEntityTable["0392"] = "Beta";
+gEntityTable["0393"] = "Gamma";
+gEntityTable["0394"] = "Delta";
+gEntityTable["0395"] = "Epsilon";
+gEntityTable["0396"] = "Zeta";
+gEntityTable["0397"] = "Eta";
+gEntityTable["0398"] = "Theta";
+gEntityTable["0399"] = "Iota";
+gEntityTable["039A"] = "Kappa";
+gEntityTable["039B"] = "Lambda";
+gEntityTable["039C"] = "Mu";
+gEntityTable["039D"] = "Nu";
+gEntityTable["039E"] = "Xi";
+gEntityTable["039F"] = "Omicron";
+gEntityTable["03A0"] = "Pi";
+gEntityTable["03A1"] = "Rho";
+gEntityTable["03A3"] = "Sigma";
+gEntityTable["03A4"] = "Tau";
+gEntityTable["03A5"] = "Upsilon";
+gEntityTable["03A6"] = "Phi";
+gEntityTable["03A7"] = "Chi";
+gEntityTable["03A8"] = "Psi";
+gEntityTable["03A9"] = "Omega";
+gEntityTable["03B1"] = "alpha";
+gEntityTable["03B2"] = "beta";
+gEntityTable["03B3"] = "gamma";
+gEntityTable["03B4"] = "delta";
+gEntityTable["03B5"] = "straightepsilon";
+gEntityTable["03B6"] = "zeta";
+gEntityTable["03B7"] = "eta";
+gEntityTable["03B8"] = "theta";
+gEntityTable["03B9"] = "iota";
+gEntityTable["03BA"] = "kappa";
+gEntityTable["03BB"] = "lambda";
+gEntityTable["03BC"] = "mu";
+gEntityTable["03BD"] = "nu";
+gEntityTable["03BE"] = "xi";
+gEntityTable["03BF"] = "omicron";
+gEntityTable["03C0"] = "pi";
+gEntityTable["03C1"] = "rho";
+gEntityTable["03C2"] = "varsigma";
+gEntityTable["03C3"] = "sigma";
+gEntityTable["03C4"] = "tau";
+gEntityTable["03C5"] = "upsilon";
+gEntityTable["03C6"] = "straightphi";
+gEntityTable["03C7"] = "chi";
+gEntityTable["03C8"] = "psi";
+gEntityTable["03C9"] = "omega";
+gEntityTable["03D1"] = "thetasym";
+gEntityTable["03D2"] = "Upsilon";
+gEntityTable["03D5"] = "varphi";
+gEntityTable["03D6"] = "varpi";
+gEntityTable["03DC"] = "digamma";
+gEntityTable["03F0"] = "varkappa";
+gEntityTable["03F1"] = "varrho";
+gEntityTable["03F6"] = "backepsilon";
+gEntityTable["0401"] = "IOcy";
+gEntityTable["0402"] = "DJcy";
+gEntityTable["0403"] = "GJcy";
+gEntityTable["0404"] = "Jukcy";
+gEntityTable["0405"] = "DScy";
+gEntityTable["0406"] = "Iukcy";
+gEntityTable["0407"] = "YIcy";
+gEntityTable["0408"] = "Jsercy";
+gEntityTable["0409"] = "LJcy";
+gEntityTable["040A"] = "NJcy";
+gEntityTable["040B"] = "TSHcy";
+gEntityTable["040C"] = "KJcy";
+gEntityTable["040E"] = "Ubrcy";
+gEntityTable["040F"] = "DZcy";
+gEntityTable["0410"] = "Acy";
+gEntityTable["0411"] = "Bcy";
+gEntityTable["0412"] = "Vcy";
+gEntityTable["0413"] = "Gcy";
+gEntityTable["0414"] = "Dcy";
+gEntityTable["0415"] = "IEcy";
+gEntityTable["0416"] = "ZHcy";
+gEntityTable["0417"] = "Zcy";
+gEntityTable["0418"] = "Icy";
+gEntityTable["0419"] = "Jcy";
+gEntityTable["041A"] = "Kcy";
+gEntityTable["041B"] = "Lcy";
+gEntityTable["041C"] = "Mcy";
+gEntityTable["041D"] = "Ncy";
+gEntityTable["041E"] = "Ocy";
+gEntityTable["041F"] = "Pcy";
+gEntityTable["0420"] = "Rcy";
+gEntityTable["0421"] = "Scy";
+gEntityTable["0422"] = "Tcy";
+gEntityTable["0423"] = "Ucy";
+gEntityTable["0424"] = "Fcy";
+gEntityTable["0425"] = "KHcy";
+gEntityTable["0426"] = "TScy";
+gEntityTable["0427"] = "CHcy";
+gEntityTable["0428"] = "SHcy";
+gEntityTable["0429"] = "SHCHcy";
+gEntityTable["042A"] = "HARDcy";
+gEntityTable["042B"] = "Ycy";
+gEntityTable["042C"] = "SOFTcy";
+gEntityTable["042D"] = "Ecy";
+gEntityTable["042E"] = "YUcy";
+gEntityTable["042F"] = "YAcy";
+gEntityTable["0430"] = "acy";
+gEntityTable["0431"] = "bcy";
+gEntityTable["0432"] = "vcy";
+gEntityTable["0433"] = "gcy";
+gEntityTable["0434"] = "dcy";
+gEntityTable["0435"] = "iecy";
+gEntityTable["0436"] = "zhcy";
+gEntityTable["0437"] = "zcy";
+gEntityTable["0438"] = "icy";
+gEntityTable["0439"] = "jcy";
+gEntityTable["043A"] = "kcy";
+gEntityTable["043B"] = "lcy";
+gEntityTable["043C"] = "mcy";
+gEntityTable["043D"] = "ncy";
+gEntityTable["043E"] = "ocy";
+gEntityTable["043F"] = "pcy";
+gEntityTable["0440"] = "rcy";
+gEntityTable["0441"] = "scy";
+gEntityTable["0442"] = "tcy";
+gEntityTable["0443"] = "ucy";
+gEntityTable["0444"] = "fcy";
+gEntityTable["0445"] = "khcy";
+gEntityTable["0446"] = "tscy";
+gEntityTable["0447"] = "chcy";
+gEntityTable["0448"] = "shcy";
+gEntityTable["0449"] = "shchcy";
+gEntityTable["044A"] = "hardcy";
+gEntityTable["044B"] = "ycy";
+gEntityTable["044C"] = "softcy";
+gEntityTable["044D"] = "ecy";
+gEntityTable["044E"] = "yucy";
+gEntityTable["044F"] = "yacy";
+gEntityTable["0451"] = "iocy";
+gEntityTable["0452"] = "djcy";
+gEntityTable["0453"] = "gjcy";
+gEntityTable["0454"] = "jukcy";
+gEntityTable["0455"] = "dscy";
+gEntityTable["0456"] = "iukcy";
+gEntityTable["0457"] = "yicy";
+gEntityTable["0458"] = "jsercy";
+gEntityTable["0459"] = "ljcy";
+gEntityTable["045A"] = "njcy";
+gEntityTable["045B"] = "tshcy";
+gEntityTable["045C"] = "kjcy";
+gEntityTable["045E"] = "ubrcy";
+gEntityTable["045F"] = "dzcy";
+gEntityTable["2002"] = "ensp";
+gEntityTable["2003"] = "emsp";
+gEntityTable["2004"] = "emsp13";
+gEntityTable["2005"] = "emsp14";
+gEntityTable["2007"] = "numsp";
+gEntityTable["2008"] = "puncsp";
+gEntityTable["2009"] = "ThinSpace";
+gEntityTable["200A"] = "VeryThinSpace";
+gEntityTable["200B"] = "InvisibleComma";
+gEntityTable["200C"] = "zwnj";
+gEntityTable["200D"] = "zwj";
+gEntityTable["200E"] = "lrm";
+gEntityTable["200F"] = "rlm";
+gEntityTable["2010"] = "hyphen";
+gEntityTable["2013"] = "ndash";
+gEntityTable["2014"] = "mdash";
+gEntityTable["2015"] = "horbar";
+gEntityTable["2016"] = "Verbar";
+gEntityTable["2018"] = "OpenCurlyQuote";
+gEntityTable["2019"] = "CloseCurlyQuote";
+gEntityTable["201A"] = "lsquor";
+gEntityTable["201C"] = "OpenCurlyDoubleQuote";
+gEntityTable["201D"] = "CloseCurlyDoubleQuote";
+gEntityTable["201E"] = "ldquor";
+gEntityTable["2020"] = "dagger";
+gEntityTable["2021"] = "ddagger";
+gEntityTable["2022"] = "bullet";
+gEntityTable["2025"] = "nldr";
+gEntityTable["2026"] = "hellip";
+gEntityTable["2030"] = "permil";
+gEntityTable["2031"] = "pertenk";
+gEntityTable["2032"] = "prime";
+gEntityTable["2033"] = "Prime";
+gEntityTable["2034"] = "tprime";
+gEntityTable["2035"] = "backprime";
+gEntityTable["2039"] = "lsaquo";
+gEntityTable["203A"] = "rsaquo";
+gEntityTable["203E"] = "oline";
+gEntityTable["2041"] = "caret";
+gEntityTable["2043"] = "hybull";
+gEntityTable["2044"] = "frasl";
+gEntityTable["204F"] = "bsemi";
+gEntityTable["2057"] = "qprime";
+gEntityTable["205F"] = "MediumSpace";
+gEntityTable["2061"] = "ApplyFunction";
+gEntityTable["2062"] = "InvisibleTimes";
+gEntityTable["20AC"] = "euro";
+gEntityTable["20DB"] = "TripleDot";
+gEntityTable["20DC"] = "DotDot";
+gEntityTable["2102"] = "complexes";
+gEntityTable["2105"] = "incare";
+gEntityTable["210A"] = "gscr";
+gEntityTable["210B"] = "HilbertSpace";
+gEntityTable["210C"] = "Poincareplane";
+gEntityTable["210D"] = "quaternions";
+gEntityTable["210E"] = "planckh";
+gEntityTable["210F"] = "hslash";
+gEntityTable["2110"] = "imagline";
+gEntityTable["2111"] = "imagpart";
+gEntityTable["2112"] = "Laplacetrf";
+gEntityTable["2113"] = "lscr";
+gEntityTable["2115"] = "naturals";
+gEntityTable["2116"] = "numero";
+gEntityTable["2117"] = "copysr";
+gEntityTable["2118"] = "weierp";
+gEntityTable["2119"] = "primes";
+gEntityTable["211A"] = "rationals";
+gEntityTable["211B"] = "realine";
+gEntityTable["211C"] = "realpart";
+gEntityTable["211D"] = "reals";
+gEntityTable["211E"] = "rx";
+gEntityTable["2122"] = "trade";
+gEntityTable["2124"] = "integers";
+gEntityTable["2126"] = "ohm";
+gEntityTable["2127"] = "mho";
+gEntityTable["2128"] = "zeetrf";
+gEntityTable["2129"] = "iiota";
+gEntityTable["212B"] = "angst";
+gEntityTable["212C"] = "Bernoullis";
+gEntityTable["212D"] = "Cayleys";
+gEntityTable["212F"] = "escr";
+gEntityTable["2130"] = "expectation";
+gEntityTable["2131"] = "Fouriertrf";
+gEntityTable["2133"] = "Mellintrf";
+gEntityTable["2134"] = "orderof";
+gEntityTable["2135"] = "alefsym";
+gEntityTable["2136"] = "beth";
+gEntityTable["2137"] = "gimel";
+gEntityTable["2138"] = "daleth";
+gEntityTable["2145"] = "CapitalDifferentialD";
+gEntityTable["2146"] = "DifferentialD";
+gEntityTable["2147"] = "ExponentialE";
+gEntityTable["2148"] = "ImaginaryI";
+gEntityTable["2153"] = "frac13";
+gEntityTable["2154"] = "frac23";
+gEntityTable["2155"] = "frac15";
+gEntityTable["2156"] = "frac25";
+gEntityTable["2157"] = "frac35";
+gEntityTable["2158"] = "frac45";
+gEntityTable["2159"] = "frac16";
+gEntityTable["215A"] = "frac56";
+gEntityTable["215B"] = "frac18";
+gEntityTable["215C"] = "frac38";
+gEntityTable["215D"] = "frac58";
+gEntityTable["215E"] = "frac78";
+gEntityTable["2190"] = "LeftArrow";
+gEntityTable["2191"] = "UpArrow";
+gEntityTable["2192"] = "RightArrow";
+gEntityTable["2193"] = "DownArrow";
+gEntityTable["2194"] = "LeftRightArrow";
+gEntityTable["2195"] = "UpDownArrow";
+gEntityTable["2196"] = "UpperLeftArrow";
+gEntityTable["2197"] = "UpperRightArrow";
+gEntityTable["2198"] = "LowerRightArrow";
+gEntityTable["2199"] = "LowerLeftArrow";
+gEntityTable["219A"] = "nleftarrow";
+gEntityTable["219B"] = "nrightarrow";
+gEntityTable["219D"] = "rightsquigarrow";
+gEntityTable["219E"] = "twoheadleftarrow";
+gEntityTable["219F"] = "Uarr";
+gEntityTable["21A0"] = "twoheadrightarrow";
+gEntityTable["21A1"] = "Darr";
+gEntityTable["21A2"] = "leftarrowtail";
+gEntityTable["21A3"] = "rightarrowtail";
+gEntityTable["21A4"] = "LeftTeeArrow";
+gEntityTable["21A5"] = "UpTeeArrow";
+gEntityTable["21A6"] = "RightTeeArrow";
+gEntityTable["21A7"] = "DownTeeArrow";
+gEntityTable["21A9"] = "hookleftarrow";
+gEntityTable["21AA"] = "hookrightarrow";
+gEntityTable["21AB"] = "looparrowleft";
+gEntityTable["21AC"] = "looparrowright";
+gEntityTable["21AD"] = "leftrightsquigarrow";
+gEntityTable["21AE"] = "nleftrightarrow";
+gEntityTable["21B0"] = "Lsh";
+gEntityTable["21B1"] = "Rsh";
+gEntityTable["21B2"] = "ldsh";
+gEntityTable["21B3"] = "rdsh";
+gEntityTable["21B5"] = "crarr";
+gEntityTable["21B6"] = "curvearrowleft";
+gEntityTable["21B7"] = "curvearrowright";
+gEntityTable["21BA"] = "circlearrowleft";
+gEntityTable["21BB"] = "circlearrowright";
+gEntityTable["21BC"] = "leftharpoonup";
+gEntityTable["21BD"] = "leftharpoondown";
+gEntityTable["21BE"] = "upharpoonright";
+gEntityTable["21BF"] = "upharpoonleft";
+gEntityTable["21C0"] = "rightharpoonup";
+gEntityTable["21C1"] = "rightharpoondown";
+gEntityTable["21C2"] = "downharpoonright";
+gEntityTable["21C3"] = "downharpoonleft";
+gEntityTable["21C4"] = "RightArrowLeftArrow";
+gEntityTable["21C5"] = "UpArrowDownArrow";
+gEntityTable["21C6"] = "LeftArrowRightArrow";
+gEntityTable["21C7"] = "leftleftarrows";
+gEntityTable["21C8"] = "upuparrows";
+gEntityTable["21C9"] = "rightrightarrows";
+gEntityTable["21CA"] = "downdownarrows";
+gEntityTable["21CB"] = "ReverseEquilibrium";
+gEntityTable["21CC"] = "rightleftharpoons";
+gEntityTable["21CD"] = "nLeftarrow";
+gEntityTable["21CE"] = "nLeftrightarrow";
+gEntityTable["21CF"] = "nRightarrow";
+gEntityTable["21D0"] = "DoubleLeftArrow";
+gEntityTable["21D1"] = "DoubleUpArrow";
+gEntityTable["21D2"] = "DoubleRightArrow";
+gEntityTable["21D3"] = "DoubleDownArrow";
+gEntityTable["21D4"] = "DoubleLeftRightArrow";
+gEntityTable["21D5"] = "DoubleUpDownArrow";
+gEntityTable["21D6"] = "nwArr";
+gEntityTable["21D7"] = "neArr";
+gEntityTable["21D8"] = "seArr";
+gEntityTable["21D9"] = "swArr";
+gEntityTable["21DA"] = "Lleftarrow";
+gEntityTable["21DB"] = "Rrightarrow";
+gEntityTable["21DD"] = "zigrarr";
+gEntityTable["21E4"] = "LeftArrowBar";
+gEntityTable["21E5"] = "RightArrowBar";
+gEntityTable["21F5"] = "DownArrowUpArrow";
+gEntityTable["21FD"] = "loarr";
+gEntityTable["21FE"] = "roarr";
+gEntityTable["21FF"] = "hoarr";
+gEntityTable["2200"] = "ForAll";
+gEntityTable["2201"] = "complement";
+gEntityTable["2202"] = "PartialD";
+gEntityTable["2203"] = "Exists";
+gEntityTable["2204"] = "NotExists";
+gEntityTable["2205"] = "varnothing";
+gEntityTable["2207"] = "nabla";
+gEntityTable["2208"] = "Element";
+gEntityTable["2209"] = "NotElement";
+gEntityTable["220B"] = "ReverseElement";
+gEntityTable["220C"] = "NotReverseElement";
+gEntityTable["220F"] = "Product";
+gEntityTable["2210"] = "Coproduct";
+gEntityTable["2211"] = "Sum";
+gEntityTable["2212"] = "minus";
+gEntityTable["2213"] = "MinusPlus";
+gEntityTable["2214"] = "dotplus";
+gEntityTable["2216"] = "Backslash";
+gEntityTable["2217"] = "lowast";
+gEntityTable["2218"] = "SmallCircle";
+gEntityTable["221A"] = "radic";
+gEntityTable["221D"] = "Proportional";
+gEntityTable["221E"] = "infin";
+gEntityTable["221F"] = "angrt";
+gEntityTable["2220"] = "angle";
+gEntityTable["2221"] = "measuredangle";
+gEntityTable["2222"] = "angsph";
+gEntityTable["2223"] = "VerticalBar";
+gEntityTable["2224"] = "NotVerticalBar";
+gEntityTable["2225"] = "DoubleVerticalBar";
+gEntityTable["2226"] = "NotDoubleVerticalBar";
+gEntityTable["2227"] = "wedge";
+gEntityTable["2228"] = "vee";
+gEntityTable["2229"] = "cap";
+gEntityTable["222A"] = "cup";
+gEntityTable["222B"] = "Integral";
+gEntityTable["222C"] = "Int";
+gEntityTable["222D"] = "iiint";
+gEntityTable["222E"] = "ContourIntegral";
+gEntityTable["222F"] = "DoubleContourIntegral";
+gEntityTable["2230"] = "Cconint";
+gEntityTable["2231"] = "cwint";
+gEntityTable["2232"] = "ClockwiseContourIntegral";
+gEntityTable["2233"] = "CounterClockwiseContourIntegral";
+gEntityTable["2234"] = "Therefore";
+gEntityTable["2235"] = "Because";
+gEntityTable["2236"] = "ratio";
+gEntityTable["2237"] = "Proportion";
+gEntityTable["2238"] = "dotminus";
+gEntityTable["223A"] = "mDDot";
+gEntityTable["223B"] = "homtht";
+gEntityTable["223C"] = "Tilde";
+gEntityTable["223D"] = "backsim";
+gEntityTable["223E"] = "mstpos";
+gEntityTable["223F"] = "acd";
+gEntityTable["2240"] = "VerticalTilde";
+gEntityTable["2241"] = "NotTilde";
+gEntityTable["2242"] = "EqualTilde";
+gEntityTable["2243"] = "TildeEqual";
+gEntityTable["2244"] = "NotTildeEqual";
+gEntityTable["2245"] = "TildeFullEqual";
+gEntityTable["2246"] = "simne";
+gEntityTable["2247"] = "NotTildeFullEqual";
+gEntityTable["2248"] = "TildeTilde";
+gEntityTable["2249"] = "NotTildeTilde";
+gEntityTable["224A"] = "approxeq";
+gEntityTable["224B"] = "apid";
+gEntityTable["224C"] = "backcong";
+gEntityTable["224D"] = "CupCap";
+gEntityTable["224E"] = "HumpDownHump";
+gEntityTable["224F"] = "HumpEqual";
+gEntityTable["2250"] = "DotEqual";
+gEntityTable["2251"] = "doteqdot";
+gEntityTable["2252"] = "fallingdotseq";
+gEntityTable["2253"] = "risingdotseq";
+gEntityTable["2254"] = "coloneq";
+gEntityTable["2255"] = "eqcolon";
+gEntityTable["2256"] = "eqcirc";
+gEntityTable["2257"] = "circeq";
+gEntityTable["2259"] = "wedgeq";
+gEntityTable["225A"] = "veeeq";
+gEntityTable["225B"] = "easter";
+gEntityTable["225C"] = "triangleq";
+gEntityTable["225F"] = "questeq";
+gEntityTable["2260"] = "NotEqual";
+gEntityTable["2261"] = "Congruent";
+gEntityTable["2262"] = "NotCongruent";
+gEntityTable["2264"] = "leq";
+gEntityTable["2265"] = "GreaterEqual";
+gEntityTable["2266"] = "LessFullEqual";
+gEntityTable["2267"] = "GreaterFullEqual";
+gEntityTable["2268"] = "lneqq";
+gEntityTable["2269"] = "gneqq";
+gEntityTable["226A"] = "NestedLessLess";
+gEntityTable["226B"] = "NestedGreaterGreater";
+gEntityTable["226C"] = "between";
+gEntityTable["226D"] = "NotCupCap";
+gEntityTable["226E"] = "NotLess";
+gEntityTable["226F"] = "NotGreater";
+gEntityTable["2270"] = "NotGreaterFullEqual";
+gEntityTable["2271"] = "NotGreaterSlantEqual";
+gEntityTable["2272"] = "lessapprox";
+gEntityTable["2273"] = "GreaterTilde";
+gEntityTable["2274"] = "NotLessTilde";
+gEntityTable["2275"] = "NotGreaterTilde";
+gEntityTable["2276"] = "LessGreater";
+gEntityTable["2277"] = "GreaterLess";
+gEntityTable["2278"] = "NotLessGreater";
+gEntityTable["2279"] = "NotGreaterLess";
+gEntityTable["227A"] = "Precedes";
+gEntityTable["227B"] = "Succeeds";
+gEntityTable["227C"] = "PrecedesSlantEqual";
+gEntityTable["227D"] = "SucceedsSlantEqual";
+gEntityTable["227E"] = "PrecedesTilde";
+gEntityTable["227F"] = "SucceedsTilde";
+gEntityTable["2280"] = "NotPrecedes";
+gEntityTable["2281"] = "NotSucceeds";
+gEntityTable["2282"] = "subset";
+gEntityTable["2283"] = "Superset";
+gEntityTable["2284"] = "NotSubset";
+gEntityTable["2285"] = "NotSuperset";
+gEntityTable["2286"] = "SubsetEqual";
+gEntityTable["2287"] = "SupersetEqual";
+gEntityTable["2288"] = "NotSubsetEqual";
+gEntityTable["2289"] = "NotSupersetEqual";
+gEntityTable["228A"] = "subsetneqq";
+gEntityTable["228B"] = "supsetneqq";
+gEntityTable["228D"] = "cupdot";
+gEntityTable["228E"] = "UnionPlus";
+gEntityTable["228F"] = "SquareSubset";
+gEntityTable["2290"] = "SquareSuperset";
+gEntityTable["2291"] = "SquareSubsetEqual";
+gEntityTable["2292"] = "SquareSupersetEqual";
+gEntityTable["2293"] = "SquareIntersection";
+gEntityTable["2294"] = "SquareUnion";
+gEntityTable["2295"] = "CirclePlus";
+gEntityTable["2296"] = "CircleMinus";
+gEntityTable["2297"] = "CircleTimes";
+gEntityTable["2298"] = "osol";
+gEntityTable["2299"] = "CircleDot";
+gEntityTable["229A"] = "circledcirc";
+gEntityTable["229B"] = "circledast";
+gEntityTable["229D"] = "circleddash";
+gEntityTable["229E"] = "boxplus";
+gEntityTable["229F"] = "boxminus";
+gEntityTable["22A0"] = "boxtimes";
+gEntityTable["22A1"] = "dotsquare";
+gEntityTable["22A2"] = "RightTee";
+gEntityTable["22A3"] = "LeftTee";
+gEntityTable["22A4"] = "DownTee";
+gEntityTable["22A5"] = "bottom";
+gEntityTable["22A7"] = "models";
+gEntityTable["22A8"] = "DoubleRightTee";
+gEntityTable["22A9"] = "Vdash";
+gEntityTable["22AA"] = "Vvdash";
+gEntityTable["22AB"] = "VDash";
+gEntityTable["22AC"] = "nvdash";
+gEntityTable["22AD"] = "nvDash";
+gEntityTable["22AE"] = "nVdash";
+gEntityTable["22AF"] = "nVDash";
+gEntityTable["22B0"] = "prurel";
+gEntityTable["22B2"] = "vartriangleleft";
+gEntityTable["22B3"] = "vartriangleright";
+gEntityTable["22B4"] = "LeftTriangleEqual";
+gEntityTable["22B5"] = "RightTriangleEqual";
+gEntityTable["22B6"] = "origof";
+gEntityTable["22B7"] = "imof";
+gEntityTable["22B8"] = "multimap";
+gEntityTable["22B9"] = "hercon";
+gEntityTable["22BA"] = "intercal";
+gEntityTable["22BB"] = "veebar";
+gEntityTable["22BC"] = "barwedge";
+gEntityTable["22BD"] = "barvee";
+gEntityTable["22BE"] = "vangrt";
+gEntityTable["22BF"] = "lrtri";
+gEntityTable["22C0"] = "bigwedge";
+gEntityTable["22C1"] = "bigvee";
+gEntityTable["22C2"] = "Intersection";
+gEntityTable["22C3"] = "bigcup";
+gEntityTable["22C4"] = "Diamond";
+gEntityTable["22C5"] = "sdot";
+gEntityTable["22C6"] = "sstarf";
+gEntityTable["22C7"] = "divideontimes";
+gEntityTable["22C8"] = "bowtie";
+gEntityTable["22C9"] = "ltimes";
+gEntityTable["22CA"] = "rtimes";
+gEntityTable["22CB"] = "leftthreetimes";
+gEntityTable["22CC"] = "rightthreetimes";
+gEntityTable["22CD"] = "backsimeq";
+gEntityTable["22CE"] = "curlyvee";
+gEntityTable["22CF"] = "curlywedge";
+gEntityTable["22D0"] = "Subset";
+gEntityTable["22D1"] = "Supset";
+gEntityTable["22D2"] = "Cap";
+gEntityTable["22D3"] = "Cup";
+gEntityTable["22D4"] = "pitchfork";
+gEntityTable["22D5"] = "epar";
+gEntityTable["22D6"] = "lessdot";
+gEntityTable["22D7"] = "gtrdot";
+gEntityTable["22D8"] = "Ll";
+gEntityTable["22D9"] = "ggg";
+gEntityTable["22DA"] = "LessEqualGreater";
+gEntityTable["22DB"] = "GreaterEqualLess";
+gEntityTable["22DC"] = "eqslantless";
+gEntityTable["22DD"] = "eqslantgtr";
+gEntityTable["22DE"] = "curlyeqprec";
+gEntityTable["22DF"] = "curlyeqsucc";
+gEntityTable["22E0"] = "NotPrecedesSlantEqual";
+gEntityTable["22E1"] = "NotSucceedsSlantEqual";
+gEntityTable["22E2"] = "NotSquareSubsetEqual";
+gEntityTable["22E3"] = "NotSquareSupersetEqual";
+gEntityTable["22E6"] = "lnsim";
+gEntityTable["22E7"] = "gnsim";
+gEntityTable["22E8"] = "precnapprox";
+gEntityTable["22E9"] = "succnapprox";
+gEntityTable["22EA"] = "NotLeftTriangle";
+gEntityTable["22EB"] = "NotRightTriangle";
+gEntityTable["22EC"] = "NotLeftTriangleEqual";
+gEntityTable["22ED"] = "NotRightTriangleEqual";
+gEntityTable["22EE"] = "vellip";
+gEntityTable["22EF"] = "ctdot";
+gEntityTable["22F0"] = "utdot";
+gEntityTable["22F1"] = "dtdot";
+gEntityTable["22F2"] = "disin";
+gEntityTable["22F3"] = "isinsv";
+gEntityTable["22F4"] = "isins";
+gEntityTable["22F5"] = "isindot";
+gEntityTable["22F6"] = "notinvc";
+gEntityTable["22F7"] = "notinvb";
+gEntityTable["22F9"] = "isinE";
+gEntityTable["22FA"] = "nisd";
+gEntityTable["22FB"] = "xnis";
+gEntityTable["22FC"] = "nis";
+gEntityTable["22FD"] = "notnivc";
+gEntityTable["22FE"] = "notnivb";
+gEntityTable["2306"] = "doublebarwedge";
+gEntityTable["2308"] = "LeftCeiling";
+gEntityTable["2309"] = "RightCeiling";
+gEntityTable["230A"] = "LeftFloor";
+gEntityTable["230B"] = "RightFloor";
+gEntityTable["230C"] = "drcrop";
+gEntityTable["230D"] = "dlcrop";
+gEntityTable["230E"] = "urcrop";
+gEntityTable["230F"] = "ulcrop";
+gEntityTable["2310"] = "bnot";
+gEntityTable["2312"] = "profline";
+gEntityTable["2313"] = "profsurf";
+gEntityTable["2315"] = "telrec";
+gEntityTable["2316"] = "target";
+gEntityTable["231C"] = "ulcorner";
+gEntityTable["231D"] = "urcorner";
+gEntityTable["231E"] = "llcorner";
+gEntityTable["231F"] = "lrcorner";
+gEntityTable["2322"] = "frown";
+gEntityTable["2323"] = "smile";
+gEntityTable["2329"] = "LeftAngleBracket";
+gEntityTable["232A"] = "RightAngleBracket";
+gEntityTable["232D"] = "cylcty";
+gEntityTable["232E"] = "profalar";
+gEntityTable["2336"] = "topbot";
+gEntityTable["233D"] = "ovbar";
+gEntityTable["233F"] = "solbar";
+gEntityTable["237C"] = "angzarr";
+gEntityTable["23B0"] = "lmoustache";
+gEntityTable["23B1"] = "rmoustache";
+gEntityTable["23B4"] = "OverBracket";
+gEntityTable["23B5"] = "UnderBracket";
+gEntityTable["2423"] = "blank";
+gEntityTable["24C8"] = "circledS";
+gEntityTable["2500"] = "HorizontalLine";
+gEntityTable["2502"] = "boxv";
+gEntityTable["250C"] = "boxdr";
+gEntityTable["2510"] = "boxdl";
+gEntityTable["2514"] = "boxur";
+gEntityTable["2518"] = "boxul";
+gEntityTable["251C"] = "boxvr";
+gEntityTable["2524"] = "boxvl";
+gEntityTable["252C"] = "boxhd";
+gEntityTable["2534"] = "boxhu";
+gEntityTable["253C"] = "boxvh";
+gEntityTable["2550"] = "boxH";
+gEntityTable["2551"] = "boxV";
+gEntityTable["2552"] = "boxdR";
+gEntityTable["2553"] = "boxDr";
+gEntityTable["2554"] = "boxDR";
+gEntityTable["2555"] = "boxdL";
+gEntityTable["2556"] = "boxDl";
+gEntityTable["2557"] = "boxDL";
+gEntityTable["2558"] = "boxuR";
+gEntityTable["2559"] = "boxUr";
+gEntityTable["255A"] = "boxUR";
+gEntityTable["255B"] = "boxuL";
+gEntityTable["255C"] = "boxUl";
+gEntityTable["255D"] = "boxUL";
+gEntityTable["255E"] = "boxvR";
+gEntityTable["255F"] = "boxVr";
+gEntityTable["2560"] = "boxVR";
+gEntityTable["2561"] = "boxvL";
+gEntityTable["2562"] = "boxVl";
+gEntityTable["2563"] = "boxVL";
+gEntityTable["2564"] = "boxHd";
+gEntityTable["2565"] = "boxhD";
+gEntityTable["2566"] = "boxHD";
+gEntityTable["2567"] = "boxHu";
+gEntityTable["2568"] = "boxhU";
+gEntityTable["2569"] = "boxHU";
+gEntityTable["256A"] = "boxvH";
+gEntityTable["256B"] = "boxVh";
+gEntityTable["256C"] = "boxVH";
+gEntityTable["2580"] = "uhblk";
+gEntityTable["2584"] = "lhblk";
+gEntityTable["2588"] = "block";
+gEntityTable["2591"] = "blk14";
+gEntityTable["2592"] = "blk12";
+gEntityTable["2593"] = "blk34";
+gEntityTable["25A1"] = "Square";
+gEntityTable["25AA"] = "blacksquare";
+gEntityTable["25AD"] = "rect";
+gEntityTable["25AE"] = "marker";
+gEntityTable["25B3"] = "bigtriangleup";
+gEntityTable["25B4"] = "blacktriangle";
+gEntityTable["25B5"] = "triangle";
+gEntityTable["25B8"] = "blacktriangleright";
+gEntityTable["25B9"] = "triangleright";
+gEntityTable["25BD"] = "bigtriangledown";
+gEntityTable["25BE"] = "blacktriangledown";
+gEntityTable["25BF"] = "triangledown";
+gEntityTable["25C2"] = "blacktriangleleft";
+gEntityTable["25C3"] = "triangleleft";
+gEntityTable["25CA"] = "lozenge";
+gEntityTable["25CB"] = "cir";
+gEntityTable["25EC"] = "tridot";
+gEntityTable["25EF"] = "bigcirc";
+gEntityTable["25F8"] = "ultri";
+gEntityTable["25F9"] = "urtri";
+gEntityTable["25FA"] = "lltri";
+gEntityTable["25FD"] = "EmptySmallSquare";
+gEntityTable["25FE"] = "FilledSmallSquare";
+gEntityTable["2605"] = "bigstar";
+gEntityTable["260E"] = "phone";
+gEntityTable["2640"] = "female";
+gEntityTable["2642"] = "male";
+gEntityTable["2660"] = "spadesuit";
+gEntityTable["2661"] = "heartsuit";
+gEntityTable["2663"] = "clubsuit";
+gEntityTable["2665"] = "hearts";
+gEntityTable["2666"] = "diamondsuit";
+gEntityTable["266A"] = "sung";
+gEntityTable["266D"] = "flat";
+gEntityTable["266E"] = "natural";
+gEntityTable["266F"] = "sharp";
+gEntityTable["2713"] = "checkmark";
+gEntityTable["2717"] = "cross";
+gEntityTable["2720"] = "maltese";
+gEntityTable["2736"] = "sext";
+gEntityTable["2758"] = "VerticalSeparator";
+gEntityTable["2905"] = "Map";
+gEntityTable["290C"] = "lbarr";
+gEntityTable["290D"] = "bkarow";
+gEntityTable["290E"] = "lBarr";
+gEntityTable["290F"] = "dbkarow";
+gEntityTable["2910"] = "drbkarow";
+gEntityTable["2911"] = "DDotrahd";
+gEntityTable["2912"] = "UpArrowBar";
+gEntityTable["2913"] = "DownArrowBar";
+gEntityTable["2916"] = "Rarrtl";
+gEntityTable["2919"] = "latail";
+gEntityTable["291B"] = "lAtail";
+gEntityTable["291C"] = "rAtail";
+gEntityTable["291D"] = "larrfs";
+gEntityTable["291E"] = "rarrfs";
+gEntityTable["291F"] = "larrbfs";
+gEntityTable["2920"] = "rarrbfs";
+gEntityTable["2923"] = "nwarhk";
+gEntityTable["2924"] = "nearhk";
+gEntityTable["2925"] = "hksearow";
+gEntityTable["2926"] = "hkswarow";
+gEntityTable["2927"] = "nwnear";
+gEntityTable["2928"] = "nesear";
+gEntityTable["2929"] = "seswar";
+gEntityTable["292A"] = "swnwar";
+gEntityTable["2933"] = "rarrc";
+gEntityTable["2935"] = "cudarrr";
+gEntityTable["2936"] = "ldca";
+gEntityTable["2937"] = "rdca";
+gEntityTable["2938"] = "cudarrl";
+gEntityTable["2939"] = "larrpl";
+gEntityTable["293C"] = "curarrm";
+gEntityTable["293D"] = "cularrp";
+gEntityTable["2945"] = "rarrpl";
+gEntityTable["2948"] = "harrcir";
+gEntityTable["2949"] = "Uarrocir";
+gEntityTable["294A"] = "lurdshar";
+gEntityTable["294B"] = "ldrushar";
+gEntityTable["294E"] = "LeftRightVector";
+gEntityTable["294F"] = "RightUpDownVector";
+gEntityTable["2950"] = "DownLeftRightVector";
+gEntityTable["2951"] = "LeftUpDownVector";
+gEntityTable["2952"] = "LeftVectorBar";
+gEntityTable["2953"] = "RightVectorBar";
+gEntityTable["2954"] = "RightUpVectorBar";
+gEntityTable["2955"] = "RightDownVectorBar";
+gEntityTable["2956"] = "DownLeftVectorBar";
+gEntityTable["2957"] = "DownRightVectorBar";
+gEntityTable["2958"] = "LeftUpVectorBar";
+gEntityTable["2959"] = "LeftDownVectorBar";
+gEntityTable["295A"] = "LeftTeeVector";
+gEntityTable["295B"] = "RightTeeVector";
+gEntityTable["295C"] = "RightUpTeeVector";
+gEntityTable["295D"] = "RightDownTeeVector";
+gEntityTable["295E"] = "DownLeftTeeVector";
+gEntityTable["295F"] = "DownRightTeeVector";
+gEntityTable["2960"] = "LeftUpTeeVector";
+gEntityTable["2961"] = "LeftDownTeeVector";
+gEntityTable["2962"] = "lHar";
+gEntityTable["2963"] = "uHar";
+gEntityTable["2964"] = "rHar";
+gEntityTable["2965"] = "dHar";
+gEntityTable["2966"] = "luruhar";
+gEntityTable["2967"] = "ldrdhar";
+gEntityTable["2968"] = "ruluhar";
+gEntityTable["2969"] = "rdldhar";
+gEntityTable["296A"] = "lharul";
+gEntityTable["296B"] = "llhard";
+gEntityTable["296C"] = "rharul";
+gEntityTable["296D"] = "lrhard";
+gEntityTable["296E"] = "UpEquilibrium";
+gEntityTable["296F"] = "ReverseUpEquilibrium";
+gEntityTable["2970"] = "RoundImplies";
+gEntityTable["2971"] = "erarr";
+gEntityTable["2972"] = "simrarr";
+gEntityTable["2973"] = "larrsim";
+gEntityTable["2974"] = "rarrsim";
+gEntityTable["2975"] = "rarrap";
+gEntityTable["2976"] = "ltlarr";
+gEntityTable["2978"] = "gtrarr";
+gEntityTable["2979"] = "subrarr";
+gEntityTable["297B"] = "suplarr";
+gEntityTable["297C"] = "lfisht";
+gEntityTable["297D"] = "rfisht";
+gEntityTable["297E"] = "ufisht";
+gEntityTable["297F"] = "dfisht";
+gEntityTable["298B"] = "lbrke";
+gEntityTable["298C"] = "rbrke";
+gEntityTable["298D"] = "lbrkslu";
+gEntityTable["298E"] = "rbrksld";
+gEntityTable["298F"] = "lbrksld";
+gEntityTable["2990"] = "rbrkslu";
+gEntityTable["2991"] = "langd";
+gEntityTable["2992"] = "rangd";
+gEntityTable["2993"] = "lparlt";
+gEntityTable["2994"] = "rpargt";
+gEntityTable["2995"] = "gtlPar";
+gEntityTable["2996"] = "ltrPar";
+gEntityTable["299A"] = "vzigzag";
+gEntityTable["299D"] = "angrtvbd";
+gEntityTable["29A4"] = "ange";
+gEntityTable["29A5"] = "range";
+gEntityTable["29A6"] = "dwangle";
+gEntityTable["29A7"] = "uwangle";
+gEntityTable["29A8"] = "angmsdaa";
+gEntityTable["29A9"] = "angmsdab";
+gEntityTable["29AA"] = "angmsdac";
+gEntityTable["29AB"] = "angmsdad";
+gEntityTable["29AC"] = "angmsdae";
+gEntityTable["29AD"] = "angmsdaf";
+gEntityTable["29AE"] = "angmsdag";
+gEntityTable["29AF"] = "angmsdah";
+gEntityTable["29B0"] = "bemptyv";
+gEntityTable["29B1"] = "demptyv";
+gEntityTable["29B2"] = "cemptyv";
+gEntityTable["29B3"] = "raemptyv";
+gEntityTable["29B4"] = "laemptyv";
+gEntityTable["29B5"] = "ohbar";
+gEntityTable["29B6"] = "omid";
+gEntityTable["29B7"] = "opar";
+gEntityTable["29B9"] = "operp";
+gEntityTable["29BB"] = "olcross";
+gEntityTable["29BC"] = "odsold";
+gEntityTable["29BE"] = "olcir";
+gEntityTable["29BF"] = "ofcir";
+gEntityTable["29C0"] = "olt";
+gEntityTable["29C1"] = "ogt";
+gEntityTable["29C2"] = "cirscir";
+gEntityTable["29C3"] = "cirE";
+gEntityTable["29C4"] = "solb";
+gEntityTable["29C5"] = "bsolb";
+gEntityTable["29C9"] = "boxbox";
+gEntityTable["29CD"] = "trisb";
+gEntityTable["29CE"] = "rtriltri";
+gEntityTable["29CF"] = "LeftTriangleBar";
+gEntityTable["29D0"] = "RightTriangleBar";
+gEntityTable["29DA"] = "race";
+gEntityTable["29DB"] = "acE";
+gEntityTable["29DC"] = "iinfin";
+gEntityTable["29DE"] = "nvinfin";
+gEntityTable["29E3"] = "eparsl";
+gEntityTable["29E4"] = "smeparsl";
+gEntityTable["29E5"] = "eqvparsl";
+gEntityTable["29EB"] = "blacklozenge";
+gEntityTable["29F4"] = "RuleDelayed";
+gEntityTable["29F6"] = "dsol";
+gEntityTable["2A0C"] = "iiiint";
+gEntityTable["2A0D"] = "fpartint";
+gEntityTable["2A10"] = "cirfnint";
+gEntityTable["2A11"] = "awint";
+gEntityTable["2A12"] = "rppolint";
+gEntityTable["2A13"] = "scpolint";
+gEntityTable["2A14"] = "npolint";
+gEntityTable["2A15"] = "pointint";
+gEntityTable["2A16"] = "quatint";
+gEntityTable["2A17"] = "intlarhk";
+gEntityTable["2A22"] = "pluscir";
+gEntityTable["2A23"] = "plusacir";
+gEntityTable["2A24"] = "simplus";
+gEntityTable["2A25"] = "plusdu";
+gEntityTable["2A26"] = "plussim";
+gEntityTable["2A27"] = "plustwo";
+gEntityTable["2A29"] = "mcomma";
+gEntityTable["2A2A"] = "minusdu";
+gEntityTable["2A2D"] = "loplus";
+gEntityTable["2A2E"] = "roplus";
+gEntityTable["2A2F"] = "Cross";
+gEntityTable["2A30"] = "timesd";
+gEntityTable["2A31"] = "timesbar";
+gEntityTable["2A33"] = "smashp";
+gEntityTable["2A34"] = "lotimes";
+gEntityTable["2A35"] = "rotimes";
+gEntityTable["2A36"] = "otimesas";
+gEntityTable["2A37"] = "Otimes";
+gEntityTable["2A38"] = "odiv";
+gEntityTable["2A39"] = "triplus";
+gEntityTable["2A3A"] = "triminus";
+gEntityTable["2A3B"] = "tritime";
+gEntityTable["2A3C"] = "intprod";
+gEntityTable["2A3F"] = "amalg";
+gEntityTable["2A40"] = "capdot";
+gEntityTable["2A42"] = "ncup";
+gEntityTable["2A43"] = "ncap";
+gEntityTable["2A44"] = "capand";
+gEntityTable["2A45"] = "cupor";
+gEntityTable["2A46"] = "cupcap";
+gEntityTable["2A47"] = "capcup";
+gEntityTable["2A48"] = "cupbrcap";
+gEntityTable["2A49"] = "capbrcup";
+gEntityTable["2A4A"] = "cupcup";
+gEntityTable["2A4B"] = "capcap";
+gEntityTable["2A4C"] = "ccups";
+gEntityTable["2A4D"] = "ccaps";
+gEntityTable["2A50"] = "ccupssm";
+gEntityTable["2A53"] = "And";
+gEntityTable["2A54"] = "Or";
+gEntityTable["2A55"] = "andand";
+gEntityTable["2A56"] = "oror";
+gEntityTable["2A57"] = "orslope";
+gEntityTable["2A58"] = "andslope";
+gEntityTable["2A5A"] = "andv";
+gEntityTable["2A5B"] = "orv";
+gEntityTable["2A5C"] = "andd";
+gEntityTable["2A5D"] = "ord";
+gEntityTable["2A5F"] = "wedbar";
+gEntityTable["2A66"] = "sdote";
+gEntityTable["2A6A"] = "simdot";
+gEntityTable["2A6D"] = "congdot";
+gEntityTable["2A6F"] = "apacir";
+gEntityTable["2A71"] = "eplus";
+gEntityTable["2A72"] = "pluse";
+gEntityTable["2A73"] = "Esim";
+gEntityTable["2A74"] = "Colone";
+gEntityTable["2A75"] = "Equal";
+gEntityTable["2A77"] = "ddotseq";
+gEntityTable["2A78"] = "equivDD";
+gEntityTable["2A79"] = "ltcir";
+gEntityTable["2A7A"] = "gtcir";
+gEntityTable["2A7B"] = "ltquest";
+gEntityTable["2A7C"] = "gtquest";
+gEntityTable["2A7D"] = "LessSlantEqual";
+gEntityTable["2A7E"] = "GreaterSlantEqual";
+gEntityTable["2A7F"] = "lesdot";
+gEntityTable["2A80"] = "gesdot";
+gEntityTable["2A81"] = "lesdoto";
+gEntityTable["2A82"] = "gesdoto";
+gEntityTable["2A83"] = "lesdotor";
+gEntityTable["2A84"] = "gesdotol";
+gEntityTable["2A89"] = "lnapprox";
+gEntityTable["2A8A"] = "gnapprox";
+gEntityTable["2A8D"] = "lsime";
+gEntityTable["2A8E"] = "gsime";
+gEntityTable["2A8F"] = "lsimg";
+gEntityTable["2A90"] = "gsiml";
+gEntityTable["2A91"] = "lgE";
+gEntityTable["2A92"] = "glE";
+gEntityTable["2A93"] = "lesges";
+gEntityTable["2A94"] = "gesles";
+gEntityTable["2A97"] = "elsdot";
+gEntityTable["2A98"] = "egsdot";
+gEntityTable["2A99"] = "el";
+gEntityTable["2A9A"] = "eg";
+gEntityTable["2A9D"] = "siml";
+gEntityTable["2A9E"] = "simg";
+gEntityTable["2A9F"] = "simlE";
+gEntityTable["2AA0"] = "simgE";
+gEntityTable["2AA1"] = "LessLess";
+gEntityTable["2AA2"] = "GreaterGreater";
+gEntityTable["2AA4"] = "glj";
+gEntityTable["2AA5"] = "gla";
+gEntityTable["2AA6"] = "ltcc";
+gEntityTable["2AA7"] = "gtcc";
+gEntityTable["2AA8"] = "lescc";
+gEntityTable["2AA9"] = "gescc";
+gEntityTable["2AAA"] = "smt";
+gEntityTable["2AAB"] = "lat";
+gEntityTable["2AAC"] = "smte";
+gEntityTable["2AAD"] = "late";
+gEntityTable["2AAE"] = "bumpE";
+gEntityTable["2AAF"] = "PrecedesEqual";
+gEntityTable["2AB5"] = "precneqq";
+gEntityTable["2AB6"] = "succneqq";
+gEntityTable["2ABB"] = "Pr";
+gEntityTable["2ABC"] = "Sc";
+gEntityTable["2ABD"] = "subdot";
+gEntityTable["2ABE"] = "supdot";
+gEntityTable["2ABF"] = "subplus";
+gEntityTable["2AC0"] = "supplus";
+gEntityTable["2AC1"] = "submult";
+gEntityTable["2AC2"] = "supmult";
+gEntityTable["2AC3"] = "subedot";
+gEntityTable["2AC4"] = "supedot";
+gEntityTable["2AC7"] = "subsim";
+gEntityTable["2AC8"] = "supsim";
+gEntityTable["2ACF"] = "csub";
+gEntityTable["2AD0"] = "csup";
+gEntityTable["2AD1"] = "csube";
+gEntityTable["2AD2"] = "csupe";
+gEntityTable["2AD3"] = "subsup";
+gEntityTable["2AD4"] = "supsub";
+gEntityTable["2AD5"] = "subsub";
+gEntityTable["2AD6"] = "supsup";
+gEntityTable["2AD7"] = "suphsub";
+gEntityTable["2AD8"] = "supdsub";
+gEntityTable["2AD9"] = "forkv";
+gEntityTable["2ADA"] = "topfork";
+gEntityTable["2ADB"] = "mlcp";
+gEntityTable["2AE4"] = "DoubleLeftTee";
+gEntityTable["2AE6"] = "Vdashl";
+gEntityTable["2AE7"] = "Barv";
+gEntityTable["2AE8"] = "vBar";
+gEntityTable["2AE9"] = "vBarv";
+gEntityTable["2AEB"] = "Vbar";
+gEntityTable["2AEC"] = "Not";
+gEntityTable["2AED"] = "bNot";
+gEntityTable["2AEE"] = "rnmid";
+gEntityTable["2AEF"] = "cirmid";
+gEntityTable["2AF0"] = "midcir";
+gEntityTable["2AF1"] = "topcir";
+gEntityTable["2AF2"] = "nhpar";
+gEntityTable["2AF3"] = "parsim";
+gEntityTable["300A"] = "Lang";
+gEntityTable["300B"] = "Rang";
+gEntityTable["3014"] = "lbbrk";
+gEntityTable["3015"] = "rbbrk";
+gEntityTable["3018"] = "lopar";
+gEntityTable["3019"] = "ropar";
+gEntityTable["301A"] = "LeftDoubleBracket";
+gEntityTable["301B"] = "RightDoubleBracket";
+gEntityTable["EEEE"] = "bne";
+gEntityTable["EEEF"] = "bsolhsub";
+gEntityTable["EEF0"] = "jmath";
+gEntityTable["EEF1"] = "NegativeThickSpace";
+gEntityTable["EEF2"] = "ThickSpace";
+gEntityTable["EEF3"] = "NegativeThinSpace";
+gEntityTable["EEF4"] = "NegativeVeryThinSpace";
+gEntityTable["EEF5"] = "NegativeMediumSpace";
+gEntityTable["EEF6"] = "planck";
+gEntityTable["EEF7"] = "ShortLeftArrow";
+gEntityTable["EEF8"] = "ShortRightArrow";
+gEntityTable["EEF9"] = "nrarrw";
+gEntityTable["EEFA"] = "npart";
+gEntityTable["EEFB"] = "emptyset";
+gEntityTable["EEFC"] = "notinva";
+gEntityTable["EEFD"] = "smallsetminus";
+gEntityTable["EEFE"] = "nang";
+gEntityTable["EEFF"] = "shortmid";
+gEntityTable["EF00"] = "nshortmid";
+gEntityTable["EF01"] = "shortparallel";
+gEntityTable["EF02"] = "nparsl";
+gEntityTable["EF03"] = "nshortparallel";
+gEntityTable["EF04"] = "caps";
+gEntityTable["EF05"] = "cups";
+gEntityTable["EF06"] = "thicksim";
+gEntityTable["EF07"] = "nvsim";
+gEntityTable["EF08"] = "NotEqualTilde";
+gEntityTable["EF09"] = "thickapprox";
+gEntityTable["EF0A"] = "nvap";
+gEntityTable["EF0B"] = "napid";
+gEntityTable["EF0C"] = "NotHumpDownHump";
+gEntityTable["EF0D"] = "NotHumpEqual";
+gEntityTable["EF0E"] = "nedot";
+gEntityTable["EF0F"] = "bnequiv";
+gEntityTable["EF10"] = "lvertneqq";
+gEntityTable["EF11"] = "gvertneqq";
+gEntityTable["EF12"] = "nLt";
+gEntityTable["EF13"] = "NotLessLess";
+gEntityTable["EF14"] = "nGt";
+gEntityTable["EF15"] = "NotGreaterGreater";
+gEntityTable["EF16"] = "NotLessEqual";
+gEntityTable["EF17"] = "NotGreaterEqual";
+gEntityTable["EF18"] = "NotSucceedsTilde";
+gEntityTable["EF19"] = "suphsol";
+gEntityTable["EF1A"] = "varsubsetneqq";
+gEntityTable["EF1B"] = "varsupsetneqq";
+gEntityTable["EF1C"] = "NotSquareSubset";
+gEntityTable["EF1D"] = "NotSquareSuperset";
+gEntityTable["EF1E"] = "sqcaps";
+gEntityTable["EF1F"] = "sqcups";
+gEntityTable["EF20"] = "nLl";
+gEntityTable["EF21"] = "nGg";
+gEntityTable["EF22"] = "lesg";
+gEntityTable["EF23"] = "gesl";
+gEntityTable["EF24"] = "nvltrie";
+gEntityTable["EF25"] = "nvrtrie";
+gEntityTable["EF26"] = "notindot";
+gEntityTable["EF27"] = "ShortUpArrow";
+gEntityTable["EF28"] = "ShortDownArrow";
+gEntityTable["EF29"] = "NotNestedLessLess";
+gEntityTable["EF2A"] = "NotNestedGreaterGreater";
+gEntityTable["EF2B"] = "nrarrc";
+gEntityTable["EF2C"] = "angrtvb";
+gEntityTable["EF2D"] = "NotLeftTriangleBar";
+gEntityTable["EF2E"] = "NotRightTriangleBar";
+gEntityTable["EF2F"] = "ncongdot";
+gEntityTable["EF30"] = "napE";
+gEntityTable["EF31"] = "smtes";
+gEntityTable["EF32"] = "lates";
+gEntityTable["EF33"] = "NotPrecedesEqual";
+gEntityTable["EF34"] = "NotSucceedsEqual";
+gEntityTable["EF35"] = "Ascr";
+gEntityTable["EF36"] = "Cscr";
+gEntityTable["EF37"] = "Dscr";
+gEntityTable["EF38"] = "Gscr";
+gEntityTable["EF39"] = "Jscr";
+gEntityTable["EF3A"] = "Kscr";
+gEntityTable["EF3B"] = "Nscr";
+gEntityTable["EF3C"] = "Oscr";
+gEntityTable["EF3D"] = "Pscr";
+gEntityTable["EF3E"] = "Qscr";
+gEntityTable["EF3F"] = "Sscr";
+gEntityTable["EF40"] = "Tscr";
+gEntityTable["EF41"] = "Uscr";
+gEntityTable["EF42"] = "Vscr";
+gEntityTable["EF43"] = "Wscr";
+gEntityTable["EF44"] = "Xscr";
+gEntityTable["EF45"] = "Yscr";
+gEntityTable["EF46"] = "Zscr";
+gEntityTable["EF47"] = "ascr";
+gEntityTable["EF48"] = "bscr";
+gEntityTable["EF49"] = "cscr";
+gEntityTable["EF4A"] = "dscr";
+gEntityTable["EF4B"] = "fscr";
+gEntityTable["EF4C"] = "hscr";
+gEntityTable["EF4D"] = "iscr";
+gEntityTable["EF4E"] = "jscr";
+gEntityTable["EF4F"] = "kscr";
+gEntityTable["EF50"] = "mscr";
+gEntityTable["EF51"] = "nscr";
+gEntityTable["EF52"] = "pscr";
+gEntityTable["EF53"] = "qscr";
+gEntityTable["EF54"] = "rscr";
+gEntityTable["EF55"] = "sscr";
+gEntityTable["EF56"] = "tscr";
+gEntityTable["EF57"] = "uscr";
+gEntityTable["EF58"] = "vscr";
+gEntityTable["EF59"] = "wscr";
+gEntityTable["EF5A"] = "xscr";
+gEntityTable["EF5B"] = "yscr";
+gEntityTable["EF5C"] = "zscr";
+gEntityTable["EF5D"] = "Afr";
+gEntityTable["EF5E"] = "Bfr";
+gEntityTable["EF5F"] = "Dfr";
+gEntityTable["EF60"] = "Efr";
+gEntityTable["EF61"] = "Ffr";
+gEntityTable["EF62"] = "Gfr";
+gEntityTable["EF63"] = "Jfr";
+gEntityTable["EF64"] = "Kfr";
+gEntityTable["EF65"] = "Lfr";
+gEntityTable["EF66"] = "Mfr";
+gEntityTable["EF67"] = "Nfr";
+gEntityTable["EF68"] = "Ofr";
+gEntityTable["EF69"] = "Pfr";
+gEntityTable["EF6A"] = "Qfr";
+gEntityTable["EF6B"] = "Sfr";
+gEntityTable["EF6C"] = "Tfr";
+gEntityTable["EF6D"] = "Ufr";
+gEntityTable["EF6E"] = "Vfr";
+gEntityTable["EF6F"] = "Wfr";
+gEntityTable["EF70"] = "Xfr";
+gEntityTable["EF71"] = "Yfr";
+gEntityTable["EF72"] = "afr";
+gEntityTable["EF73"] = "bfr";
+gEntityTable["EF74"] = "cfr";
+gEntityTable["EF75"] = "dfr";
+gEntityTable["EF76"] = "efr";
+gEntityTable["EF77"] = "ffr";
+gEntityTable["EF78"] = "gfr";
+gEntityTable["EF79"] = "hfr";
+gEntityTable["EF7A"] = "ifr";
+gEntityTable["EF7B"] = "jfr";
+gEntityTable["EF7C"] = "kfr";
+gEntityTable["EF7D"] = "lfr";
+gEntityTable["EF7E"] = "mfr";
+gEntityTable["EF7F"] = "nfr";
+gEntityTable["EF80"] = "ofr";
+gEntityTable["EF81"] = "pfr";
+gEntityTable["EF82"] = "qfr";
+gEntityTable["EF83"] = "rfr";
+gEntityTable["EF84"] = "sfr";
+gEntityTable["EF85"] = "tfr";
+gEntityTable["EF86"] = "ufr";
+gEntityTable["EF87"] = "vfr";
+gEntityTable["EF88"] = "wfr";
+gEntityTable["EF89"] = "xfr";
+gEntityTable["EF8A"] = "yfr";
+gEntityTable["EF8B"] = "zfr";
+gEntityTable["EF8C"] = "Aopf";
+gEntityTable["EF8D"] = "Bopf";
+gEntityTable["EF8E"] = "Dopf";
+gEntityTable["EF8F"] = "Eopf";
+gEntityTable["EF90"] = "Fopf";
+gEntityTable["EF91"] = "Gopf";
+gEntityTable["EF92"] = "Iopf";
+gEntityTable["EF93"] = "Jopf";
+gEntityTable["EF94"] = "Kopf";
+gEntityTable["EF95"] = "imped";
+gEntityTable["EF96"] = "Mopf";
+gEntityTable["EF97"] = "Oopf";
+gEntityTable["EF98"] = "Sopf";
+gEntityTable["EF99"] = "Topf";
+gEntityTable["EF9A"] = "Uopf";
+gEntityTable["EF9B"] = "Vopf";
+gEntityTable["EF9C"] = "Wopf";
+gEntityTable["EF9D"] = "Xopf";
+gEntityTable["EF9E"] = "Yopf";
+gEntityTable["EF9F"] = "aopf";
+gEntityTable["EFA0"] = "bopf";
+gEntityTable["EFA1"] = "copf";
+gEntityTable["EFA2"] = "dopf";
+gEntityTable["EFA3"] = "eopf";
+gEntityTable["EFA4"] = "fopf";
+gEntityTable["EFA5"] = "gopf";
+gEntityTable["EFA6"] = "hopf";
+gEntityTable["EFA7"] = "iopf";
+gEntityTable["EFA8"] = "jopf";
+gEntityTable["EFA9"] = "kopf";
+gEntityTable["EFAA"] = "lopf";
+gEntityTable["EFAB"] = "mopf";
+gEntityTable["EFAC"] = "nopf";
+gEntityTable["EFAD"] = "oopf";
+gEntityTable["EFAE"] = "popf";
+gEntityTable["EFAF"] = "qopf";
+gEntityTable["EFB0"] = "ropf";
+gEntityTable["EFB1"] = "sopf";
+gEntityTable["EFB2"] = "topf";
+gEntityTable["EFB3"] = "uopf";
+gEntityTable["EFB4"] = "vopf";
+gEntityTable["EFB5"] = "wopf";
+gEntityTable["EFB6"] = "xopf";
+gEntityTable["EFB7"] = "yopf";
+gEntityTable["EFB8"] = "zopf";
+gEntityTable["F558"] = "loang";
+gEntityTable["F559"] = "roang";
+gEntityTable["F576"] = "LongLeftArrow";
+gEntityTable["F577"] = "LongRightArrow";
+gEntityTable["F578"] = "LongLeftRightArrow";
+gEntityTable["F579"] = "DoubleLongLeftArrow";
+gEntityTable["F57A"] = "DoubleLongRightArrow";
+gEntityTable["F57B"] = "DoubleLongLeftRightArrow";
+gEntityTable["F57D"] = "longmapsto";
+gEntityTable["F59B"] = "FilledVerySmallSquare";
+gEntityTable["F59C"] = "EmptyVerySmallSquare";
+gEntityTable["F5A2"] = "dzigrarr";
+gEntityTable["FB00"] = "fflig";
+gEntityTable["FB01"] = "filig";
+gEntityTable["FB02"] = "fllig";
+gEntityTable["FB03"] = "ffilig";
+gEntityTable["FB04"] = "ffllig";
+gEntityTable["FE35"] = "OverParenthesis";
+gEntityTable["FE36"] = "UnderParenthesis";
+gEntityTable["FE37"] = "OverBrace";
+gEntityTable["FE38"] = "UnderBrace";
+gEntityTable["FEFF"] = "NoBreak";
+
+function unicode2entity(text)
+{
+ var str = '';
+ for (var i = 0; i < text.length; i++) {
+ var c = text.charCodeAt(i);
+ if (c < 0x7F) {
+ if (text[i] == '<')
+ str += '&<span class="entity">lt;</span>';
+ else if (text[i] == '>')
+ str += '&<span class="entity">gt;</span>';
+ else
+ str += text[i];
+ }
+ else {
+ var unichar = c.toString(16).toUpperCase();
+ while (unichar.length < 4)
+ unichar = '0' + unichar;
+ if (unichar in gEntityTable)
+ str += '&<span class="entity">' + gEntityTable[unichar] + ';</span>';
+ else
+ str += '&<span class="entity">#x' + unichar + ';</span>';
+ }
+ }
+ return str;
+}
diff --git a/html/libjs/viewmath.js b/html/libjs/viewmath.js
new file mode 100644
index 0000000..9150d26
--- /dev/null
+++ b/html/libjs/viewmath.js
@@ -0,0 +1,161 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the"License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an"AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla MathML Project.
+ *
+ * The Initial Developer of the Original Code is The University Of
+ * Queensland. Portions created by The University Of Queensland are
+ * Copyright (C) 2002 The University Of Queensland. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Roger B. Sidje <rbs at maths.uq.edu.au>
+ * Steve Swanson <steve.swanson at mackichan.com>
+ *
+ */
+
+var gDebug = 0;
+var gLineCount = 0;
+var gStartTargetLine = 0;
+var gEndTargetLine = 0;
+var gTargetNode = null;
+var gWYSIWYGWindow = null;
+// had to use an absolute path here, otherwise Mozilla is confused when the
+// script is loaded from a directory different from where the CSS resides
+var gViewSourceCSS = 'http://www.mozilla.org/projects/mathml/demo/viewsource.css';
+
+function viewmath(evt) {
+ evt.preventBubble();
+ gLineCount = 0;
+ gStartTargetLine = 0;
+ gEndTargetLine = 0;
+ gTargetNode = evt.target;
+ if (gTargetNode.nodeType == Node.TEXT_NODE) { // leaf text
+ gTargetNode = gTargetNode.parentNode;
+ }
+ var m = findmathparent(evt.target);
+ if (m) {
+ gWYSIWYGWindow = open("", "wysiwyg", "scrollbars=1,resizable=1,width=500,height=200");
+ gWYSIWYGWindow.document.open();
+ with (gWYSIWYGWindow.document) {
+ writeln('<html><base target="wysiwyg">');
+ writeln('<head><title>MathML WYSIWYG Source</title>');
+ writeln('<link rel="stylesheet" type="text/css" href="'+gViewSourceCSS+'">');
+ writeln('<style>#target{border:dashed 1px; background-color:lightyellow;}</style>');
+ writeln('<script>');
+ writeln('function scrollToTarget() {');
+ // bug: self.location.hash = 'anchor'; doesn't work
+ writeln(' var anchor = document.anchors["target"];');
+ writeln(' scrollTo(0/*anchor.offsetLeft*/, anchor.offsetTop);');
+ writeln('}');
+ writeln('</script>');
+ writeln('</head>');
+ write('<body id="viewsource" onload="window.focus();scrollToTarget();">');
+//if wrapping... write('<body id="viewsource" class="wrap" onload="window.focus();scrollToTarget();">');
+ write('<pre>');
+ writeln(getOuterMarkup(m,0));
+ writeln('</pre></body></html>');
+ }
+ gWYSIWYGWindow.document.close();
+ }
+}
+
+function findmathparent(node) {
+ while (node && node.nodeName.indexOf("math") == -1)
+ node = node.parentNode;
+ return node;
+}
+
+function getInnerMarkup(n, indent) {
+ var str = '';
+ for (var i = 0; i<n.childNodes.length; i++)
+ str += getOuterMarkup(n.childNodes.item(i),indent);
+ return str;
+}
+
+function getOuterMarkup(n, indent) {
+ var newline = '';
+ var padding = '';
+ var str = '';
+ if (n == gTargetNode) {
+ gStartTargetLine = gLineCount;
+ str += '</pre><a name="target"></a><pre id="target">';
+ }
+
+ switch (n.nodeType) {
+ case Node.ELEMENT_NODE: // Element
+ // to avoid the wide gap problem, '\n' is not emitted on the first
+ // line and the lines before & after the <pre id="target">...</pre>
+ newline = '';
+ if (gLineCount > 0) {
+ newline = '\n';
+ }
+ if (gLineCount == gStartTargetLine ||
+ gLineCount == gEndTargetLine) {
+ newline = '';
+ }
+ gLineCount++;
+ if (gDebug) {
+ newline += gLineCount;
+ }
+ for (var k=0; k<indent; k++) {
+ padding += ' ';
+ }
+ str += newline + padding + '<<span class="start-tag">' + n.nodeName + '</span>';
+ for (var i=0; i<n.attributes.length; i++) {
+ var attr = n.attributes.item(i);
+ if (!gDebug && attr.nodeName.match(/^-moz-math-/)) {
+ continue;
+ }
+ str += ' <span class="attribute-name">';
+ str += attr.nodeName;
+ str += '</span>=<span class="attribute-value">"';
+ str += unicode2entity(attr.nodeValue);
+ str += '"</span>';
+ }
+ str += '>';
+ var oldLine = gLineCount;
+ str += getInnerMarkup(n, indent + 2);
+ if (oldLine == gLineCount) {
+ newline = '';
+ padding = '';
+ }
+ else {
+ newline = '\n';
+ if (gLineCount == gEndTargetLine) {
+ newline = '';
+ }
+ gLineCount++;
+ if (gDebug) {
+ newline += gLineCount;
+ }
+ }
+ str += newline + padding + '</<span class="end-tag">' + n.nodeName + '</span>>';
+ break;
+ case Node.TEXT_NODE: // Text
+ var tmp = n.nodeValue;
+ tmp = tmp.toString();
+ tmp = tmp.replace(/(\n|\r|\t)+/g, " ");
+ tmp = tmp.replace(/\s+/," ");
+ tmp = tmp.replace(/^\s+/, "");
+ tmp = tmp.replace(/\s+$/,"");
+ if (tmp.length != 0) {
+ str += '<span class="text">' + unicode2entity(tmp) + '</span>';
+ }
+ break;
+ default:
+ break;
+ }
+ if (n == gTargetNode) {
+ gEndTargetLine = gLineCount;
+ str += '</pre><pre>';
+ }
+ return str;
+}
diff --git a/html/math/math1.mml b/html/math/math1.mml
new file mode 100644
index 0000000..8eb7fb7
--- /dev/null
+++ b/html/math/math1.mml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN" "math.dtd">
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mi math:fontstyle="italic">Jx</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:munderover>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>j</math:mi>
+ <math:mi>r</math:mi>
+ </math:munderover>
+ <math:mrow>
+ <math:munderover>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>i</math:mi>
+ <math:msub>
+ <math:mi>m</math:mi>
+ <math:mi>j</math:mi>
+ </math:msub>
+ </math:munderover>
+ <math:msubsup>
+ <math:mi>x</math:mi>
+ <math:mi math:fontstyle="italic">ij</math:mi>
+ <math:mn>2</math:mn>
+ </math:msubsup>
+ </math:mrow>
+ </math:mrow>
+ <math:mi>r</math:mi>
+ </math:mfrac>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">Jx = sum from{j} to{r} sum from{i} to{m_j} x^{2} _ij over r</math:annotation>
+ </math:semantics>
+</math:math>
\ No newline at end of file
diff --git a/html/math/math1.odf b/html/math/math1.odf
new file mode 100644
index 0000000..dc62136
Binary files /dev/null and b/html/math/math1.odf differ
diff --git a/html/old/formules/das.xhtml b/html/old/formules/das.xhtml
new file mode 100755
index 0000000..573bd6c
--- /dev/null
+++ b/html/old/formules/das.xhtml
@@ -0,0 +1,230 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Shared allele distance (Chakraborty and Jin, 1993) [Jin, L. 93]</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Shared allele distance (Chakraborty and Jin, 1993) [Jin, L. 93]"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+Shared allele distance (Chakraborty and Jin, 1993) [<a
+ href="../index.html#pubdas">Jin, L. 93</a>]
+</h2>
+
+<div>
+between individuals:
+<br/>
+<!-- MATH
+ $D_{SA_{I}}=1-P_{SA_{I}}$
+ -->
+
+ <math xmlns="&mathml;">
+ <semantics>
+ <mrow>
+ <msub>
+ <mi>D</mi>
+ <msub>
+ <mi>SA</mi>
+ <mi>I</mi>
+ </msub>
+ </msub>
+ <mo>=</mo>
+ <mrow>
+ <mn>1</mn>
+ <mo>−</mo>
+ <msub>
+ <mi>P</mi>
+ <msub>
+ <mi>SA</mi>
+ <mi>I</mi>
+ </msub>
+ </msub>
+ </mrow>
+ </mrow>
+ <annotation encoding="StarMath 5.0">D_{SA_{I}}=1-P_{SA_{I}}</annotation>
+ </semantics>
+
+</math>
+
+ <!--
+<IMG
+ WIDTH="127" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img8.png"
+ ALT="\( D_{SA_{I}}=1-P_{SA_{I}} \)">
+ -->
+ , with
+ <math xmlns="&mathml;">
+ <semantics>
+ <mrow>
+ <msub>
+ <mi>P</mi>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>I</mi>
+ </msub>
+ </msub>
+ <mo stretchy="false">=</mo>
+ <mfrac>
+ <mrow>
+ <msubsup>
+ <mo stretchy="false">∑</mo>
+ <mi>j</mi>
+ <mi>r</mi>
+ </msubsup>
+ <mi>S</mi>
+ </mrow>
+ <mn>2r</mn>
+ </mfrac>
+ </mrow>
+ <annotation encoding="StarMath 5.0">P_{SA_{I}}={sum ^{r}_{j}S} over {2r}
+
+</annotation>
+ </semantics>
+</math>
+ <!--
+<IMG
+ WIDTH="98" HEIGHT="54" ALIGN="MIDDLE" BORDER="0"
+ SRC="img9.png"
+ ALT="\( P_{SA_{I}}=\frac{\sum ^{r}_{j}S}{2r} \)">
+-->
+<div>
+where the number of shared alleles S is sumed over all loci r.
+</div>
+<div>
+
+between populations:
+</div>
+<div>
+<math mode="display" xmlns="&mathml;" >
+ <semantics>
+ <mrow>
+ <msub>
+ <mi>D</mi>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>B</mi>
+ </msub>
+ </msub>
+ <mo stretchy="false">=</mo>
+ <mrow>
+ <mn>1</mn>
+ <mo stretchy="false">−</mo>
+ <mfrac>
+ <mrow>
+ <mn>2</mn>
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>B</mi>
+ </msub>
+ </msub>
+ </mrow>
+ <mrow>
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>X</mi>
+ </msub>
+ </msub>
+ <mo stretchy="false">+</mo>
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>Y</mi>
+ </msub>
+ </msub>
+ </mrow>
+ </mfrac>
+ </mrow>
+ </mrow>
+ <annotation encoding="StarMath 5.0">D_{SA_{B}}=1-{2{bar{P}}_{SA_{B}}}over{{bar{P}}_{SA_{X}}+{bar{P}}_{SA_{Y}}}</annotation>
+ </semantics>
+</math>
+ <!--
+<IMG
+ WIDTH="194" HEIGHT="48" BORDER="0"
+ SRC="img10.png"
+ ALT="\begin{displaymath}
+D_{SA_{B}}=1-\frac{2\overline{P}_{SA_{B}}}{\overline{P}_{SA_{X}}+\overline{P}_{SA_{Y}}}\end{displaymath}"/>
+</DIV>
+<br/>
+<P></P>
+-->
+</div>
+<div>
+where the average proportion of shared alleles between and within
+populations X and Y (
+<math xmlns="&mathml;">
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>B</mi>
+ </msub>
+ </msub>
+ </math>
+ ,
+ <math xmlns="&mathml;" class="inclus">
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>X</mi>
+ </msub>
+ </msub>
+ </math>
+ ,
+ <math class="inclus" xmlns="&mathml;">
+ <msub>
+ <mover accent="true">
+ <mi>P</mi>
+ <mo stretchy="false">ˉ</mo>
+ </mover>
+ <msub>
+ <mi fontstyle="italic">SA</mi>
+ <mi>Y</mi>
+ </msub>
+ </msub>
+ </math>
+ <!--
+<IMG
+ WIDTH="45" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
+ SRC="img13.png"
+ ALT="\( \overline{P}_{SA_{Y}} \)"/>
+ -->
+respectively) is computed overall possible combinations of individuals
+sampled.
+
+</div>
+</div>
+</body>
+</html>
diff --git a/html/old/formules/das_a.mml b/html/old/formules/das_a.mml
new file mode 100644
index 0000000..7da18d2
--- /dev/null
+++ b/html/old/formules/das_a.mml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN" "math.dtd">
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:msub>
+ <math:mi>D</math:mi>
+ <math:msub>
+ <math:mi math:fontstyle="italic">SA</math:mi>
+ <math:mi>I</math:mi>
+ </math:msub>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:msub>
+ <math:mi>P</math:mi>
+ <math:msub>
+ <math:mi math:fontstyle="italic">SA</math:mi>
+ <math:mi>I</math:mi>
+ </math:msub>
+ </math:msub>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">D_{SA_{I}}=1-P_{SA_{I}}</math:annotation>
+ </math:semantics>
+</math:math>
diff --git a/html/old/formules/das_b.mml b/html/old/formules/das_b.mml
new file mode 100644
index 0000000..0af062e
--- /dev/null
+++ b/html/old/formules/das_b.mml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN" "math.dtd">
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:msub>
+ <math:mi>P</math:mi>
+ <math:msub>
+ <math:mi math:fontstyle="italic">SA</math:mi>
+ <math:mi>I</math:mi>
+ </math:msub>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:msubsup>
+ <math:mo math:stretchy="false">∑</math:mo>
+ <math:mi>j</math:mi>
+ <math:mi>r</math:mi>
+ </math:msubsup>
+ <math:mi>S</math:mi>
+ </math:mrow>
+ <math:mn>2r</math:mn>
+ </math:mfrac>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">P_{SA_{I}}={sum ^{r}_{j}S} over {2r}
+
+</math:annotation>
+ </math:semantics>
+</math:math>
\ No newline at end of file
diff --git a/html/old/formules/das_c.mml b/html/old/formules/das_c.mml
new file mode 100644
index 0000000..7eb2229
--- /dev/null
+++ b/html/old/formules/das_c.mml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN" "math.dtd">
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:msub>
+ <math:mi>D</math:mi>
+ <math:msub>
+ <math:mi math:fontstyle="italic">SA</math:mi>
+ <math:mi>B</math:mi>
+ </math:msub>
+ </math:msub>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mn>1</math:mn>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mfrac>
+ <math:mrow>
+ <math:mn>2</math:mn>
+ <math:msub>
+ <math:mover math:accent="true">
+ <math:mi>P</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ <math:msub>
+ <math:mi math:fontstyle="italic">SA</math:mi>
+ <math:mi>B</math:mi>
+ </math:msub>
+ </math:msub>
+ </math:mrow>
+ <math:mrow>
+ <math:msub>
+ <math:mover math:accent="true">
+ <math:mi>P</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ <math:msub>
+ <math:mi math:fontstyle="italic">SA</math:mi>
+ <math:mi>X</math:mi>
+ </math:msub>
+ </math:msub>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mover math:accent="true">
+ <math:mi>P</math:mi>
+ <math:mo math:stretchy="false">ˉ</math:mo>
+ </math:mover>
+ <math:msub>
+ <math:mi math:fontstyle="italic">SA</math:mi>
+ <math:mi>Y</math:mi>
+ </math:msub>
+ </math:msub>
+ </math:mrow>
+ </math:mfrac>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">D_{SA_{B}}=1-{2{bar{P}}_{SA_{B}}}over{{bar{P}}_{SA_{X}}+{bar{P}}_{SA_{Y}}}</math:annotation>
+ </math:semantics>
+</math:math>
\ No newline at end of file
diff --git a/html/old/formules/formules.html b/html/old/formules/formules.html
new file mode 100755
index 0000000..7947cf5
--- /dev/null
+++ b/html/old/formules/formules.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>formules</TITLE>
+<META NAME="description" CONTENT="formules">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node1.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html2"
+ HREF="node1.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up_g.png">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev_g.png">
+<BR>
+<B> Next:</B> <A NAME="tex2html3"
+ HREF="node1.html">Distances</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<P>
+<BR><HR>
+<!--Table of Child-Links-->
+<A NAME="CHILD_LINKS"></A>
+
+<UL>
+<LI><A NAME="tex2html4"
+ HREF="node1.html">Distances</A>
+<UL>
+<LI><A NAME="tex2html5"
+ HREF="node2.html">IAM distances</A>
+<UL>
+<LI><A NAME="tex2html6"
+ HREF="node3.html">Shared allele distance (Chakraborty and Jin, 1993) [Jin, L. 93]</A>
+<LI><A NAME="tex2html7"
+ HREF="node4.html">Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html8"
+ HREF="node5.html">Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html9"
+ HREF="node6.html">Latter's (1972) Fst (=<IMG
+ WIDTH="14" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img16.png"
+ ALT="\( \phi \protect \)">*) distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html10"
+ HREF="node7.html">Rogers' (1972) distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html11"
+ HREF="node8.html">Prevosti et al's (1975) distance [Takezaki, N. 96] has a statistical property
+similar to that of Dr and is defined as</A>
+<LI><A NAME="tex2html12"
+ HREF="node9.html">Cavali-Sforza and Edwards' (1967) chord distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html13"
+ HREF="node10.html">Nei et al's (1983) <IMG
+ WIDTH="28" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img21.png"
+ ALT="\( D_{A}\protect \)"> distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html14"
+ HREF="node11.html">Sanghvi's (1953) <IMG
+ WIDTH="26" HEIGHT="16" ALIGN="BOTTOM" BORDER="0"
+ SRC="img23.png"
+ ALT="\( X^{2}\protect \)"> distance[Takezaki, N. 96]</A>
+<LI><A NAME="tex2html15"
+ HREF="node12.html">Reynold's genetic distance for short-term evolution (1983) [Reynolds, J. 83]</A>
+<UL>
+<LI><A NAME="tex2html16"
+ HREF="node13.html">unweighted average of single-locus ratio estimators, <!-- MATH
+ $\tilde{\theta }_{U}\protect$
+ -->
+<IMG
+ WIDTH="22" HEIGHT="37" ALIGN="MIDDLE" BORDER="0"
+ SRC="img30.png"
+ ALT="\( \tilde{\theta }_{U}\protect \)">:</A>
+<LI><A NAME="tex2html17"
+ HREF="node14.html">weighted average of single-locus ratio estimators :</A>
+<LI><A NAME="tex2html18"
+ HREF="node15.html">least squares <!-- MATH
+ $\theta \protect$
+ -->
+<IMG
+ WIDTH="12" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
+ SRC="img1.png"
+ ALT="\( \theta \)"> estimator :</A>
+</UL>
+</UL>
+<LI><A NAME="tex2html19"
+ HREF="node16.html">SMM distances</A>
+<UL>
+<LI><A NAME="tex2html20"
+ HREF="node17.html">Goldstein et al. (1995a) [Goldstein, D.B. 97]</A>
+<LI><A NAME="tex2html21"
+ HREF="node18.html">average square distance (ASD) (Goldstein et al. 1995b; Slatkin 1995)
+[Goldstein, D.B. 97]</A>
+<LI><A NAME="tex2html22"
+ HREF="node19.html">Shriver et al.'s (1995) [Shriver, M.D. 95]</A>
+<LI><A NAME="tex2html23"
+ HREF="node20.html">Lev A. Zhivotovsky (1999) [Takezaki, N. 96]</A>
+</UL>
+</UL>
+<BR>
+<LI><A NAME="tex2html24"
+ HREF="node21.html">Bibliography</A>
+<LI><A NAME="tex2html25"
+ HREF="node22.html">About this document ...</A>
+</UL>
+<!--End of Table of Child-Links-->
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/img1.gif b/html/old/formules/img1.gif
new file mode 100755
index 0000000..2f1e332
Binary files /dev/null and b/html/old/formules/img1.gif differ
diff --git a/html/old/formules/img1.png b/html/old/formules/img1.png
new file mode 100755
index 0000000..e406d7b
Binary files /dev/null and b/html/old/formules/img1.png differ
diff --git a/html/old/formules/img10.gif b/html/old/formules/img10.gif
new file mode 100755
index 0000000..b5715c6
Binary files /dev/null and b/html/old/formules/img10.gif differ
diff --git a/html/old/formules/img10.png b/html/old/formules/img10.png
new file mode 100755
index 0000000..3ce4d68
Binary files /dev/null and b/html/old/formules/img10.png differ
diff --git a/html/old/formules/img11.gif b/html/old/formules/img11.gif
new file mode 100755
index 0000000..aca4d00
Binary files /dev/null and b/html/old/formules/img11.gif differ
diff --git a/html/old/formules/img11.png b/html/old/formules/img11.png
new file mode 100755
index 0000000..5a8dc27
Binary files /dev/null and b/html/old/formules/img11.png differ
diff --git a/html/old/formules/img12.gif b/html/old/formules/img12.gif
new file mode 100755
index 0000000..a3f18f9
Binary files /dev/null and b/html/old/formules/img12.gif differ
diff --git a/html/old/formules/img12.png b/html/old/formules/img12.png
new file mode 100755
index 0000000..95966d3
Binary files /dev/null and b/html/old/formules/img12.png differ
diff --git a/html/old/formules/img13.gif b/html/old/formules/img13.gif
new file mode 100755
index 0000000..5acc9c0
Binary files /dev/null and b/html/old/formules/img13.gif differ
diff --git a/html/old/formules/img13.png b/html/old/formules/img13.png
new file mode 100755
index 0000000..58c14be
Binary files /dev/null and b/html/old/formules/img13.png differ
diff --git a/html/old/formules/img14.gif b/html/old/formules/img14.gif
new file mode 100755
index 0000000..2bdbd77
Binary files /dev/null and b/html/old/formules/img14.gif differ
diff --git a/html/old/formules/img14.png b/html/old/formules/img14.png
new file mode 100755
index 0000000..acfaa03
Binary files /dev/null and b/html/old/formules/img14.png differ
diff --git a/html/old/formules/img15.gif b/html/old/formules/img15.gif
new file mode 100755
index 0000000..cb6b0f4
Binary files /dev/null and b/html/old/formules/img15.gif differ
diff --git a/html/old/formules/img15.png b/html/old/formules/img15.png
new file mode 100755
index 0000000..9b67b1e
Binary files /dev/null and b/html/old/formules/img15.png differ
diff --git a/html/old/formules/img16.gif b/html/old/formules/img16.gif
new file mode 100755
index 0000000..f3cda2a
Binary files /dev/null and b/html/old/formules/img16.gif differ
diff --git a/html/old/formules/img16.png b/html/old/formules/img16.png
new file mode 100755
index 0000000..8ce8bdd
Binary files /dev/null and b/html/old/formules/img16.png differ
diff --git a/html/old/formules/img17.gif b/html/old/formules/img17.gif
new file mode 100755
index 0000000..b2f4806
Binary files /dev/null and b/html/old/formules/img17.gif differ
diff --git a/html/old/formules/img17.png b/html/old/formules/img17.png
new file mode 100755
index 0000000..e5c1b97
Binary files /dev/null and b/html/old/formules/img17.png differ
diff --git a/html/old/formules/img18.gif b/html/old/formules/img18.gif
new file mode 100755
index 0000000..9f6e8e6
Binary files /dev/null and b/html/old/formules/img18.gif differ
diff --git a/html/old/formules/img18.png b/html/old/formules/img18.png
new file mode 100755
index 0000000..49c2c1e
Binary files /dev/null and b/html/old/formules/img18.png differ
diff --git a/html/old/formules/img19.gif b/html/old/formules/img19.gif
new file mode 100755
index 0000000..6f9e170
Binary files /dev/null and b/html/old/formules/img19.gif differ
diff --git a/html/old/formules/img19.png b/html/old/formules/img19.png
new file mode 100755
index 0000000..ea2dd2a
Binary files /dev/null and b/html/old/formules/img19.png differ
diff --git a/html/old/formules/img2.gif b/html/old/formules/img2.gif
new file mode 100755
index 0000000..d3bec3c
Binary files /dev/null and b/html/old/formules/img2.gif differ
diff --git a/html/old/formules/img2.png b/html/old/formules/img2.png
new file mode 100755
index 0000000..e4a2bc9
Binary files /dev/null and b/html/old/formules/img2.png differ
diff --git a/html/old/formules/img20.gif b/html/old/formules/img20.gif
new file mode 100755
index 0000000..5fceb50
Binary files /dev/null and b/html/old/formules/img20.gif differ
diff --git a/html/old/formules/img20.png b/html/old/formules/img20.png
new file mode 100755
index 0000000..f040b21
Binary files /dev/null and b/html/old/formules/img20.png differ
diff --git a/html/old/formules/img21.gif b/html/old/formules/img21.gif
new file mode 100755
index 0000000..bf1de9b
Binary files /dev/null and b/html/old/formules/img21.gif differ
diff --git a/html/old/formules/img21.png b/html/old/formules/img21.png
new file mode 100755
index 0000000..b03393c
Binary files /dev/null and b/html/old/formules/img21.png differ
diff --git a/html/old/formules/img22.gif b/html/old/formules/img22.gif
new file mode 100755
index 0000000..a1f513c
Binary files /dev/null and b/html/old/formules/img22.gif differ
diff --git a/html/old/formules/img22.png b/html/old/formules/img22.png
new file mode 100755
index 0000000..75aa7df
Binary files /dev/null and b/html/old/formules/img22.png differ
diff --git a/html/old/formules/img23.gif b/html/old/formules/img23.gif
new file mode 100755
index 0000000..baa5ebf
Binary files /dev/null and b/html/old/formules/img23.gif differ
diff --git a/html/old/formules/img23.png b/html/old/formules/img23.png
new file mode 100755
index 0000000..b7315c5
Binary files /dev/null and b/html/old/formules/img23.png differ
diff --git a/html/old/formules/img24.gif b/html/old/formules/img24.gif
new file mode 100755
index 0000000..18890b1
Binary files /dev/null and b/html/old/formules/img24.gif differ
diff --git a/html/old/formules/img24.png b/html/old/formules/img24.png
new file mode 100755
index 0000000..d7efea2
Binary files /dev/null and b/html/old/formules/img24.png differ
diff --git a/html/old/formules/img25.gif b/html/old/formules/img25.gif
new file mode 100755
index 0000000..209c31b
Binary files /dev/null and b/html/old/formules/img25.gif differ
diff --git a/html/old/formules/img25.png b/html/old/formules/img25.png
new file mode 100755
index 0000000..a33cd95
Binary files /dev/null and b/html/old/formules/img25.png differ
diff --git a/html/old/formules/img26.gif b/html/old/formules/img26.gif
new file mode 100755
index 0000000..bf1b3ea
Binary files /dev/null and b/html/old/formules/img26.gif differ
diff --git a/html/old/formules/img26.png b/html/old/formules/img26.png
new file mode 100755
index 0000000..d257b24
Binary files /dev/null and b/html/old/formules/img26.png differ
diff --git a/html/old/formules/img27.gif b/html/old/formules/img27.gif
new file mode 100755
index 0000000..c3ff4ba
Binary files /dev/null and b/html/old/formules/img27.gif differ
diff --git a/html/old/formules/img27.png b/html/old/formules/img27.png
new file mode 100755
index 0000000..48c18cd
Binary files /dev/null and b/html/old/formules/img27.png differ
diff --git a/html/old/formules/img28.gif b/html/old/formules/img28.gif
new file mode 100755
index 0000000..b5b848c
Binary files /dev/null and b/html/old/formules/img28.gif differ
diff --git a/html/old/formules/img28.png b/html/old/formules/img28.png
new file mode 100755
index 0000000..cdafd0d
Binary files /dev/null and b/html/old/formules/img28.png differ
diff --git a/html/old/formules/img29.gif b/html/old/formules/img29.gif
new file mode 100755
index 0000000..b13ac0e
Binary files /dev/null and b/html/old/formules/img29.gif differ
diff --git a/html/old/formules/img29.png b/html/old/formules/img29.png
new file mode 100755
index 0000000..4410356
Binary files /dev/null and b/html/old/formules/img29.png differ
diff --git a/html/old/formules/img3.gif b/html/old/formules/img3.gif
new file mode 100755
index 0000000..8f427ce
Binary files /dev/null and b/html/old/formules/img3.gif differ
diff --git a/html/old/formules/img3.png b/html/old/formules/img3.png
new file mode 100755
index 0000000..dc4d8ff
Binary files /dev/null and b/html/old/formules/img3.png differ
diff --git a/html/old/formules/img30.gif b/html/old/formules/img30.gif
new file mode 100755
index 0000000..4e48ffd
Binary files /dev/null and b/html/old/formules/img30.gif differ
diff --git a/html/old/formules/img30.png b/html/old/formules/img30.png
new file mode 100755
index 0000000..88e22df
Binary files /dev/null and b/html/old/formules/img30.png differ
diff --git a/html/old/formules/img31.gif b/html/old/formules/img31.gif
new file mode 100755
index 0000000..1259aa9
Binary files /dev/null and b/html/old/formules/img31.gif differ
diff --git a/html/old/formules/img31.png b/html/old/formules/img31.png
new file mode 100755
index 0000000..22bae0b
Binary files /dev/null and b/html/old/formules/img31.png differ
diff --git a/html/old/formules/img32.gif b/html/old/formules/img32.gif
new file mode 100755
index 0000000..7c5b388
Binary files /dev/null and b/html/old/formules/img32.gif differ
diff --git a/html/old/formules/img32.png b/html/old/formules/img32.png
new file mode 100755
index 0000000..374891a
Binary files /dev/null and b/html/old/formules/img32.png differ
diff --git a/html/old/formules/img33.gif b/html/old/formules/img33.gif
new file mode 100755
index 0000000..f47488f
Binary files /dev/null and b/html/old/formules/img33.gif differ
diff --git a/html/old/formules/img33.png b/html/old/formules/img33.png
new file mode 100755
index 0000000..32de75e
Binary files /dev/null and b/html/old/formules/img33.png differ
diff --git a/html/old/formules/img34.gif b/html/old/formules/img34.gif
new file mode 100755
index 0000000..87daead
Binary files /dev/null and b/html/old/formules/img34.gif differ
diff --git a/html/old/formules/img34.png b/html/old/formules/img34.png
new file mode 100755
index 0000000..e31b28d
Binary files /dev/null and b/html/old/formules/img34.png differ
diff --git a/html/old/formules/img35.gif b/html/old/formules/img35.gif
new file mode 100755
index 0000000..0d5c8a6
Binary files /dev/null and b/html/old/formules/img35.gif differ
diff --git a/html/old/formules/img35.png b/html/old/formules/img35.png
new file mode 100755
index 0000000..d3c7a15
Binary files /dev/null and b/html/old/formules/img35.png differ
diff --git a/html/old/formules/img36.gif b/html/old/formules/img36.gif
new file mode 100755
index 0000000..d213037
Binary files /dev/null and b/html/old/formules/img36.gif differ
diff --git a/html/old/formules/img36.png b/html/old/formules/img36.png
new file mode 100755
index 0000000..baf29bc
Binary files /dev/null and b/html/old/formules/img36.png differ
diff --git a/html/old/formules/img37.gif b/html/old/formules/img37.gif
new file mode 100755
index 0000000..d184b1b
Binary files /dev/null and b/html/old/formules/img37.gif differ
diff --git a/html/old/formules/img37.png b/html/old/formules/img37.png
new file mode 100755
index 0000000..be718b7
Binary files /dev/null and b/html/old/formules/img37.png differ
diff --git a/html/old/formules/img38.gif b/html/old/formules/img38.gif
new file mode 100755
index 0000000..77cfa93
Binary files /dev/null and b/html/old/formules/img38.gif differ
diff --git a/html/old/formules/img38.png b/html/old/formules/img38.png
new file mode 100755
index 0000000..2866b4a
Binary files /dev/null and b/html/old/formules/img38.png differ
diff --git a/html/old/formules/img39.gif b/html/old/formules/img39.gif
new file mode 100755
index 0000000..b4f4fe4
Binary files /dev/null and b/html/old/formules/img39.gif differ
diff --git a/html/old/formules/img39.png b/html/old/formules/img39.png
new file mode 100755
index 0000000..bfbf0f9
Binary files /dev/null and b/html/old/formules/img39.png differ
diff --git a/html/old/formules/img4.gif b/html/old/formules/img4.gif
new file mode 100755
index 0000000..c516542
Binary files /dev/null and b/html/old/formules/img4.gif differ
diff --git a/html/old/formules/img4.png b/html/old/formules/img4.png
new file mode 100755
index 0000000..904b886
Binary files /dev/null and b/html/old/formules/img4.png differ
diff --git a/html/old/formules/img40.gif b/html/old/formules/img40.gif
new file mode 100755
index 0000000..5663c9b
Binary files /dev/null and b/html/old/formules/img40.gif differ
diff --git a/html/old/formules/img40.png b/html/old/formules/img40.png
new file mode 100755
index 0000000..f036b42
Binary files /dev/null and b/html/old/formules/img40.png differ
diff --git a/html/old/formules/img41.gif b/html/old/formules/img41.gif
new file mode 100755
index 0000000..6bf804c
Binary files /dev/null and b/html/old/formules/img41.gif differ
diff --git a/html/old/formules/img41.png b/html/old/formules/img41.png
new file mode 100755
index 0000000..e4e6b13
Binary files /dev/null and b/html/old/formules/img41.png differ
diff --git a/html/old/formules/img42.gif b/html/old/formules/img42.gif
new file mode 100755
index 0000000..9583b7a
Binary files /dev/null and b/html/old/formules/img42.gif differ
diff --git a/html/old/formules/img42.png b/html/old/formules/img42.png
new file mode 100755
index 0000000..dfc46fc
Binary files /dev/null and b/html/old/formules/img42.png differ
diff --git a/html/old/formules/img43.gif b/html/old/formules/img43.gif
new file mode 100755
index 0000000..29183a0
Binary files /dev/null and b/html/old/formules/img43.gif differ
diff --git a/html/old/formules/img43.png b/html/old/formules/img43.png
new file mode 100755
index 0000000..6c749b8
Binary files /dev/null and b/html/old/formules/img43.png differ
diff --git a/html/old/formules/img44.png b/html/old/formules/img44.png
new file mode 100755
index 0000000..ad6f678
Binary files /dev/null and b/html/old/formules/img44.png differ
diff --git a/html/old/formules/img45.png b/html/old/formules/img45.png
new file mode 100755
index 0000000..7ca9f0f
Binary files /dev/null and b/html/old/formules/img45.png differ
diff --git a/html/old/formules/img46.png b/html/old/formules/img46.png
new file mode 100755
index 0000000..476cca5
Binary files /dev/null and b/html/old/formules/img46.png differ
diff --git a/html/old/formules/img47.png b/html/old/formules/img47.png
new file mode 100755
index 0000000..0581c48
Binary files /dev/null and b/html/old/formules/img47.png differ
diff --git a/html/old/formules/img48.png b/html/old/formules/img48.png
new file mode 100755
index 0000000..8b91976
Binary files /dev/null and b/html/old/formules/img48.png differ
diff --git a/html/old/formules/img49.png b/html/old/formules/img49.png
new file mode 100755
index 0000000..25cd2ef
Binary files /dev/null and b/html/old/formules/img49.png differ
diff --git a/html/old/formules/img5.gif b/html/old/formules/img5.gif
new file mode 100755
index 0000000..3a4cf77
Binary files /dev/null and b/html/old/formules/img5.gif differ
diff --git a/html/old/formules/img5.png b/html/old/formules/img5.png
new file mode 100755
index 0000000..1cec8c8
Binary files /dev/null and b/html/old/formules/img5.png differ
diff --git a/html/old/formules/img50.png b/html/old/formules/img50.png
new file mode 100755
index 0000000..835eaac
Binary files /dev/null and b/html/old/formules/img50.png differ
diff --git a/html/old/formules/img51.png b/html/old/formules/img51.png
new file mode 100755
index 0000000..b53c7ef
Binary files /dev/null and b/html/old/formules/img51.png differ
diff --git a/html/old/formules/img52.png b/html/old/formules/img52.png
new file mode 100755
index 0000000..5ff9271
Binary files /dev/null and b/html/old/formules/img52.png differ
diff --git a/html/old/formules/img53.png b/html/old/formules/img53.png
new file mode 100755
index 0000000..39b0998
Binary files /dev/null and b/html/old/formules/img53.png differ
diff --git a/html/old/formules/img54.png b/html/old/formules/img54.png
new file mode 100755
index 0000000..0ab9ca4
Binary files /dev/null and b/html/old/formules/img54.png differ
diff --git a/html/old/formules/img55.png b/html/old/formules/img55.png
new file mode 100755
index 0000000..eb0ec9d
Binary files /dev/null and b/html/old/formules/img55.png differ
diff --git a/html/old/formules/img56.png b/html/old/formules/img56.png
new file mode 100755
index 0000000..9f641c6
Binary files /dev/null and b/html/old/formules/img56.png differ
diff --git a/html/old/formules/img57.png b/html/old/formules/img57.png
new file mode 100755
index 0000000..b885c2a
Binary files /dev/null and b/html/old/formules/img57.png differ
diff --git a/html/old/formules/img58.png b/html/old/formules/img58.png
new file mode 100755
index 0000000..2b1e618
Binary files /dev/null and b/html/old/formules/img58.png differ
diff --git a/html/old/formules/img59.png b/html/old/formules/img59.png
new file mode 100755
index 0000000..05d5fe9
Binary files /dev/null and b/html/old/formules/img59.png differ
diff --git a/html/old/formules/img6.gif b/html/old/formules/img6.gif
new file mode 100755
index 0000000..ca25ddf
Binary files /dev/null and b/html/old/formules/img6.gif differ
diff --git a/html/old/formules/img6.png b/html/old/formules/img6.png
new file mode 100755
index 0000000..62eab6b
Binary files /dev/null and b/html/old/formules/img6.png differ
diff --git a/html/old/formules/img60.png b/html/old/formules/img60.png
new file mode 100755
index 0000000..e32bcec
Binary files /dev/null and b/html/old/formules/img60.png differ
diff --git a/html/old/formules/img61.png b/html/old/formules/img61.png
new file mode 100755
index 0000000..a3f3dfc
Binary files /dev/null and b/html/old/formules/img61.png differ
diff --git a/html/old/formules/img62.png b/html/old/formules/img62.png
new file mode 100755
index 0000000..6015b99
Binary files /dev/null and b/html/old/formules/img62.png differ
diff --git a/html/old/formules/img63.png b/html/old/formules/img63.png
new file mode 100755
index 0000000..4ec9a96
Binary files /dev/null and b/html/old/formules/img63.png differ
diff --git a/html/old/formules/img7.gif b/html/old/formules/img7.gif
new file mode 100755
index 0000000..ab2bbfc
Binary files /dev/null and b/html/old/formules/img7.gif differ
diff --git a/html/old/formules/img7.png b/html/old/formules/img7.png
new file mode 100755
index 0000000..ea9a5fd
Binary files /dev/null and b/html/old/formules/img7.png differ
diff --git a/html/old/formules/img8.gif b/html/old/formules/img8.gif
new file mode 100755
index 0000000..06b3aef
Binary files /dev/null and b/html/old/formules/img8.gif differ
diff --git a/html/old/formules/img8.png b/html/old/formules/img8.png
new file mode 100755
index 0000000..640167e
Binary files /dev/null and b/html/old/formules/img8.png differ
diff --git a/html/old/formules/img9.gif b/html/old/formules/img9.gif
new file mode 100755
index 0000000..718e266
Binary files /dev/null and b/html/old/formules/img9.gif differ
diff --git a/html/old/formules/img9.png b/html/old/formules/img9.png
new file mode 100755
index 0000000..6f38834
Binary files /dev/null and b/html/old/formules/img9.png differ
diff --git a/html/old/formules/index.html b/html/old/formules/index.html
new file mode 100755
index 0000000..7947cf5
--- /dev/null
+++ b/html/old/formules/index.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>formules</TITLE>
+<META NAME="description" CONTENT="formules">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node1.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html2"
+ HREF="node1.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up_g.png">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev_g.png">
+<BR>
+<B> Next:</B> <A NAME="tex2html3"
+ HREF="node1.html">Distances</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<P>
+<BR><HR>
+<!--Table of Child-Links-->
+<A NAME="CHILD_LINKS"></A>
+
+<UL>
+<LI><A NAME="tex2html4"
+ HREF="node1.html">Distances</A>
+<UL>
+<LI><A NAME="tex2html5"
+ HREF="node2.html">IAM distances</A>
+<UL>
+<LI><A NAME="tex2html6"
+ HREF="node3.html">Shared allele distance (Chakraborty and Jin, 1993) [Jin, L. 93]</A>
+<LI><A NAME="tex2html7"
+ HREF="node4.html">Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html8"
+ HREF="node5.html">Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html9"
+ HREF="node6.html">Latter's (1972) Fst (=<IMG
+ WIDTH="14" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img16.png"
+ ALT="\( \phi \protect \)">*) distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html10"
+ HREF="node7.html">Rogers' (1972) distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html11"
+ HREF="node8.html">Prevosti et al's (1975) distance [Takezaki, N. 96] has a statistical property
+similar to that of Dr and is defined as</A>
+<LI><A NAME="tex2html12"
+ HREF="node9.html">Cavali-Sforza and Edwards' (1967) chord distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html13"
+ HREF="node10.html">Nei et al's (1983) <IMG
+ WIDTH="28" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img21.png"
+ ALT="\( D_{A}\protect \)"> distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html14"
+ HREF="node11.html">Sanghvi's (1953) <IMG
+ WIDTH="26" HEIGHT="16" ALIGN="BOTTOM" BORDER="0"
+ SRC="img23.png"
+ ALT="\( X^{2}\protect \)"> distance[Takezaki, N. 96]</A>
+<LI><A NAME="tex2html15"
+ HREF="node12.html">Reynold's genetic distance for short-term evolution (1983) [Reynolds, J. 83]</A>
+<UL>
+<LI><A NAME="tex2html16"
+ HREF="node13.html">unweighted average of single-locus ratio estimators, <!-- MATH
+ $\tilde{\theta }_{U}\protect$
+ -->
+<IMG
+ WIDTH="22" HEIGHT="37" ALIGN="MIDDLE" BORDER="0"
+ SRC="img30.png"
+ ALT="\( \tilde{\theta }_{U}\protect \)">:</A>
+<LI><A NAME="tex2html17"
+ HREF="node14.html">weighted average of single-locus ratio estimators :</A>
+<LI><A NAME="tex2html18"
+ HREF="node15.html">least squares <!-- MATH
+ $\theta \protect$
+ -->
+<IMG
+ WIDTH="12" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
+ SRC="img1.png"
+ ALT="\( \theta \)"> estimator :</A>
+</UL>
+</UL>
+<LI><A NAME="tex2html19"
+ HREF="node16.html">SMM distances</A>
+<UL>
+<LI><A NAME="tex2html20"
+ HREF="node17.html">Goldstein et al. (1995a) [Goldstein, D.B. 97]</A>
+<LI><A NAME="tex2html21"
+ HREF="node18.html">average square distance (ASD) (Goldstein et al. 1995b; Slatkin 1995)
+[Goldstein, D.B. 97]</A>
+<LI><A NAME="tex2html22"
+ HREF="node19.html">Shriver et al.'s (1995) [Shriver, M.D. 95]</A>
+<LI><A NAME="tex2html23"
+ HREF="node20.html">Lev A. Zhivotovsky (1999) [Takezaki, N. 96]</A>
+</UL>
+</UL>
+<BR>
+<LI><A NAME="tex2html24"
+ HREF="node21.html">Bibliography</A>
+<LI><A NAME="tex2html25"
+ HREF="node22.html">About this document ...</A>
+</UL>
+<!--End of Table of Child-Links-->
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/nei_dm.mml b/html/old/formules/nei_dm.mml
new file mode 100644
index 0000000..61a469d
--- /dev/null
+++ b/html/old/formules/nei_dm.mml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN" "math.dtd">
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mi math:fontstyle="italic">Dm</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mfrac>
+ <math:mrow>
+ <math:mo math:stretchy="false">(</math:mo>
+ <math:mrow>
+ <math:msub>
+ <math:mi>J</math:mi>
+ <math:mi>X</math:mi>
+ </math:msub>
+ <math:mo math:stretchy="false">+</math:mo>
+ <math:msub>
+ <math:mi>J</math:mi>
+ <math:mi>Y</math:mi>
+ </math:msub>
+ </math:mrow>
+ <math:mo math:stretchy="false">)</math:mo>
+ </math:mrow>
+ <math:mn>2</math:mn>
+ </math:mfrac>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:msub>
+ <math:mi>J</math:mi>
+ <math:mi math:fontstyle="italic">XY</math:mi>
+ </math:msub>
+ </math:mrow>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">Dm=(J_X + J_Y)over 2 - J_XY</math:annotation>
+ </math:semantics>
+</math:math>
\ No newline at end of file
diff --git a/html/old/formules/nei_dm.xhtml b/html/old/formules/nei_dm.xhtml
new file mode 100644
index 0000000..fde61c7
--- /dev/null
+++ b/html/old/formules/nei_dm.xhtml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+ Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]
+</h2>
+
+<div>
+
+<math mode="display" xmlns="&mathml;">
+ <semantics>
+ <mrow>
+ <msub>
+ <mi>D</mi>
+ <mi>m</mi>
+ </msub>
+ <mo >=</mo>
+ <mrow>
+ <mfrac>
+ <mrow>
+ <mfenced open="(" close=")">
+ <mrow>
+ <msub>
+ <mi>J</mi>
+ <mi>X</mi>
+ </msub>
+ <mo>+</mo>
+ <msub>
+ <mi>J</mi>
+ <mi>Y</mi>
+ </msub>
+ </mrow>
+ </mfenced>
+ </mrow>
+ <mn>2</mn>
+ </mfrac>
+ <mo>-</mo>
+ <msub>
+ <mi>J</mi>
+ <mi >XY</mi>
+ </msub>
+ </mrow>
+ </mrow>
+ <annotation encoding="StarMath 5.0">Dm=(J_X + J_Y)over 2 - J_XY</annotation>
+ </semantics>
+
+</math>
+
+</div>
+</body>
+</html>
diff --git a/html/old/formules/nei_ds.mml b/html/old/formules/nei_ds.mml
new file mode 100644
index 0000000..1d0c2a5
--- /dev/null
+++ b/html/old/formules/nei_ds.mml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN" "math.dtd">
+<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
+ <math:semantics>
+ <math:mrow>
+ <math:mrow>
+ <math:mi math:fontstyle="italic">Ds</math:mi>
+ <math:mo math:stretchy="false">=</math:mo>
+ <math:mrow>
+ <math:mo math:stretchy="false">−</math:mo>
+ <math:mi>ln</math:mi>
+ </math:mrow>
+ </math:mrow>
+ <math:mfenced math:open="[" math:close="]">
+ <math:mfrac>
+ <math:msub>
+ <math:mi>J</math:mi>
+ <math:mi math:fontstyle="italic">XY</math:mi>
+ </math:msub>
+ <math:msqrt>
+ <math:mrow>
+ <math:msub>
+ <math:mi>J</math:mi>
+ <math:mi>X</math:mi>
+ </math:msub>
+ <math:msub>
+ <math:mi>J</math:mi>
+ <math:mi>Y</math:mi>
+ </math:msub>
+ </math:mrow>
+ </math:msqrt>
+ </math:mfrac>
+ </math:mfenced>
+ </math:mrow>
+ <math:annotation math:encoding="StarMath 5.0">Ds=-ln {left[ {J_{XY}}over{sqrt{J_{X}J_{Y}}} right]}</math:annotation>
+ </math:semantics>
+</math:math>
\ No newline at end of file
diff --git a/html/old/formules/nei_ds.xhtml b/html/old/formules/nei_ds.xhtml
new file mode 100644
index 0000000..9b7f667
--- /dev/null
+++ b/html/old/formules/nei_ds.xhtml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]</title>
+ <link rel="stylesheet" href="../libcss/mathematica.css" type="text/CSS"/>
+ <!--<link rel="stylesheet" href="../libcss/main.css" type="text/CSS"/>
+ <link rel="shortcut icon" href="./libimage/icon.png" type="images/x-icon"/> -->
+<meta name="description" content="Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]"/>
+<meta name="keywords" content="formules"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+ </head>
+ <body>
+
+<h2>
+ Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]
+</h2>
+
+<div>
+
+<math mode="display" xmlns="&mathml;">
+ <semantics>
+ <mrow>
+ <mrow>
+ <mi fontstyle="italic">Ds</mi>
+ <mo stretchy="false">=</mo>
+ <mrow>
+ <mo stretchy="false">−</mo>
+ <mi>ln</mi>
+ </mrow>
+ </mrow>
+ <mfenced open="[" close="]">
+ <mrow>
+ <mfrac>
+ <msub>
+ <mi>J</mi>
+ <mi>XY</mi>
+ </msub>
+ <msqrt>
+ <mrow>
+ <msub>
+ <mi>J</mi>
+ <mi>X</mi>
+ </msub>
+ <msub>
+ <mi>J</mi>
+ <mi>Y</mi>
+ </msub>
+ </mrow>
+ </msqrt>
+ </mfrac>
+ </mrow>
+ </mfenced>
+ </mrow>
+ <annotation encoding="StarMath 5.0">Ds=-ln {left[ {J_{XY}}over{sqrt{J_{X}J_{Y}}} right]}</annotation>
+ </semantics>
+</math>
+
+</div>
+</body>
+</html>
diff --git a/html/old/formules/next_motif.gif b/html/old/formules/next_motif.gif
new file mode 100755
index 0000000..7a2dbe9
Binary files /dev/null and b/html/old/formules/next_motif.gif differ
diff --git a/html/old/formules/next_motif_gr.gif b/html/old/formules/next_motif_gr.gif
new file mode 100755
index 0000000..1416b1c
Binary files /dev/null and b/html/old/formules/next_motif_gr.gif differ
diff --git a/html/old/formules/node1.html b/html/old/formules/node1.html
new file mode 100755
index 0000000..7a5bf04
--- /dev/null
+++ b/html/old/formules/node1.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Distances</TITLE>
+<META NAME="description" CONTENT="Distances">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node21.html">
+<LINK REL="previous" HREF="formules.html">
+<LINK REL="up" HREF="formules.html">
+<LINK REL="next" HREF="node2.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html34"
+ HREF="node2.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html32"
+ HREF="formules.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html26"
+ HREF="formules.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html35"
+ HREF="node2.html">IAM distances</A>
+<B> Up:</B> <A NAME="tex2html33"
+ HREF="formules.html">formules</A>
+<B> Previous:</B> <A NAME="tex2html27"
+ HREF="formules.html">formules</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H1><A NAME="SECTION00100000000000000000">
+Distances</A>
+</H1>
+
+<P>
+<BR><HR>
+<!--Table of Child-Links-->
+<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
+
+<UL>
+<LI><A NAME="tex2html36"
+ HREF="node2.html">IAM distances</A>
+<UL>
+<LI><A NAME="tex2html37"
+ HREF="node3.html">Shared allele distance (Chakraborty and Jin, 1993) [Jin, L. 93]</A>
+<LI><A NAME="tex2html38"
+ HREF="node4.html">Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html39"
+ HREF="node5.html">Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html40"
+ HREF="node6.html">Latter's (1972) Fst (=<IMG
+ WIDTH="14" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img16.png"
+ ALT="\( \phi \protect \)">*) distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html41"
+ HREF="node7.html">Rogers' (1972) distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html42"
+ HREF="node8.html">Prevosti et al's (1975) distance [Takezaki, N. 96] has a statistical property
+similar to that of Dr and is defined as</A>
+<LI><A NAME="tex2html43"
+ HREF="node9.html">Cavali-Sforza and Edwards' (1967) chord distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html44"
+ HREF="node10.html">Nei et al's (1983) <IMG
+ WIDTH="28" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img21.png"
+ ALT="\( D_{A}\protect \)"> distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html45"
+ HREF="node11.html">Sanghvi's (1953) <IMG
+ WIDTH="26" HEIGHT="16" ALIGN="BOTTOM" BORDER="0"
+ SRC="img23.png"
+ ALT="\( X^{2}\protect \)"> distance[Takezaki, N. 96]</A>
+<LI><A NAME="tex2html46"
+ HREF="node12.html">Reynold's genetic distance for short-term evolution (1983) [Reynolds, J. 83]</A>
+<UL>
+<LI><A NAME="tex2html47"
+ HREF="node13.html">unweighted average of single-locus ratio estimators, <!-- MATH
+ $\tilde{\theta }_{U}\protect$
+ -->
+<IMG
+ WIDTH="22" HEIGHT="37" ALIGN="MIDDLE" BORDER="0"
+ SRC="img30.png"
+ ALT="\( \tilde{\theta }_{U}\protect \)">:</A>
+<LI><A NAME="tex2html48"
+ HREF="node14.html">weighted average of single-locus ratio estimators :</A>
+<LI><A NAME="tex2html49"
+ HREF="node15.html">least squares <!-- MATH
+ $\theta \protect$
+ -->
+<IMG
+ WIDTH="12" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
+ SRC="img1.png"
+ ALT="\( \theta \)"> estimator :</A>
+</UL>
+</UL>
+<BR>
+<LI><A NAME="tex2html50"
+ HREF="node16.html">SMM distances</A>
+<UL>
+<LI><A NAME="tex2html51"
+ HREF="node17.html">Goldstein et al. (1995a) [Goldstein, D.B. 97]</A>
+<LI><A NAME="tex2html52"
+ HREF="node18.html">average square distance (ASD) (Goldstein et al. 1995b; Slatkin 1995)
+[Goldstein, D.B. 97]</A>
+<LI><A NAME="tex2html53"
+ HREF="node19.html">Shriver et al.'s (1995) [Shriver, M.D. 95]</A>
+<LI><A NAME="tex2html54"
+ HREF="node20.html">Lev A. Zhivotovsky (1999) [Takezaki, N. 96]</A>
+</UL></UL>
+<!--End of Table of Child-Links-->
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node10.html b/html/old/formules/node10.html
new file mode 100755
index 0000000..66539e8
--- /dev/null
+++ b/html/old/formules/node10.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Nei et al's (1983) distance [Takezaki, N. 96]</TITLE>
+<META NAME="description" CONTENT="Nei et al's (1983) distance [Takezaki, N. 96]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node11.html">
+<LINK REL="previous" HREF="node9.html">
+<LINK REL="up" HREF="node2.html">
+<LINK REL="next" HREF="node11.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html156"
+ HREF="node11.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html154"
+ HREF="node2.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html148"
+ HREF="node9.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html157"
+ HREF="node11.html">Sanghvi's (1953) distance[Takezaki, N. 96]</A>
+<B> Up:</B> <A NAME="tex2html155"
+ HREF="node2.html">IAM distances</A>
+<B> Previous:</B> <A NAME="tex2html149"
+ HREF="node9.html">Cavali-Sforza and Edwards' (1967)</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00118000000000000000">
+Nei et al's (1983) <IMG
+ WIDTH="28" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img21.png"
+ ALT="\( D_{A}\protect \)"> distance [<A
+ HREF="node21.html#TN96">Takezaki, N. 96</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+D_{A}=1-\frac{1}{r}\sum ^{r}_{j}\sum ^{m_{j}}_{i}\sqrt{x_{ij}y_{ij}}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="191" HEIGHT="57" BORDER="0"
+ SRC="img22.png"
+ ALT="\begin{displaymath}
+D_{A}=1-\frac{1}{r}\sum ^{r}_{j}\sum ^{m_{j}}_{i}\sqrt{x_{ij}y_{ij}}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node11.html b/html/old/formules/node11.html
new file mode 100755
index 0000000..808a907
--- /dev/null
+++ b/html/old/formules/node11.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Sanghvi's (1953) distance[Takezaki, N. 96]</TITLE>
+<META NAME="description" CONTENT="Sanghvi's (1953) distance[Takezaki, N. 96]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node12.html">
+<LINK REL="previous" HREF="node10.html">
+<LINK REL="up" HREF="node2.html">
+<LINK REL="next" HREF="node12.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html166"
+ HREF="node12.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html164"
+ HREF="node2.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html158"
+ HREF="node10.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html167"
+ HREF="node12.html">Reynold's genetic distance for</A>
+<B> Up:</B> <A NAME="tex2html165"
+ HREF="node2.html">IAM distances</A>
+<B> Previous:</B> <A NAME="tex2html159"
+ HREF="node10.html">Nei et al's (1983)</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00119000000000000000">
+Sanghvi's (1953) <IMG
+ WIDTH="26" HEIGHT="16" ALIGN="BOTTOM" BORDER="0"
+ SRC="img23.png"
+ ALT="\( X^{2}\protect \)"> distance[<A
+ HREF="node21.html#TN96">Takezaki, N. 96</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+X^{2}=\frac{\sum ^{r}_{j}\sum ^{m_{j}}_{i}2\frac{\left( x_{ij}-y_{ij}\right) ^{2}}{\left( x_{ij}+y_{ij}\right) }}{r}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="180" HEIGHT="50" BORDER="0"
+ SRC="img24.png"
+ ALT="\begin{displaymath}
+X^{2}=\frac{\sum ^{r}_{j}\sum ^{m_{j}}_{i}2\frac{\left( x_{ij}-y_{ij}\right) ^{2}}{\left( x_{ij}+y_{ij}\right) }}{r}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node12.html b/html/old/formules/node12.html
new file mode 100755
index 0000000..b66a14b
--- /dev/null
+++ b/html/old/formules/node12.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Reynold's genetic distance for short-term evolution (1983) [Reynolds, J. 83]</TITLE>
+<META NAME="description" CONTENT="Reynold's genetic distance for short-term evolution (1983) [Reynolds, J. 83]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="previous" HREF="node11.html">
+<LINK REL="up" HREF="node2.html">
+<LINK REL="next" HREF="node13.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html174"
+ HREF="node13.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html172"
+ HREF="node2.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html168"
+ HREF="node11.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html175"
+ HREF="node13.html">unweighted average of single-locus</A>
+<B> Up:</B> <A NAME="tex2html173"
+ HREF="node2.html">IAM distances</A>
+<B> Previous:</B> <A NAME="tex2html169"
+ HREF="node11.html">Sanghvi's (1953) distance[Takezaki, N. 96]</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION001110000000000000000">
+Reynold's genetic distance for short-term evolution (1983) [<A
+ HREF="node21.html#RWC83">Reynolds, J. 83</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+DReynold=-\ln (1-\theta )
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="168" HEIGHT="28" BORDER="0"
+ SRC="img25.png"
+ ALT="\begin{displaymath}
+DReynold=-\ln (1-\theta )\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+the following notation is used, for all <IMG
+ WIDTH="12" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
+ SRC="img1.png"
+ ALT="\( \theta \)"> estimators:
+
+<P>
+<!-- MATH
+ $\bar{n}=\sum ^{r}_{i=1}\frac{n_{i}}{r}$
+ -->
+<IMG
+ WIDTH="92" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
+ SRC="img26.png"
+ ALT="\( \bar{n}=\sum ^{r}_{i=1}\frac{n_{i}}{r} \)">, <!-- MATH
+ $n_{c}=\frac{\left( r\bar{n}-\sum ^{r}_{i=1}\frac{n^{2}_{i}}{r\bar{n}}\right) }{\left( r-1\right) }$
+ -->
+<IMG
+ WIDTH="143" HEIGHT="74" ALIGN="MIDDLE" BORDER="0"
+ SRC="img27.png"
+ ALT="\( n_{c}=\frac{\left( r\bar{n}-\sum ^{r}_{i=1}\frac{n^{2}_{i}}{r\bar{n}}\right) }{\left( r-1\right) } \)">,
+<!-- MATH
+ $\tilde{p}_{lu}=\sum ^{r}_{i=1}\frac{n_{i}\tilde{p}_{ilu}}{r\bar{n}}$
+ -->
+<IMG
+ WIDTH="126" HEIGHT="37" ALIGN="MIDDLE" BORDER="0"
+ SRC="img28.png"
+ ALT="\( \tilde{p}_{lu}=\sum ^{r}_{i=1}\frac{n_{i}\tilde{p}_{ilu}}{r\bar{n}} \)">,
+<!-- MATH
+ $\tilde{\alpha }_{il}=1-\sum ^{v_{l}}_{u=1}\tilde{p}_{ilu}^{2}$
+ -->
+<IMG
+ WIDTH="141" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
+ SRC="img29.png"
+ ALT="\( \tilde{\alpha }_{il}=1-\sum ^{v_{l}}_{u=1}\tilde{p}_{ilu}^{2} \)">
+
+<P>
+<BR><HR>
+<!--Table of Child-Links-->
+<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
+
+<UL>
+<LI><A NAME="tex2html176"
+ HREF="node13.html">unweighted average of single-locus ratio estimators, <!-- MATH
+ $\tilde{\theta }_{U}\protect$
+ -->
+<IMG
+ WIDTH="22" HEIGHT="37" ALIGN="MIDDLE" BORDER="0"
+ SRC="img30.png"
+ ALT="\( \tilde{\theta }_{U}\protect \)">:</A>
+<LI><A NAME="tex2html177"
+ HREF="node14.html">weighted average of single-locus ratio estimators :</A>
+<LI><A NAME="tex2html178"
+ HREF="node15.html">least squares <!-- MATH
+ $\theta \protect$
+ -->
+<IMG
+ WIDTH="12" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
+ SRC="img1.png"
+ ALT="\( \theta \)"> estimator :</A>
+</UL>
+<!--End of Table of Child-Links-->
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node13.html b/html/old/formules/node13.html
new file mode 100755
index 0000000..8c0d722
--- /dev/null
+++ b/html/old/formules/node13.html
@@ -0,0 +1,180 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>unweighted average of single-locus ratio estimators, :</TITLE>
+<META NAME="description" CONTENT="unweighted average of single-locus ratio estimators, :">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node14.html">
+<LINK REL="previous" HREF="node12.html">
+<LINK REL="up" HREF="node12.html">
+<LINK REL="next" HREF="node14.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html187"
+ HREF="node14.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html185"
+ HREF="node12.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html179"
+ HREF="node12.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html188"
+ HREF="node14.html">weighted average of single-locus</A>
+<B> Up:</B> <A NAME="tex2html186"
+ HREF="node12.html">Reynold's genetic distance for</A>
+<B> Previous:</B> <A NAME="tex2html180"
+ HREF="node12.html">Reynold's genetic distance for</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H3><A NAME="SECTION001110100000000000000">
+unweighted average of single-locus ratio estimators, <!-- MATH
+ $\tilde{\theta }_{U}\protect$
+ -->
+<IMG
+ WIDTH="22" HEIGHT="37" ALIGN="MIDDLE" BORDER="0"
+ SRC="img30.png"
+ ALT="\( \tilde{\theta }_{U}\protect \)">:</A>
+</H3>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+\tilde{\theta }_{U}=\frac{1}{m}\sum ^{m}_{l=1}\tilde{\theta }_{l}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="97" HEIGHT="54" BORDER="0"
+ SRC="img31.png"
+ ALT="\begin{displaymath}
+\tilde{\theta }_{U}=\frac{1}{m}\sum ^{m}_{l=1}\tilde{\theta }_{l}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+, with <!-- MATH
+ $\tilde{\theta }_{l}=\frac{a_{l}}{a_{l}+b_{l}}$
+ -->
+<IMG
+ WIDTH="73" HEIGHT="37" ALIGN="MIDDLE" BORDER="0"
+ SRC="img32.png"
+ ALT="\( \tilde{\theta }_{l}=\frac{a_{l}}{a_{l}+b_{l}} \)">. The estimates
+of the components of variance of interest for the lth locus are within
+populations, r is the number of populations examined:
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+b_{l}=2\sum ^{r}_{i=1}\frac{n_{i}\tilde{\alpha }_{il}}{r(2\bar{n}-1)}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="136" HEIGHT="53" BORDER="0"
+ SRC="img33.png"
+ ALT="\begin{displaymath}
+b_{l}=2\sum ^{r}_{i=1}\frac{n_{i}\tilde{\alpha }_{il}}{r(2\bar{n}-1)}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+and between populations:
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+a_{l}=\frac{\left[ 2\sum ^{r}_{i=1}n_{i}\sum ^{v_{l}}_{u=1}\left( \tilde{p}_{ilu}-\tilde{p}_{lu}\right) ^{2}-\left( r-1\right) b_{l}\right] }{2\left( r-1\right) n_{c}}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="330" HEIGHT="56" BORDER="0"
+ SRC="img34.png"
+ ALT="\begin{displaymath}
+a_{l}=\frac{\left[ 2\sum ^{r}_{i=1}n_{i}\sum ^{v_{l}}_{u=1}\...
+...^{2}-\left( r-1\right) b_{l}\right] }{2\left( r-1\right) n_{c}}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+When there are just two populations, r = 2, the usual genetic distance
+situation obtains, and the most convenient computing formulas for
+the variance components are (used in Populations)
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+a_{l}=\frac{1}{2}\sum _{u}\left( \tilde{p}_{1lu}-\tilde{p}_{2lu}\right) ^{2}-\frac{\left( n_{1}+n_{2}\right) \left( n_{1}\tilde{\alpha }_{1l}+n_{2}\tilde{\alpha }_{2l}\right) }{4n_{1}n_{2}\left( n_{1}+n_{2}-1\right) }
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="364" HEIGHT="49" BORDER="0"
+ SRC="img35.png"
+ ALT="\begin{displaymath}
+a_{l}=\frac{1}{2}\sum _{u}\left( \tilde{p}_{1lu}-\tilde{p}_{...
+...\alpha }_{2l}\right) }{4n_{1}n_{2}\left( n_{1}+n_{2}-1\right) }\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+a_{l}+b_{l}=\frac{1}{2}\sum _{u}\left( \tilde{p}_{1lu}-\tilde{p}_{2lu}\right) ^{2}+\frac{\left( 4n_{1}n_{2}-n_{1}-n_{2}\right) \left( n_{1}\tilde{\alpha }_{1l}+n_{2}\tilde{\alpha }_{2l}\right) }{4n_{1}n_{2}\left( n_{1}+n_{2}-1\right) }
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="456" HEIGHT="49" BORDER="0"
+ SRC="img36.png"
+ ALT="\begin{displaymath}
+a_{l}+b_{l}=\frac{1}{2}\sum _{u}\left( \tilde{p}_{1lu}-\tild...
+...\alpha }_{2l}\right) }{4n_{1}n_{2}\left( n_{1}+n_{2}-1\right) }\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node14.html b/html/old/formules/node14.html
new file mode 100755
index 0000000..b0eb5d5
--- /dev/null
+++ b/html/old/formules/node14.html
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>weighted average of single-locus ratio estimators :</TITLE>
+<META NAME="description" CONTENT="weighted average of single-locus ratio estimators :">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node15.html">
+<LINK REL="previous" HREF="node13.html">
+<LINK REL="up" HREF="node12.html">
+<LINK REL="next" HREF="node15.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html197"
+ HREF="node15.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html195"
+ HREF="node12.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html189"
+ HREF="node13.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html198"
+ HREF="node15.html">least squares estimator :</A>
+<B> Up:</B> <A NAME="tex2html196"
+ HREF="node12.html">Reynold's genetic distance for</A>
+<B> Previous:</B> <A NAME="tex2html190"
+ HREF="node13.html">unweighted average of single-locus</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H3><A NAME="SECTION001110200000000000000">
+weighted average of single-locus ratio estimators :</A>
+</H3>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+\tilde{\theta }_{W}=\frac{\left( \sum ^{m}_{l=1}a_{l}\right) }{\sum ^{m}_{l=1}\left( a_{l}+b_{l}\right) }
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="143" HEIGHT="46" BORDER="0"
+ SRC="img37.png"
+ ALT="\begin{displaymath}
+\tilde{\theta }_{W}=\frac{\left( \sum ^{m}_{l=1}a_{l}\right) }{\sum ^{m}_{l=1}\left( a_{l}+b_{l}\right) }\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node15.html b/html/old/formules/node15.html
new file mode 100755
index 0000000..a0ce58e
--- /dev/null
+++ b/html/old/formules/node15.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>least squares estimator :</TITLE>
+<META NAME="description" CONTENT="least squares estimator :">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="previous" HREF="node14.html">
+<LINK REL="up" HREF="node12.html">
+<LINK REL="next" HREF="node16.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html205"
+ HREF="node16.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html203"
+ HREF="node12.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html199"
+ HREF="node14.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html206"
+ HREF="node16.html">SMM distances</A>
+<B> Up:</B> <A NAME="tex2html204"
+ HREF="node12.html">Reynold's genetic distance for</A>
+<B> Previous:</B> <A NAME="tex2html200"
+ HREF="node14.html">weighted average of single-locus</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H3><A NAME="SECTION001110300000000000000">
+least squares <!-- MATH
+ $\theta \protect$
+ -->
+<IMG
+ WIDTH="12" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
+ SRC="img1.png"
+ ALT="\( \theta \)"> estimator :</A>
+</H3>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+\tilde{\theta }_{L}=\frac{2x+y-z\pm \sqrt{\left( z-y\right) ^{2}+4x^{2}}}{2\left( y-z\right) }
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="248" HEIGHT="57" BORDER="0"
+ SRC="img38.png"
+ ALT="\begin{displaymath}
+\tilde{\theta }_{L}=\frac{2x+y-z\pm \sqrt{\left( z-y\right) ^{2}+4x^{2}}}{2\left( y-z\right) }\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+where: <!-- MATH
+ $z=\sum ^{m}_{l=1}a_{l}^{2}$
+ -->
+<IMG
+ WIDTH="90" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
+ SRC="img39.png"
+ ALT="\( z=\sum ^{m}_{l=1}a_{l}^{2} \)">, <!-- MATH
+ $x=\sum ^{m}_{l=1}a_{l}b_{l}$
+ -->
+<IMG
+ WIDTH="100" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
+ SRC="img40.png"
+ ALT="\( x=\sum ^{m}_{l=1}a_{l}b_{l} \)">
+and <!-- MATH
+ $y=\sum ^{m}_{l=1}b_{l}^{2}$
+ -->
+<IMG
+ WIDTH="88" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
+ SRC="img41.png"
+ ALT="\( y=\sum ^{m}_{l=1}b_{l}^{2} \)"> .
+
+<P>
+to check which of the two solutions for <!-- MATH
+ $\tilde{\theta }_{L}$
+ -->
+<IMG
+ WIDTH="21" HEIGHT="37" ALIGN="MIDDLE" BORDER="0"
+ SRC="img42.png"
+ ALT="\( \tilde{\theta }_{L} \)">
+provides the minimum, the residual sum of squares, R, should be calculated
+for each where:
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+R=\frac{\left( 2x+y+z\right) \tilde{\theta }_{L}^{2}-2\left( x+z\right) \tilde{\theta }_{L}+z}{1-2\tilde{\theta }_{L}+2\tilde{\theta }_{L}^{2}}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="266" HEIGHT="50" BORDER="0"
+ SRC="img43.png"
+ ALT="\begin{displaymath}
+R=\frac{\left( 2x+y+z\right) \tilde{\theta }_{L}^{2}-2\left(...
+...theta }_{L}+z}{1-2\tilde{\theta }_{L}+2\tilde{\theta }_{L}^{2}}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node16.html b/html/old/formules/node16.html
new file mode 100755
index 0000000..802badb
--- /dev/null
+++ b/html/old/formules/node16.html
@@ -0,0 +1,106 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>SMM distances</TITLE>
+<META NAME="description" CONTENT="SMM distances">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="previous" HREF="node2.html">
+<LINK REL="up" HREF="node1.html">
+<LINK REL="next" HREF="node17.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html213"
+ HREF="node17.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html211"
+ HREF="node1.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html207"
+ HREF="node15.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html214"
+ HREF="node17.html">Goldstein et al. (1995a)</A>
+<B> Up:</B> <A NAME="tex2html212"
+ HREF="node1.html">Distances</A>
+<B> Previous:</B> <A NAME="tex2html208"
+ HREF="node15.html">least squares estimator :</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H1><A NAME="SECTION00120000000000000000">
+SMM distances</A>
+</H1>
+
+<P>
+<!-- MATH
+ $\mu _{X_{j}}=\sum _{i}ix_{ij}$
+ -->
+<IMG
+ WIDTH="103" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
+ SRC="img44.png"
+ ALT="\( \mu _{X_{j}}=\sum _{i}ix_{ij} \)"> and <!-- MATH
+ $\mu _{Y_{j}}=\sum _{i}iy_{ij}$
+ -->
+<IMG
+ WIDTH="98" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
+ SRC="img45.png"
+ ALT="\( \mu _{Y_{j}}=\sum _{i}iy_{ij} \)">
+are average allelic states at the <I>j</I>th locus, and <IMG
+ WIDTH="24" HEIGHT="28" ALIGN="MIDDLE" BORDER="0"
+ SRC="img5.png"
+ ALT="\( x_{ij} \)">
+and <IMG
+ WIDTH="23" HEIGHT="28" ALIGN="MIDDLE" BORDER="0"
+ SRC="img6.png"
+ ALT="\( y_{ij} \)"> are the frequencies of the allele in state <IMG
+ WIDTH="10" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
+ SRC="img46.png"
+ ALT="\( i \)">
+at the <I>j</I>th locus in populations X an Y, respectively.
+
+<P>
+<BR><HR>
+<!--Table of Child-Links-->
+<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
+
+<UL>
+<LI><A NAME="tex2html215"
+ HREF="node17.html">Goldstein et al. (1995a) [Goldstein, D.B. 97]</A>
+<LI><A NAME="tex2html216"
+ HREF="node18.html">average square distance (ASD) (Goldstein et al. 1995b; Slatkin 1995)
+[Goldstein, D.B. 97]</A>
+<LI><A NAME="tex2html217"
+ HREF="node19.html">Shriver et al.'s (1995) [Shriver, M.D. 95]</A>
+<LI><A NAME="tex2html218"
+ HREF="node20.html">Lev A. Zhivotovsky (1999) [Takezaki, N. 96]</A>
+</UL>
+<!--End of Table of Child-Links-->
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node17.html b/html/old/formules/node17.html
new file mode 100755
index 0000000..404b4bf
--- /dev/null
+++ b/html/old/formules/node17.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Goldstein et al. (1995a) [Goldstein, D.B. 97]</TITLE>
+<META NAME="description" CONTENT="Goldstein et al. (1995a) [Goldstein, D.B. 97]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node18.html">
+<LINK REL="previous" HREF="node16.html">
+<LINK REL="up" HREF="node16.html">
+<LINK REL="next" HREF="node18.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html227"
+ HREF="node18.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html225"
+ HREF="node16.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html219"
+ HREF="node16.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html228"
+ HREF="node18.html">average square distance (ASD)</A>
+<B> Up:</B> <A NAME="tex2html226"
+ HREF="node16.html">SMM distances</A>
+<B> Previous:</B> <A NAME="tex2html220"
+ HREF="node16.html">SMM distances</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00121000000000000000">
+Goldstein et al. (1995a) [<A
+ HREF="node21.html#GP97">Goldstein, D.B. 97</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+\left( \delta \mu \right) ^{2}=\frac{\sum ^{r}_{j}\left( \mu _{X_{j}}-\mu _{Y_{j}}\right) ^{2}}{r}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="178" HEIGHT="47" BORDER="0"
+ SRC="img47.png"
+ ALT="\begin{displaymath}
+\left( \delta \mu \right) ^{2}=\frac{\sum ^{r}_{j}\left( \mu _{X_{j}}-\mu _{Y_{j}}\right) ^{2}}{r}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node18.html b/html/old/formules/node18.html
new file mode 100755
index 0000000..80bcfd2
--- /dev/null
+++ b/html/old/formules/node18.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>average square distance (ASD) (Goldstein et al. 1995b; Slatkin 1995)
+[Goldstein, D.B. 97]</TITLE>
+<META NAME="description" CONTENT="average square distance (ASD) (Goldstein et al. 1995b; Slatkin 1995)
+[Goldstein, D.B. 97]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node19.html">
+<LINK REL="previous" HREF="node17.html">
+<LINK REL="up" HREF="node16.html">
+<LINK REL="next" HREF="node19.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html237"
+ HREF="node19.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html235"
+ HREF="node16.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html229"
+ HREF="node17.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html238"
+ HREF="node19.html">Shriver et al.'s (1995)</A>
+<B> Up:</B> <A NAME="tex2html236"
+ HREF="node16.html">SMM distances</A>
+<B> Previous:</B> <A NAME="tex2html230"
+ HREF="node17.html">Goldstein et al. (1995a)</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00122000000000000000">
+average square distance (ASD) (Goldstein et al. 1995b; Slatkin 1995)
+[<A
+ HREF="node21.html#GP97">Goldstein, D.B. 97</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+ASD=\frac{\sum ^{r}_{k}\sum _{i,j}\left( \left( i-j\right) ^{2}x_{ik}y_{jk}\right) }{r}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="238" HEIGHT="52" BORDER="0"
+ SRC="img48.png"
+ ALT="\begin{displaymath}
+ASD=\frac{\sum ^{r}_{k}\sum _{i,j}\left( \left( i-j\right) ^{2}x_{ik}y_{jk}\right) }{r}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node19.html b/html/old/formules/node19.html
new file mode 100755
index 0000000..d1c94e1
--- /dev/null
+++ b/html/old/formules/node19.html
@@ -0,0 +1,106 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Shriver et al.'s (1995) [Shriver, M.D. 95]</TITLE>
+<META NAME="description" CONTENT="Shriver et al.'s (1995) [Shriver, M.D. 95]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node20.html">
+<LINK REL="previous" HREF="node18.html">
+<LINK REL="up" HREF="node16.html">
+<LINK REL="next" HREF="node20.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html247"
+ HREF="node20.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html245"
+ HREF="node16.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html239"
+ HREF="node18.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html248"
+ HREF="node20.html">Lev A. Zhivotovsky (1999)</A>
+<B> Up:</B> <A NAME="tex2html246"
+ HREF="node16.html">SMM distances</A>
+<B> Previous:</B> <A NAME="tex2html240"
+ HREF="node18.html">average square distance (ASD)</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00123000000000000000">
+Shriver et al.'s (1995) [<A
+ HREF="node21.html#SJB95">Shriver, M.D. 95</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+D_{SW}=W_{XY}-\frac{\left( W_{X}+W_{Y}\right) }{2}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="201" HEIGHT="40" BORDER="0"
+ SRC="img49.png"
+ ALT="\begin{displaymath}
+D_{SW}=W_{XY}-\frac{\left( W_{X}+W_{Y}\right) }{2}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+where <!-- MATH
+ $W_{X}=\frac{\sum ^{r}_{k}\sum _{i\neq j}\left( \left| i-j\right| x_{ik}x_{jk}\right) }{r}$
+ -->
+<IMG
+ WIDTH="193" HEIGHT="54" ALIGN="MIDDLE" BORDER="0"
+ SRC="img50.png"
+ ALT="\( W_{X}=\frac{\sum ^{r}_{k}\sum _{i\neq j}\left( \left\vert i-j\right\vert x_{ik}x_{jk}\right) }{r} \)">,
+<!-- MATH
+ $W_{Y}=\frac{\sum ^{r}_{k}\sum _{i\neq j}\left( \left| i-j\right| y_{ik}y_{jk}\right) }{r}$
+ -->
+<IMG
+ WIDTH="190" HEIGHT="54" ALIGN="MIDDLE" BORDER="0"
+ SRC="img51.png"
+ ALT="\( W_{Y}=\frac{\sum ^{r}_{k}\sum _{i\neq j}\left( \left\vert i-j\right\vert y_{ik}y_{jk}\right) }{r} \)">,
+<!-- MATH
+ $W_{XY}=\frac{\sum ^{r}_{k}\sum _{i\neq j}\left( \left| i-j\right| x_{ik}y_{jk}\right) }{r}$
+ -->
+<IMG
+ WIDTH="202" HEIGHT="54" ALIGN="MIDDLE" BORDER="0"
+ SRC="img52.png"
+ ALT="\( W_{XY}=\frac{\sum ^{r}_{k}\sum _{i\neq j}\left( \left\vert i-j\right\vert x_{ik}y_{jk}\right) }{r} \)">
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node2.html b/html/old/formules/node2.html
new file mode 100755
index 0000000..63317c6
--- /dev/null
+++ b/html/old/formules/node2.html
@@ -0,0 +1,159 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>IAM distances</TITLE>
+<META NAME="description" CONTENT="IAM distances">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node16.html">
+<LINK REL="previous" HREF="node1.html">
+<LINK REL="up" HREF="node1.html">
+<LINK REL="next" HREF="node3.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html63"
+ HREF="node3.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html61"
+ HREF="node1.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html55"
+ HREF="node1.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html64"
+ HREF="node3.html">Shared allele distance (Chakraborty</A>
+<B> Up:</B> <A NAME="tex2html62"
+ HREF="node1.html">Distances</A>
+<B> Previous:</B> <A NAME="tex2html56"
+ HREF="node1.html">Distances</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H1><A NAME="SECTION00110000000000000000">
+IAM distances</A>
+</H1>
+
+<P>
+<!-- MATH
+ $J_{X}=\frac{\sum ^{r}_{j}\sum ^{m_{j}}_{i}x^{2}_{ij}}{r}$
+ -->
+<IMG
+ WIDTH="128" HEIGHT="54" ALIGN="MIDDLE" BORDER="0"
+ SRC="img2.png"
+ ALT="\( J_{X}=\frac{\sum ^{r}_{j}\sum ^{m_{j}}_{i}x^{2}_{ij}}{r} \)"> and
+<!-- MATH
+ $J_{Y}=\frac{\sum ^{r}_{j}\sum ^{m_{j}}_{i}y^{2}_{ij}}{r}$
+ -->
+<IMG
+ WIDTH="127" HEIGHT="54" ALIGN="MIDDLE" BORDER="0"
+ SRC="img3.png"
+ ALT="\( J_{Y}=\frac{\sum ^{r}_{j}\sum ^{m_{j}}_{i}y^{2}_{ij}}{r} \)">are
+the average homozygoties over loci in populations X and Y, respectively,
+and <!-- MATH
+ $J_{XY}=\frac{\sum ^{r}_{j}\sum ^{m_{j}}_{i}x_{ij}y_{ij}}{r}$
+ -->
+<IMG
+ WIDTH="155" HEIGHT="54" ALIGN="MIDDLE" BORDER="0"
+ SRC="img4.png"
+ ALT="\( J_{XY}=\frac{\sum ^{r}_{j}\sum ^{m_{j}}_{i}x_{ij}y_{ij}}{r} \)">.
+
+<P>
+<IMG
+ WIDTH="24" HEIGHT="28" ALIGN="MIDDLE" BORDER="0"
+ SRC="img5.png"
+ ALT="\( x_{ij} \)"> and <IMG
+ WIDTH="23" HEIGHT="28" ALIGN="MIDDLE" BORDER="0"
+ SRC="img6.png"
+ ALT="\( y_{ij} \)"> are the frequencies of the <I>i</I>th
+allele at the <I>j</I>th locus in populations X and Y, respectively,
+<IMG
+ WIDTH="25" HEIGHT="28" ALIGN="MIDDLE" BORDER="0"
+ SRC="img7.png"
+ ALT="\( m_{j} \)"> is the number of alleles at the <I>j</I>th locus, and
+r is the number of loci examined.
+
+<P>
+<BR><HR>
+<!--Table of Child-Links-->
+<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
+
+<UL>
+<LI><A NAME="tex2html65"
+ HREF="node3.html">Shared allele distance (Chakraborty and Jin, 1993) [Jin, L. 93]</A>
+<LI><A NAME="tex2html66"
+ HREF="node4.html">Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html67"
+ HREF="node5.html">Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html68"
+ HREF="node6.html">Latter's (1972) Fst (=<IMG
+ WIDTH="14" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img16.png"
+ ALT="\( \phi \protect \)">*) distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html69"
+ HREF="node7.html">Rogers' (1972) distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html70"
+ HREF="node8.html">Prevosti et al's (1975) distance [Takezaki, N. 96] has a statistical property
+similar to that of Dr and is defined as</A>
+<LI><A NAME="tex2html71"
+ HREF="node9.html">Cavali-Sforza and Edwards' (1967) chord distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html72"
+ HREF="node10.html">Nei et al's (1983) <IMG
+ WIDTH="28" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img21.png"
+ ALT="\( D_{A}\protect \)"> distance [Takezaki, N. 96]</A>
+<LI><A NAME="tex2html73"
+ HREF="node11.html">Sanghvi's (1953) <IMG
+ WIDTH="26" HEIGHT="16" ALIGN="BOTTOM" BORDER="0"
+ SRC="img23.png"
+ ALT="\( X^{2}\protect \)"> distance[Takezaki, N. 96]</A>
+<LI><A NAME="tex2html74"
+ HREF="node12.html">Reynold's genetic distance for short-term evolution (1983) [Reynolds, J. 83]</A>
+<UL>
+<LI><A NAME="tex2html75"
+ HREF="node13.html">unweighted average of single-locus ratio estimators, <!-- MATH
+ $\tilde{\theta }_{U}\protect$
+ -->
+<IMG
+ WIDTH="22" HEIGHT="37" ALIGN="MIDDLE" BORDER="0"
+ SRC="img30.png"
+ ALT="\( \tilde{\theta }_{U}\protect \)">:</A>
+<LI><A NAME="tex2html76"
+ HREF="node14.html">weighted average of single-locus ratio estimators :</A>
+<LI><A NAME="tex2html77"
+ HREF="node15.html">least squares <!-- MATH
+ $\theta \protect$
+ -->
+<IMG
+ WIDTH="12" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
+ SRC="img1.png"
+ ALT="\( \theta \)"> estimator :</A>
+</UL></UL>
+<!--End of Table of Child-Links-->
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node20.html b/html/old/formules/node20.html
new file mode 100755
index 0000000..da9c061
--- /dev/null
+++ b/html/old/formules/node20.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Lev A. Zhivotovsky (1999) [Takezaki, N. 96]</TITLE>
+<META NAME="description" CONTENT="Lev A. Zhivotovsky (1999) [Takezaki, N. 96]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="previous" HREF="node19.html">
+<LINK REL="up" HREF="node16.html">
+<LINK REL="next" HREF="node21.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html255"
+ HREF="node21.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html253"
+ HREF="node16.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html249"
+ HREF="node19.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html256"
+ HREF="node21.html">Bibliography</A>
+<B> Up:</B> <A NAME="tex2html254"
+ HREF="node16.html">SMM distances</A>
+<B> Previous:</B> <A NAME="tex2html250"
+ HREF="node19.html">Shriver et al.'s (1995)</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00124000000000000000">
+Lev A. Zhivotovsky (1999) [<A
+ HREF="node21.html#TN96">Takezaki, N. 96</A>]</A>
+</H2>
+
+<P>
+Consider two populations, X an Y and r autosomal microsatellite loci.<!-- MATH
+ $\overline{\mu _{X}}$
+ -->
+<IMG
+ WIDTH="26" HEIGHT="28" ALIGN="MIDDLE" BORDER="0"
+ SRC="img53.png"
+ ALT="\( \overline{\mu _{X}} \)">
+and <!-- MATH
+ $\overline{\mu _{Y}}$
+ -->
+<IMG
+ WIDTH="25" HEIGHT="28" ALIGN="MIDDLE" BORDER="0"
+ SRC="img54.png"
+ ALT="\( \overline{\mu _{Y}} \)">are the mean of <IMG
+ WIDTH="31" HEIGHT="28" ALIGN="MIDDLE" BORDER="0"
+ SRC="img55.png"
+ ALT="\( \mu _{X_{j}} \)">and
+<IMG
+ WIDTH="28" HEIGHT="28" ALIGN="MIDDLE" BORDER="0"
+ SRC="img56.png"
+ ALT="\( \mu _{Y_{j}} \)">averall loci for population X and Y respectively.
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+D_{R}=-\log \left( \frac{C_{XY}}{V_{XY}}\right)
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="141" HEIGHT="45" BORDER="0"
+ SRC="img57.png"
+ ALT="\begin{displaymath}
+D_{R}=-\log \left( \frac{C_{XY}}{V_{XY}}\right) \end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+with,
+
+<P>
+<!-- MATH
+ $C_{XY}=\frac{1}{r-1}\left( \sum ^{r}_{j}\mu _{X_{j}}\mu _{Y_{j}}-r\overline{\mu _{X}}\overline{\mu _{Y}}\right)$
+ -->
+<IMG
+ WIDTH="253" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
+ SRC="img58.png"
+ ALT="\( C_{XY}=\frac{1}{r-1}\left( \sum ^{r}_{j}\mu _{X_{j}}\mu _{Y_{j}}-r\overline{\mu _{X}}\overline{\mu _{Y}}\right) \)">
+and <!-- MATH
+ $V_{XY}=\frac{1}{2}\left( V_{X}+V_{Y}\right)$
+ -->
+<IMG
+ WIDTH="143" HEIGHT="34" ALIGN="MIDDLE" BORDER="0"
+ SRC="img59.png"
+ ALT="\( V_{XY}=\frac{1}{2}\left( V_{X}+V_{Y}\right) \)">, where <!-- MATH
+ $V_{X}=\frac{1}{r-1}\left( \sum ^{r}_{j}\mu _{X_{j}}^{2}-r\overline{\mu _{X}}^{2}\right)$
+ -->
+<IMG
+ WIDTH="204" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
+ SRC="img60.png"
+ ALT="\( V_{X}=\frac{1}{r-1}\left( \sum ^{r}_{j}\mu _{X_{j}}^{2}-r\overline{\mu _{X}}^{2}\right) \)">,<!-- MATH
+ $V_{Y}=\frac{1}{r-1}\left( \sum ^{r}_{j}\mu _{Y_{j}}^{2}-r\overline{\mu _{Y}}^{2}\right)$
+ -->
+<IMG
+ WIDTH="199" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
+ SRC="img61.png"
+ ALT="\( V_{Y}=\frac{1}{r-1}\left( \sum ^{r}_{j}\mu _{Y_{j}}^{2}-r\overline{\mu _{Y}}^{2}\right) \)">
+
+<P>
+Attention, to avoid software crash, when <IMG
+ WIDTH="67" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img62.png"
+ ALT="\( C_{XY}<1 \)">, <IMG
+ WIDTH="38" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img63.png"
+ ALT="\( C_{XY} \)">
+is set to 1.
+
+<P>
+
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node21.html b/html/old/formules/node21.html
new file mode 100755
index 0000000..61fd3d6
--- /dev/null
+++ b/html/old/formules/node21.html
@@ -0,0 +1,102 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Bibliography</TITLE>
+<META NAME="description" CONTENT="Bibliography">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node22.html">
+<LINK REL="previous" HREF="node1.html">
+<LINK REL="up" HREF="formules.html">
+<LINK REL="next" HREF="node22.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html265"
+ HREF="node22.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html263"
+ HREF="formules.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html257"
+ HREF="node20.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html266"
+ HREF="node22.html">About this document ...</A>
+<B> Up:</B> <A NAME="tex2html264"
+ HREF="formules.html">formules</A>
+<B> Previous:</B> <A NAME="tex2html258"
+ HREF="node20.html">Lev A. Zhivotovsky (1999)</A>
+<BR><BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00200000000000000000">
+Bibliography</A>
+</H2><DL COMPACT><DD><P></P><DT><A NAME="GP97">Goldstein, D.B. 97</A>
+<DD>
+Goldstein, D.B. & Pollock, D.D.
+<BR><EM>Launching Microsatellites: A Review of Mutation Processes and
+ Methods of Phylogenetic Inference</EM>.
+<BR>Journal of Heredity, vol. 88, no. 335-342, pages 0022-1503, 31 1997.
+<BR>1997.
+
+<P></P><DT><A NAME="JC93">Jin, L. 93</A>
+<DD>
+Jin, L. & Chakraborty, R.
+<BR><EM>Estimation of Genetic Distance and Coefficient of Gene
+ Diversity from Single-Probe Multilocus DNA Fingerprinting
+ Data</EM>.
+<BR>Mol. Biol. Evol., vol. 11, no. 1, pages 120-127, 13 1993.
+<BR>1994.
+
+<P></P><DT><A NAME="RWC83">Reynolds, J. 83</A>
+<DD>
+Reynolds, J., Weir, B.S. & Cockerham, C.
+<BR><EM>Estimation of the coancestry coefficient: basis for a short-term
+ genetic distance</EM>.
+<BR>Genetics Society of America, vol. 105, pages 767-779, November 1983.
+<BR>1983.
+
+<P></P><DT><A NAME="SJB95">Shriver, M.D. 95</A>
+<DD>
+Shriver, M.D., Jin, L. & Boerwinkle, E.
+<BR><EM>A Novel Measure of Genetic Distance for Highly Polymorphic
+ Tandem Repeat Loci</EM>.
+<BR>Mol. Bio. Evol., vol. 12, no. 5, pages 914-920, 4 1995.
+
+<P></P><DT><A NAME="TN96">Takezaki, N. 96</A>
+<DD>
+Takezaki, N. & Nei, M.
+<BR><EM>Genetic Distances and Reconstruction of Phylogenetic
+ Trees From Microsatellite DNA</EM>.
+<BR>Genetics, no. 144, pages 189-399, 6 1996.
+<BR>september, 1996.
+</DL>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node22.html b/html/old/formules/node22.html
new file mode 100755
index 0000000..144164a
--- /dev/null
+++ b/html/old/formules/node22.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>About this document ...</TITLE>
+<META NAME="description" CONTENT="About this document ...">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="previous" HREF="node21.html">
+<LINK REL="up" HREF="formules.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next_g.png">
+<A NAME="tex2html271"
+ HREF="formules.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html267"
+ HREF="node21.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Up:</B> <A NAME="tex2html272"
+ HREF="formules.html">formules</A>
+<B> Previous:</B> <A NAME="tex2html268"
+ HREF="node21.html">Bibliography</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H1><A NAME="SECTION00300000000000000000">
+About this document ...</A>
+</H1>
+ <P>
+This document was generated using the
+<A HREF="http://www-texdev.mpce.mq.edu.au/l2h/docs/manual/"><STRONG>LaTeX</STRONG>2<tt>HTML</tt></A> translator Version 2K.1beta (1.48)
+<P>
+Copyright © 1993, 1994, 1995, 1996,
+<A HREF="http://cbl.leeds.ac.uk/nikos/personal.html">Nikos Drakos</A>,
+Computer Based Learning Unit, University of Leeds.
+<BR>
+Copyright © 1997, 1998, 1999,
+<A HREF="http://www.maths.mq.edu.au/~ross/">Ross Moore</A>,
+Mathematics Department, Macquarie University, Sydney.
+<P>
+The command line arguments were: <BR>
+ <STRONG>latex2html</STRONG> <TT><A NAME="tex2html1"
+ HREF="../formules.tex">formules.tex</A></TT>
+<P>
+The translation was initiated by Olivier Langella on 2002-03-20
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node3.html b/html/old/formules/node3.html
new file mode 100755
index 0000000..42802f6
--- /dev/null
+++ b/html/old/formules/node3.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Shared allele distance (Chakraborty and Jin, 1993) [Jin, L. 93]</TITLE>
+<META NAME="description" CONTENT="Shared allele distance (Chakraborty and Jin, 1993) [Jin, L. 93]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node4.html">
+<LINK REL="previous" HREF="node2.html">
+<LINK REL="up" HREF="node2.html">
+<LINK REL="next" HREF="node4.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html86"
+ HREF="node4.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html84"
+ HREF="node2.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html78"
+ HREF="node2.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html87"
+ HREF="node4.html">Nei's (1972) standard genetic</A>
+<B> Up:</B> <A NAME="tex2html85"
+ HREF="node2.html">IAM distances</A>
+<B> Previous:</B> <A NAME="tex2html79"
+ HREF="node2.html">IAM distances</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00111000000000000000">
+Shared allele distance (Chakraborty and Jin, 1993) [<A
+ HREF="node21.html#JC93">Jin, L. 93</A>]</A>
+</H2>
+
+<P>
+between individuals:
+
+<P>
+<!-- MATH
+ $D_{SA_{I}}=1-P_{SA_{I}}$
+ -->
+<IMG
+ WIDTH="127" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img8.png"
+ ALT="\( D_{SA_{I}}=1-P_{SA_{I}} \)">, with <!-- MATH
+ $P_{SA_{I}}=\frac{\sum ^{r}_{j}S}{2r}$
+ -->
+<IMG
+ WIDTH="98" HEIGHT="54" ALIGN="MIDDLE" BORDER="0"
+ SRC="img9.png"
+ ALT="\( P_{SA_{I}}=\frac{\sum ^{r}_{j}S}{2r} \)">
+
+<P>
+where the number of shared alleles S is sumed over all loci r.
+
+<P>
+between populations:
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+D_{SA_{B}}=1-\frac{2\overline{P}_{SA_{B}}}{\overline{P}_{SA_{X}}+\overline{P}_{SA_{Y}}}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="194" HEIGHT="48" BORDER="0"
+ SRC="img10.png"
+ ALT="\begin{displaymath}
+D_{SA_{B}}=1-\frac{2\overline{P}_{SA_{B}}}{\overline{P}_{SA_{X}}+\overline{P}_{SA_{Y}}}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+where the average proportion of shared alleles between and within
+populations X and Y (<!-- MATH
+ $\overline{P}_{SA_{B}}$
+ -->
+<IMG
+ WIDTH="45" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
+ SRC="img11.png"
+ ALT="\( \overline{P}_{SA_{B}} \)">, <!-- MATH
+ $\overline{P}_{SA_{X}}$
+ -->
+<IMG
+ WIDTH="46" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
+ SRC="img12.png"
+ ALT="\( \overline{P}_{SA_{X}} \)">,<!-- MATH
+ $\overline{P}_{SA_{Y}}$
+ -->
+<IMG
+ WIDTH="45" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
+ SRC="img13.png"
+ ALT="\( \overline{P}_{SA_{Y}} \)">
+respectively) is computed overall possible combinations of individuals
+sampled.
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node4.html b/html/old/formules/node4.html
new file mode 100755
index 0000000..e57d7b6
--- /dev/null
+++ b/html/old/formules/node4.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]</TITLE>
+<META NAME="description" CONTENT="Nei's (1972) standard genetic distance (Ds) [Takezaki, N. 96]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node5.html">
+<LINK REL="previous" HREF="node3.html">
+<LINK REL="up" HREF="node2.html">
+<LINK REL="next" HREF="node5.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html96"
+ HREF="node5.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html94"
+ HREF="node2.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html88"
+ HREF="node3.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html97"
+ HREF="node5.html">Nei's (1973) minimum genetic</A>
+<B> Up:</B> <A NAME="tex2html95"
+ HREF="node2.html">IAM distances</A>
+<B> Previous:</B> <A NAME="tex2html89"
+ HREF="node3.html">Shared allele distance (Chakraborty</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00112000000000000000">
+Nei's (1972) standard genetic distance (Ds) [<A
+ HREF="node21.html#TN96">Takezaki, N. 96</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+Ds=-\ln \left[ \frac{J_{XY}}{\sqrt{J_{X}J_{Y}}}\right]
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="144" HEIGHT="45" BORDER="0"
+ SRC="img14.png"
+ ALT="\begin{displaymath}
+Ds=-\ln \left[ \frac{J_{XY}}{\sqrt{J_{X}J_{Y}}}\right] \end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node5.html b/html/old/formules/node5.html
new file mode 100755
index 0000000..414424a
--- /dev/null
+++ b/html/old/formules/node5.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]</TITLE>
+<META NAME="description" CONTENT="Nei's (1973) minimum genetic distance (Dm) [Takezaki, N. 96]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node6.html">
+<LINK REL="previous" HREF="node4.html">
+<LINK REL="up" HREF="node2.html">
+<LINK REL="next" HREF="node6.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html106"
+ HREF="node6.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html104"
+ HREF="node2.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html98"
+ HREF="node4.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html107"
+ HREF="node6.html">Latter's (1972) Fst (=*)</A>
+<B> Up:</B> <A NAME="tex2html105"
+ HREF="node2.html">IAM distances</A>
+<B> Previous:</B> <A NAME="tex2html99"
+ HREF="node4.html">Nei's (1972) standard genetic</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00113000000000000000">
+Nei's (1973) minimum genetic distance (Dm) [<A
+ HREF="node21.html#TN96">Takezaki, N. 96</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+Dm=\frac{\left( J_{X}+J_{Y}\right) }{2}-J_{XY}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="175" HEIGHT="40" BORDER="0"
+ SRC="img15.png"
+ ALT="\begin{displaymath}
+Dm=\frac{\left( J_{X}+J_{Y}\right) }{2}-J_{XY}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node6.html b/html/old/formules/node6.html
new file mode 100755
index 0000000..14b14af
--- /dev/null
+++ b/html/old/formules/node6.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Latter's (1972) Fst (=*) distance [Takezaki, N. 96]</TITLE>
+<META NAME="description" CONTENT="Latter's (1972) Fst (=*) distance [Takezaki, N. 96]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node7.html">
+<LINK REL="previous" HREF="node5.html">
+<LINK REL="up" HREF="node2.html">
+<LINK REL="next" HREF="node7.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html116"
+ HREF="node7.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html114"
+ HREF="node2.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html108"
+ HREF="node5.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html117"
+ HREF="node7.html">Rogers' (1972) distance [Takezaki,</A>
+<B> Up:</B> <A NAME="tex2html115"
+ HREF="node2.html">IAM distances</A>
+<B> Previous:</B> <A NAME="tex2html109"
+ HREF="node5.html">Nei's (1973) minimum genetic</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00114000000000000000">
+Latter's (1972) Fst (=<IMG
+ WIDTH="14" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
+ SRC="img16.png"
+ ALT="\( \phi \protect \)">*) distance [<A
+ HREF="node21.html#TN96">Takezaki, N. 96</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+Fst=\frac{\frac{\left( J_{X}+J_{Y}\right) }{2}-J_{XY}}{1-J_{XY}}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="156" HEIGHT="48" BORDER="0"
+ SRC="img17.png"
+ ALT="\begin{displaymath}
+Fst=\frac{\frac{\left( J_{X}+J_{Y}\right) }{2}-J_{XY}}{1-J_{XY}}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node7.html b/html/old/formules/node7.html
new file mode 100755
index 0000000..9efd603
--- /dev/null
+++ b/html/old/formules/node7.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Rogers' (1972) distance [Takezaki, N. 96]</TITLE>
+<META NAME="description" CONTENT="Rogers' (1972) distance [Takezaki, N. 96]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node8.html">
+<LINK REL="previous" HREF="node6.html">
+<LINK REL="up" HREF="node2.html">
+<LINK REL="next" HREF="node8.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html126"
+ HREF="node8.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html124"
+ HREF="node2.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html118"
+ HREF="node6.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html127"
+ HREF="node8.html">Prevosti et al's (1975)</A>
+<B> Up:</B> <A NAME="tex2html125"
+ HREF="node2.html">IAM distances</A>
+<B> Previous:</B> <A NAME="tex2html119"
+ HREF="node6.html">Latter's (1972) Fst (=*)</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00115000000000000000">
+Rogers' (1972) distance [<A
+ HREF="node21.html#TN96">Takezaki, N. 96</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+Dr=\frac{1}{r}\sum ^{r}_{j}\sqrt{\frac{\sum ^{m}_{i}\left( x_{ij}-y_{ij}\right) ^{2}}{2}}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="212" HEIGHT="63" BORDER="0"
+ SRC="img18.png"
+ ALT="\begin{displaymath}
+Dr=\frac{1}{r}\sum ^{r}_{j}\sqrt{\frac{\sum ^{m}_{i}\left( x_{ij}-y_{ij}\right) ^{2}}{2}}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node8.html b/html/old/formules/node8.html
new file mode 100755
index 0000000..771281d
--- /dev/null
+++ b/html/old/formules/node8.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Prevosti et al's (1975) distance [Takezaki, N. 96] has a statistical property
+similar to that of Dr and is defined as</TITLE>
+<META NAME="description" CONTENT="Prevosti et al's (1975) distance [Takezaki, N. 96] has a statistical property
+similar to that of Dr and is defined as">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node9.html">
+<LINK REL="previous" HREF="node7.html">
+<LINK REL="up" HREF="node2.html">
+<LINK REL="next" HREF="node9.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html136"
+ HREF="node9.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html134"
+ HREF="node2.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html128"
+ HREF="node7.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html137"
+ HREF="node9.html">Cavali-Sforza and Edwards' (1967)</A>
+<B> Up:</B> <A NAME="tex2html135"
+ HREF="node2.html">IAM distances</A>
+<B> Previous:</B> <A NAME="tex2html129"
+ HREF="node7.html">Rogers' (1972) distance [Takezaki,</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00116000000000000000">
+Prevosti et al's (1975) distance [<A
+ HREF="node21.html#TN96">Takezaki, N. 96</A>] has a statistical property
+similar to that of Dr and is defined as</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+Cp=\frac{\sum ^{r}_{j}\sum ^{m_{j}}_{i}\left| x_{ij}-y_{ij}\right| }{2r}
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="176" HEIGHT="44" BORDER="0"
+ SRC="img19.png"
+ ALT="\begin{displaymath}
+Cp=\frac{\sum ^{r}_{j}\sum ^{m_{j}}_{i}\left\vert x_{ij}-y_{ij}\right\vert }{2r}\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/node9.html b/html/old/formules/node9.html
new file mode 100755
index 0000000..8bbceab
--- /dev/null
+++ b/html/old/formules/node9.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2K.1beta (1.48)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Cavali-Sforza and Edwards' (1967) chord distance [Takezaki, N. 96]</TITLE>
+<META NAME="description" CONTENT="Cavali-Sforza and Edwards' (1967) chord distance [Takezaki, N. 96]">
+<META NAME="keywords" CONTENT="formules">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="formules.css">
+
+<LINK REL="next" HREF="node10.html">
+<LINK REL="previous" HREF="node8.html">
+<LINK REL="up" HREF="node2.html">
+<LINK REL="next" HREF="node10.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html146"
+ HREF="node10.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
+ SRC="/usr/share/latex2html/icons/next.png"></A>
+<A NAME="tex2html144"
+ HREF="node2.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
+ SRC="/usr/share/latex2html/icons/up.png"></A>
+<A NAME="tex2html138"
+ HREF="node8.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
+ SRC="/usr/share/latex2html/icons/prev.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html147"
+ HREF="node10.html">Nei et al's (1983)</A>
+<B> Up:</B> <A NAME="tex2html145"
+ HREF="node2.html">IAM distances</A>
+<B> Previous:</B> <A NAME="tex2html139"
+ HREF="node8.html">Prevosti et al's (1975)</A>
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00117000000000000000">
+Cavali-Sforza and Edwards' (1967) chord distance [<A
+ HREF="node21.html#TN96">Takezaki, N. 96</A>]</A>
+</H2>
+
+<P>
+<BR><P></P>
+<DIV ALIGN="CENTER">
+<!-- MATH
+ \begin{displaymath}
+Dc=\frac{2}{\Pi r}\sum ^{r}_{j}\sqrt{2\left( (1-\sum _{i}^{m_{j}}\sqrt{x_{ij}y_{ij}}\right) }
+\end{displaymath}
+ -->
+
+<IMG
+ WIDTH="258" HEIGHT="64" BORDER="0"
+ SRC="img20.png"
+ ALT="\begin{displaymath}
+Dc=\frac{2}{\Pi r}\sum ^{r}_{j}\sqrt{2\left( (1-\sum _{i}^{m_{j}}\sqrt{x_{ij}y_{ij}}\right) }\end{displaymath}">
+</DIV>
+<BR CLEAR="ALL">
+<P></P>
+
+<P>
+<BR><HR>
+<ADDRESS>
+Olivier Langella
+2002-03-20
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/html/old/formules/previous_motif.gif b/html/old/formules/previous_motif.gif
new file mode 100755
index 0000000..aef90f1
Binary files /dev/null and b/html/old/formules/previous_motif.gif differ
diff --git a/html/old/formules/previous_motif_gr.gif b/html/old/formules/previous_motif_gr.gif
new file mode 100755
index 0000000..c6acaab
Binary files /dev/null and b/html/old/formules/previous_motif_gr.gif differ
diff --git a/html/old/formules/up_motif.gif b/html/old/formules/up_motif.gif
new file mode 100755
index 0000000..3d1aebf
Binary files /dev/null and b/html/old/formules/up_motif.gif differ
diff --git a/html/old/formules/up_motif_gr.gif b/html/old/formules/up_motif_gr.gif
new file mode 100755
index 0000000..a8b463a
Binary files /dev/null and b/html/old/formules/up_motif_gr.gif differ
diff --git a/html/old/index.php.html b/html/old/index.php.html
new file mode 100644
index 0000000..b83d920
--- /dev/null
+++ b/html/old/index.php.html
@@ -0,0 +1,229 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//FR" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"><head><title>Bioinfo PGE</title>
+
+
+
+
+
+<link type="text/CSS" rel="stylesheet" href="index.php_fichiers/bioinfo.css">
+<link type="text/CSS" rel="stylesheet" href="index.php_fichiers/menu.css">
+<link type="text/CSS" rel="stylesheet" href="index.php_fichiers/pge.css">
+<link type="text/CSS" rel="stylesheet" href="index.php_fichiers/basdepage.css"></head><body>
+
+<table class="menu-back">
+<tbody><tr class="menu-back">
+<td class="menu-accueil">
+<div><a href="http://localhost/pge/bioinfo/accueil/index.php?lang=fr">Accueil</a></div></td>
+<td class="menu-tampon">
+</td>
+<td class="menu-centre">
+<table class="menu">
+<tbody><tr>
+<td class="button" onmouseout="this.className='button'" onmouseover="this.className='button-up'" onmousedown="this.className='button-down'" onclick="document.location='../lea/index.php?lang=fr&doc=lea'">
+<table>
+<tbody><tr>
+<td class="button-text">LEA</td>
+</tr>
+</tbody></table>
+</td>
+<td class="button-down">
+<table>
+<tbody><tr>
+<td class="button-text">Populations</td>
+</tr>
+</tbody></table>
+</td>
+<td class="button" onmouseout="this.className='button'" onmouseover="this.className='button-up'" onmousedown="this.className='button-down'" onclick="document.location='../treeplot/index.php?lang=fr&doc=treeplot'">
+<table>
+<tbody><tr>
+<td class="button-text">Treeplot</td>
+</tr>
+</tbody></table>
+</td>
+<td class="button" onmouseout="this.className='button'" onmouseover="this.className='button-up'" onmousedown="this.className='button-down'" onclick="document.location='../nuees/index.php?lang=fr&doc=nuees'">
+<table>
+<tbody><tr>
+<td class="button-text">Nu�es</td>
+</tr>
+</tbody></table>
+</td>
+<td class="button" onmouseout="this.className='button'" onmouseover="this.className='button-up'" onmousedown="this.className='button-down'" onclick="document.location='../phpMesEchantillons/index.php?lang=fr&doc=phpMesEchantillons'">
+<table>
+<tbody><tr>
+<td class="button-text">phpMesEchantillons</td>
+</tr>
+</tbody></table>
+</td>
+</tr>
+</tbody></table>
+</td>
+<td class="menu-tampon">
+</td>
+<td class="menu-langue">
+<div class="choix_langue">[ <a href="http://localhost/pge/bioinfo/populations/index.php?lang=en&doc=populations">English</a> | Fran�ais ]</div></td>
+</tr>
+</tbody></table>
+<table class="milieuTable">
+<tbody><tr>
+<td class="milieuCellule">
+<div class="titre">Populations 1.2.28 (12/5/2002)</div><div class="paragraphe">Logiciel de g�n�tique des populations (distances entre individus ou populations, arbres phylog�n�tiques)</div><ul class="plan"><li><a href="#ancre_fonctionnalites">Fonctionnalit�s</a></li><li><a href="#ancre_telechargement">T�l�chargement</a></li><li><a href="#ancre_distances">Distances calcul�es</a></li><li><a href="#ancre_formats">Formats</a></li><li>Utilisation en ligne de commande <a href="#ancre_ligne_de_ [...]
+programme est distribu� car potentiellement utile, mais SANS AUCUNE
+GARANTIE, ni explicite ni implicite, y compris les garanties de
+commercialisation ou d'adaptation dans un but sp�cifique. Reportez-vous
+� la <a href="http://www.gnu.org/copyleft/gpl.html">Licence Publique G�n�rale GNU</a> pour plus de d�tails.</div><div class="paragraphe">Vous
+devez avoir re�u une copie de la Licence Publique G�n�rale GNU en m�me
+temps que ce programme ; si ce n'est pas le cas, �crivez � la Free
+Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307, Etats-Unis.</div><div class="information">Auteurs</div><div class="paragraphe">Olivier Langella, CNRS UPR9034</div><div class="paragraphe">Paquet Debian GNU/Linux : <a href="http://localhost/pge/bioinfo/debian/populations_1.2.28-1_i386.deb">populations_1.2.28-1_i386.deb</a></div><div class="paragraphe">Paquet RPM GNU/Linux (RedHat ou Mandrake) : <a href="http://localhost/pge/bioinfo/rpm/populations-1.2.28-2.i386.rpm">populations-1.2.28-2.i386.rpm</a></div><div class="paragrap [...]
+<div class="script">make install</div><a id="ancre_distances"></a>
+<div class="titre">Distances</div><div class="enumeration">
+ <a href="./formules/node3.html">DAS</a>, shared allele distance (Chakraborty et Jin., 1993)</div>
+ <div class="enumeration">Nei, minimum genetic distance,
+ <a href="./formules/node5.html">Dm</a> (Nei,1987)</div>
+ <div class="enumeration">Nei, standard genetic distance,
+ <a href="./formules/node4.html">Ds</a> (Nei, 1987)</div>
+ <div class="enumeration">Cavalli-Sforza and Edwards,
+ <a href="./formules/node9.html">Dc</a> (1967)</div>
+ <div class="enumeration">Nei et al's,
+ <a href="./formules/node10.html">Da</a> (1983)</div>
+ <div class="enumeration"><a href="./formules/node6.html">Latter, Fst</a>
+ (1972)</div><div class="enumeration">Prevosti et al.'s,
+ <a href="./formules/node8.html">Cp</a> (1975)</div><div class="enumeration">Rogers',
+ <a href="./formules/node7.html">Dr</a> (1972)</div>
+ <div class="enumeration">Reynolds J. unweighted,
+ <a href="./formules/node13.html">Dru</a> (1983)</div>
+ <div class="enumeration">Reynolds J. weighted,
+ <a href="./formules/node14.html">Drw</a> (1983)</div>
+ <div class="enumeration">Reynolds J. least squares,
+ <a href="./formules/node15.html">Drl</a> (1983)</div>
+ <div class="paragraphe">Distances microsatellites</div>
+ <div class="enumeration">Goldstein et al.,
+ <a href="./formules/node17.html">dmu2</a> (1995a)</div>
+ <div class="enumeration">Average Square Distance (
+ <a href="./formules/node18.html">ASD</a>, Goldstein, Slatkin 1995)</div>
+ <div class="enumeration">Shriver et al's,
+<a href="./formules/node19.html">Dsw</a> (1995)</div>
+<div class="enumeration">Lev A. Zhivotovsky,
+<a href="./formules/node20.html">DR</a> (1999)</div><a id="ancre_formats"></a><div class="titre">Formats</div><div class="plan">- <a href="#ancre_formats_entree">entr�e</a></div><div class="plan">- <a href="#ancre_formats_sortie">sortie</a></div><a id="ancre_formats_entree"></a><div class="titre2">en entr�e</div><div class="paragraphe">Populations peut lire les formats:</div><div class="enumeration">- <a href="http://www.cefe.cnrs-mop.fr/">Genepop</a></div><div class="enumeration">- <a h [...]
+le format propre � Populations, qui permet de traiter un nombre
+illimit� d'all�les, et sur des populations haplo�des, diplo�des... ou N
+plo�des (en s�parant les all�les par ":").</div><div class="paragraphe">exemple pour des populations diplo�des:</div><div class="script">
+"Grape populations in southern France"<br>
+ADHLocus1<br>
+ADH#2<br>
+ADHthree<br>
+ADH-4<br>
+ADH-5<br>
+Pop Montpellier<br>
+Montpellier1 , 02:01 03:03 01:02 03:02 10:11<br>
+Montpellier2 , 02:02 03:01 01:02 03:03 11:11<br>
+Montpellier3 , 01:02 04:01 02:02 01:02 10:10<br>
+Montpellier4 , 01:03 02:02 01:01 02:02 10:11<br>
+Montpellier5 , 02:03 02:04 01:01 01:02 10:10<br>
+POP Gigondas<br>
+Gigondas1 , 01:02 02:02 02:01 04:05 08:07<br>
+Gigondas2 , 01:02 02:01 02:01 04:05 03:07<br>
+Gigondas3 , 02:01 02:03 01:01 05:05 04:02<br>
+Gigondas4 , 02:01 03:03 03:01 03:03 06:03<br>
+Gigondas5 , 01:01 02:01 03:01 05:05 08:07<br>
+</div>
+
+<div class="paragraphe">exemple pour des populations haplo�des:</div><div class="script">
+"Grape populations in southern France"<br>
+ADHLocus1<br>
+ADH#2<br>
+ADHthree<br>
+ADH-4<br>
+ADH-5<br>
+Pop Montpellier<br>
+Montpellier1 , 02 03 01 03 10<br>
+Montpellier2 , 02 03 01 03 11<br>
+Montpellier3 , 01 04 02 01 10<br>
+Montpellier4 , 01 02 01 02 10<br>
+Montpellier5 , 02 02 01 01 10<br>
+POP Gigondas<br>
+Gigondas1 , 01 02 02 04 08<br>
+Gigondas2 , 01 02 02 04 03<br>
+Gigondas3 , 02 02 01 05 04<br>
+Gigondas4 , 02 03 03 03 06<br>
+Gigondas5 , 01 02 03 05 08<br>
+</div>
+
+<div class="paragraphe">exemple pour des populations haplo�des, en utilisant des noms d'all�les alphanum�riques (sans espaces):</div><div class="script">
+"Grape populations in southern France"<br>
+ADHLocus1<br>
+ADH#2<br>
+ADHthree<br>
+ADH-4<br>
+ADH-5<br>
+Pop Montpellier<br>
+Montpellier1 , all2 03 01 03 10<br>
+Montpellier2 , all2 03 01 03 11<br>
+Montpellier3 , all1 04 02 01 miss<br>
+Montpellier4 , all1 02 01 02 10<br>
+Montpellier5 , all2 02 01 01 10<br>
+POP Gigondas<br>
+Gigondas1 , all1 02 02 04 08<br>
+Gigondas2 , all1 02 02 04 miss<br>
+Gigondas3 , all2 02 01 05 04<br>
+Gigondas4 , all2 03 03 03 06<br>
+Gigondas5 , all1 02 03 05 08<br>
+</div>
+
+<a id="ancre_pop_struct"></a><div class="titre2">cas des populations structur�es:</div><div class="paragraphe">Les
+formats d�crits ci-dessus sont valables, il suffit d'indiquer derri�re
+le mot cl� "POP" un nom en forme de chemin de fichier.</div><div class="paragraphe">exemple:</div><div class="script">
+exemple de populations structur�es<br>
+locus1<br>
+locus2<br>
+locus3<br>
+POP Rennes/immeuble_sud/pop_3emeetage<br>
+ind1, (description des individus)<br>
+ind2, ...<br>
+ind3, ...<br>
+ind4, ...<br>
+POP Rennes/immeuble_sud/pop_2emeetage<br>
+ind1, (description des individus)<br>
+ind2, ...<br>
+ind3, ...<br>
+ind4, ...<br>
+</div>
+
+<a id="ancre_formats_sortie"></a><div class="titre2">Formats de sortie</div><div class="paragraphe">Populations peut �crire des fichiers dans les formats suivants:</div><div class="enumeration"><a href="http://www.cefe.cnrs-mop.fr/">Genepop</a></div><div class="enumeration"><a href="http://www.univ-montp2.fr/%7Egenetix/genetix/genetix.htm">G�n�tix</a></div><div class="enumeration">Populations</div><div class="enumeration"><a href="http://localhost/pge/bioinfo/lea/index.php?lang=fr">Lea</ [...]
+Note: "treeplot" permet de convertir les fichiers Phylip en Adobe
+illustrator, PostScript, Gif... et de colorier automatiquement les
+individus en fonction de leur population.</div><div class="paragraphe">Les matrices de distances peuvent �tre lues par Excell, Phylip, xgobi, NTsys.</div><a id="ancre_ligne_de_commande"></a><div class="titre">Utilisation en ligne de commande</div><div class="paragraphe">On peut maintenant utiliser "Populations" en ligne de commande pour produire des arbres phylog�n�tiques. il suffit de taper:</div><div class="commande">populations nom_du_fichier_de_donn�es -"arguments"</div><div class="p [...]
+m�thode (par d�faut, Nei standard, Ds) pour choisir la m�thode de
+distance utilis�e parmi ces possibilit�s: DAS, Dm, Ds, Dc, Da, dmu2,
+Fst, Cp, Dr, ASD, Dsw, Dr, Dru, Drw, Drl. voir distances calcul�es</div><div class="enumeration">construct m�thode (par d�faut, upgma) avec au choix: upgma ou nj (Neighbor Joining)</div><div class="enumeration">-bootstrap_ind
+nombre pour indiquer le nombre de bootstrap que vous voulez effectuer
+sur les individus (indisponible si l'on a choisi l'argument -ind)</div><div class="enumeration">-bootstrap_locus nombre pour indiquer le nombre de bootstrap que vous voulez effectuer sur les locus</div><div class="enumeration">-output nom_de_fichier_treeview pour indiquer le nom du fichier de sortie (au format treeview)</div><div class="enumeration">-level
+nombre , dans le cas de populations structur�es, permet d'indiquer le
+niveau sur lequel on d�sire faire l'arbre de m�tapopulations.</div><div class="paragraphe">exemple de commande:</div><div class="script">populations toutc2.txt -phylogeny pop -dist Dm -bootstrap_locus 10000 -output toutc2_10000_Dm.tre</div><div class="paragraphe">On peut placer ces commandes dans un fichier .bat (pour DOS) ou un script (pour linux).</div><a id="ancre_bibliographie"></a><div class="titre">Bibliographie</div><div class="article"><strong>Bruce Ranala and Joanna L. Mountain. [...]
+Launching Microsatellites: A Review of Mutation Processes and Methods
+of Phylogenetic Inference. Journal of Heredity, 88(335-342):0022-1503,
+31/3/1997. </div><div class="article"><strong>Li Jin and Ranajit Chakraborty.</strong>
+Estimation of Genetic Distance and Coefficient of Gene Diversity from
+Single-Probe Multilocus DNA Fingerprinting Data. Mol. Biol. Evol,
+11(1):120-127, 13/9/1993. </div><div class="article"><strong>Mark D. Shriver, Li Jin, Eric Boerwinkle, Ranjan Deka, Robert E. Ferrel and Ranajit Chakraborty.</strong> A Novel Measure of Genetic Distance for Highly Polymorphic Tandem Repeat Loci. Mol. Biol. Evol, 12(5):914-920, 13/4/1995. </div><div class="article"><strong>Montgomery Slatkin.</strong> A Measure of Population Subdivision on Microsatellite Allele Frequencies. Genetics, (139):457-462, 19/6/1994. </div><div class="article"><s [...]
+Weighted Neigbhor Joining: A Likelihood-Based Approach to
+Distance-Based Phylogeny Reconstruction. Mol. Biol. Evol,
+17(1):189-197, 11/10/1999. </div></td>
+<td></td>
+</tr>
+</tbody></table>
+<table class="bas-de-page">
+<tbody><tr>
+<td>
+<a href="http://validator.w3.org/"><img src="index.php_fichiers/valid-xhtml11.png" alt="validation xhtml1.1" title=""></a></td>
+<td class="bas-de-page-tampon">
+</td>
+<td class="bas-de-page-centre">
+<div class="bas_de_page">Ce site s'affiche mieux dans un navigateur conforme aux <a href="http://localhost/pge/bioinfo/xhtml/index.php?lang=fr">standards.</a></div></td>
+<td class="bas-de-page-tampon">
+</td>
+<td>
+<a href="http://jigsaw.w3.org/css-validator/"><img src="index.php_fichiers/valid-css.png" alt="validation xhtml1.1" title=""></a></td>
+</tr>
+</tbody></table>
+</body></html>
\ No newline at end of file
diff --git a/html/old/index.php_fichiers/basdepage.css b/html/old/index.php_fichiers/basdepage.css
new file mode 100644
index 0000000..71a70b5
--- /dev/null
+++ b/html/old/index.php_fichiers/basdepage.css
@@ -0,0 +1,18 @@
+table.bas-de-page {
+ width: 100%;
+}
+
+div.bas_de_page {
+ font-style: italic;
+ width: 100%;
+ align: center;
+}
+
+td.bas-de-page-centre {
+ align: center;
+}
+
+td.bas-de-page-tampon
+{
+ width: 40%;
+}
\ No newline at end of file
diff --git a/html/old/index.php_fichiers/bioinfo.css b/html/old/index.php_fichiers/bioinfo.css
new file mode 100644
index 0000000..f71898a
--- /dev/null
+++ b/html/old/index.php_fichiers/bioinfo.css
@@ -0,0 +1,68 @@
+/*********
+ * bioinfo *
+ *********/
+
+form {
+ padding: 0.5em;
+ margin: 0.5em;
+ font-family:sans-serif;
+ background-color: #E0F0F0;
+ }
+
+div {
+ font-family:sans-serif;
+ }
+
+div.bas_de_page {
+ font-style: italic;
+ }
+
+div.plan{
+ font-weight:bold;
+ padding: 0.2em;
+ margin: 0.5em;
+ text-align : left;
+ // background-color: #E0F0F0;
+ }
+
+
+div.enumeration{
+ // font-weight:bold;
+ padding: 0.2em;
+ margin: 0.5em;
+ text-align : left;
+ background-color: #E0F0F0;
+ }
+
+div.script{
+ text-align : left;
+ font-family: courrier;
+ padding : 0.5em
+ }
+
+div.paragraphe{
+ text-align : left;
+ padding : 0.5em
+ }
+
+div.article{
+ text-align : left;
+ padding : 0.5em
+ }
+
+div.titre {
+ color:#0000ca;
+ font-weight:bold;
+ text-align:center;
+ font-family:sans-serif;
+ font-size:x-large;
+ padding : 0.5em
+ }
+div.titre2 {
+ color:#0000ca;
+ font-weight:bold;
+ text-align:left;
+ font-family:sans-serif;
+ font-size:x-medium;
+ padding : 0.5em
+ }
\ No newline at end of file
diff --git a/html/old/index.php_fichiers/menu.css b/html/old/index.php_fichiers/menu.css
new file mode 100644
index 0000000..dc77cd5
--- /dev/null
+++ b/html/old/index.php_fichiers/menu.css
@@ -0,0 +1,132 @@
+/*********
+* Menu *
+*********/
+
+div.haut
+{
+ padding-bottom: 0.5em;
+ }
+
+table.menu
+{
+ text-align: center;
+ margin: 0px;
+ background-color: #E0E0F0;
+ border-width: 0px 1px 1px 1px;
+ border-style: solid;
+ border-color: #F0F0FF #B0B0C0 #B0B0C0 #F0F0FF;
+}
+
+table.menu-back
+{
+ width: 100%;
+ margin: 0px;
+ padding: 0px 0px 0px 0px;
+ background-color: #D8D8F8;
+ border-width: 0px 1px 1px 1px;
+ border-style: solid;
+ border-color: #F0F0FF #A0A0C0 #A0A0C0 #F0F0FF;
+}
+
+tr.menu-back
+{
+ width: 100%;
+}
+
+td.menu-accueil
+{
+ background-image: url(../images/logos/fondcnrs.gif);
+ padding: 4px 4px 4px 4px;
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border-color: #F0F0FF #A0A0C0 #A0A0C0 #F0F0FF;
+}
+td.menu-accueil div
+{
+ align: center;
+ margin: 1px 4px 1px 4px;
+}
+
+td.menu-langue div
+{
+ align: center;
+ margin: 1px 5px 1px 5px;
+}
+
+td.button
+{
+ padding: 1px;
+ background-color: #E0E0F0;
+ border: 0px;
+ border-style: solid;
+ border-color: #F0F0FF #B0B0C0 #B0B0C0 #F0F0FF;
+ cursor: pointer;
+ color: blue;
+ text-decoration: underline;
+}
+
+div.sep
+{
+ width: 0px;
+ height: 100%;
+ padding: 0px;
+ margin: 0px;
+ border-style: solid;
+ border-width: 0px 1px 0px 1px;
+ border-right-color: #F0F0FF;
+ border-left-color: #B0B0C0;
+}
+
+td.centre
+{
+ align:center;
+}
+
+td.menu-tampon
+{
+ width: 40%;
+ align:center;
+}
+
+td.menu-langue
+{
+ align:right;
+}
+
+td.button-up
+{
+ padding: 0px;
+ background-color: #E8E8F8;
+ border: 1px;
+ border-style: solid;
+ border-color: #F0F0FF #B0B0C0 #B0B0C0 #F0F0FF;
+ cursor: pointer;
+ color: blue;
+ text-decoration: underline;
+}
+
+td.button-down
+{
+ padding: 0px;
+ background-color: #D8D8E8;
+ border: 1px;
+ border-style: solid;
+ border-color: #B0B0C0 #F0F0FF #F0F0FF #B0B0C0;
+ cursor: pointer;
+}
+
+td.button-text
+{
+ font-size: 0.8em;
+ font-weight: 600;
+ padding: 1px 3px 1px 2px;
+ border: 0px;
+}
+
+img.button
+{
+ height: 24px;
+ border: 0;
+ margin: 0;
+ padding: 0;
+}
diff --git a/html/old/index.php_fichiers/pge.css b/html/old/index.php_fichiers/pge.css
new file mode 100644
index 0000000..62a749f
--- /dev/null
+++ b/html/old/index.php_fichiers/pge.css
@@ -0,0 +1,141 @@
+
+body
+{
+ font-family: sans-serif, Arial, Helvetica;
+ background: #F5FBFF;
+ margin-left: 2%;
+ margin-right: 2%;
+ }
+
+div {
+ //margin: 0.5em;
+ text-align : left;
+ font-family: sans-serif, Arial, Helvetica;
+ }
+
+div.dateMaj
+{
+ text-align : left;
+ margin: 0.5em;
+ font-size: -1;
+
+ }
+
+div.nomLabo {
+ text-align : center;
+ font-size: 1.2em;
+ }
+
+div.titre
+{
+ font-weight:bold;
+ text-align : center;
+ margin: 0.5em;
+
+ }
+
+div.persoTitre
+{
+ font-weight:bold;
+ text-align : left;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+
+ }
+
+div.erreur
+{
+ font-weight:bold;
+ text-align : left;
+ margin: 0.5em;
+ color: red;
+ }
+
+div.article
+{
+ margin: 0.5em;
+ }
+
+div.paragraphe
+{
+ text-align : left;
+ }
+
+div.gaucheCellule
+{
+ float: left;
+ position: fixed;
+ background-color: #ffecce;
+ border: 1px solid #666666;
+ padding: 0.5em;
+ width: 16%;
+ }
+div.milieuCellule
+{
+ padding: 1em;
+ margin-left:18%;
+ }
+
+div.menuGauche
+{
+ }
+
+div.elementMenuGauche
+{
+ margin-top : 0.5em;
+}
+
+
+div.etiquette
+{
+ margin-top: 0.5em;
+ font-weight:bold;
+ text-align : left;
+ }
+
+div.image
+{
+ text-align: center;
+ }
+
+ul.enumeration li
+{
+ padding: 0.2em;
+ margin: 0.5em;
+ text-align : left;
+ background-color: #E0F0F0;
+ list-style-type: square;
+// list-style-image: none;
+// list-style-image: url(redball.gif);
+ }
+
+ul.plan li
+{
+ font-weight:bold;
+ padding: 0.2em;
+ margin: 0.5em;
+ text-align : left;
+ list-style-type: square;
+ }
+
+td.gaucheCellule
+{
+ align: top;
+ }
+
+table.seminaires
+{
+ text-align: center;
+ margin: 0px;
+ border-width: 0px 1px 1px 1px;
+ border-style: solid;
+ border-color: #F0F0FF #B0B0C0 #B0B0C0 #F0F0FF;
+ margin-bottom: 1em;
+}
+table.seminaires tr {
+ background-color: #E0F0F0;
+ }
+table.seminaires tr:hover /*autre couleur de fond quand on passe sur l'autre ligne*/
+{
+ background-color:#FFB5C5;
+}
diff --git a/html/old/index.php_fichiers/valid-css.png b/html/old/index.php_fichiers/valid-css.png
new file mode 100644
index 0000000..9b2f596
Binary files /dev/null and b/html/old/index.php_fichiers/valid-css.png differ
diff --git a/html/old/index.php_fichiers/valid-xhtml11.png b/html/old/index.php_fichiers/valid-xhtml11.png
new file mode 100644
index 0000000..2c63d93
Binary files /dev/null and b/html/old/index.php_fichiers/valid-xhtml11.png differ
diff --git a/html/old/index_en.php.html b/html/old/index_en.php.html
new file mode 100644
index 0000000..2aca5a0
--- /dev/null
+++ b/html/old/index_en.php.html
@@ -0,0 +1,354 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//FR" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
+ <head>
+ <title>Bioinfo PGE</title>
+
+
+
+
+
+ <link type="text/CSS" rel="stylesheet" href="index_en.php_fichiers/bioinfo.css"/>
+ <link type="text/CSS" rel="stylesheet" href="index_en.php_fichiers/menu.css"/>
+ <link type="text/CSS" rel="stylesheet" href="index_en.php_fichiers/pge.css"/>
+ <link type="text/CSS" rel="stylesheet" href="index_en.php_fichiers/basdepage.css"/>
+ </head>
+ <body>
+
+
+ <table class="milieuTable">
+ <tbody>
+ <tr>
+ <td class="milieuCellule">
+ <div class="titre">Populations 1.2.28 (12/5/2002)</div>
+ <div class="paragraphe">Population genetic software (individuals or
+ populations distances, phylogenetic trees)</div>
+ <ul class="plan">
+ <li>
+ <a href="#ancre_fonctionnalites">Contents</a>
+ </li>
+ <li>
+ <a href="#ancre_telechargement">Download</a>
+ </li>
+ <li>
+ <a href="#ancre_distances">Distances</a>
+ </li>
+ <li>File <a href="#ancre_formats">formats</a></li>
+ <li>
+ <a href="#ancre_ligne_de_commande">Command line</a>
+ </li>
+ <li>
+ <a href="#ancre_bibliographie">Bibliography</a>
+ </li>
+ <li>
+ <a href="http://localhost/pge/bioinfo/populations/formules"
+ >Formula</a>
+ </li>
+ </ul>
+ <a id="ancre_fonctionnalites"/>
+ <div class="titre">Contents</div>
+ <ul class="enumeration">
+ <li>haploids, diploids or polyploids genotypes (see input <a
+ href="#ancre_formats">formats</a>)</li>
+ <li>structured populations (see input files <a href="#ancre_pop_struct"
+ >structured populations</a>
+ </li>
+ <li>No limit of populations, loci, alleles per loci (see input <a
+ href="#ancre_formats">formats</a>) </li>
+ <li>Distances between individuals (15 different <a
+ href="#ancre_distances">methods</a>)</li>
+ <li>Distances between populations (15 <a href="#ancre_distances"
+ >methods</a>)</li>
+ <li>Bootstraps on loci OR individuals</li>
+ <li>Phylogenetic trees (individuals or populations), using Neighbor
+ Joining or UPGMA (PHYLIP tree format)</li>
+ <li>Allelic diversity</li>
+ <li>Converts data files from Genepop to different formats (Genepop,
+ Genetix, Msat, Populations...)</li>
+ </ul>
+ <a id="ancre_telechargement"/>
+ <div class="titre">Download</div>
+ <div class="information">Populations, 1.2.28 (12/5/2002) Copyright (C) 1999,
+ Olivier Langella, CNRS UPR9034 </div>
+ <div class="paragraphe">This program is free software; you can redistribute
+ it and/or modify it under the terms of the <a
+ href="http://www.gnu.org/copyleft/gpl.html"> GNU General Public
+ License</a> as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version licence</div>
+ <div class="paragraphe">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 <a
+ href="http://www.gnu.org/copyleft/gpl.html">GNU General Public
+ License</a> for more details.</div>
+ <div class="paragraphe">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.</div>
+ <div class="information">Authors</div>
+ <div class="paragraphe">Olivier Langella, CNRS UPR9034</div>
+ <div class="paragraphe">Debian GNU/Linux package : <a
+ href="http://localhost/pge/bioinfo/debian/populations_1.2.28-1_i386.deb"
+ >populations_1.2.28-1_i386.deb</a>
+ </div>
+ <div class="paragraphe">RPM GNU/Linux package (RedHat ou Mandrake) : <a
+ href="http://localhost/pge/bioinfo/rpm/populations-1.2.28-2.i386.rpm"
+ >populations-1.2.28-2.i386.rpm</a>
+ </div>
+ <div class="paragraphe">Sources : <a
+ href="http://localhost/pge/bioinfo/sources/populations-1.2.28.tar.gz"
+ >populations-1.2.28.tar.gz</a>
+ </div>
+ <div class="paragraphe">Windows : <a
+ href="http://localhost/pge/bioinfo/wini386/populations.exe">
+ populations.exe</a></div>
+ <div class="paragraphe">Note aux utilisateurs de Debian GNU/Linux<a href=""
+ /></div>
+ <div class="paragraphe">to compile "populations", download tar.gz sources an
+ do the following with root privileges:</div>
+ <div class="script">tar xvfz populations-1.2.28.tar.gz</div>
+ <div class="script">cd populations-1.2.28</div>
+ <div class="script">./configure</div>
+ <div class="script">make</div>
+ <div class="script">make install</div>
+ <a id="ancre_distances"/>
+ <div class="titre">Distances</div>
+ <div class="enumeration">
+ <a href="http://localhost/pge/bioinfo/populations/formules/node3.html"
+ >DAS</a>, shared allele distance (Chakraborty et Jin., 1993)</div>
+ <div class="enumeration"> Nei, minimum genetic distance, <a
+ href="http://localhost/pge/bioinfo/populations/formules/node5.html">
+ Dm</a> (Nei,1987)</div>
+ <div class="enumeration">Nei, standard genetic distance, <a
+ href="http://localhost/pge/bioinfo/populations/formules/node4.html"
+ >Ds</a> (Nei, 1987)</div>
+ <div class="enumeration">Cavalli-Sforza and Edwards, <a
+ href="http://localhost/pge/bioinfo/populations/formules/node9.html"
+ >Dc</a> (1967)</div>
+ <div class="enumeration">Nei et al's, <a
+ href="http://localhost/pge/bioinfo/populations/formules/node10.html"
+ >Da</a> (1983)</div>
+ <div class="enumeration"><a
+ href="http://localhost/pge/bioinfo/populations/formules/node6.html">
+ Latter, Fst</a> (1972)</div>
+ <div class="enumeration">Prevosti et al.'s, <a
+ href="http://localhost/pge/bioinfo/populations/formules/node8.html"
+ >Cp</a> (1975)</div>
+ <div class="enumeration">Rogers', <a
+ href="http://localhost/pge/bioinfo/populations/formules/node7.html"
+ >Dr</a> (1972)</div>
+ <div class="enumeration">Reynolds J. unweighted, <a
+ href="http://localhost/pge/bioinfo/populations/formules/node13.html"
+ >Dru</a> (1983)</div>
+ <div class="enumeration">Reynolds J. weighted, <a
+ href="http://localhost/pge/bioinfo/populations/formules/node14.html"
+ >Drw</a> (1983)</div>
+ <div class="enumeration">Reynolds J. least squares, <a
+ href="http://localhost/pge/bioinfo/populations/formules/node15.html"
+ >Drl</a> (1983)</div>
+ <div class="paragraphe">Microsatellites distances</div>
+ <div class="enumeration">Goldstein et al., <a
+ href="http://localhost/pge/bioinfo/populations/formules/node17.html"
+ >dmu2</a> (1995a)</div>
+ <div class="enumeration">Average Square Distance ( <a
+ href="http://localhost/pge/bioinfo/populations/formules/node18.html"
+ >ASD</a> , Goldstein, Slatkin 1995)</div>
+ <div class="enumeration">Shriver et al's, <a
+ href="http://localhost/pge/bioinfo/populations/formules/node19.html"
+ >Dsw</a> (1995)</div>
+ <div class="enumeration">Lev A. Zhivotovsky, <a
+ href="http://localhost/pge/bioinfo/populations/formules/node20.html"
+ >DR</a> (1999)</div>
+ <a id="ancre_formats"/>
+ <div class="titre">Formats</div>
+ <div class="plan">- <a href="#ancre_formats_entree">input</a></div>
+ <div class="plan">- <a href="#ancre_formats_sortie">output</a></div>
+ <a id="ancre_formats_entree"/>
+ <div class="titre2">input files</div>
+ <div class="paragraphe">"Populations" accepts file from other population
+ genetic softwares:</div>
+ <div class="enumeration">- <a href="http://www.cefe.cnrs-mop.fr/"
+ >Genepop</a></div>
+ <div class="enumeration">- <a
+ href="http://www.univ-montp2.fr/%7Egenetix/genetix/genetix.htm"
+ >Génétix</a>
+ </div>
+ <div class="paragraphe"> and it has its own format:<br/>"Populations" format
+ allows to use unlimited number of alleles, of haploids, diploids or
+ nploids. The format is close to Genepop but alleles at a given locus are
+ separated by ":". Thus, man can code alleles with all ASCII characters.</div>
+ <div class="paragraphe">Diploid population example:</div>
+ <div class="script"> "Grape populations in southern France"<br/>
+ ADHLocus1<br/> ADH#2<br/> ADHthree<br/> ADH-4<br/> ADH-5<br/> Pop
+ Montpellier<br/> Montpellier1 , 02:01 03:03 01:02 03:02 10:11<br/>
+ Montpellier2 , 02:02 03:01 01:02 03:03 11:11<br/> Montpellier3 , 01:02
+ 04:01 02:02 01:02 10:10<br/> Montpellier4 , 01:03 02:02 01:01 02:02
+ 10:11<br/> Montpellier5 , 02:03 02:04 01:01 01:02 10:10<br/> POP
+ Gigondas<br/> Gigondas1 , 01:02 02:02 02:01 04:05 08:07<br/> Gigondas2 ,
+ 01:02 02:01 02:01 04:05 03:07<br/> Gigondas3 , 02:01 02:03 01:01 05:05
+ 04:02<br/> Gigondas4 , 02:01 03:03 03:01 03:03 06:03<br/> Gigondas5 ,
+ 01:01 02:01 03:01 05:05 08:07<br/>
+ </div>
+
+ <div class="paragraphe">Haploid example :</div>
+ <div class="script"> "Grape populations in southern France"<br/>
+ ADHLocus1<br/> ADH#2<br/> ADHthree<br/> ADH-4<br/> ADH-5<br/> Pop
+ Montpellier<br/> Montpellier1 , 02 03 01 03 10<br/> Montpellier2 , 02 03
+ 01 03 11<br/> Montpellier3 , 01 04 02 01 10<br/> Montpellier4 , 01 02 01
+ 02 10<br/> Montpellier5 , 02 02 01 01 10<br/> POP Gigondas<br/>
+ Gigondas1 , 01 02 02 04 08<br/> Gigondas2 , 01 02 02 04 03<br/>
+ Gigondas3 , 02 02 01 05 04<br/> Gigondas4 , 02 03 03 03 06<br/>
+ Gigondas5 , 01 02 03 05 08<br/>
+ </div>
+
+ <div class="paragraphe">example of haploid, using any ASCII character: no
+ space in allele names:</div>
+ <div class="script"> "Grape populations in southern France"<br/>
+ ADHLocus1<br/> ADH#2<br/> ADHthree<br/> ADH-4<br/> ADH-5<br/> Pop
+ Montpellier<br/> Montpellier1 , all2 03 01 03 10<br/> Montpellier2 ,
+ all2 03 01 03 11<br/> Montpellier3 , all1 04 02 01 miss<br/>
+ Montpellier4 , all1 02 01 02 10<br/> Montpellier5 , all2 02 01 01
+ 10<br/> POP Gigondas<br/> Gigondas1 , all1 02 02 04 08<br/> Gigondas2 ,
+ all1 02 02 04 miss<br/> Gigondas3 , all2 02 01 05 04<br/> Gigondas4 ,
+ all2 03 03 03 06<br/> Gigondas5 , all1 02 03 05 08<br/>
+ </div>
+
+ <a id="ancre_pop_struct"/>
+ <div class="titre2">Structured population</div>
+ <div class="paragraphe">To code metapopulations, you can choose either
+ "Genepop" or "Populations" format. You only need to give the name of
+ population after the keyword "POP " (separator = "/")</div>
+ <div class="paragraphe">example:</div>
+ <div class="script"> exemple de populations structurées<br/> locus1<br/>
+ locus2<br/> locus3<br/> POP Rennes/immeuble_sud/pop_3emeetage<br/> ind1,
+ (description des individus)<br/> ind2, ...<br/> ind3, ...<br/> ind4,
+ ...<br/> POP Rennes/immeuble_sud/pop_2emeetage<br/> ind1, (description
+ des individus)<br/> ind2, ...<br/> ind3, ...<br/> ind4, ...<br/>
+ </div>
+
+ <a id="ancre_formats_sortie"/>
+ <div class="titre2">Output files</div>
+ <div class="paragraphe">Populations is able to produce various population
+ genetic software formats:</div>
+ <div class="enumeration">
+ <a href="http://www.cefe.cnrs-mop.fr/">Genepop</a>
+ </div>
+ <div class="enumeration">
+ <a href="http://www.univ-montp2.fr/%7Egenetix/genetix/genetix.htm"
+ >Génétix</a>
+ </div>
+ <div class="enumeration">Populations</div>
+ <div class="enumeration">
+ <a href="http://localhost/pge/bioinfo/lea/index.php?lang=en">Lea</a>
+ </div>
+ <div class="enumeration">
+ <a href="http://www.rannala.org/docs/immanc.html">Immanc</a>
+ </div>
+ <div class="enumeration">microsat</div>
+ <div class="enumeration">
+ <a href="http://www.unife.it/genetica/Giorgio/giorgio_soft.html#ADMIX"
+ >Admix (G. Bertorelle)</a>
+ </div>
+ <div class="enumeration">
+ <a href="http://www.unil.ch/izea/softwares/fstat.html">Fstat (Jerome
+ Goudet)</a>
+ </div>
+ <div class="paragraphe">Phylogenetic trees are coded using the "Phylip"
+ format. " <a href="http://taxonomy.zoology.gla.ac.uk/rod/treeview.html"
+ >Treeview</a>" can be used for Windows or Linux, and you can use "<a
+ href="http://localhost/pge/bioinfo/treeplot/index.php?lang=en"
+ >Treeplot</a>" to convert the phylip format into postscript, adobe
+ illustrator, gif... with colors for each populations</div>
+ <div class="paragraphe">Matrix distances files are "Excel (gnumeric
+ compatible)", "Phylip", "xgobi", "NTsys" or any text editor compliant.</div>
+ <a id="ancre_ligne_de_commande"/>
+ <div class="titre">Command line</div>
+ <div class="paragraphe">You can use "Populations" as a command line programm
+ (very useful for batch treatment) to infer phylogenetic trees:</div>
+ <div class="commande">populations name_of_input_file -"arguments"</div>
+ <div class="paragraphe">Available arguments:</div>
+ <div class="enumeration">-phylogeny ind ou pop (default) for phylogenetic
+ trees based on individuals or populations</div>
+ <div class="enumeration">-dist method (default: Nei standard, Ds) you can
+ choose among: DAS, Dm, Ds, Dc, Da, dmu2, Fst, Cp, Dr, ASD, Dsw, Dr, Dru,
+ Drw, Drl. see distances for details.</div>
+ <div class="enumeration">-construct method (default: upgma) possibilities
+ upgma or nj (Neighbor Joining)</div>
+ <div class="enumeration">-bootstrap_ind number to indicate the number of
+ bootstraps to perform on individuals</div>
+ <div class="enumeration">-bootstrap_locus number to indicate the number of
+ bootstraps to perform on loci</div>
+ <div class="enumeration">-output name_of_treeview_file to indicate the name
+ of the tree file (phylip tree format)</div>
+ <div class="enumeration">-level number , structured populations allows to
+ choose the structuration factor (in the example: town level is 1,
+ building level is 2...).</div>
+ <div class="paragraphe">example:</div>
+ <div class="script">populations toutc2.txt -phylogeny pop -dist Dm
+ -bootstrap_locus 10000 -output toutc2_10000_Dm.tre</div>
+ <div class="paragraphe">Commands can be write in a .bat file (for DOS) or a
+ script file (for UNIX).</div>
+ <a id="ancre_bibliographie"/>
+ <div class="titre">Bibliography</div>
+ <div class="article"><strong>Bruce Ranala and Joanna L. Mountain.</strong>
+ Detecting immigration by using multilocus genotypes. Proc.Natl. Acad.
+ Sci. USA, 94:9197-9201, 13/6/1997. </div>
+ <div class="article"><strong>David B. Goldstein, Andres Ruiz Linares, Luigi
+ Luca Cavalli-Sforza and Marcus W. Feldman.</strong> An Evaluation of
+ Genetic Distances for Use With Microsatellite Loci. Genetics,
+ 139:463-471, 5/10/1994. </div>
+ <div class="article"><strong>D. B. Goldstein and D. D. Pollock.</strong>
+ Launching Microsatellites: A Review of Mutation Processes and Methods of
+ Phylogenetic Inference. Journal of Heredity, 88(335-342):0022-1503,
+ 31/3/1997. </div>
+ <div class="article"><strong>Li Jin and Ranajit Chakraborty.</strong>
+ Estimation of Genetic Distance and Coefficient of Gene Diversity from
+ Single-Probe Multilocus DNA Fingerprinting Data. Mol. Biol. Evol,
+ 11(1):120-127, 13/9/1993. </div>
+ <div class="article"><strong>Mark D. Shriver, Li Jin, Eric Boerwinkle,
+ Ranjan Deka, Robert E. Ferrel and Ranajit Chakraborty.</strong> A
+ Novel Measure of Genetic Distance for Highly Polymorphic Tandem Repeat
+ Loci. Mol. Biol. Evol, 12(5):914-920, 13/4/1995. </div>
+ <div class="article"><strong>Montgomery Slatkin.</strong> A Measure of
+ Population Subdivision on Microsatellite Allele Frequencies. Genetics,
+ (139):457-462, 19/6/1994. </div>
+ <div class="article"><strong>Naruya Saitou and Masatoshi Nei.</strong> The
+ Neigbhor-joining Method: A New Method for Reconstructing Phylogenetic
+ Trees. Mol. Biol. Evol, 4(4):406-425, 18/2/1987. </div>
+ <div class="article"><strong>Naoko Takezaki and Masatoshi Nei.</strong>
+ Genetic Distances and Reconstruction of Phylogenetic Trees From
+ Microsatellite DNA. Genetics, (144):189-399, 6/6/1996. </div>
+ <div class="article"><strong>William J. Bruno, Nicholas D. Socci and Aaron
+ L. Halpern.</strong> Weighted Neigbhor Joining: A Likelihood-Based
+ Approach to Distance-Based Phylogeny Reconstruction. Mol. Biol. Evol,
+ 17(1):189-197, 11/10/1999. </div>
+ </td>
+ <td/>
+ </tr>
+ </tbody>
+ </table>
+ <table class="bas-de-page">
+ <tbody>
+ <tr>
+ <td>
+ <a href="http://validator.w3.org/">
+ <img src="index_en.php_fichiers/valid-xhtml11.png"
+ alt="validation xhtml1.1" title=""/>
+ </a>
+ </td>
+ <td class="bas-de-page-tampon"> </td>
+ <td class="bas-de-page-centre">
+ <div class="bas_de_page">Viewable With <a
+ href="http://localhost/pge/bioinfo/xhtml/index.php?lang=en"
+ >Any Browser.</a></div>
+ </td>
+ <td class="bas-de-page-tampon"> </td>
+ <td>
+ <a href="http://jigsaw.w3.org/css-validator/">
+ <img src="index_en.php_fichiers/valid-css.png" alt="validation xhtml1.1"
+ title=""/>
+ </a>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </body>
+</html>
diff --git a/html/old/index_en.php_fichiers/basdepage.css b/html/old/index_en.php_fichiers/basdepage.css
new file mode 100644
index 0000000..71a70b5
--- /dev/null
+++ b/html/old/index_en.php_fichiers/basdepage.css
@@ -0,0 +1,18 @@
+table.bas-de-page {
+ width: 100%;
+}
+
+div.bas_de_page {
+ font-style: italic;
+ width: 100%;
+ align: center;
+}
+
+td.bas-de-page-centre {
+ align: center;
+}
+
+td.bas-de-page-tampon
+{
+ width: 40%;
+}
\ No newline at end of file
diff --git a/html/old/index_en.php_fichiers/bioinfo.css b/html/old/index_en.php_fichiers/bioinfo.css
new file mode 100644
index 0000000..f71898a
--- /dev/null
+++ b/html/old/index_en.php_fichiers/bioinfo.css
@@ -0,0 +1,68 @@
+/*********
+ * bioinfo *
+ *********/
+
+form {
+ padding: 0.5em;
+ margin: 0.5em;
+ font-family:sans-serif;
+ background-color: #E0F0F0;
+ }
+
+div {
+ font-family:sans-serif;
+ }
+
+div.bas_de_page {
+ font-style: italic;
+ }
+
+div.plan{
+ font-weight:bold;
+ padding: 0.2em;
+ margin: 0.5em;
+ text-align : left;
+ // background-color: #E0F0F0;
+ }
+
+
+div.enumeration{
+ // font-weight:bold;
+ padding: 0.2em;
+ margin: 0.5em;
+ text-align : left;
+ background-color: #E0F0F0;
+ }
+
+div.script{
+ text-align : left;
+ font-family: courrier;
+ padding : 0.5em
+ }
+
+div.paragraphe{
+ text-align : left;
+ padding : 0.5em
+ }
+
+div.article{
+ text-align : left;
+ padding : 0.5em
+ }
+
+div.titre {
+ color:#0000ca;
+ font-weight:bold;
+ text-align:center;
+ font-family:sans-serif;
+ font-size:x-large;
+ padding : 0.5em
+ }
+div.titre2 {
+ color:#0000ca;
+ font-weight:bold;
+ text-align:left;
+ font-family:sans-serif;
+ font-size:x-medium;
+ padding : 0.5em
+ }
\ No newline at end of file
diff --git a/html/old/index_en.php_fichiers/menu.css b/html/old/index_en.php_fichiers/menu.css
new file mode 100644
index 0000000..dc77cd5
--- /dev/null
+++ b/html/old/index_en.php_fichiers/menu.css
@@ -0,0 +1,132 @@
+/*********
+* Menu *
+*********/
+
+div.haut
+{
+ padding-bottom: 0.5em;
+ }
+
+table.menu
+{
+ text-align: center;
+ margin: 0px;
+ background-color: #E0E0F0;
+ border-width: 0px 1px 1px 1px;
+ border-style: solid;
+ border-color: #F0F0FF #B0B0C0 #B0B0C0 #F0F0FF;
+}
+
+table.menu-back
+{
+ width: 100%;
+ margin: 0px;
+ padding: 0px 0px 0px 0px;
+ background-color: #D8D8F8;
+ border-width: 0px 1px 1px 1px;
+ border-style: solid;
+ border-color: #F0F0FF #A0A0C0 #A0A0C0 #F0F0FF;
+}
+
+tr.menu-back
+{
+ width: 100%;
+}
+
+td.menu-accueil
+{
+ background-image: url(../images/logos/fondcnrs.gif);
+ padding: 4px 4px 4px 4px;
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border-color: #F0F0FF #A0A0C0 #A0A0C0 #F0F0FF;
+}
+td.menu-accueil div
+{
+ align: center;
+ margin: 1px 4px 1px 4px;
+}
+
+td.menu-langue div
+{
+ align: center;
+ margin: 1px 5px 1px 5px;
+}
+
+td.button
+{
+ padding: 1px;
+ background-color: #E0E0F0;
+ border: 0px;
+ border-style: solid;
+ border-color: #F0F0FF #B0B0C0 #B0B0C0 #F0F0FF;
+ cursor: pointer;
+ color: blue;
+ text-decoration: underline;
+}
+
+div.sep
+{
+ width: 0px;
+ height: 100%;
+ padding: 0px;
+ margin: 0px;
+ border-style: solid;
+ border-width: 0px 1px 0px 1px;
+ border-right-color: #F0F0FF;
+ border-left-color: #B0B0C0;
+}
+
+td.centre
+{
+ align:center;
+}
+
+td.menu-tampon
+{
+ width: 40%;
+ align:center;
+}
+
+td.menu-langue
+{
+ align:right;
+}
+
+td.button-up
+{
+ padding: 0px;
+ background-color: #E8E8F8;
+ border: 1px;
+ border-style: solid;
+ border-color: #F0F0FF #B0B0C0 #B0B0C0 #F0F0FF;
+ cursor: pointer;
+ color: blue;
+ text-decoration: underline;
+}
+
+td.button-down
+{
+ padding: 0px;
+ background-color: #D8D8E8;
+ border: 1px;
+ border-style: solid;
+ border-color: #B0B0C0 #F0F0FF #F0F0FF #B0B0C0;
+ cursor: pointer;
+}
+
+td.button-text
+{
+ font-size: 0.8em;
+ font-weight: 600;
+ padding: 1px 3px 1px 2px;
+ border: 0px;
+}
+
+img.button
+{
+ height: 24px;
+ border: 0;
+ margin: 0;
+ padding: 0;
+}
diff --git a/html/old/index_en.php_fichiers/pge.css b/html/old/index_en.php_fichiers/pge.css
new file mode 100644
index 0000000..62a749f
--- /dev/null
+++ b/html/old/index_en.php_fichiers/pge.css
@@ -0,0 +1,141 @@
+
+body
+{
+ font-family: sans-serif, Arial, Helvetica;
+ background: #F5FBFF;
+ margin-left: 2%;
+ margin-right: 2%;
+ }
+
+div {
+ //margin: 0.5em;
+ text-align : left;
+ font-family: sans-serif, Arial, Helvetica;
+ }
+
+div.dateMaj
+{
+ text-align : left;
+ margin: 0.5em;
+ font-size: -1;
+
+ }
+
+div.nomLabo {
+ text-align : center;
+ font-size: 1.2em;
+ }
+
+div.titre
+{
+ font-weight:bold;
+ text-align : center;
+ margin: 0.5em;
+
+ }
+
+div.persoTitre
+{
+ font-weight:bold;
+ text-align : left;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+
+ }
+
+div.erreur
+{
+ font-weight:bold;
+ text-align : left;
+ margin: 0.5em;
+ color: red;
+ }
+
+div.article
+{
+ margin: 0.5em;
+ }
+
+div.paragraphe
+{
+ text-align : left;
+ }
+
+div.gaucheCellule
+{
+ float: left;
+ position: fixed;
+ background-color: #ffecce;
+ border: 1px solid #666666;
+ padding: 0.5em;
+ width: 16%;
+ }
+div.milieuCellule
+{
+ padding: 1em;
+ margin-left:18%;
+ }
+
+div.menuGauche
+{
+ }
+
+div.elementMenuGauche
+{
+ margin-top : 0.5em;
+}
+
+
+div.etiquette
+{
+ margin-top: 0.5em;
+ font-weight:bold;
+ text-align : left;
+ }
+
+div.image
+{
+ text-align: center;
+ }
+
+ul.enumeration li
+{
+ padding: 0.2em;
+ margin: 0.5em;
+ text-align : left;
+ background-color: #E0F0F0;
+ list-style-type: square;
+// list-style-image: none;
+// list-style-image: url(redball.gif);
+ }
+
+ul.plan li
+{
+ font-weight:bold;
+ padding: 0.2em;
+ margin: 0.5em;
+ text-align : left;
+ list-style-type: square;
+ }
+
+td.gaucheCellule
+{
+ align: top;
+ }
+
+table.seminaires
+{
+ text-align: center;
+ margin: 0px;
+ border-width: 0px 1px 1px 1px;
+ border-style: solid;
+ border-color: #F0F0FF #B0B0C0 #B0B0C0 #F0F0FF;
+ margin-bottom: 1em;
+}
+table.seminaires tr {
+ background-color: #E0F0F0;
+ }
+table.seminaires tr:hover /*autre couleur de fond quand on passe sur l'autre ligne*/
+{
+ background-color:#FFB5C5;
+}
diff --git a/html/old/index_en.php_fichiers/valid-css.png b/html/old/index_en.php_fichiers/valid-css.png
new file mode 100644
index 0000000..9b2f596
Binary files /dev/null and b/html/old/index_en.php_fichiers/valid-css.png differ
diff --git a/html/old/index_en.php_fichiers/valid-xhtml11.png b/html/old/index_en.php_fichiers/valid-xhtml11.png
new file mode 100644
index 0000000..2c63d93
Binary files /dev/null and b/html/old/index_en.php_fichiers/valid-xhtml11.png differ
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..f8c5dad
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,40 @@
+
+# this command finds Qt4 libraries and sets all required variables
+# note that it's Qt4, not QT4 or qt4
+#/usr/share/cmake-2.6/Modules/FindQt4.cmake
+SET (QT_USE_QTXML true)
+FIND_PACKAGE( Qt4 REQUIRED )
+
+INCLUDE( ${QT_USE_FILE} )
+
+#FIND_PACKAGE(X11 REQUIRED)
+#FIND_PACKAGE(FindThreads REQUIRED)
+
+IF(WIN32)
+ ADD_DEFINITIONS(-DMINGW32)
+ENDIF(WIN32)
+
+#INCLUDE_DIRECTORIES(X11_INCLUDE_DIR)
+# X11_FOUND is true if X11 is available.
+# * X11_INCLUDE_DIR contains the include directories to use X11.
+# * X11_LIBRARIES points to the libraries to link against to use X11.
+# Make sure the compiler can find include files from our Hello library.
+#include_directories (${X11_INCLUDE_DIR})
+
+# -m -pthread FindThreads
+
+
+# Make sure the linker can find the Hello library once it is built.
+#link_directories (${X11_INCLUDE_DIR})
+
+add_executable (populations populations.cpp distgnt jeupopexp fstat jeupop applpop applpopulations matrices applications
+arbre arbreplus couleur vecteurs locus allele individu strucpop chaineficpop metapop population)
+
+
+IF(WIN32)
+ target_link_libraries (populations ${QT_LIBRARIES} m)
+ELSE(WIN32)
+ target_link_libraries (populations ${QT_LIBRARIES} m)
+ENDIF(WIN32)
+
+
\ No newline at end of file
diff --git a/src/allele.cpp b/src/allele.cpp
new file mode 100644
index 0000000..560a8ef
--- /dev/null
+++ b/src/allele.cpp
@@ -0,0 +1,140 @@
+/***************************************************************************
+ allele.cpp - description
+ -------------------
+ begin : Thu Sep 14 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+
+//#include "entetepop.h"
+#include "allele.h"
+#include "locus.h"
+
+//constructeur
+Allele::Allele (Locus* Ploc)
+{
+ _nom.assign("");
+ // strcpy (_nomgpop,_nom.c_str());
+ _Ploc = Ploc;
+
+ _miss = r_ismissingvalue(_nom);
+ // if ((_nom == "00") || (_nom == "NULL") || (_nom == "NULL") || (_nom == "NULL")) _nul = true;
+ // else _nul = false;
+}
+
+
+Allele::Allele (const Allele & original, Locus * Ploc)
+{
+ //constructeur de copies
+ _nom.assign(original._nom);
+
+ _Ploc = Ploc;
+ _miss = original._miss;
+ _nbrepet = original._nbrepet;
+}
+
+
+Allele::Allele (Locus* Ploc,const string & nom)
+{
+ _nom = nom;
+ // strcpy (_nomgpop,_nom.c_str());
+ _Ploc = Ploc;
+ _nbrepet = atoi(nom.c_str());
+
+ _miss = r_ismissingvalue(nom);
+}
+
+Allele::Allele (Locus* Ploc,const char * nom)
+{
+ _nom.assign(nom);
+ // strcpy (_nomgpop,_nom.c_str());
+ _Ploc = Ploc;
+ _nbrepet = atoi(nom);
+
+ _miss = r_ismissingvalue(nom);
+}
+
+//destructeur
+Allele::~Allele ()
+{
+ // delete [] _tabPind;
+}
+
+bool Allele::f_verifnum(int typedenum) const
+{
+ // Vérification du type de numérotation des allèles
+ // 1 => type Genepop stricte (2digits)
+ // 2 => nom d'alleles = numéros
+ // 3 => nom d'alleles = numéros < 999
+ //Anomalie 2-> les numéros d'allèles format genepop ne sont pas présents
+ unsigned long i;
+
+ switch (typedenum)
+ {
+ case 1:
+ if (_nom.size() != 2) return (false);
+ if ((_nom[0] < 48) || ((_nom[0] > 57))) return (false);
+ if ((_nom[1] < 48) || ((_nom[1] > 57))) return (false);
+
+ break;
+ case 2:
+ for (i=0; i < _nom.size();i++)
+ {
+ if ((_nom[i] < 48) || ((_nom[i] > 57))) return (false);
+ }
+
+ break;
+
+ case 3:
+ if (_nom.size() > 3) return (false);
+ for (i=0; i < _nom.size();i++)
+ {
+ if ((_nom[i] < 48) || ((_nom[i] > 57))) return (false);
+ }
+
+ break;
+ }
+
+ return(true);
+}
+
+const Allele& Allele::operator= (const Allele & rval)
+{
+
+ _nom = rval._nom;
+ _miss = rval._miss;
+ _nbrepet = rval._nbrepet;
+ return(*this);
+}
+
+bool Allele::operator== (const Allele & rval) const
+{
+ //egalité basée sur les noms des allèles et des locus correspondants
+ // PAS sur les pointeurs !!!
+ if (rval._Ploc->get_nom() != _Ploc->get_nom()) return (false);
+
+ return((_miss && rval._miss) || (rval._nom == _nom));
+}
+
+
+const string& Allele::get_NomLocus() const
+{
+ return(_Ploc->get_nom());
+}
+
+bool Allele::r_ismissingvalue(const string & nom) const
+{
+ if ((nom == "0") || (nom == "000") || (nom == "00") || (nom == "null") || (nom == "NULL") || (nom == "miss") || (nom == "missing")) return true;
+ else return false;
+}
+
diff --git a/src/allele.h b/src/allele.h
new file mode 100644
index 0000000..7df291b
--- /dev/null
+++ b/src/allele.h
@@ -0,0 +1,88 @@
+/***************************************************************************
+ allele.h - description
+ -------------------
+ begin : Thu Sep 14 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef ALLELE_H
+#define ALLELE_H
+
+//#include "arbres.h"
+#include "vecteurs.h"
+
+using namespace std;
+
+class Individu;
+class Population;
+class Allele;
+class StrucPop;
+class Locus;
+class Jeupop;
+class ConstGnt;
+
+typedef biolib::vecteurs::ChaineCar ChaineCar;
+//allèle
+class Allele {
+public :
+// Allele();
+ Allele(Locus*);
+// Allele(Locus*, const Allele &);
+ Allele(const Allele &, Locus * Ploc);//constructeur de sopies
+ Allele(Locus*, const char *);
+ Allele(Locus*, const string &);
+ ~Allele();
+ bool f_verifnum(int) const;
+
+// string& get_NomLocus();
+ const string& get_Nom() const {return(_nom);};
+ Locus * get_Ploc() const {return(_Ploc);};
+ const string& get_nom() const {return(_nom);};
+ const string& get_NomLocus() const;
+ const unsigned int get_nbrepet() const{return(_nbrepet);};
+ void set_nbrepet(unsigned int nbrepet) {_nbrepet = nbrepet;};
+
+ void set_Plocus(Locus * Ploc) {_Ploc = Ploc;};
+ void set_nom(const char * mot) {_nom = mot;};
+ void set_nom(const ChaineCar& mot) {_nom = mot;};
+ void set_idXML(const string& id) {_idXML = id;};
+
+ const string& get_idXML() const {return(_idXML);};
+
+ bool r_estnul() const {return(_miss);};
+ bool r_nonnul() const {return(!_miss);};
+
+ const Allele& operator= (const Allele &);
+ bool operator== (const Allele & rval) const;
+
+ friend class Locus;
+ friend class Individu;
+ friend class StrucPop;
+ friend class Jeupop;
+ friend class DistancesGnt;
+
+private :
+// int _occurence; //nb d'occurences de cet allèle dans le jeu de populations
+ bool r_ismissingvalue(const string &) const;
+ string _nom;
+// char _nomgpop[4];
+ Locus * _Ploc;
+ bool _miss; //missing value
+ unsigned int _nbrepet; //specifique aux microsatellite: nombre de repetitions de motifs
+// int _nbind; //nb d'individus pourvus de cet allèle
+// Individu ** _tabPind;
+ string _idXML; //sert à la lecture et à l'écriture en XML
+
+};
+
+#endif
diff --git a/src/applications.cpp b/src/applications.cpp
new file mode 100644
index 0000000..e0d4476
--- /dev/null
+++ b/src/applications.cpp
@@ -0,0 +1,448 @@
+/***************************************************************************
+ applications.cpp - Librairie d'objets pour creer des applications
+ -------------------
+ begin : ven aug 14 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include"applications.h"
+
+Application::Application() {
+#ifndef GZSTREAM_H
+ _formatMatrice = 1;
+#else
+ _formatMatrice = 1; //5 format gnumeric
+#endif
+ _confirmeEcraseFichier = true;
+}
+void Application::affPubSortie() const {
+
+ cout << endl << endl;
+ cout << "Programmation: Olivier Langella" << endl;
+ cout << "" << endl;
+ cout << "e-mail: langella at moulon.inra.fr" << endl;
+ cout << "" << endl;
+ cout << endl << endl;
+}
+
+void Application::affPubEntree() const {
+
+ cout << endl << endl;
+ cout << "**************************************" << endl;
+ // cout << "* Populations 1.1.00 CNRS UPR9034 *" << endl;
+ cout << "* langella at moulon.inra.fr *" << endl;
+ cout << "* *" << endl;
+ cout << "**************************************" << endl;
+ cout << endl << endl;
+}
+
+void Application::lancement(int nbcommandes, char ** commandes) {
+
+ if (nbcommandes > 1) {
+ fLigneCommande(commandes, nbcommandes);
+ } else {
+ affPubEntree();
+
+ while (menu_principal() != 0) {
+ }
+
+ affPubSortie();
+ }
+}
+
+void Application::fLigneCommande(char ** commandes, int nbcommandes) {
+ affPubEntree();
+
+}
+
+int Application::menu_principal() {
+ int choix;
+ cout << endl << endl;
+ cout << "0) Quitter" << endl;
+
+ /* cout << endl << "choix: ";
+ cin >> choix;
+ */
+ choix = DemandeChoix(0, 0);
+
+ switch (choix) {
+ case 0:
+ return (0);
+ break;
+ // case 1:
+ // return(1);
+ // break;
+ default:
+ return (0);
+ break;
+ }
+}
+
+int Application::menu_formatMatrice() {
+ int choix;
+ cout << endl << endl;
+ cout << _("Matrix outputfile format:") << endl;
+ cout << "1) " << _("ASCII, (excell or gnumeric compliant)") << endl;
+ cout << "2) " << _("NtSys") << endl;
+ cout << "3) " << _("Phylip") << endl;
+ cout << "4) " << _("xgobi") << endl;
+ cout << "5) " << _("Gnumeric spreadsheet") << endl;
+
+ /* cout << endl << "choix: ";
+ cin >> choix;
+ */
+ choix = DemandeChoix(1, 5);
+
+ switch (choix) {
+ case 1:
+ _formatMatrice = 1;
+ return (1);
+ break;
+ case 2:
+ _formatMatrice = 2;
+ return (2);
+ break;
+ case 3:
+ _formatMatrice = 4;
+ return (3);
+ break;
+ case 4:
+ _formatMatrice = 3;
+ return (4);
+ break;
+ case 5:
+ _formatMatrice = 5;
+ return (5);
+ break;
+ default:
+ return (0);
+ break;
+ }
+}
+
+bool Application::litMatriceLD(MatriceLD &mat) {
+ bool ok(false);
+
+ /* if (*PPmat != NULL) {
+ delete *PPmat;
+ *PPmat = NULL;
+ }*/
+
+ while (_fichier.is_open() == 0) {
+ cout << _("Matrix filename ?") << endl;
+ cin >> _nomFichier;
+
+ _fichier.open(_nomFichier.c_str(), ios::in);
+ _fichier.clear();
+ }
+
+ try {
+ // *PPmat = new MatriceLD();
+ cout << _("Reading file...") << endl;
+
+ //cerr << " Application::litMatriceLD(MatriceLD &mat)" << endl;
+ //cerr << _fichier;
+ // char c;
+ // while ( _fichier.get(c))
+ // cerr << c;
+
+ mat.iFichier(_fichier);
+ _fichier.clear();
+ _fichier.close();
+ ok = true;
+ } catch (MatriceLD::Anomalie pb) {
+ _fichier.close();
+#ifdef GZSTREAM_H
+ igzstream gzfichier;
+ gzfichier.open(_nomFichier.c_str(), ios::in);
+
+ try {
+ //cerr << " Application::litMatriceLD(MatriceLD &mat) gzfile" << endl;
+ // char c;
+ // while ( _fichier.get(c))
+ // cerr << c;
+ mat.iGnumeric(gzfichier);
+ ok = true;
+ gzfichier.close();
+ //cerr << " Application::litMatriceLD(MatriceLD &mat)" << endl;
+ //mat.oExcel(cerr);
+ return(ok);
+ }
+ catch (MatriceLD::Anomalie pb) {
+ ok = false;
+ }
+ gzfichier.close();
+#else
+ ok = false;
+#endif
+ // if (*PPmat != NULL) delete *PPmat;
+
+
+ switch (pb.le_pb) {
+ default:
+ cout << _("This Matrix file format is not recognized...") << endl;
+ break;
+ }
+ }
+
+ return (ok);
+}
+
+bool Application::ecritMatriceLD(MatriceLD &mat, string nomFichier, int format) {
+ bool ok(false);
+ ofstream sortie;
+
+ if (format == 0)
+ format = _formatMatrice;
+
+ /* if (*PPmat != NULL) {
+ return (false);
+ }*/
+ //cerr << format;
+ //_sortie << ends;
+ //_sortie.close();
+
+ while (nomFichier == "") {
+ cout << _("Matrix filename to write into ?") << endl;
+ cin >> nomFichier;
+ }
+
+ sortie.open(nomFichier.c_str(), ios::out);
+
+ //sortie << "coucou application::ecritMatriceLD";
+ // cerr << "coucou pplication::ecritMatriceLD";
+ // _sortie << ends;
+ // _sortie.close();
+
+ try {
+ mat.ofFormat(sortie, format, nomFichier);
+ //sortie << ends;
+ sortie.close();
+ ok = true;
+ } catch (MatriceLD::Anomalie pb) {
+ sortie.close();
+ ok = false;
+
+ switch (pb.le_pb) {
+ default:
+ cout << _("Error writing matrix") << " MatriceLD::Anomalie "
+ << pb.le_pb << endl;
+ break;
+ }
+ }
+
+ return (ok);
+}
+
+bool Application::DemandeOuiNon(char laquestion[]) const {
+ string rep;
+
+ cout << laquestion << endl;
+ cin >> rep;
+ // cout << endl;
+ if (rep == "")
+ rep.assign("N");
+
+ switch (rep[0]) {
+ case 'Y':
+ return (true);
+ break;
+ case 'y':
+ return (true);
+ break;
+ case 'o':
+ return (true);
+ break;
+ case 'O':
+ return (true);
+ break;
+ default:
+ return (false);
+ break;
+ }
+}
+
+string Application::DemandeString(char laquestion[]) const {
+ string rep("");
+
+ while (rep == "") {
+ cout << endl << laquestion << endl;
+ cin >> rep;
+ }
+ return (rep);
+}
+
+string Application::DemandeFichier(const string & laquestion) {
+ string rep("");
+ bool ok(false);
+
+ while ((rep == "") || (ok == false)) {
+ ok = false;
+ cout << endl << laquestion << endl;
+ cin >> rep;
+ if ((rep != "") && (_confirmeEcraseFichier) && (fFichierExiste(
+ rep.c_str()))) {
+ cout << _("The file ") << rep << _(" already exist.") << endl;
+ if (DemandeOuiNon(_("Choose Y if you to overwrite it: ")))
+ ok = true;
+ } else
+ ok = true;
+ }
+
+ return (rep);
+}
+
+float Application::DemandeReel(char laquestion[], float inf, float sup) const {
+ float reel(-9999);
+ string rep;
+
+ while ((reel < inf) || (reel > sup)) {
+ cout << endl << laquestion << endl;
+ cin >> rep;
+ reel = atof(rep.c_str());
+ }
+ return (reel);
+}
+
+int Application::DemandeEntier(const string & laquestion, int inf, int sup) const {
+ int entier(-999);
+ string rep;
+
+ while ((entier < inf) || (entier > sup)) {
+ cout << endl << laquestion << endl;
+ cin >> rep;
+ entier = atoi(rep.c_str());
+ }
+ return (entier);
+}
+
+int Application::DemandeEntier(char laquestion[], int inf, int sup, int defaut) const {
+ int entier(-999);
+ char car;
+ string mot;
+ if ((defaut < inf) || (defaut > sup))
+ cerr << "DemandeEntier defaut ERROR" << endl;
+
+ while ((entier < inf) || (entier > sup)) {
+ cout << endl << laquestion << endl;
+ cin.get(car);
+ cin.get(car);
+ // rep[0] = rep[0]+50;
+ // cout << rep;
+ if (car == '\n')
+ entier = defaut;
+ else {
+ cin >> mot;
+ mot = car + mot;
+ entier = atoi(mot.c_str());
+ }
+ }
+ return (entier);
+}
+
+int Application::DemandeChoix(int inf, int sup) const {
+
+ return (DemandeEntier(_("Your choice: "), inf, sup));
+}
+
+bool Application::litJeuMatriceLD(JeuMatriceLD &jeumat) {
+ bool ok(false);
+
+ /* if (*PPmat != NULL) {
+ delete *PPmat;
+ *PPmat = NULL;
+ }*/
+
+ while (_fichier.is_open() == 0) {
+ cout << _("Filename of the set of matrix ?") << endl;
+ cin >> _nomFichier;
+
+ _fichier.open(_nomFichier.c_str(), ios::in);
+ _fichier.clear();
+ }
+
+ try {
+ // *PPmat = new MatriceLD();
+ cout << _("Reading file...") << endl;
+ jeumat.iFlux(_fichier);
+ _fichier.clear();
+ _fichier.close();
+ ok = true;
+ } catch (MatriceLD::Anomalie pb) {
+ _fichier.close();
+ ok = false;
+ // if (*PPmat != NULL) delete *PPmat;
+
+ switch (pb.le_pb) {
+ default:
+ cout << _("This file format is not recognized...") << endl;
+ break;
+ }
+ }
+
+ return (ok);
+}
+
+bool Application::ecritJeuMatriceLD(const JeuMatriceLD &jeumat,
+ string nomFichier, int format) {
+ bool ok(false);
+ //string nomFichier;
+
+ if (format == 0)
+ format = _formatMatrice;
+
+ /* if (*PPmat != NULL) {
+ return (false);
+ }*/
+ //cerr << format;
+ _sortie << ends;
+ _sortie.close();
+
+ while (_sortie.is_open() == 0) {
+ while (nomFichier == "") {
+ cout << _("Name of the file to write the set of matrix ?") << endl;
+ cin >> nomFichier;
+ }
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ }
+
+ try {
+ nomFichier = _nomFichier;
+ jeumat.oFlux(_sortie, format);
+ _sortie << ends;
+ _sortie.close();
+ ok = true;
+ } catch (MatriceLD::Anomalie pb) {
+ _sortie.close();
+ ok = false;
+
+ switch (pb.le_pb) {
+ default:
+ cout << _("Writing error...") << endl;
+ break;
+ }
+ }
+
+ return (ok);
+}
+/** test si nomfichier existe */
+bool Application::fFichierExiste(const string & nomfichier) {
+ _fichier.open(nomfichier.c_str(), ios::in);
+
+ if (_fichier.is_open() == 0) {
+ _fichier.clear();
+ return (false);
+ }
+ _fichier.close();
+ return (true);
+}
diff --git a/src/applications.h b/src/applications.h
new file mode 100644
index 0000000..96bb5e9
--- /dev/null
+++ b/src/applications.h
@@ -0,0 +1,78 @@
+/***************************************************************************
+ applications.h - Librairie d'objets pour creer des applications
+ -------------------
+ begin : ven aug 14 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef APPLICATIONS_H
+#define APPLICATIONS_H
+
+//#define __ENABLE_WSTRING
+
+#include "internat.h"
+
+#include "matrices.h"
+
+# ifndef COMPILATION_MINGW32
+//# include "gzstream.h"
+# endif
+
+using namespace std;
+using namespace biolib::vecteurs;
+
+class Application {
+public:
+
+ Application();
+ virtual ~Application() {};
+
+ virtual void lancement(int nbcommandes=0, char ** commandes=0);
+ /** test si nomfichier existe */
+ virtual bool fFichierExiste(const string & nomfichier);
+
+protected:
+ virtual int menu_principal();
+ virtual int menu_formatMatrice();
+ virtual void affPubEntree() const;
+ virtual void affPubSortie() const;
+ virtual void fLigneCommande(char ** commandes, int nbcommandes);
+
+ virtual bool DemandeOuiNon(char laquestion[]) const;
+ virtual int DemandeEntier(const string & laquestion, int inf, int sup) const;
+ virtual int DemandeEntier(char laquestion[], int inf, int sup, int defaut) const;
+ virtual float DemandeReel(char laquestion[], float inf, float sup) const;
+ virtual int DemandeChoix(int inf, int sup) const;
+ virtual string DemandeString(char laquestion[]) const;
+ virtual string DemandeFichier(const string & laquestion);
+ bool litMatriceLD(MatriceLD & mat);
+ bool litJeuMatriceLD(JeuMatriceLD &jeumat);
+ bool ecritMatriceLD(MatriceLD & mat, string nomFichier="", int format=0);
+ bool ecritJeuMatriceLD(const JeuMatriceLD & jeumat, string nomFichier="", int format=0);
+
+
+ string _nomFichier;
+ int _choix;
+ int _formatMatrice; // 1-> Excel
+
+
+ ifstream _fichier;
+
+ ofstream _sortie;
+
+ bool _confirmeEcraseFichier;
+
+};
+
+#endif
+
diff --git a/src/applpop.cpp b/src/applpop.cpp
new file mode 100644
index 0000000..2233b0e
--- /dev/null
+++ b/src/applpop.cpp
@@ -0,0 +1,273 @@
+/***************************************************************************
+ applpop.cpp - Application dérivée de l'objet ApplPop
+ spécifique aux populations
+ -------------------
+ begin : ven aug 14 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+
+
+
+//#include "entetepop.h"
+
+#include "applpop.h"
+
+ApplPop::ApplPop ():Application(){
+//cerr << _formatMatrice;
+ _Pjeupop = 0;
+ _niveau = 100; // niveau de structuration des populations (100 => dernier ensemble avant les individus)
+}
+
+ApplPop::~ApplPop() {
+ if (_Pjeupop != 0) delete _Pjeupop;
+}
+
+
+/*
+void ApplPop::fconcatenationpop() {
+ // concatenation de jeux de populations
+ Jeupop * PjeupopOriginal(_Pjeupop);
+
+ cout << endl << "Lecture des populations a concatener :" <<endl;
+
+ _Pjeupop = 0;
+//cerr << "coucou" <<endl;
+ if (!litGenepop()) {
+//cerr << "coucou" <<endl;
+ _Pjeupop = PjeupopOriginal;
+//cerr << "coucou" <<endl;
+ return;
+ }
+
+ try {
+//cerr << PjeupopOriginal->_commentaires[0];
+//cerr << _Pjeupop->_commentaires[0];
+//cerr << "concat avant" <<endl;
+ *_Pjeupop = *PjeupopOriginal + *_Pjeupop;
+//cerr << "concat apres" <<endl;
+//cerr << _Pjeupop->_commentaires.size(); //<< _Pjeupop->_commentaires[1];
+ }
+ catch (Jeupop::Anomalie pb) {
+ cout << endl << "il y a eu une erreur de type: " << pb.le_pb << endl;
+
+ _Pjeupop = PjeupopOriginal;
+ }
+}
+*/
+
+
+
+bool ApplPop::litGenepop() {
+ Jeupop * Poldjeupop;
+ bool ok(false);
+
+ while (_fichier.is_open() == 0) {
+ cout << _("Name of input file (Populations or Genepop format) ?") << endl;
+ cin >> _nomFichier;
+
+ _fichier.open(_nomFichier.c_str(), ios::in);
+ _fichier.clear();
+ }
+
+ try {
+ Poldjeupop = _Pjeupop;
+//cerr << "ApplPop::litgenepop " <<endl;
+ _Pjeupop = new Jeupop();
+//cerr << "ApplPop::litgenepop " <<endl;
+ _fichier >> *(_Pjeupop);
+//cerr << "ApplPop::litgenepop fin >>" <<endl;
+ _fichier.close();
+ _fichier.clear();
+ ok = true;
+ }
+ catch (Jeupop::Anomalie pb){
+ _fichier.close();
+ _fichier.clear();
+ delete _Pjeupop;
+ _Pjeupop = Poldjeupop;
+ Poldjeupop = 0;
+ ok = false;
+
+ switch (pb.le_pb) {
+ case 4:
+ cout << _("The file format seems incorrect...") << endl;
+ break;
+ }
+ }
+
+ if (Poldjeupop != 0) delete Poldjeupop;
+ return(ok);
+}
+
+
+
+bool ApplPop::iPopulations() {
+
+ if (_Pjeupop == 0) {
+ if(litGenepop()) return(true);
+ else return(false);
+ }
+ return(true);
+}
+
+
+void ApplPop::affPubEntree() const {
+
+ cout << endl << endl;
+ cout << "**************************************" << endl;
+ cout << "* *" << endl;
+ cout << "* langella at moulon.inra.fr *" << endl;
+ cout << "* http://www.cnrs-gif.fr/pge/bioinfo *" << endl;
+ cout << "**************************************" << endl;
+ cout << endl << endl;
+}
+
+
+
+/** Demande à l'utilisateur de choisir une population.
+retourne le numéro dans _tabPpop */
+unsigned long ApplPop::DemandePopulation(char laquestion[]) const{
+ signed long numpop(-1);
+ unsigned long i;
+ string rep;
+
+ while ((numpop < 0) || ((unsigned long) numpop > _Pjeupop->get_nbpop())) {
+ cout << _("Please, choose a population among these ones:") << endl;
+ for (i=0; i < _Pjeupop->get_nbpop(); i++) cout << _Pjeupop->get_nompop(i) << " ";
+ cout << endl;
+
+ cout << endl << laquestion << endl;
+ cin >> rep;
+ try {
+ numpop = _Pjeupop->get_numpop(_Pjeupop->get_Ppop(rep));
+ }
+ catch (Jeupop::Anomalie le_pb) {
+ cout << _("the population ") << rep << _(" has not been found.") << endl;
+ numpop = -1;
+ }
+ }
+ return ((unsigned long) numpop);
+
+}
+
+void ApplPop::set_groupes_individus() {
+ // crée des groupes d'individus par Populations
+ if (_Pjeupop == 0) return;
+ unsigned int nbpop, nbind, i, j;
+
+//cerr << "ApplPop::set_groupes_individus() debut" << endl;
+ Titre noms_niveaux;
+
+ try {
+//cerr << "ApplPop::set_groupes_individus() rempli" << endl;
+ _Pjeupop->f_rempliVcalcStrucPop(_niveau);
+//cerr << "ApplPop::set_groupes_individus() noms" << endl;
+ //_Pjeupop->get_nomniveauxstruc(noms_niveaux);
+ }
+ catch (Jeupop::Anomalie pb) {
+ cerr << "ApplPop::set_groupes_individus() anomalie Jeupop " << pb.le_pb << endl;
+ }
+
+ nbpop = _Pjeupop->get_nbstrucpopVcalc();
+
+ _tab_groupes.resize(nbpop);
+ _tab_noms_groupes.resize(nbpop);
+ _tab_couleurs_groupes.resize(nbpop);
+
+ for (i = 0; i < nbpop; i++) {
+ _tab_noms_groupes[i] = _Pjeupop->get_PstrucpopVcalc(i)->get_nom();
+ _tab_couleurs_groupes[i] = _Pjeupop->get_PstrucpopVcalc(i)->get_couleur();
+
+ nbind = _Pjeupop->get_PstrucpopVcalc(i)->get_nbind();
+ _tab_groupes[i] = "";
+ for (j = 0; j < nbind; j++) {
+ _tab_groupes[i] += "'";
+ _tab_groupes[i] += _Pjeupop->get_PstrucpopVcalc(i)->get_nomind(j);
+//cerr << "ApplPop::set_groupes_individus() get_nomind" << endl;
+ _tab_groupes[i] += "'";
+//cerr << _tab_groupes[i] << endl;
+ //_tab_couleurs_groupes[i] = Couleur::get_couleur_diff();
+ if (j != (nbind -1)) _tab_groupes[i] += " ";
+
+ }
+ }
+//cerr << "ApplPop::set_groupes_individus() fin";
+
+}
+
+void ApplPop::set_groupes_populations() {
+ // crée des groupes d'individus par Populations
+ if (_Pjeupop == 0) return;
+
+ unsigned int nbstrucpop, i,j;
+ reset_groupes();
+ MetaPop * Pmetapop;
+ Vecteur<MetaPop *> tabPmetapop;
+
+ _Pjeupop->f_rempliVcalcStrucPop(_niveau);
+
+ nbstrucpop = _Pjeupop->get_nbstrucpopVcalc();
+
+ //balayage des strucpop pour voir si il n'existe pas une métastructure
+ // => groupe de strucpop
+ for (i = 0; i < nbstrucpop; i++) {
+ if (_Pjeupop->get_PstrucpopVcalc(i)->get_niveau() < 2) {
+ //pas de metastructure
+ }
+ else {
+
+ Pmetapop = _Pjeupop->get_PstrucpopVcalc(i)->get_Pmetapop();
+
+ if (!(tabPmetapop.Existe(Pmetapop))) tabPmetapop.push_back(Pmetapop);
+ }
+ }
+
+ _tab_groupes.resize(tabPmetapop.size());
+ _tab_noms_groupes.resize(tabPmetapop.size());
+ _tab_couleurs_groupes.resize(tabPmetapop.size());
+
+ for (i = 0; i < tabPmetapop.size(); i++) {
+ _tab_noms_groupes[i] = tabPmetapop[i]->get_nom();
+ _tab_couleurs_groupes[i] = tabPmetapop[i]->get_couleur();
+
+ nbstrucpop = tabPmetapop[i]->get_nbpop();
+ _tab_groupes[i] = "";
+ for (j = 0; j < nbstrucpop; j++) {
+ _tab_groupes[i] += "'";
+ _tab_groupes[i] += tabPmetapop[i]->get_nompop(j);
+//cerr << "ApplPop::set_groupes_individus() get_nomind" << endl;
+ _tab_groupes[i] += "'";
+//cerr << _tab_groupes[i] << endl;
+ //_tab_couleurs_groupes[i] = Couleur::get_couleur_diff();
+ if (j != (nbstrucpop -1)) _tab_groupes[i] += " ";
+
+ }
+
+ }
+
+
+}
+
+void ApplPop::set_groupes_arbre(ArbrePlus & larbre) const {
+// larbre._titre = _temp;
+ if (_tab_groupes.size() == 0) return;
+
+ unsigned int i, nbgroupes(_tab_groupes.size());
+
+ larbre.f_tri_ind_alpha();
+
+ for (i = 0; i < nbgroupes; i ++) {
+ larbre.ajouter_groupe(_tab_groupes[i], _tab_couleurs_groupes[i], _tab_noms_groupes[i]);
+ }
+}
diff --git a/src/applpop.h b/src/applpop.h
new file mode 100644
index 0000000..127e7cf
--- /dev/null
+++ b/src/applpop.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ applpop.h - Application dérivée de l'objet ApplPop
+ spécifique aux populations
+ -------------------
+ begin : ven aug 14 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef APPLPOP_H
+#define APPLPOP_H
+
+#include "jeupopexp.h"
+#include "jeupop.h"
+#include "arbreplus.h"
+#include "distgnt.h"
+
+//#include "matrices.h"
+#include "applications.h"
+
+typedef biolib::arbres::ArbrePlus ArbrePlus;
+
+class ApplPop:public Application {
+public:
+
+ ApplPop();
+ ~ApplPop();
+ /** Demande à l'utilisateur de choisir une population.
+retourne le numéro dans _tabPpop */
+ unsigned long DemandePopulation(char []) const;
+
+ void set_groupes_individus();
+ void set_groupes_populations();
+ void set_groupes_arbre(ArbrePlus & larbre) const;
+ void reset_groupes() {_temp.resize(0);_tab_groupes.resize(0);_tab_noms_groupes.resize(0);_tab_couleurs_groupes.resize(0);};
+
+protected:
+
+ virtual bool litGenepop();
+
+ virtual void affPubEntree() const;
+ virtual bool iPopulations();
+
+ Jeupop* _Pjeupop;
+ vector<string> _tab_groupes;
+ vector<string> _tab_noms_groupes;
+ vector<string> _tab_couleurs_groupes;
+
+ unsigned int _niveau;
+
+ Titre _temp;
+
+};
+
+#endif
+
diff --git a/src/applpopulations.cpp b/src/applpopulations.cpp
new file mode 100644
index 0000000..6c1543b
--- /dev/null
+++ b/src/applpopulations.cpp
@@ -0,0 +1,1859 @@
+/***************************************************************************
+ applpopulations.cpp - description
+ -------------------
+ begin : Mon Oct 30 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "applpopulations.h"
+
+ApplPopulations::ApplPopulations() :
+ ApplPop() {
+ _square_distance = false;
+}
+
+ApplPopulations::~ApplPopulations() {
+}
+
+int ApplPopulations::menu_principal() {
+ // calcul de distance entre tous les individus de n pop
+ int choix;
+ _choix = 0;
+
+ cout << endl << endl;
+ cout << _("Main menu") << endl << endl;
+ cout << "0) " << _("Exit") << endl;
+ cout << "1) " << _("Compute individuals distances + tree") << endl;
+ cout << "2) " << _("Compute populations distances + tree") << endl;
+ cout << "3) " << _("Allelic frequencies, Fstats") << endl;
+ cout << "4) " << _("Build phylogenetic tree with a distance matrix")
+ << endl;
+ cout << "5) " << _("Formated output for other softwares") << endl;
+ cout << "6) " << _("Choose the output format of matrix") << endl;
+ cout << "7) " << _("Structured populations") << endl;
+ cout << "8) " << _("microsatellites number of repeats corrections") << endl;
+ // cout << "8) Concatenation de populations" << endl;
+
+ choix = DemandeChoix(0, 8);
+
+ switch (choix) {
+ case 0:
+ return (0);
+ break;
+ case 1:
+ if (!iPopulations())
+ return (1);
+ menu_arbreind();
+ return (1);
+ break;
+
+ case 2:
+ if (!iPopulations())
+ return (1);
+ menu_arbrepop();
+ return (2);
+ break;
+
+ case 3:
+ if (!iPopulations())
+ return (1);
+ menu_calculs();
+ return (3);
+ break;
+
+ case 4:
+ cout << endl << endl;
+ cout << _("Build phylogenetic tree with a distance matrix") << endl;
+ // cout << " a partir d'une matrice de distance" << endl;
+ fmat2arbre();
+ return (4);
+ break;
+
+ case 5:
+ if (!iPopulations())
+ return (1);
+ menu_formats();
+ return (5);
+ break;
+
+ case 6:
+ menu_formatMatrice();
+ return (6);
+ break;
+
+ case 7:
+ if (!iPopulations())
+ return (7);
+ menu_popstructurees();
+ return (7);
+ break;
+
+ case 8:
+ if (!iPopulations())
+ return (8);
+ fmicrosatcorrections();
+ return (7);
+ break;
+
+ /* case 8:
+ if (!iPopulations()) return(8);
+ cout << endl << endl;
+ // cout << "Format de sortie des matrices:" << endl;
+ fconcatenationpop();
+ return(8);
+ break;
+ */
+ default:
+ return (0);
+ break;
+ }
+}
+
+void ApplPopulations::fdistind() {
+ MatriceLD distances;
+ string nomFichier;
+
+ nomFichier = DemandeFichier("Individuals distance matrix filename :");
+
+ if (fcompdistind(distances) == false)
+ return;
+
+ ecritMatriceLD(distances, nomFichier);
+}
+
+void ApplPopulations::ftreeind() {
+ MatriceLD distances;
+ string nomFichier;
+ int metdist;
+ int metconstruct;
+ // unsigned int i;
+
+ metdist = menu_metdistpop();
+ if (_choix == -1)
+ return;
+
+ metconstruct = menu_metconstructarbre();
+ if (_choix == -1)
+ return;
+
+ nomFichier = DemandeFichier("Individuals tree filename (Phylip format):");
+
+ if (fcompdistind(distances, metdist) == false)
+ return;
+
+ fconstructarbre(distances, nomFichier, metconstruct);
+
+ cout << _("Phylogenetic tree saved in : ") << nomFichier << endl;
+}
+
+void ApplPopulations::ftreeindBootLocus() {
+ MatriceLD distances;
+ int metdist;
+ int metconstructarbre;
+ ArbrePlus larbre;
+
+ larbre._titre.resize(2);
+ larbre._titre[0].assign(""); // individus, populations
+ larbre._titre[1].assign(""); // m�thode de distance, nb bootstrap
+
+ metdist = menu_metdistpop();
+ if (_choix == -1)
+ return;
+
+ cout << _("Computing distances between individuals...") << endl;
+ larbre._titre[0].AjEntier(_Pjeupop->get_nbind());
+ larbre._titre[0] += " inidividuals, ";
+ larbre._titre[0].AjEntier(_Pjeupop->get_nbpop());
+ larbre._titre[0] += " populations";
+
+ larbre._titre[1] += DistancesGnt::get_nom_methode(metdist);
+
+ int nbtirages;
+
+ metconstructarbre = menu_metconstructarbre();
+ nbtirages = DemandeEntier(
+ _("How many times do you want to perform bootstraps ?"), 1,
+ 30000);
+
+ larbre._titre[1] += ", ";
+ larbre._titre[1].AjEntier(nbtirages);
+ larbre._titre[1] += " bootstraps on locus";
+
+ // cout << _("Output file name (Phylip tree format) ?") << endl;
+ // cin >> _nomFichier;
+ _nomFichier = DemandeFichier("Output file name (Phylip tree format) ?");
+
+ if (_VcalcLocus.size() == 0)
+ _Pjeupop->f_BootstrapLocus(larbre, metconstructarbre, metdist,
+ _square_distance, nbtirages, true);
+ else
+ _Pjeupop->f_BootstrapLocus(larbre, metconstructarbre, metdist,
+ _square_distance, nbtirages, true, &_VcalcLocus);
+ // _Pjeupop->f_BootstrapLocus(larbre, metconstructarbre, metdist, nbtirages, true);
+
+ // larbre.fElimineTrifurcation();
+ ecritArbre(larbre, _nomFichier);
+}
+
+void ApplPopulations::fsetniveau() {
+ // r�glage du niveau de structure pour calculs sur des m�tapops
+
+ _niveau = DemandeEntier(_("Which level ?"), 1, 100);
+
+ _Pjeupop->f_rempliVcalcStrucPop(_niveau);
+
+ cerr << "ApplPopulations::fsetniveau() 1" << _VcalcLocus.size() << endl;
+ cout << _("level has been set to: ") << _niveau << endl;
+ cout << _("any compute using metapopulation will use this") << endl;
+ cout << _("(ex: computing distances or making trees") << endl;
+
+}
+
+void ApplPopulations::fmat2arbre() {
+ // calcul de distance entre tous les individus de n pop
+ MatriceLD distances;
+ string nomficarbre("");
+
+ cout << _("Reading distance matrix: ") << endl;
+ while (litMatriceLD(distances) == false) {
+ // cout << "Lecture en cours..."<< endl;
+ }
+
+ //cerr << "ApplPopulations::fmat2arbre " << distances.GetNC() << " " << distances.GetNL() << endl;
+
+ try {
+
+ /*
+ if (distances.GetType() != 2) {
+ long i, j;
+ for (i = 0; i < distances.GetNC(); i++) {
+ for (j = 0; j < i; j++) {
+ distances.GetCase(j, i) = distances.GetCase(i, j);
+ }
+ }
+ distances.SetType(2);
+ }
+ */
+ if (distances.SetType(2) == false) {
+ throw biolib::vecteurs::MatriceLD::Anomalie(5);
+ }
+
+ //cerr << "ApplPopulations::fmat2arbre" << endl;
+ //distances.oExcel(cout);
+ fconstructarbre(distances, nomficarbre, menu_metconstructarbre());
+ } catch (MatriceLD::Anomalie pb) {
+ _fichier.close();
+ switch (pb.le_pb) {
+ case 1:
+ _fichier.close();
+ cout << _("Error while reading the matrix file");
+ break;
+
+ case 5:
+ cerr
+ << _("Failure reading matrix file : the matrix is not symetric\n");
+ cerr
+ << _("Populations only works with euclidian distance matrix\n");
+ cerr << _("Please check your file and retry\n\n");
+ break;
+ case 7:
+ cout << _("Out of range access in the matrix");
+ break;
+ }
+ }
+
+}
+
+void ApplPopulations::frarefaction() {
+ MatriceLD distances;
+ int taille;
+
+ //cerr << _Pjeupop->get_nbpop();
+ taille = DemandeEntier(_("Sample size ?"), 2, 1000);
+
+ cout << _("Computing...") << endl;
+ _Pjeupop->f_rarefaction(distances, taille);
+
+ cout << _("Results matrix output :") << endl;
+
+ // cerr << distances.GetCase (1,1);
+ ecritMatriceLD(distances);
+}
+
+bool ApplPopulations::fcompdistind(MatriceLD & distances, int metdist) {
+ _temp.resize(2);
+ _temp[0].assign(""); // individus, populations
+ _temp[1].assign(""); // m�thode de distance, nb bootstrap
+
+ if (metdist == 0) {
+ metdist = menu_metdistpop();
+ if (_choix == -1)
+ return (false);
+ }
+
+ cout << _("Computing distances between individuals...") << endl;
+ _temp[0].AjEntier(_Pjeupop->get_nbind());
+ _temp[0] += " inidividuals, ";
+ _temp[0].AjEntier(_Pjeupop->get_nbpop());
+ _temp[0] += " populations";
+
+ _temp[1] += DistancesGnt::get_nom_methode(metdist);
+
+ if (_VcalcLocus.size() == 0)
+ _Pjeupop->f_distgnt(distances, metdist, _square_distance);
+ else
+ _Pjeupop->f_distgnt(distances, metdist, _square_distance, &_VcalcLocus);
+
+ return (true);
+}
+
+bool ApplPopulations::fcompdistpop(MatriceLD & distances, int metdist) {
+ // calcul de distance entre toutes les populations
+ _temp.resize(2);
+ _temp[0].assign(""); // individus, populations
+ _temp[1].assign(""); // m�thode de distance, nb bootstrap
+
+ if (metdist == 0) {
+ metdist = menu_metdistpop();
+ if (_choix == -1)
+ return (false);
+ }
+
+ cout << _("Computing distances between populations...") << endl;
+ _temp[0].AjEntier(_Pjeupop->get_nbpop());
+ _temp[0] += " populations";
+
+ _temp[1] += DistancesGnt::get_nom_methode(metdist);
+
+ try {
+ //cerr << "ApplPopulations::fcompdistpop(MatriceLD & distances, int metdist) 1" << _VcalcLocus.size() << endl;
+ if (_VcalcLocus.size() == 0) {
+ //cerr << "ApplPopulations::fcompdistpop(MatriceLD & distances, int metdist) niveau " << _niveau << endl;
+ _Pjeupop->f_distgntpop(distances, metdist, _square_distance,
+ _niveau);
+ } else {
+ _Pjeupop->f_distgntpop(distances, metdist, _square_distance,
+ _niveau, &_VcalcLocus);
+ }
+ } catch (Jeupop::Anomalie lepb) {
+ // cerr << endl << lepb.fmessage() << endl;
+ return (false);
+ }
+
+ return (true);
+}
+
+void ApplPopulations::fdistpop() {
+ // sortie des distance entre toutes les populations
+ MatriceLD distances;
+ string nomFichier;
+
+ nomFichier = DemandeFichier(_("Populations distance matrix filename :"));
+
+ if (fcompdistpop(distances) == false)
+ return;
+
+ ecritMatriceLD(distances, nomFichier);
+}
+
+void ApplPopulations::ftreepop() {
+ // sortie de l'arbre phylogenetic des pops
+ MatriceLD distances;
+ string nomFichier;
+ int metdist;
+ int metconstruct;
+
+ metdist = menu_metdistpop();
+ if (_choix == -1)
+ return;
+
+ metconstruct = menu_metconstructarbre();
+ if (_choix == -1)
+ return;
+
+ nomFichier
+ = DemandeFichier(_("Populations tree filename (Phylip format):"));
+
+ if (fcompdistpop(distances, metdist)) {
+ fconstructarbre(distances, nomFichier, metconstruct);
+
+ cout << _("Phylogenetic tree saved in : ") << nomFichier << endl;
+ } else {
+ cout
+ << _("Phylogenetic tree reconstruction aborted, tree file was not written")
+ << endl;
+ }
+}
+
+void ApplPopulations::ftreepopBootLocus() {
+ // calcul de distance entre toutes les populations
+ // avec bootstrap sur les locus
+ MatriceLD distances;
+ int metdist;
+ int metconstructarbre;
+
+ ArbrePlus larbre;
+ int nbtirages;
+
+ metdist = menu_metdistpop();
+ if (_choix == -1) {
+ _choix = 1;
+ return;
+ }
+
+ metconstructarbre = menu_metconstructarbre();
+ nbtirages = DemandeEntier("Combien de tirages voulez-vous effectuer ?", 1,
+ 10000);
+
+ larbre._titre.resize(2);
+ larbre._titre[0].assign(""); // individus, populations
+ larbre._titre[1].assign(""); // m�thode de distance, nb bootstrap
+
+ larbre._titre[0].AjEntier(_Pjeupop->get_nbpop());
+ larbre._titre[0] += " populations";
+
+ larbre._titre[1] += DistancesGnt::get_nom_methode(metdist);
+ larbre._titre[1] += ", ";
+ larbre._titre[1].AjEntier(nbtirages);
+ larbre._titre[1] += " bootstraps on locus";
+
+ _nomFichier = DemandeFichier(
+ _("Populations tree filename (Phylip format):"));
+
+ try {
+ if (_VcalcLocus.size() == 0)
+ _Pjeupop->f_BootstrapLocus(larbre, metconstructarbre, metdist,
+ _square_distance, nbtirages, false);
+ else
+ _Pjeupop->f_BootstrapLocus(larbre, metconstructarbre, metdist,
+ _square_distance, nbtirages, false, &_VcalcLocus);
+ } catch (Jeupop::Anomalie lepb) {
+ cout
+ << _("Phylogenetic tree reconstruction aborted, tree file was not written")
+ << endl;
+ return;
+ }
+
+ // larbre.fElimineTrifurcation();
+ ecritArbre(larbre, _nomFichier);
+}
+
+void ApplPopulations::ftreepopBootInd() {
+ // calcul de distance entre toutes les populations
+ // avec bootstrap sur les individus
+ MatriceLD distances;
+ int metdist;
+ int metconstructarbre;
+
+ ArbrePlus larbre;
+ int nbtirages;
+
+ metdist = menu_metdistpop();
+ if (_choix == -1) {
+ _choix = 1;
+ return;
+ }
+
+ metconstructarbre = menu_metconstructarbre();
+ nbtirages = DemandeEntier(
+ _("How many times do you want to perform bootstraps ?"), 1,
+ 30000);
+
+ larbre._titre.resize(2);
+ larbre._titre[0].assign(""); // individus, populations
+ larbre._titre[1].assign(""); // m�thode de distance, nb bootstrap
+
+ larbre._titre[0].AjEntier(_Pjeupop->get_nbpop());
+ larbre._titre[0] += " populations";
+
+ larbre._titre[1] += DistancesGnt::get_nom_methode(metdist);
+ larbre._titre[1] += ", ";
+ larbre._titre[1].AjEntier(nbtirages);
+ larbre._titre[1] += " bootstraps on individuals";
+
+ _nomFichier = DemandeFichier(
+ _("Populations tree filename (Phylip format):"));
+
+ try {
+ if (_VcalcLocus.size() == 0)
+ _Pjeupop->f_BootstrapIndividus(larbre, metconstructarbre, metdist,
+ _square_distance, nbtirages);
+ else
+ _Pjeupop->f_BootstrapIndividus(larbre, metconstructarbre, metdist,
+ _square_distance, nbtirages, &_VcalcLocus);
+ } catch (Jeupop::Anomalie lepb) {
+ cout
+ << _("Phylogenetic tree reconstruction aborted, tree file was not written")
+ << endl;
+ return;
+ }
+
+ // larbre.fElimineTrifurcation();
+ ecritArbre(larbre, _nomFichier);
+}
+
+void ApplPopulations::ecritGenepop() {
+ // cout << _("Output file name (Genepop modified format) ?") << endl;
+ // cin >> _nomFichier;
+ _nomFichier = DemandeFichier(
+ _("Output file name (Genepop modified format) ?"));
+
+ try {
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ _Pjeupop->oGenepop(_sortie);
+ _sortie.close();
+ } catch (Jeupop::Anomalie pb) {
+ _sortie.close();
+ switch (pb.le_pb) {
+ case 1:
+ cerr << endl
+ << _("Genepop format allows only diploid genetic datasets")
+ << endl;
+ break;
+ case 2:
+ //la numerotation est a refaire, avec une table de conversion
+ //cerr << "ApplPop::ecritGenepop() impossible" << endl;
+ Jeupop traduction(*_Pjeupop);
+
+ _sortie.open("correspondances.txt", ios::out);
+ traduction.f_trad2Gpop(_sortie);
+ // _sortie << ends;
+ _sortie.close();
+
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ traduction.oGenepopCano(_sortie);
+ _sortie.close();
+
+ break;
+ }
+ }
+}
+
+void ApplPopulations::ecritGenepopCano() {
+ // cout << _("Output file name (canonical Genepop format) ?") << endl;
+ // cin >> _nomFichier;
+ _nomFichier = DemandeFichier(
+ _("Output file name (canonical Genepop format) ?"));
+
+ try {
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ _Pjeupop->oGenepopCano(_sortie);
+ _sortie.close();
+ } catch (Jeupop::Anomalie pb) {
+ _sortie.close();
+ switch (pb.le_pb) {
+ case 1:
+ cerr << endl
+ <<_("Genepop format allows only diploid genetic datasets")
+ << endl;
+ break;
+ case 2:
+ //la numerotation est a refaire, avec une table de conversion
+ Jeupop traduction(*_Pjeupop);
+
+ _sortie.open("correspondances.txt", ios::out);
+ traduction.f_trad2Gpop(_sortie);
+ // _sortie << ends;
+ _sortie.close();
+
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ traduction.oGenepop(_sortie);
+ _sortie.close();
+
+ break;
+ }
+ }
+}
+
+void ApplPopulations::ecritPopulations() {
+ // cout << _("Output file name (Populations format) ?") << endl;
+ // cin >> _nomFichier;
+ _nomFichier = DemandeFichier(_("Output file name (Populations format) ?"));
+
+ try {
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ _Pjeupop->oPopulations(_sortie);
+ _sortie.close();
+ } catch (Jeupop::Anomalie pb) {
+ _sortie.close();
+ switch (pb.le_pb) {
+ default:
+ cerr << _("Error writing Populations file...") << endl;
+ }
+ }
+}
+
+void ApplPopulations::menu_formats() {
+
+ Vecteur<unsigned int> Vlocus;
+ Jeupop * Pjeupopsvg(0);
+
+ int choix(1);
+ while (choix != 0) {
+ cout << endl << endl;
+ cout << _("Output format:") << endl;
+ cout << "0) " << _("Back") << endl;
+ cout << "1) " << _("Choose locus to export (default: all)") << endl;
+ cout << "2) " << _("Populations format") << endl;
+ cout << "3) " << _("Populations XML format") << endl;
+ cout << "4) " << _("Genepop format") << endl;
+ cout << "5) " << _("Genepop modified format") << endl;
+ cout << "6) " << _("Immanc format") << endl;
+ cout << "7) " << _("microsat individuals format") << endl;
+ cout << "8) " << _("microsat populations + frequencies format") << endl;
+ cout << "9) " << _("LEA Likelihood Estimation of Admixture") << endl;
+ cout << "10) " << _("Admix (G. Bertorelle)") << endl;
+ cout << "11) " << _("Genetix") << endl;
+ cout << "12) " << _("Fstat (Jerome Goudet)") << endl;
+
+ choix = DemandeChoix(0, 12);
+
+ switch (choix) {
+ case 0:
+ if (Pjeupopsvg != 0) {
+ delete _Pjeupop;
+ _Pjeupop = Pjeupopsvg;
+ }
+ break;
+ case 1:
+ //choix des locus
+ Vlocus = menu_choixlocus();
+ if (Vlocus.size() != 0) {
+ Pjeupopsvg = _Pjeupop;
+ _Pjeupop = new Jeupop(*Pjeupopsvg);
+ _Pjeupop->GarderVlocus(Vlocus);
+ }
+ break;
+ case 2:
+ ecritPopulations();
+ break;
+ case 3:
+ ecritPopulationsXML();
+ break;
+ case 4:
+ ecritGenepopCano();
+ break;
+ case 5:
+ ecritGenepop();
+ break;
+ case 6:
+ ecritImmanc();
+ break;
+ case 7:
+ ecritMsat(1);
+ break;
+ case 8:
+ ecritMsat(2);
+ break;
+ case 9:
+ ecritLea();
+ break;
+ case 10:
+ ecritAdmix();
+ break;
+ case 11:
+ ecritGenetix();
+ break;
+ case 12:
+ ecritFstat();
+ break;
+ }
+ }
+
+}
+
+void ApplPopulations::menu_popstructurees() {
+
+ int choix(0);
+ _choix = 1;
+ while (_choix > 0) {
+ cout << endl << endl;
+ cout << _("Structured Populations") << endl;
+ cout << endl << endl;
+ cout << "0) " << _("back") << endl;
+ cout << "1) " << _("Show structure level") << endl;
+ cout << "2) " << _("Set level") << endl;
+ cout << "3) " << _("Display Wright indices per loci") << endl;
+
+ choix = DemandeChoix(0, 3);
+
+ switch (choix) {
+ case 0:
+ _choix = -1;
+ return;
+ break;
+ case 1:
+ AffNiveauxPopStruc(cout);
+ break;
+ case 2:
+ fsetniveau();
+ case 3:
+ Fstat lesfstats(_Pjeupop->get_Pracinepop());
+ lesfstats.f_affparlocus(cout);
+ break;
+ }
+ }
+}
+
+void ApplPopulations::menu_calculs() {
+
+ int choix(0);
+ _choix = 1;
+ while (_choix > 0) {
+ cout << endl << endl;
+ cout << _("Allelic frequencies, Fstats") << endl;
+ cout << endl << endl;
+ cout << "0) " << _("back") << endl;
+ cout << "1) " << _("Allelic diversity for reduced sample") << endl;
+ cout << "2) " << _("Fst, Fis, Fit per populations") << endl;
+
+ choix = DemandeChoix(0, 3);
+
+ switch (choix) {
+ case 0:
+ _choix = -1;
+ return;
+ break;
+ case 1:
+ cout << endl << endl;
+ cout << _("Compute allelic diversity") << endl;
+ cout << _(" for reduced sample") << endl;
+ frarefaction();
+ break;
+ case 2:
+ ecritRapportFst();
+ break;
+ }
+ }
+}
+
+void ApplPopulations::menu_arbrepop() {
+
+ int choix(0);
+
+ set_groupes_populations();
+
+ _choix = 1;
+ while (_choix > 0) {
+ cout << endl << endl;
+ cout << _("Reconstructing phylogenetic trees with populations") << endl;
+ cout << endl << endl;
+ cout << "0) " << _("back") << endl;
+ cout << "1) " << _("Get distance matrix between populations") << endl;
+ cout << "2) " << _("Phylogenetic tree of populations") << endl;
+ cout << "3) "
+ << _("Phylogenetic tree of populations with bootstraps on locus")
+ << endl;
+ cout << "4) "
+ << _("Phylogenetic tree of populations with bootstraps on individuals")
+ << endl;
+ cout << "5) " << _("Choose locus to compute distances (default: all)")
+ << endl;
+
+ choix = DemandeChoix(0, 5);
+
+ switch (choix) {
+ case 0:
+ _choix = -1;
+ return;
+ break;
+ case 1:
+ fdistpop();
+ break;
+ case 2:
+ ftreepop();
+ break;
+ case 3:
+ ftreepopBootLocus();
+ break;
+ case 4:
+ ftreepopBootInd();
+ break;
+ case 5:
+ _VcalcLocus = menu_choixlocus();
+ affVlocus(_VcalcLocus);
+ break;
+ }
+ }
+ reset_groupes();
+}
+
+void ApplPopulations::menu_arbreind() {
+
+ int choix(0);
+
+ set_groupes_individus();
+
+ _choix = 1;
+ while (_choix > 0) {
+ cout << endl << endl;
+ cout << _("Reconstructing phylogenetic trees with individuals") << endl;
+ cout << endl << endl;
+ cout << "0) " << _("back") << endl;
+ cout << "1) " << _("Get distance matrix between individuals") << endl;
+ cout << "2) " << _("Phylogenetic tree of individuals") << endl;
+ cout << "3) "
+ << _("Phylogenetic tree of individuals with bootstraps on locus")
+ << endl;
+ cout << "4) " << _("Choose locus to compute distances (default: all)")
+ << endl;
+
+ choix = DemandeChoix(0, 4);
+
+ switch (choix) {
+ case 0:
+ _choix = -1;
+ return;
+ break;
+ case 1:
+ fdistind();
+ break;
+ case 2:
+ ftreeind();
+ break;
+ case 3:
+ ftreeindBootLocus();
+ break;
+ case 4:
+ _VcalcLocus = menu_choixlocus();
+ affVlocus(_VcalcLocus);
+ break;
+ }
+ }
+
+ reset_groupes();
+}
+
+void ApplPopulations::AffNiveauxPopStruc(ostream &) {
+
+ //Affichage des niveaux de structuration des populations
+ Titre nom_niveaux;
+ unsigned long i;
+
+ _Pjeupop->get_nomniveauxstruc(nom_niveaux);
+
+ cout << endl << endl;
+ cout << _("Structured Population") << endl;
+ cout << endl;
+
+ for (i = 0; i < nom_niveaux.size(); i++) {
+ cout << _("Level ") << i << ":" << endl;
+ cout << nom_niveaux[i] << endl;
+ }
+
+}
+
+void ApplPopulations::ecritImmanc() {
+ // cout << _("Output file format (Immanc format) ?") << endl;
+ // cin >> _nomFichier;
+ _nomFichier = DemandeFichier(_("Output file format (Immanc format) ?"));
+
+ try {
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ _Pjeupop->oImmanc(_sortie);
+ _sortie.close();
+ } catch (Jeupop::Anomalie pb) {
+ _sortie.close();
+ switch (pb.le_pb) {
+ case 1:
+ cerr << endl
+ << _("Immanc format allows only diploid genetic datasets")
+ << endl;
+ break;
+ case 2:
+ //la numerotation est a refaire, avec une table de conversion
+ Jeupop traduction(*_Pjeupop);
+
+ _sortie.open("correspondances.txt", ios::out);
+ traduction.f_trad2Gpop(_sortie);
+ _sortie << ends;
+ _sortie.close();
+
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ traduction.oImmanc(_sortie);
+ _sortie.close();
+
+ break;
+ }
+ }
+}
+
+void ApplPopulations::ecritLea() {
+ // format LEA Likelihood Estimation of Admixture
+ unsigned long P1, P2, H;
+
+ P1
+ = DemandePopulation(
+ _("What is the name of the population P1 (parental population) ?"));
+ P2
+ = DemandePopulation(
+ _("What is the name of the population P2 (parental population) ?"));
+ H
+ = DemandePopulation(
+ _("What is the name of the population H (hybrid population)?"));
+
+ // cout << _("Output file name (LEA format, M.A. Beaumont, L. Chikhi) ?") << endl;
+ // cin >> _nomFichier;
+ _nomFichier
+ = DemandeFichier(
+ _("Output file name (LEA format, M.A. Beaumont, L. Chikhi) ?"));
+
+ try {
+ _sortie.open(_nomFichier.c_str(), ios::out);
+
+ JeuPopExp exportation(_Pjeupop);
+
+ exportation.oLea(P1, P2, H, _sortie, cout);
+
+ _sortie.close();
+ } catch (JeuPopExp::Anomalie pb) {
+ _sortie.close();
+ switch (pb.le_pb) {
+ case 1:
+ break;
+ case 2:
+ break;
+ default:
+ cerr << _("Error number: ") << pb.le_pb << _(" in the object: ")
+ << "JeuPopExp" << endl;
+ break;
+ }
+ }
+}
+
+void ApplPopulations::ecritAdmix() {
+ // format Admix http://www.unife.it/genetica/Giorgio/giorgio.html
+ unsigned long P1, P2, H;
+ string fichier_mtx;
+
+ P1
+ = DemandePopulation(
+ _("What is the name of the population P1 (parental population) ?"));
+ P2
+ = DemandePopulation(
+ _("What is the name of the population P2 (parental population) ?"));
+ H
+ = DemandePopulation(
+ _("What is the name of the population H (hybrid population)?"));
+
+ cout << _("Output file name (Admix .dat format, G. Bertorelle) ?") << endl;
+ cin >> _nomFichier;
+
+ cout << _("Output file name (Admix .mtx format, G. Bertorelle) ?") << endl;
+ cin >> fichier_mtx;
+
+ try {
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ JeuPopExp exportation(_Pjeupop);
+ exportation.oAdmix_dat(P1, P2, H, _sortie, cout);
+ _sortie.close();
+
+ _sortie.open(fichier_mtx.c_str(), ios::out);
+ exportation.oAdmix_mtx(_sortie, cout);
+ _sortie.close();
+ } catch (JeuPopExp::Anomalie pb) {
+ _sortie.close();
+ switch (pb.le_pb) {
+ case 1:
+ break;
+ case 2:
+ break;
+ default:
+ cerr << _("Error number: ") << pb.le_pb << _(" in the object: ")
+ << "JeuPopExp" << endl;
+ break;
+ }
+ }
+}
+
+void ApplPopulations::ecritMsat(int choix) {
+ // cout << _("Output file (Microsat format) ?") << endl;
+ // cin >> _nomFichier;
+ _nomFichier = DemandeFichier(_("Output file (Microsat format) ?"));
+
+ try {
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ switch (choix) {
+ case 1:
+ _Pjeupop->oMsat(_sortie);
+ break;
+ default:
+ _Pjeupop->oMsatFreq(_sortie);
+ break;
+ }
+ _sortie.close();
+ } catch (Jeupop::Anomalie pb) {
+ _sortie.close();
+ switch (pb.le_pb) {
+ // case 1:
+ // cerr << endl << "le format Immanc ne permet que le stockage de pop diploides" << endl;
+ // break;
+ case 2:
+ //les noms d'alleles ne sont pas des tailles de msat
+ cout << _("Populations is not able to export dataset:") << endl;
+ // cout << _("Les noms d'alleles doivent correspondre a des tailles de microsatellites (ou au nombre de repetitions).") << endl;
+ cout
+ << _("Alleles names should be numeric, corresponding to allele size (or number of repetition).")
+ << endl;
+
+ break;
+ }
+ }
+}
+
+int ApplPopulations::menu_metconstructarbre() {
+
+ int choix;
+ _choix = 0;
+
+ // while (_choix != 0) {
+ cout << endl << endl;
+ // cout << "0) Menu principal" << endl;
+ cout << "1) " << _("UPGMA") << endl;
+ cout << "2) " << _("Neighbor Joining") << endl;
+ cout << endl << _("Your choice: ");
+ cin >> choix;
+
+ switch (choix) {
+ // case 0:
+ // _choix = -1;
+ // return;
+ // break;
+ case 1:
+ return (1);
+ break;
+ case 2:
+ return (2);
+ break;
+ default:
+ return (2);
+ break;
+ }
+ // }
+
+}
+
+int ApplPopulations::menu_metdistpop() {
+
+ int choix;
+ unsigned int i, nb_methods(DistancesGnt::get_nb_methodes());
+ _choix = 0;
+
+ // while (_choix != 0) {
+ cout << endl << _("Distance methods") << endl;
+ cout << "0) " << _("Back") << endl;
+ for (i = 1; i < nb_methods; i++) {
+ cout << (i) << ") " << DistancesGnt::get_nom_methode(i) << endl;
+ }
+ if (_square_distance)
+ cout << nb_methods << ") " << _("Squared distance: yes") << endl;
+ else
+ cout << nb_methods << ") " << _("Squared distance: no") << endl;
+ /*
+ cout << "1) " << _("DAS, Allelic Shared Distance (Chakraborty et Jin., 1993)") << endl;
+ cout << "2) " << _("Nei, minimum genetic distance, Dm (Nei,1987)") << endl;
+ cout << "3) " << _("Nei, standard genetic distance, Ds (Nei, 1987)") << endl;
+ cout << "4) " << _("Cavalli-Sforza and Edwards, Dc (1967)") << endl;
+ cout << "5) " << _("Nei et al's, Da (1983)") << endl;
+ cout << "6) " << _("Goldstein et al., dmu2 (1995a)") << endl;
+ cout << "7) " << _("Latter, Fst (1972)") << endl;
+ cout << "8) " << _("Prevosti et al.'s, Cp (1975)") << endl;
+ cout << "9) " << _("Rogers', Dr (1972)") << endl;
+ cout << "10) " << _("Average Square Distance (ASD, Goldstein, Slatkin 1995)") << endl;
+ cout << "11) " << _("Shriver et al's, Dsw (1995)") << endl;
+ cout << "12) " << _("Lev A. Zhivotovsky, DR (1999)") << endl;
+ */
+
+ choix = DemandeChoix(0, nb_methods + 1);
+
+ switch (choix) {
+ case 0:
+ _choix = -1;
+ return (-1);
+ break;
+ case 1:
+ return (101); //Das sur les individus
+ break;
+ case 2:
+ return (102); //Nei sur les populations
+ break;
+ case 3:
+ return (103); //Nei sur les populations
+ break;
+ case 4:
+ return (104); //Cavalli-Sforza and Edwards' (1967)sur les populations
+ break;
+ case 5:
+ return (5); // Nei et al's, Da (1983) sur les populations
+ break;
+ case 6:
+ return (106); // Goldstein et al., Mu (1995a) sur les populations
+ break;
+ case 7:
+ return (107); // Latter's Fst (1972) sur les populations
+ break;
+ case 8:
+ return (108); // Prevosti et al.'s, Cp (1975) sur les populations
+ break;
+ case 9:
+ return (109); // Rogers', Dr (1972) sur les populations
+ break;
+ case 10:
+ return (110); // Goldstein et al. (1995b) Slatkin 1995
+ break;
+ case 11:
+ return (111); // Shriver et al's, Dsw (1995)
+ break;
+ case 12:
+ return (112); // Lev A. Zhivotovsky, DR (1999)
+ break;
+ case 13:
+ return (113); // Reynolds unweighted (1983)
+ break;
+ case 14:
+ return (114); // Reynolds weighted (1983)
+ break;
+ case 15:
+ return (115); // Reynolds least squares (1983)
+ break;
+
+ case 16:
+ _square_distance = !_square_distance;
+ return (menu_metdistpop());
+ break;
+
+ default:
+ return (5);
+ break;
+ }
+}
+
+void ApplPopulations::fconstructarbre(MatriceLD &distances,
+ string & nomficarbre, int methodearbre) {
+ ArbrePlus larbre;
+ bool continuer(true);
+
+ if (_temp.size() != 0)
+ larbre._titre = _temp;
+ switch (methodearbre) {
+ case 1:
+ cerr << _("Building phylogenetic tree with UPGMA...") << endl;
+ larbre._titre.push_back("UPGMA");
+ break;
+ case 2:
+ cerr << _("Building phylogenetic tree with Neighbor-Joining...")
+ << endl;
+ larbre._titre.push_back("Neighbor-Joining");
+ break;
+ case 101:
+ cerr << _("Building phylogenetic tree with UPGMA...") << endl;
+ larbre._titre.push_back("UPGMA");
+ break;
+ case 102:
+ cerr << _("Building phylogenetic tree with Neighbor-Joining...")
+ << endl;
+ larbre._titre.push_back("Neighbor-Joining");
+ break;
+ default:
+ cerr
+ << _("Error missing construction method to build phylogenetic tree")
+ << endl;
+ // larbre._titre.push_back("UPGMA");
+ return;
+ }
+
+ while (continuer) {
+ continuer = false;
+ try {
+ // _sortie.open("debug.txt", ios::out);
+ // distances.oExcel(_sortie);
+ // _sortie.close();
+ //cerr << "ApplPopulations::fconstructarbre debut iDistances" << endl;
+ larbre.iDistances(distances, methodearbre);
+ // larbre.fElimineTrifurcation();
+ //cerr << "ApplPopulations::fconstructarbre fin iDistances" << endl;
+
+ ecritArbre(larbre, nomficarbre);
+ } catch (Arbre::Anomalie pb) {
+ switch (pb.le_pb) {
+ case 4:
+ cout << _("Inconsistant matrix file format") << endl;
+ break;
+ case 5:
+ cout << _("the matrix is too small") << endl;
+ break;
+ case 6:
+ cout << _("Negative distances in the matrix...") << endl;
+ cout << _("the smallest value is: ")
+ << distances.get_ppvaleur() << endl;
+ cout
+ << _("to build a tree, you must set negative values to zero.")
+ << endl;
+ if (DemandeOuiNon(
+ _("Do you want to set negative values to zero (Y/N) ?"))) {
+ distances.f_neg2zero();
+ continuer = true;
+ }
+ break;
+ }
+ if (continuer == false)
+ cout << _("The tree file was not written.") << endl;
+
+ }
+ }// continuer
+ _temp.resize(0);
+}
+
+void ApplPopulations::ecritArbre(ArbrePlus & larbre, string nomFichier) {
+ //cerr << "ApplPopulations::ecritArbre(ArbrePlus & larbre, string nomFichier) debut" << endl;
+ set_groupes_arbre(larbre);
+
+ if (nomFichier == "") {
+ cout << _("Output tree file:") << endl;
+ nomFichier = DemandeFichier(
+ _("Name of output file (Phylip tree file) ?"));
+ }
+
+ _sortie.open(nomFichier.c_str(), ios::out);
+ larbre.oFichier(_sortie, 1);
+ // _sortie << larbre;
+ // _sortie << endl << ends;
+ _sortie.close();
+ //cerr << "ApplPopulations::ecritArbre(ArbrePlus & larbre, string nomFichier) fin" << endl;
+}
+
+void ApplPopulations::fLigneCommande(char ** commandes, int nbcommandes) {
+ Titre tab_commandes(commandes, nbcommandes);
+
+ if (tab_commandes.Position("-phylogeny") > 0)
+ fLiPhylogeny(tab_commandes);
+ else if (tab_commandes.Position("--test") >= 0)
+ fLiTest(tab_commandes);
+ else
+ fLiHelp();
+}
+
+void ApplPopulations::fLiPhylogeny(Titre & tab_commandes) {
+ // demande d'arbre phylog�n�tique
+ int pos;
+ // unsigned int niveau(100); //niveau pour populations structur�es
+ ArbrePlus larbre;
+
+ istream * Pentree(&cin);
+ ostream * Psortie(&cout);
+
+ tab_commandes.Suppr(0);
+
+ //fichiers d'entree ou entree standard (par d�faut)
+ _fichier.open(tab_commandes[0].c_str(), ios::in);
+
+ if (_fichier.is_open())
+ Pentree = &_fichier;
+ try {
+ _Pjeupop = new Jeupop();
+ *Pentree >> *(_Pjeupop);
+ _fichier.close();
+ _fichier.clear();
+ } catch (Jeupop::Anomalie pb) {
+ _fichier.close();
+ _fichier.clear();
+ delete _Pjeupop;
+
+ switch (pb.le_pb) {
+ case 4:
+ cerr << _("Input file format seems incorrect...") << endl;
+ return;
+ break;
+ }
+ }
+
+ //fichiers de sortie ou sortie standard (sortie standard par d�faut)
+ pos = tab_commandes.Position("-output");
+ if ((pos > 0) && (pos + 1 != (long) tab_commandes.size())) {
+ _sortie.open(tab_commandes[pos + 1].c_str(), ios::out);
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) debug output : "
+ << tab_commandes[pos + 1].c_str() << endl;
+ if (_sortie.is_open() != 0)
+ Psortie = &_sortie;
+ tab_commandes.Suppr(pos + 1);
+ tab_commandes.Suppr(pos);
+ }
+
+ // Individus ou Populations ? (populations par d�faut)
+ bool sur_pop(true);
+
+ //tab_commandes.Suppr(tab_commandes.Position("-phylogeny"));
+ pos = tab_commandes.Position("-phylogeny");
+
+ if ((pos + 1 != (long) tab_commandes.size()) && (tab_commandes[pos + 1]
+ == "ind")) {
+ sur_pop = false;
+ tab_commandes.Suppr(pos + 1);
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) debug phylogeny : ind"
+ << endl;
+ } else if ((pos + 1 != (long) tab_commandes.size()) && (tab_commandes[pos
+ + 1] == "pop")) {
+ tab_commandes.Suppr(pos + 1);
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) debug phylogeny : pop"
+ << endl;
+ }
+ tab_commandes.Suppr(pos);
+
+ // Methode de distance ? (Nei standard par d�faut)
+ int metdist(102);
+ pos = tab_commandes.Position("-dist");
+ if ((pos > 0) && (pos + 1 != (long) tab_commandes.size())) {
+ if (tab_commandes[pos + 1] == "DAS") {
+ metdist = 5;
+ tab_commandes.Suppr(pos + 1);
+ } else if (tab_commandes[pos + 1] == "Dm") {
+ metdist = 101;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "Ds") || (tab_commandes[pos + 1]
+ == "nei")) {
+ metdist = 102;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "Dc") || (tab_commandes[pos + 1]
+ == "cav")) {
+ metdist = 103;
+ tab_commandes.Suppr(pos + 1);
+ } else if (tab_commandes[pos + 1] == "Da") {
+ metdist = 104;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "dmu2")
+ || (tab_commandes[pos + 1] == "goldstein")) {
+ metdist = 106;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "Fst") || (tab_commandes[pos + 1]
+ == "latter")) {
+ metdist = 107;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "Cp") || (tab_commandes[pos + 1]
+ == "prevosti")) {
+ metdist = 108;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "Dr") || (tab_commandes[pos + 1]
+ == "roger")) {
+ metdist = 109;
+ tab_commandes.Suppr(pos + 1);
+ } else if (tab_commandes[pos + 1] == "ASD") {
+ metdist = 110;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "Dsw") || (tab_commandes[pos + 1]
+ == "shriver")) {
+ metdist = 111;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "DR") || (tab_commandes[pos + 1]
+ == "zhiv")) {
+ metdist = 112;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "Dru") || (tab_commandes[pos + 1]
+ == "reynoldsu")) {
+ metdist = 113;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "Drw") || (tab_commandes[pos + 1]
+ == "reynoldsw")) {
+ metdist = 114;
+ tab_commandes.Suppr(pos + 1);
+ } else if ((tab_commandes[pos + 1] == "Drl") || (tab_commandes[pos + 1]
+ == "reynoldsl")) {
+ metdist = 115;
+ tab_commandes.Suppr(pos + 1);
+ }
+ /* return(5); //Das sur les individus
+ return(101); //Nei sur les populations, Dm
+ return(102); //Nei sur les populations, Ds
+ return(103); //Cavalli-Sforza and Edwards' (1967), Dc
+ return(104); // Nei et al's, Da (1983)
+ return(106); // Goldstein et al., Mu (1995a), dmu2
+ return(107); // Latter's Fst (1972)
+ return(108); // Prevosti et al.'s, Cp (1975)
+ return(109); // Rogers', Dr (1972)
+ return(110); // Goldstein et al. (1995b) Slatkin 1995, ASD
+ return(111); // Shriver et al's, Dsw (1995)
+ return(112); // Lev A. Zhivotovsky, DR (1999)
+ */
+ tab_commandes.Suppr(pos);
+ }
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) metdist : "
+ << metdist << endl;
+
+ // Methode de construction d'arbre ? (Neigbhor Joining par d�faut)
+ int metconstructarbre(2);
+ pos = tab_commandes.Position("-construct");
+ if ((pos > 0) && (pos + 1 != (long) tab_commandes.size())) {
+ if (tab_commandes[pos + 1] == "upgma") {
+ metconstructarbre = 1;
+ tab_commandes.Suppr(pos + 1);
+ tab_commandes.Suppr(pos);
+ } else if (tab_commandes[pos + 1] == "nj") {
+ metconstructarbre = 2;
+ tab_commandes.Suppr(pos + 1);
+ tab_commandes.Suppr(pos);
+ }
+ }
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) metconstructarbre : "
+ << metconstructarbre << endl;
+
+ //nombre d'it�rations pour le bootstrap
+ int nb_iterations(0);
+
+ // bootstrap locus ou bootstrap individus ? (bootstrap locus par d�faut)
+ bool bootstrap_locus(true);
+
+ if (sur_pop) {
+
+ pos = tab_commandes.Position("-bootstrap_ind");
+ if (pos > 0) {
+ nb_iterations = 100;
+ bootstrap_locus = false;
+ if ((pos + 1 != (long) tab_commandes.size()) && (tab_commandes[pos
+ + 1].EstUnChiffre())) {
+ nb_iterations = tab_commandes[pos + 1];
+ tab_commandes.Suppr(pos + 1);
+ }
+ tab_commandes.Suppr(pos);
+ }
+
+ pos = tab_commandes.Position("-level");
+ if (pos > 0) {
+ _niveau = 100;
+ if ((pos + 1 != (long) tab_commandes.size()) && (tab_commandes[pos
+ + 1].EstUnChiffre())) {
+ _niveau = tab_commandes[pos + 1];
+ tab_commandes.Suppr(pos + 1);
+ }
+ tab_commandes.Suppr(pos);
+ }
+ } else {
+ pos = tab_commandes.Position("-bootstrap_ind");
+ if (pos > 0) {
+ cerr
+ << "ERROR: Populations is unable to bootstrap on individuals to make a phylogenetic tree of individuals"
+ << endl;
+ return;
+ }
+ }
+
+ pos = tab_commandes.Position("-bootstrap_locus");
+ if (pos > 0) {
+ nb_iterations = 100;
+ if ((pos + 1 != (long) tab_commandes.size())
+ && (tab_commandes[pos + 1].EstUnChiffre())) {
+ nb_iterations = tab_commandes[pos + 1];
+ tab_commandes.Suppr(pos + 1);
+ }
+ tab_commandes.Suppr(pos);
+ }
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) bootstrap_locus : "
+ << bootstrap_locus << endl;
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) nb_iterations : "
+ << nb_iterations << endl;
+
+ //---------------------------------------------
+ // Décryptage de la ligne de commande terminé
+ // ----------------------------------------------
+
+ if (sur_pop) {
+ //phylogenie sur les populations
+ set_groupes_populations();
+ larbre._titre.resize(2);
+ larbre._titre[0].assign(""); // individus, populations
+ larbre._titre[1].assign(""); // méthode de distance, nb bootstrap
+
+ larbre._titre[0].AjEntier(_Pjeupop->get_nbpop());
+ larbre._titre[0] += " populations";
+
+ larbre._titre[1] += DistancesGnt::get_nom_methode(metdist);
+
+ if (nb_iterations == 0) {
+ //pas de bootstrap
+ // calcul de distance entre toutes les populations
+ MatriceLD distances;
+
+ try {
+ _Pjeupop->f_distgntpop(distances, metdist, _niveau);
+ } catch (Jeupop::Anomalie pb) {
+ cerr
+ << "ApplPopulations::fLiPhylogeny(Titre & tab_commandes) ERROR: "
+ << pb.le_pb << endl;
+ return;
+ }
+ try {
+ larbre.iDistances(distances, metconstructarbre);
+ // larbre.fElimineTrifurcation();
+ } catch (Arbre::Anomalie pb) {
+ switch (pb.le_pb) {
+ case 4:
+ cout << _("Inconsistant matrix file format");
+ break;
+ case 5:
+ cout << _("the matrix is too small");
+ break;
+ case 6:
+ cout << _("Negative distances in the matrix");
+ break;
+ }
+ return;
+ }
+ } else {
+ larbre._titre[1] += ", ";
+ larbre._titre[1].AjEntier(nb_iterations);
+
+ if (bootstrap_locus) {
+ larbre._titre[1] += " bootstraps on locus";
+ _Pjeupop->f_BootstrapLocus(larbre, metconstructarbre, metdist,
+ _square_distance, nb_iterations, false);
+ } else {
+ larbre._titre[1] += " bootstraps on individuals";
+ _Pjeupop->f_BootstrapIndividus(larbre, metconstructarbre,
+ metdist, _square_distance, nb_iterations);
+ }
+
+ // larbre.fElimineTrifurcation();
+ }
+ } else {
+ //phylogenie sur les individus
+ set_groupes_individus();
+ larbre._titre.resize(2);
+ larbre._titre[0].assign(""); // individus, populations
+ larbre._titre[1].assign(""); // m�thode de distance, nb bootstrap
+
+ larbre._titre[0].AjEntier(_Pjeupop->get_nbind());
+ larbre._titre[0] += " individuals";
+
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) phylogeny on individuals "
+ << endl;
+
+ larbre._titre[1] += DistancesGnt::get_nom_methode(metdist);
+
+ if (nb_iterations == 0) {
+ //pas de bootstrap
+ // calcul de distance entre tous les individus
+ MatriceLD distances;
+
+ try {
+
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) Pjeupop->f_distgnt(distances, metdist, _square_distance); "
+ << endl;
+ _Pjeupop->f_distgnt(distances, metdist, _square_distance);
+ } catch (Jeupop::Anomalie pb) {
+ cerr
+ << "ApplPopulations::fLiPhylogeny(Titre & tab_commandes) ERROR: "
+ << pb.le_pb << endl;
+ return;
+ }
+
+ try {
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) larbre.iDistances "
+ << endl;
+ larbre.iDistances(distances, metconstructarbre);
+ // larbre.fElimineTrifurcation();
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) end larbre.iDistances "
+ << endl;
+ } catch (Arbre::Anomalie pb) {
+ switch (pb.le_pb) {
+ case 4:
+ cout << _("Inconsistant matrix file format");
+ break;
+ case 5:
+ cout << _("the matrix is too small");
+ break;
+ case 6:
+ cout << _("Negative distances in the matrix");
+ }
+ }
+ //return;
+ } else {
+ //bootstrap sur les locus
+ larbre._titre[1] += ", ";
+ larbre._titre[1].AjEntier(nb_iterations);
+ larbre._titre[1] += " bootstraps on locus";
+ _Pjeupop->f_BootstrapLocus(larbre, metconstructarbre, metdist,
+ nb_iterations, true);
+
+ // larbre.fElimineTrifurcation();
+ }
+ }
+
+ cerr
+ << "DEBUG ApplPopulations::fLiPhylogeny(Titre & tab_commandes) set_groupes_arbre(larbre); "
+ << endl;
+ set_groupes_arbre(larbre);
+ larbre.oFichier(*Psortie);
+ reset_groupes();
+
+ // *Psortie << larbre;
+ // larbre.oFichier(*Psortie);
+
+ if (_sortie.is_open() != 0)
+ _sortie.close();
+
+}
+
+void ApplPopulations::fLiHelp() const {
+ cout << _("Online help missing") << endl;
+ cout << _("Please visit our website :") << endl;
+ cout << "http://www.bioinformatics.org/~tryphon/populations/" << endl;
+}
+
+void ApplPopulations::fLiTest(Titre & tab_commandes) {
+ cout << "test du jour" << endl;
+ cout << "Copie d'objet Jeupop" << endl;
+
+ istream * Pentree(&cin);
+ // ostream * Psortie(&cout);
+
+ // tab_commandes.Suppr(0);
+
+ //fichiers d'entree ou entree standard (par d�faut)
+ _fichier.open("toutc2.txt", ios::in);
+
+ if (_fichier.is_open())
+ Pentree = &_fichier;
+ try {
+ _Pjeupop = new Jeupop();
+ *Pentree >> *(_Pjeupop);
+ _fichier.close();
+ _fichier.clear();
+ } catch (Jeupop::Anomalie pb) {
+ _fichier.close();
+ _fichier.clear();
+ delete _Pjeupop;
+
+ switch (pb.le_pb) {
+ case 4:
+ cerr << "Erreur de lecture..." << endl;
+ return;
+ break;
+ }
+ }
+
+ // _Pjeupop->oGenepop(cout);
+ Jeupop copie(*_Pjeupop);
+
+ // copie.oGenepopCano(cout);
+
+}
+
+void ApplPopulations::affPubEntree() const {
+
+ cout << endl << endl;
+ cout << "**********************************************************"
+ << endl;
+ cout << "* Populations " << version_populations
+ << " *" << endl;
+ cout << "* langella at moulon.inra.fr *"
+ << endl;
+ cout << "* http://bioinformatics.org/project/?group_id=84 *"
+ << endl;
+ cout << "**********************************************************"
+ << endl;
+ cout << endl << endl;
+
+ // cout << log (10) << endl; //log n�perien
+}
+
+/** Choix de locus */
+Vecteur<unsigned int> ApplPopulations::menu_choixlocus() const {
+
+ Vecteur<unsigned int> Vlocus;
+ _Pjeupop->f_selectlocustous(Vlocus);
+ signed int pos;
+
+ int choix(1);
+ while (choix > 0) {
+ cout << endl << endl;
+ cout << _("Locus selection:") << endl;
+ cout << "0) " << _("back") << endl;
+ cout << "1) " << _("Select all loci (default)") << endl;
+ cout << "2) " << _("Remove all loci") << endl;
+ cout << "3) " << _("Add a particular locus") << endl;
+ cout << "4) " << _("Remove a particular locus") << endl;
+ cout << "5) " << _("Display selected loci") << endl;
+
+ choix = DemandeChoix(0, 5);
+
+ switch (choix) {
+ case 0:
+ return (Vlocus);
+ break;
+ case 1: // ajouter tous les locus
+ _Pjeupop->f_selectlocustous(Vlocus);
+ break;
+ case 2: //enlever tous les locus
+ Vlocus.resize(0);
+ break;
+ case 3: //ajouter un locus
+ pos = DemandeLocus();
+ if (pos != -1)
+ Vlocus.push_back((unsigned int) pos);
+ break;
+ case 4: //enlever un locus
+ pos = DemandeLocus();
+ if (pos != -1) {
+ pos = Vlocus.Position((unsigned int) pos);
+ if (pos >= 0)
+ Vlocus.Suppr(pos);
+ }
+ break;
+ case 5: //affichage des locus selectionnes
+ affVlocus(Vlocus);
+ break;
+ }
+ }
+ return (Vlocus);
+}
+/** */
+void ApplPopulations::affVlocus(const Vecteur<unsigned int> & Vlocus) const {
+ unsigned int i;
+
+ cout << endl;
+ for (i = 0; i < Vlocus.size(); i++)
+ cout << _Pjeupop->get_nomlocus(Vlocus[i]) << " ";
+ cout << endl;
+}
+/** Demande le nom ou le numero d'un locus */
+int ApplPopulations::DemandeLocus(const char laquestion[]) const {
+ // float Application::DemandeReel(char laquestion[], float inf, float sup) const{
+ biolib::vecteurs::ChaineCar rep;
+ int nblocus(_Pjeupop->get_nbloc());
+ int numlocus(-1);
+
+ if (laquestion == 0)
+ cout << _("Name or number of the locus: ") << endl;
+ else
+ cout << laquestion << endl;
+ cin >> rep;
+
+ numlocus = _Pjeupop->get_numloc(rep);
+ if (numlocus == -1) {
+ numlocus = rep;
+ numlocus--;
+ }
+
+ if ((numlocus < 0) || (numlocus >= nblocus)) {
+ cerr << _("The locus ") << rep << _(" was not found") << endl;
+ numlocus = -1;
+ }
+ return (numlocus);
+}
+
+void ApplPopulations::ecritGenetix() {
+ _nomFichier = DemandeFichier(_("Output file name (Genetix format) ?"));
+
+ try {
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ JeuPopExp jeuaexporter(_Pjeupop);
+
+ jeuaexporter.oGenetix(_sortie, cerr);
+
+ _sortie.close();
+ } catch (JeuPopExp::Anomalie pb) {
+ _sortie.close();
+ cerr << pb.fmessage(pb.le_pb) << endl;
+ }
+}
+
+void ApplPopulations::ecritFstat() {
+ _nomFichier = DemandeFichier(_("Output file name (Fstat format) ?"));
+
+ try {
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ JeuPopExp jeuaexporter(_Pjeupop);
+
+ jeuaexporter.oFstat(_sortie, cerr);
+
+ _sortie.close();
+ } catch (JeuPopExp::Anomalie pb) {
+ _sortie.close();
+ cerr << pb.fmessage(pb.le_pb) << endl;
+ }
+}
+
+void ApplPopulations::ecritRapportFst() {
+ cout << endl;
+ cout << _("Fst, Fis and Fit computation") << endl;
+ cout << "" << endl;
+ JeuMatriceLD mat_resultat;
+ _nomFichier = DemandeFichier(_("Output file name ?"));
+
+ cout << endl;
+ cout << _("computing...") << endl;
+ cout << "" << endl;
+ Fstat lesfstats(_Pjeupop->get_Pracinepop());
+ // lesfstats.f_affparlocus(cout);
+ lesfstats.f_calcFstFisFit(mat_resultat);
+
+ ecritJeuMatriceLD(mat_resultat, _nomFichier);
+
+}
+
+void ApplPopulations::fmicrosatcorrections() {
+#ifdef XMLREADMICROSATCORRECTION_H
+ while (_fichier.is_open() == 0) {
+ cout << _("Name of the XML file containing corrections ?") << endl;
+ cin >> _nomFichier;
+
+ _fichier.open(_nomFichier.c_str(), ios::in);
+ _fichier.clear();
+ }
+
+ try {
+ XMLreadMicrosatCorrection parser(*_Pjeupop);
+ parser.iParseFlux(_fichier);
+ _fichier.close();
+ }
+ catch (XMLreadMicrosatCorrection::Anomalie pb) {
+ _fichier.close();
+ //throw Anomalie(1);
+ }
+
+#else
+ cout << endl;
+ cout << _("Sorry this version of Populations is unable to read XML files.")
+ << endl;
+ cout << _("Try the linux version.") << endl;
+ cout << "" << endl;
+#endif
+}
+
+void ApplPopulations::ecritPopulationsXML() {
+ // cout << _("Output file name (Populations format) ?") << endl;
+ // cin >> _nomFichier;
+ _nomFichier = DemandeFichier(
+ _("Output file name (XML Populations format) ?"));
+
+ try {
+ _sortie.open(_nomFichier.c_str(), ios::out);
+ JeuPopExp jeuaexporter(_Pjeupop);
+
+ jeuaexporter.oPopulationsXML(_sortie, cerr);
+
+ _sortie.close();
+ } catch (JeuPopExp::Anomalie pb) {
+ _sortie.close();
+ cerr << pb.fmessage(pb.le_pb) << endl;
+ }
+}
diff --git a/src/applpopulations.h b/src/applpopulations.h
new file mode 100644
index 0000000..8ef6f30
--- /dev/null
+++ b/src/applpopulations.h
@@ -0,0 +1,109 @@
+/***************************************************************************
+ applpopulations.h - description
+ -------------------
+ begin : Mon Oct 30 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef APPLPOPULATIONS_H
+#define APPLPOPULATIONS_H
+
+#include "config.h"
+#define version_populations POPULATIONS_VERSION
+
+#include "arbreplus.h"
+#include "fstat.h"
+#include "applpop.h"
+# ifndef COMPILATION_MINGW32
+//# include "olivxml.h"
+# endif
+
+//#include "distgnt.h"
+/**Objet sp�cifique � l'application "Populations"
+ *@author Olivier Langella
+ */
+typedef biolib::arbres::ArbrePlus ArbrePlus;
+typedef biolib::vecteurs::ChaineCar ChaineCar;
+//typedef biolib::arbres::Arbre Arbre;
+
+class ApplPopulations: public ApplPop {
+public:
+ ApplPopulations();
+ ~ApplPopulations();
+
+ void affPubEntree() const;
+ /** */
+ void affVlocus(const Vecteur<unsigned int> &) const;
+ /** Demande le nom ou le numero d'un locus */
+ int DemandeLocus(const char laquestion[] = 0) const;
+
+private:
+
+ int menu_principal();
+ void menu_formats();
+ int menu_metdistpop();
+ // int menu_metdistind();
+ int menu_metconstructarbre();
+ void menu_popstructurees();
+ void menu_arbrepop();
+ void menu_arbreind();
+ void menu_calculs();
+ /** Choix de locus */
+ Vecteur<unsigned int> menu_choixlocus() const;
+
+ //traitement en ligne de commande:
+ void fLigneCommande(char ** commandes, int nbcommandes);
+ void fLiPhylogeny(Titre & tab_commandes);
+ void fLiHelp() const;
+ void fLiTest(Titre & tab_commandes);
+
+ void fconstructarbre(MatriceLD &distances, string & nomficarbre,
+ int methodearbre);
+ void fmat2arbre();
+ bool fcompdistind(MatriceLD &distances, int metdist = 0);
+ void fdistind();
+ void ftreeind();
+ void ftreeindBootLocus();
+ bool fcompdistpop(MatriceLD &distances, int metdist = 0);
+ void fdistpop();
+ void ftreepop();
+ void ftreepopBootLocus();
+ void ftreepopBootInd();
+ void fintrogresse();
+ void frarefaction();
+ void fsetniveau();
+ void fmicrosatcorrections();
+
+private:
+
+ void ecritGenepop();
+ void ecritGenepopCano();
+ void ecritPopulations();
+ void ecritImmanc();
+ void ecritMsat(int);
+ void ecritArbre(ArbrePlus & larbre, string nomFichier = "");
+ void ecritLea();
+ void ecritAdmix();
+ void ecritGenetix();
+ void ecritFstat();
+ void ecritRapportFst();
+ void ecritPopulationsXML();
+
+ void AffNiveauxPopStruc(ostream &);
+
+ Vecteur<unsigned int> _VcalcLocus;
+ bool _square_distance;
+};
+
+#endif
+
diff --git a/src/arbre.cpp b/src/arbre.cpp
new file mode 100644
index 0000000..610dfb8
--- /dev/null
+++ b/src/arbre.cpp
@@ -0,0 +1,1866 @@
+/***************************************************************************
+ arbre.cpp - description
+ -------------------
+ begin : Mon Dec 18 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+
+#include "arbre.h"
+
+namespace biolib {
+namespace arbres {
+
+Arbre::~Arbre() {
+ //destruction des noeuds et individus
+ unsigned int i;
+
+ for (i=0; i < _tabPind.size(); i++) delete _tabPind[i];
+ for (i=0; i < _tabPnoeuds.size(); i++) delete _tabPnoeuds[i];
+
+}
+
+Arbre::Arbre() {
+ reset();
+// _oui_taille_branches = false;
+// _oui_bootstrap = false;
+// _Pracine = 0;
+}
+
+ArbreNdBase::ArbreNdBase(Arbre * Parbre) {
+
+ _Parbre = Parbre;
+}
+
+ArbreNdBase::~ArbreNdBase() {
+}
+
+void ArbreNdBase::set_Pnoeud(unsigned int pos, ArbreNdBase * Pnoeud) {
+ _tabPNoeuds[pos] = Pnoeud;
+}
+
+unsigned int ArbreNdBase::get_nbbranches() const {
+ return(_tabPNoeuds.size());
+}
+bool ArbreNdBase::est_racine() const {
+ return(false);
+}
+
+void ArbreNdBase::set_nom(const string & nom) {
+}
+
+ArbreNdOTU * Arbre::new_ArbreNdOTU(const string & nom) {
+ unsigned int i, taille, j;
+ ArbreNdOTU * Pindswap;
+
+ _tabPind.push_back(new ArbreNdOTU(this, nom));
+
+
+ Pindswap = _tabPind.back();
+
+ taille = _tabPind.size();
+ if ((taille == 1) || (nom == "")) {Pindswap->set_id(taille-1);return(Pindswap);}
+// _tabPind.back()->set_id(taille-1);
+//classement de l'individu
+ // on avance jusqu'à son emplacement:
+ i = 0;
+ while ((i < (taille-1)) && (strcmp(_tabPind[i]->get_reference(), Pindswap->get_reference()) < 0)) i++;
+
+ _tabPind.back()->set_id(i);
+
+ if ((taille-1) == i) return (Pindswap);
+
+
+ for ( j = (taille-1); j > i; j--) {
+ _tabPind[j] = _tabPind[j-1];
+ _tabPind[j]->set_id(j);
+ }
+ _tabPind[i] = Pindswap;
+
+ return(Pindswap);
+}
+
+ArbreNdOTU * Arbre::new_ArbreNdOTU(ArbreNdNoeud * PArbreNdNoeudPere) {
+ _tabPind.push_back(new ArbreNdOTU(this, PArbreNdNoeudPere));
+ _tabPind.back()->set_id(_tabPind.size()-1);
+ return(_tabPind.back());
+}
+
+ArbreNdNoeud * Arbre::new_ArbreNdNoeud(unsigned int nbbranches){
+//cerr << "Arbre::new_ArbreNdNoeud(unsigned int nbbranches)" << endl;
+ _tabPnoeuds.push_back(new ArbreNdNoeud(this, nbbranches));
+//cerr << "Arbre::new_ArbreNdNoeud(unsigned int nbbranches) fin" << endl;
+ return(_tabPnoeuds.back());
+}
+
+ArbreNdNoeud * Arbre::new_ArbreNdNoeud(ArbreNdNoeud * PArbreNdNoeudere) {
+ _tabPnoeuds.push_back(new ArbreNdNoeud(this, PArbreNdNoeudere));
+ return(_tabPnoeuds.back());
+}
+
+void ArbreNdBase::f_chgt_sens(ArbreNdNoeud * Pracine, ArbreNdNoeud * Psens) {
+//cerr << "ArbreNdBase::f_chgt_sens" << endl;
+
+}
+
+void ArbreNdNoeud::f_chgt_sens(ArbreNdNoeud * Pracine, ArbreNdNoeud * Psens) {
+ //Psens devient le pointeur vers la racine de l'arbre
+ // => a la place de tabPNoeuds[0]
+ unsigned int i;
+ unsigned int pos(0);
+ unsigned int taille (_tabPNoeuds.size());
+ ArbreNdBase * Pswap;
+ float lgbranche;
+
+//cerr << "ArbreNdNoeud::f_chgt_sens debut" << endl;
+
+ Pswap = _tabPNoeuds[0];
+
+ for (i=0; i < taille; i++) if (_tabPNoeuds[i] == Psens) pos = i;
+
+ if (pos != 0) {
+
+ _tabPNoeuds[0] = _tabPNoeuds[pos];
+ _tabPNoeuds[pos] = Pswap;
+
+ lgbranche = _tabLgBranches[0];
+ set_longueur(0, _tabLgBranches[pos]);
+
+// _tabLgBranches[0] = _tabLgBranches[pos];
+ set_longueur(pos, lgbranche);
+// _tabLgBranches[pos] = lgbranche;
+ }
+
+ if ( Pracine == this) {
+ return;
+// _tabLgBranches[pos] = _tabPNoeuds[pos]->get_tabLgBranches(0);
+ }
+ else {
+ Pswap->f_chgt_sens(Pracine, this);
+ }
+//cerr << "ArbreNdNoeud::f_chgt_sens fin" << endl;
+
+}
+
+void ArbreNdNoeud::f_chgt_racine(ArbreNdNoeud * Pancracine) {
+//cerr << "ArbreNdNoeud::f_chgt_racine debut" << endl;
+ if (_racine) {
+ set_longueur(0, _tabLgBranches[0]);
+ _tabPNoeuds[0]->f_chgt_sens(Pancracine, this);
+// if (_tabLgBranches[0] != -999) _tabLgBranches[0] = -999;
+
+//cerr << "ArbreNdNoeud::f_chgt_racine " << Pancracine->get_nbbranches() << endl;
+ if (Pancracine->get_nbbranches() == 1) { //le noeud est inutile
+ // il faut le squizer
+ _Parbre->SquizNoeud(Pancracine);
+ }
+ }
+ else {
+ if (Pancracine == this) {
+ }
+ }
+//cerr << "ArbreNdNoeud::f_chgt_racine fin" << endl;
+}
+
+void ArbreNdBase::oPhylipRec(ostream & fichier) const {}//écriture d'arbres au format Phylip
+
+ArbreNdBase * ArbreNdBase::get_Pracine() const {
+ return (_tabPNoeuds[0]);
+}
+
+double ArbreNdBase::get_tabLgBranches(unsigned int i) const{
+ return (_tabLgBranches[i]);
+}
+
+double ArbreNdBase::get_longueur_branche() const{
+ //longueur de la branche racine
+ if (est_racine()) return(0);
+ else return (_tabLgBranches[0]);
+}
+
+double ArbreNdNoeud::get_longueur_max() const {
+ //donne la longueur de la plus grande branche
+ double taille(-1), temp;
+ unsigned int i;
+
+// if (_oui_taille_branche) {
+ if (est_racine()) {
+ temp = _tabPNoeuds[0]->get_longueur_max();
+ if (taille < temp) taille = temp;
+ }
+ for (i=1; i < _tabPNoeuds.size();i++) {
+ temp = _tabPNoeuds[i]->get_longueur_max();
+ if (taille < temp) taille = temp;
+ }
+ temp = get_longueur_branche();
+ if (temp < 0) return (taille);
+ else return (temp + taille);
+// }
+ return(0);
+}
+
+unsigned int ArbreNdNoeud::get_nbnoeuds_max() const {
+ //donne le nombre de noeuds de la plus grande branche
+ unsigned int i, temp, nbnoeuds(0);
+
+// if (_oui_taille_branche) {
+ if (est_racine()) {
+ temp = _tabPNoeuds[0]->get_nbnoeuds_max();
+ if (nbnoeuds < temp) nbnoeuds = temp;
+ }
+ for (i=1; i < _tabPNoeuds.size();i++) {
+ temp = _tabPNoeuds[i]->get_nbnoeuds_max();
+ if (nbnoeuds < temp) nbnoeuds = temp;
+ }
+ return (1 + nbnoeuds);
+// }
+}
+
+double ArbreNdNoeud::get_val_bootstrap() const{
+ return (_force);
+}
+
+ArbreNdBase * ArbreNdNoeud::get_Pracine() const {
+ if (_racine) return(0);
+ else return (_tabPNoeuds[0]);
+}
+
+void ArbreNdNoeud::AjBootstrap() {
+ _accuvalboot++;
+}
+
+ArbreVectUINT* ArbreNdOTU::f_load_id_ind() {
+ ArbreVectUINT * Ptab_id_ind;
+
+//cerr << "ArbreNdOTU::f_load_id_ind debut" <<endl;
+
+ Ptab_id_ind = new ArbreVectUINT;
+ Ptab_id_ind->push_back(_id);
+
+
+//cerr << "ArbreNdOTU::f_load_id_ind fin" <<endl;
+ return (Ptab_id_ind);
+}
+
+ArbreVectUINT* ArbreNdNoeud::f_load_id_ind() {
+ //chargement du vecteur d'id d'individus
+ //à partir de la racine, déclenche une fonction récursive de remplissage
+ unsigned int i,j;
+ ArbreVectUINT * Ptab_id_ind;
+
+//cerr << "ArbreNdNoeud::f_load_id_ind debut" <<endl;
+ for (i=0; i < _tabP_tab_id_ind.size(); i++) delete _tabP_tab_id_ind[i];
+ _tabP_tab_id_ind.resize(0);
+
+ if (_racine) {
+ _tabP_tab_id_ind.push_back(_tabPNoeuds[0]->f_load_id_ind());
+ }
+ else _tabP_tab_id_ind.push_back(new ArbreVectUINT);
+
+ for (i = 1; i < _tabPNoeuds.size(); i++) {
+ _tabP_tab_id_ind.push_back(_tabPNoeuds[i]->f_load_id_ind());
+ }
+ if (_racine) return (0);
+
+ Ptab_id_ind = new ArbreVectUINT;
+//cerr << "ArbreNdNoeud::f_load_id_ind tri " << _tabP_tab_id_ind[0] << " " << _tabP_tab_id_ind[0]->size() << endl;
+ for (i = 1; i < _tabPNoeuds.size(); i++) {
+//cerr << "ArbreNdNoeud::f_load_id_ind tri " << _tabP_tab_id_ind[i] << " " << _tabP_tab_id_ind[i]->size() << endl;
+ for (j = 0; j < _tabP_tab_id_ind[i]->size(); j++) {
+ Ptab_id_ind->push_back(_tabP_tab_id_ind[i]->operator[](j));
+ }
+ }
+ // => tri de Ptab_id_ind
+
+//cerr << "ArbreNdNoeud::f_load_id_ind tri" <<endl;
+ Ptab_id_ind->f_tri();
+//cerr << "ArbreNdNoeud::f_load_id_ind tri fin tri" <<endl;
+
+ //remplissage de _tabP_tab_id_ind[0]
+ //avec tout ce qui n'est pas dans Ptab_id_ind
+ unsigned int nbind(_Parbre->get_nbind());
+//cerr << "ArbreNdNoeud::f_load_id_ind fin Ptab_id_ind " <<endl;
+//Ptab_id_ind->affiche();
+ for (i=0; i < nbind; i++) if (!Ptab_id_ind->Existe(i)) _tabP_tab_id_ind[0]->push_back(i);
+//cerr << "ArbreNdNoeud::f_load_id_ind fin" <<endl;
+//cerr << "ArbreNdNoeud::f_load_id_ind ";
+//Ptab_id_ind->affiche();
+//cerr <<endl;
+ return (Ptab_id_ind);
+}
+
+
+void ArbreNdNoeud::set_force(float force) {
+ _force = (int) force;
+}
+
+bool ArbreNdNoeud::est_racine() const {
+ return(_racine);
+}
+
+ArbreNdNoeud::ArbreNdNoeud(Arbre * Parbre, ArbreNdNoeud * Pnoeud):ArbreNdBase(Parbre) {
+ _force = 0;
+ _accuvalboot = 0;
+ if (Pnoeud == 0) {
+ _racine = true;
+ Parbre->set_Pracine(this);
+ }
+ else {
+ _racine = false;
+ _tabPNoeuds.resize(1);
+ _tabLgBranches.resize(1);
+ _tabPNoeuds[0] = Pnoeud;
+ _tabLgBranches[0] = 0;
+ Pnoeud->AjouterFils(this);
+ }
+}
+
+ArbreNdNoeud::ArbreNdNoeud(Arbre * Parbre, unsigned int nbbranches):ArbreNdBase(Parbre) {
+// création d'un noeud neutre (dont on ne connait pas encore le noeud père)
+// avec 'nbbranches' branches
+ unsigned int i;
+
+ _force = 0;
+ _accuvalboot = 0;
+ _racine = false;
+ _tabPNoeuds.resize(nbbranches);
+ _tabLgBranches.resize(nbbranches);
+ for (i=0; i < _tabP_tab_id_ind.size(); i++) delete _tabP_tab_id_ind[i];
+// _tabPNoeuds[0] = 0;
+// _tabLgBranches[0] = 0;
+// Pnoeud->AjouterFils(this);
+}
+
+ArbreNdNoeud::~ArbreNdNoeud() {};
+
+unsigned int ArbreNdNoeud::get_nbbranches() const {
+ if (_racine) return(_tabPNoeuds.size());
+ else return(_tabPNoeuds.size()-1);
+}
+
+
+ArbreNdOTU::ArbreNdOTU(Arbre * Parbre, ArbreNdNoeud * Pnoeud):ArbreNdBase(Parbre) {
+ _tabPNoeuds.resize(1);
+ _tabLgBranches.resize(1);
+ _tabPNoeuds[0] = Pnoeud;
+ _tabLgBranches[0] = 0;
+ Pnoeud->AjouterFils(this);
+
+// _Parbre->AjouterIndividu(this);
+}
+
+ArbreNdOTU::ArbreNdOTU(Arbre * Parbre, const string & nom):ArbreNdBase(Parbre) {
+ //création d'un individu orphelin de noeud
+ _tabPNoeuds.resize(1);
+ _tabLgBranches.resize(1);
+ _tabPNoeuds[0] = 0;
+ _tabLgBranches[0] = 0;
+ set_nom(nom);
+ set_reference(nom);
+// Pnoeud->AjouterFils(this);
+// _Parbre->AjouterIndividu(this);
+}
+
+ArbreNdOTU::~ArbreNdOTU() {
+}
+
+/*
+bool ArbreNdOTU::operator== (const ArbreNdOTU &rval){
+//cerr << "ArbreNdOTU::operator==" << endl;
+ return (_nom == rval._nom);
+}
+*/
+void ArbreNdNoeud::AjouterFils(ArbreNdBase * Pnoeud) {
+ _tabLgBranches.push_back(Pnoeud->get_tabLgBranches(0));
+ _tabPNoeuds.push_back(Pnoeud);
+}
+
+void ArbreNdBase::set_longueur(unsigned int pos, float taille) {
+ _tabLgBranches[pos] = taille;
+
+//cerr << "ArbreNdBase::set_longueur" << endl;
+ if (_tabPNoeuds[pos] != 0) _tabPNoeuds[pos]->set_longueur(this,taille);
+//cerr << "ArbreNdBase::set_longueur fin" << endl;
+
+}
+
+void ArbreNdNoeud::set_longueur(unsigned int pos, float taille) {
+ _tabLgBranches[pos] = taille;
+
+//cerr << "ArbreNdNoeud::set_longueur debut" << endl1
+ if (_tabPNoeuds[pos] != 0) {
+ if ((_racine == true) && (pos == 0)) _tabPNoeuds[0]->set_longueur(this,taille);
+ else if (pos > 0) _tabPNoeuds[pos]->set_longueur(this,taille);
+ }
+//cerr << "ArbreNdNoeud::set_longueur fin" << endl;
+
+}
+
+void ArbreNdNoeud::oPhylipRec(ostream & fichier) const {
+ //écriture d'arbres au format Phylip
+ unsigned int i;
+// char car;
+//cerr << "ArbreNdNoeud::oPhylipRec debut" << endl;
+
+ fichier << "(";
+ if (_racine) {
+ _tabPNoeuds[0]->oPhylipRec(fichier);
+ fichier << ",";
+ }
+ for (i=1; i < _tabPNoeuds.size(); i++) {
+ if (i>1) fichier << ",";
+ _tabPNoeuds[i]->oPhylipRec(fichier);
+ }
+ fichier << ")";
+ if (_Parbre->get_oui_bootstrap() && _force != -999) fichier << _force;
+ if ((_racine == false) && (_Parbre->get_oui_taille_branches())) {
+ fichier << ":";
+ fichier << _tabLgBranches[0];
+// if ((_tabLgBranches[0] < 1e-6) || (_tabLgBranches[0] < 0)) fichier << 0;
+// else fichier << _tabLgBranches[0];
+ }
+}
+
+void ArbreNdOTU::oPhylipRec(ostream & fichier) const {
+ //écriture d'arbres au format Phylip
+ fichier << _nom;
+ if ( _tabLgBranches[0]!=-999) fichier << ":" << _tabLgBranches[0];
+}
+
+void ArbreNdBase::set_longueur(ArbreNdBase * Pnoeudbase, float taille) {
+ unsigned int i;
+
+ for (i=0; i < _tabPNoeuds.size();i++) {
+ if (Pnoeudbase == _tabPNoeuds[i]) _tabLgBranches[i] = taille;
+ }
+}
+
+int ArbreNdBase::get_posnoeuds(ArbreNdNoeud * Pnoeud) const {
+ unsigned int i;
+
+ for (i=0; i < _tabPNoeuds.size();i++) {
+ if (Pnoeud == _tabPNoeuds[i]) return ((int) i);
+ }
+ return (-1);
+}
+
+
+int Arbre::PositionInd(const char * nom_ind) const {
+ unsigned int taille(_tabPind.size()),i;
+
+ for (i = 0; i < taille; i++) {
+//cerr << "Arbre::PositionInd " << endl;
+//cerr << _tabPind[i]->get_nom_c_str() << "[" << endl;
+//cerr << nom_ind << "[" << endl ;
+ if ( strcmp(_tabPind[i]->get_reference(),nom_ind) == 0) return ((int)i);
+ }
+
+ string nom(nom_ind);
+ for (i = 0; i < taille; i++) {
+//cerr << "Arbre::PositionInd " << endl;
+//cerr << _tabPind[i]->get_nom_c_str() << "[" << endl;
+//cerr << nom_ind << "[" << endl ;
+ if (_tabPind[i]->get_nom() == nom) return ((int)i);
+ }
+
+ return (-1);
+}
+
+void Arbre::AjBootstrap(Arbre & rval) {
+
+// if (!_ind_charge) f_load_vectind();
+ if (!_ind_charge) f_load_vect_id_ind();
+ if (!rval._ind_charge) rval.f_load_vect_id_ind();
+//cerr << "Arbre::AjBootstrap" << endl;
+ unsigned int i,j, taille(_tabPnoeuds.size());
+
+ bool * tab_dejatrouve;
+ tab_dejatrouve = new bool[taille];
+ for (i = 0; i < taille; i++) tab_dejatrouve[i] = false;
+
+//cerr << "Arbre::AjBootstrap for debut" << endl;
+ for (i = 0; i < taille; i++) {
+//cerr << "Arbre::AjBootstrap for " << i << endl;
+ for (j = 0; j < taille; j++) {
+ if (!tab_dejatrouve[j]){
+ if (*(_tabPnoeuds[i]) == *(rval._tabPnoeuds[j])) {
+ _tabPnoeuds[i]->AjBootstrap();
+ tab_dejatrouve[j] = true;
+ break;
+ }
+ }
+ }
+ }
+//cerr << "Arbre::AjBootstrap fin" << endl;
+ _cumulbootstrap++;
+}
+
+void Arbre::set_Pracine(ArbreNdNoeud * Pracine) {
+ if (Pracine == 0) return;
+
+ if (_Pracine == 0) {
+ _Pracine = Pracine;
+ return;
+ }
+ if (Pracine == _Pracine) return;
+ // si il ya déjà un pointeur Pracine =>
+ // changement de racine de l'arbre
+ ArbreNdNoeud * Pancien(_Pracine);
+ _Pracine = Pracine;
+
+ Pancien->set_racine(false);
+ _Pracine->set_racine(true);
+//cerr << "Arbre::set_Pracine" << endl;
+ // réarrangement de l'arbre par propagation dans les noeuds
+
+ _Pracine->f_chgt_racine(Pancien);
+}
+
+void Arbre::iFichier(istream & fichier) {
+ _oui_taille_branches = false;
+ iPhylip(fichier);
+ f_tri_ind_alpha();
+}
+
+void Arbre::iPhylip(istream & fichier) {
+//lecture d'arbres au format Phylip
+
+//cerr << "Arbre::iPhylip debut" << endl;
+ char car;
+ unsigned int i;
+
+ car = fichier.peek();
+ if (car == '[') {
+ ChaineCar ligne;
+ fichier.get(car);
+ fichier.get(car);
+
+ while (fichier.good() && (car != ']')) {
+ ligne += car;
+ fichier.get(car);
+ }
+ if (fichier.fail()) throw Anomalie(100);
+ else {
+ unsigned int nblignes(ligne.GetNbMots("\\"));
+ for (i=0; i < nblignes; i++) {
+ _titre.push_back("");
+ ligne.GetMot(i+1,_titre.back(),"\\");
+ }
+ }
+ GetLigneFlot(fichier, ligne);
+ }
+
+ fichier.get(car);
+ if (car != '(') throw Anomalie(100);
+ iPhylipRec(fichier,0);
+
+ f_tri_ind_alpha();
+ for (i=0; i < _titre.size(); i++) {
+ if (_titre[i].Position("#G") == 0) {
+ //définition d'un groupe
+ iPhylipDefGroupe(_titre[i]);
+ _titre.Suppr(i);
+ i--;
+ }
+ }
+
+//cerr << "Arbre::iPhylip fin " << _oui_taille_branches << endl;
+
+// if (_tabPnoeuds.size() > 0) set_Pracine(_tabPnoeuds[0]);
+}
+
+void Arbre::oFichier(ostream & fichier, unsigned int format) const {
+ if ((format == 0) || (format > 2)) format = _oFormat;
+
+ switch (format) {
+ case 1:
+ oPhylip(fichier);
+ break;
+ case 2:
+ oXML(fichier);
+ break;
+
+ default:
+ oPhylip(fichier);
+ break;
+ }
+
+}
+
+void Arbre::oPhylip(ostream & fichier) const {
+//lecture d'arbres au format Phylip
+ unsigned int i;
+
+ if (_titre.size() > 0) {
+ fichier << "[";
+ for (i=0; i < _titre.size() ; i++) {
+ fichier << _titre[i];
+ if (i != (_titre.size()-1)) fichier << "\\";
+ }
+ oPhylipEcritGroupes(fichier);
+ fichier << "]" << endl;
+ }
+ else {
+ oPhylipEcritGroupes(fichier);
+ }
+ _Pracine->oPhylipRec(fichier);
+
+ fichier << ";" << endl;
+}
+
+void Arbre::iPhylipRec(istream & fichier, ArbreNdNoeud * Pnoeudracine) {
+ char nomcar[50];
+// string individu;
+ float force, taille;
+ char car;
+ ArbreNdNoeud * Pnoeud(new_ArbreNdNoeud(Pnoeudracine));
+
+
+// fichier.clear();
+
+// _tabPnoeuds.push_back(new ArbreNdNoeud(this, Pnoeudracine));
+// ArbreNdNoeud * Pnoeud(_tabPnoeuds.back());
+
+ fichier.get(car);
+ while (fichier.good()) {
+//cerr << "Arbre::iPhylipRec deb " << car << endl;
+ switch (car) {
+ case ';': //fin de l'arbre
+ return;
+ break;
+
+ case ')': //fin du noeud
+ // force du noeud
+ // taille de la branche mere
+// iPhylipRecPasser(fichier);
+ force = iPhylipRecGetForce(fichier);
+ taille = iPhylipRecGetTaille(fichier);
+ Pnoeud->set_force(force);
+ if (Pnoeud->est_racine() == false) Pnoeud->set_longueur(0, taille);
+// if ((taille == -999) && (Pnoeud.est_racine())) _taille_branches = false;
+ if (force > 0) _oui_bootstrap = true;
+ return;
+ break;
+
+ case '(': //nouveau noeud
+ iPhylipRec(fichier, Pnoeud);
+ break;
+ case ',': //nouvelle branche
+ break;
+ case ' ': //rien
+ break;
+ case 13: //retour chariot CR
+ break;
+ case 9: //tabulation
+ break;
+ case 10: //LF Line Feed
+ break;
+ default: //branche terminale
+// _tabPind.push_back(new ArbreNdOTU(this, Pnoeud));
+ //new ArbreNdOTU(this, Pnoeud);
+ new_ArbreNdOTU(Pnoeud);
+ nomcar[0] = car;
+//cerr << "//branche terminale deb" << endl;
+ i_PhylipRecGetNom(fichier, nomcar);
+ _tabPind.back()->set_nom(nomcar);
+ _tabPind.back()->set_reference(nomcar);
+// iPhylipRecPasser(fichier);
+ taille = iPhylipRecGetTaille(fichier);
+ _tabPind.back()->set_longueur((unsigned int) 0,taille);
+ break;
+ }
+ fichier.get(car);
+ }
+ // traitement du noeud terminé
+}
+
+/*void Arbre::iPhylipRecPasser(istream & fichier) {
+ char car;
+
+ car = fichier.peek();
+// car = fichier[pos]; pos++;
+ while ((((car > 47 ) && (car < 58)) || (car == '.') || (car == ':')) && fichier.good()) {
+ fichier.get(car);
+ car = fichier.peek();
+ }
+}
+*/
+
+float Arbre::iPhylipRecGetForce(istream & fichier) {
+ char car;
+ char temp[10]; //ATTENTION à la taille de temp !!!!!
+ int i(0);
+
+ car = fichier.peek();
+// car = fichier[pos]; pos++;
+
+ while ((car == 13) || (car == 10) || (car == '\'')) {//passage du retour chariot
+ fichier.get(car);
+ car = fichier.peek();
+ }
+
+ while (((car > 47 ) && (car < 58)) || (car == '.') && fichier.good() && (car != '\'')) {
+ _oui_bootstrap = true;
+ temp[i] = car;
+ i++;
+ fichier.get(car);
+ car = fichier.peek();
+ }
+ temp[i] = '\0';
+ if (car == '\'') {
+ fichier.get(car);
+ car = fichier.peek();
+ }
+ if (i == 0) return(-999);
+
+ if (fichier.fail()) cerr << "Arbre::iPhylipRecGetForce fichier.fail()" << endl;
+
+ return(atof(temp));
+}
+
+float Arbre::iPhylipRecGetTaille(istream & fichier) {
+ char car;
+ char temp[15]; //ATTENTION à la taille de temp !!!!!
+ int i(0);
+// bool neg(false);
+//cerr << "Arbre::iPhylipRecGetTaille" << endl;
+
+ car = fichier.peek();
+ while ((car == 13) || (car == 10)) {//passage du retour chariot
+ fichier.get(car);
+ car = fichier.peek();
+ }
+
+ if (car == ':') {
+ _oui_taille_branches = true;
+ fichier.get(car);
+ car = fichier.peek();
+ if (car == '-') {
+ fichier.get(car);
+ temp[i] = car;
+ i++;
+ car = fichier.peek();
+ }
+ while ((((car > 47 ) && (car < 58)) || (car == '.') || (car == 'e'))) {
+ if (car == 'e') {
+ temp[i] = car;
+ i++;
+ fichier.get(car);
+ car = fichier.peek();
+ if (car == '-') {
+ temp[i] = car;
+ i++;
+ fichier.get(car);
+ car = fichier.peek();
+ }
+ }
+ temp[i] = car;
+ i++;
+ fichier.get(car);
+ car = fichier.peek();
+ }
+ }
+//cerr << "Arbre::iPhylipRecGetTaille " << car << endl;
+ temp[i] = '\0';
+// if (i == 0) _oui_taille_branches = false;
+
+ if (fichier.fail()) cerr << "Arbre::iPhylipRecGetTaille fichier.fail()" << endl;
+
+// return(0);
+ return(atof(temp));
+}
+
+void Arbre::i_PhylipRecGetNom(istream & fichier, char * nom) {
+// string nom;
+ char car;
+ unsigned int i(1);
+
+ car = fichier.peek();
+
+ if (nom[0] == '\'') {
+ i = 0;
+// nom[0] = car;
+// fichier.get(car);
+// car = fichier.peek();
+ }
+ while ((car != ':' ) && (car != ',' ) && (car != ')' ) && (car != '\'' )) {
+ nom[i] = car;
+ i++;
+ fichier.get(car);
+ car = fichier.peek();
+ }
+ if (car == '\'') {
+ fichier.get(car);
+ car = fichier.peek();
+ }
+ nom[i] = '\0';
+
+// if (fichier.fail()) cerr << "Arbre::i_PhylipRecGetNom fichier.fail()" << endl;
+
+// return(nom);
+}
+
+void Arbre::f_test() {
+
+ set_Pracine(_tabPnoeuds[4]);
+}
+
+void Arbre::SquizNoeud(ArbreNdNoeud * Pndaeffacer) {
+ //élimination d'un noeud à 1 branche
+
+// cerr << "Arbre::SquizNoeud" << endl;
+
+ if (Pndaeffacer->get_nbbranches()!=1) {
+ cerr << "erreur Arbre::SquizNoeud" << endl;
+ return;
+ }
+
+ ArbreNdBase * Phaut;
+ ArbreNdBase * Pbas;
+ float longueur(0);
+ int pos;
+ unsigned int i;
+
+ Phaut = Pndaeffacer->get_Pnoeud(0);
+ Pbas = Pndaeffacer->get_Pnoeud(1);
+ pos = Phaut->get_posnoeuds(Pndaeffacer);
+ if (pos == -1) {
+ cerr << "Erreur Arbre::SquizNoeud" << endl;
+ return;
+ }
+// cerr << "Arbre::SquizNoeud "<< longueur << endl;
+ if (Phaut->get_tabLgBranches(pos) != -999) longueur = Phaut->get_tabLgBranches(pos);
+// cerr << "Arbre::SquizNoeud "<< longueur << endl;
+ if (Pbas->get_tabLgBranches(0) != -999) longueur += Pbas->get_tabLgBranches(0);
+ if ((Pbas->get_tabLgBranches(0) == -999) && (Phaut->get_tabLgBranches(pos) == -999))
+ longueur = -999;
+ Phaut->set_longueur(pos, longueur);
+ Pbas->set_longueur((unsigned int)0, longueur);
+ Phaut->set_Pnoeud(pos, Pbas);
+ Pbas->set_Pnoeud(0, Phaut);
+
+ for (i = 0; i < _tabPnoeuds.size(); i++) {
+ if (_tabPnoeuds[i] == Pndaeffacer) _tabPnoeuds.erase(_tabPnoeuds.begin()+i);
+ }
+
+ delete Pndaeffacer;
+}
+
+bool ArbreNdNoeud::ExisteBranche(const ArbreVectUINT & tabInd) const {
+ unsigned int i;
+
+ for (i=0; i < _tabP_tab_id_ind.size(); i++) {
+ if (tabInd == *(_tabP_tab_id_ind[i])) {
+ return (true);
+ }
+ }
+
+ return (false);
+}
+
+
+ArbreNdNoeud * Arbre::RechercheNoeud(const ArbreVectUINT & tabInd) const {
+ ArbreNdNoeud * Presultat(0);
+ unsigned int i;
+
+ for (i=0; i < _tabPnoeuds.size(); i++) {
+ if (_tabPnoeuds[i]->ExisteBranche(tabInd)) {
+ Presultat = _tabPnoeuds[i];
+ break;
+ }
+ }
+
+ return (Presultat);
+}
+
+void Arbre::f_load_vect_id_ind() {
+ //chargement du vecteur d'id d'individus
+ //à partir de la racine, déclenche une fonction récursive de remplissage
+//cerr << "Arbre::f_load_vect_id_ind debut" <<endl;
+
+//cerr << "Arbre::f_load_vectind " << endl;
+ // chargement descendant
+ _Pracine->f_load_id_ind();
+
+ _ind_charge = true;
+//cerr << "Arbre::f_load_vect_id_ind fin" <<endl;
+}
+
+/*
+void Arbre::f_load_vectind() {
+ //chargement du vecteur de vecteurs de pointeurs d'individus
+ //à partir de la racine, déclenche une fonction récursive de remplissage
+ unsigned int i;
+ unsigned int taille (_tabPind.size());
+cerr << "Arbre::f_load_vectind debut" <<endl;
+
+//cerr << "Arbre::f_load_vectind " << endl;
+ // chargement descendant
+ _Pracine->f_load_vectind();
+ // chargement ascendant
+ for (i = 0; i < taille; i++) {
+ _tabPind[i]->f_load_vectind_parent();
+ }
+ _ind_charge = true;
+cerr << "Arbre::f_load_vectind fin" <<endl;
+}
+*/
+
+void Arbre::fCalcValBootstrap() {
+ //calcul de la force des noeuds
+
+ if (_cumulbootstrap != 0) _Pracine->fCalcValBootstrap(_cumulbootstrap);
+
+ _oui_bootstrap = true;
+}
+
+void ArbreNdNoeud::fCalcValBootstrap(unsigned int total_bootstrap) {
+
+ double resultat;
+
+ if (modf ((((double) _accuvalboot / (double) total_bootstrap) * (double) 100),&resultat) > 0.5) {
+ _force = (int)resultat + 1;
+ }
+ else _force = (int)resultat;
+
+ unsigned int i;
+
+ if (_racine) _tabPNoeuds[0]->fCalcValBootstrap(total_bootstrap);
+ for (i=1; i < _tabPNoeuds.size();i++) {
+ _tabPNoeuds[i]->fCalcValBootstrap(total_bootstrap);
+ }
+}
+
+void Arbre::reset() {
+//remise à zéro de l'arbre
+ //destruction des noeuds et individus
+ unsigned int i;
+
+ for (i=0; i < _tabPind.size(); i++) delete _tabPind[i];
+ for (i=0; i < _tabPnoeuds.size(); i++) delete _tabPnoeuds[i];
+ _tabPind.resize(0);
+ _tabPnoeuds.resize(0);
+
+ _ind_charge = false;
+ _oui_taille_branches = false;
+ _oui_bootstrap = false;
+ _cumulbootstrap = 0;
+ _Pracine = 0;
+}
+
+template<class T> void Arbre::iNeighborJoining(Matrice<T> & distances) {
+//cerr << "nj" << endl;
+ //pour accelerer le traitement des bootstrap:
+// if (_PtabPnoeud == 0) _PtabPnoeud = new vector<Noeud *>;
+// else _PtabPnoeud->resize(0);
+ reset();
+//cerr << "Arbre::iNeighborJoining debut " << distances.GetType() << endl;
+
+ bool *etatMat;
+// Vecteur<Branche *> tabPbranches;
+ vector<ArbreNdBase *> tabPNoeuds;
+ long nblignemat;
+ long taille(distances.GetNL());
+ long i, j, pos1(0), pos2(0), pos3, id, jd, refi, refj;
+ T sumbr1, sumbr2;
+ T comparer;
+ T critere;
+ T * Ptab(distances._tab);
+ vector<T> accDistances;
+ T distance;
+
+
+ ArbreNdNoeud * Pnoeud;
+
+ if (distances.GetType() != 2) throw Anomalie(4);
+
+//cerr << "Arbre::iNeighborJoining debut 2" << endl;
+ if (taille < 3) throw Anomalie(5);
+
+ for (i = 0; i < taille; i++) {
+ for (j = 0; j < i; j++) {
+ if (distances.GetCase(i,j) < 0) throw Anomalie(6);
+ }
+ }
+//cerr << "Arbre::iNeighborJoining debut3" << endl;
+
+ etatMat = new bool[taille];
+// tabPbranches.resize(taille);
+ tabPNoeuds.resize(taille);
+// _tabPotu.resize(taille);
+ accDistances.resize(taille);
+
+ for (i=0; i < taille ; i++) {
+ etatMat[i] = true;
+// cerr << distances._tlig[i] << endl;
+// _tabPotu[i] = new Otu(distances._tlig[i]);
+// _tabPind[i] = new ArbreNdOTU(this, distances._tlig[i]);
+// tabPNoeuds[i] = _tabPind[i];
+ tabPNoeuds[i] = new_ArbreNdOTU(distances._tlig[i]);
+// tabPNoeuds[i] = new ArbreNdOTU(this, distances._tlig[i]);
+// tabPbranches[i] = new Branche(this, _tabPotu[i]);
+ }
+
+ nblignemat = taille;
+
+ while (nblignemat > 3) {
+//cerr << "Arbre::iNeighborJoining Critere Q debut" << endl;
+ comparer = 9999999;
+ for (i = 1; i < taille; i++) {
+ if (etatMat[i]) {
+ for (j = 0; j < i; j++) {
+ if (etatMat[j]) {
+ for (critere = 0, refj = (j * taille), refi = (i * taille),id = 0; id < taille; id++, refi++, refj++) {
+ if (etatMat[id]) {
+ if (id != i) critere += *(Ptab + refi);
+
+ if (id != j) critere += *(Ptab + refj);
+ }
+ }
+ critere = ((nblignemat - 2) * *(Ptab + ((i * taille) + j))) - critere;
+
+ //recherche du couple ou la distance est minimum
+ if (comparer > critere) {
+ comparer = critere;
+ pos1 = j;
+ pos2 = i;
+ }
+ }
+ }
+ }
+ }
+ // ----- Critere Q Fin ----
+
+//cerr << "Arbre::iNeighborJoining Critere Q fin" << endl;
+
+ //--------------calcul des longueurs de branches
+ distance = Ptab[(pos1 * taille) + pos2];
+ sumbr1 = 0;
+ sumbr2 = 0;
+ for (i = 0; i < taille; i ++) {
+ if ((etatMat[i]) && (i != pos1) && (i != pos2)) {
+ sumbr1 += Ptab[(pos1 * taille) + i];
+ sumbr2 += Ptab[(pos2 * taille) + i];
+ }
+ }
+ sumbr1 /= (nblignemat - 2);
+ sumbr2 /= (nblignemat - 2);
+
+ tabPNoeuds[pos1]->set_longueur((unsigned int)0,((distance + sumbr1 - sumbr2) /2) - accDistances[pos1]);
+//cerr << "Arbre::iNeighborJoining set_longueur" << endl;
+ //tabPbranches[pos1]->_taille = (distance + sumbr1 - sumbr2) /2;
+ tabPNoeuds[pos2]->set_longueur((unsigned int)0,((distance + sumbr2 - sumbr1) /2) - accDistances[pos2]);
+ //tabPbranches[pos2]->_taille = (distance + sumbr2 - sumbr1) /2;
+
+ accDistances[pos1] = (distance / 2);
+ //------------fin du calcul des longueurs de branches
+
+ //grouper les branches dans un Noeud
+ //creer une nouvelle Branche
+
+// Pnoeud = new Noeud(new Branche(this));
+ Pnoeud = new_ArbreNdNoeud((unsigned int) 1);
+ //pour accelerer le traitement des bootstrap:
+// _PtabPnoeud->push_back(Pnoeud);
+// _tabPnoeuds.push_back(Pnoeud);
+
+// Pnoeud->_tabPbranche.resize(2);
+// Pnoeud->_tabPbranche[0] = tabPbranches[pos1];
+// Pnoeud->_tabPbranche[1] = tabPbranches[pos2];
+//cerr << "Arbre::iNeighborJoining AjouterFils" << endl;
+ Pnoeud->AjouterFils(tabPNoeuds[pos1]);
+ tabPNoeuds[pos1]->set_Pnoeud(0,Pnoeud);
+ Pnoeud->AjouterFils(tabPNoeuds[pos2]);
+ tabPNoeuds[pos2]->set_Pnoeud(0,Pnoeud);
+
+
+// tabPbranches[pos1] = Pnoeud->_PbrMere;
+// tabPbranches[pos1]->_type = 1;
+ tabPNoeuds[pos1] = Pnoeud;
+ etatMat[pos2] = false;
+ nblignemat--;
+
+ //recalculer les distances
+ jd = pos1; //colonne pos1
+ id = (pos1 * taille); //ligne pos1
+ for (i = 0; i < taille; i ++,id ++,jd += taille) {
+ if ((etatMat[i]) && (i != pos1)) {
+// distances.GetCase(pos1,i) = (distances.GetCase(pos1,i) + distances.GetCase(pos2,i)) / 2;
+ Ptab[id] += Ptab[(pos2 * taille) + i];
+ Ptab[id] /= (T) 2;
+ Ptab[jd] = Ptab[id];
+ }
+ }
+//cerr << "+" << endl;
+
+ }
+
+ pos2 = pos3 = -1;
+ for (i = 0; i < taille; i++) {
+ if ((etatMat[i]) && (i != pos1)) {
+ if (pos2 < 0) pos2 = i;
+ else if (pos3 < 0) pos3 = i;
+ // else pos3 = i;
+ }
+ }
+
+// _PndRoot = new Noeud(new Branche(this));
+//cerr << "Arbre::iNeighborJoining racine" << endl;
+ _Pracine = new_ArbreNdNoeud();
+ //pour accelerer le traitement des bootstrap:
+// _PtabPnoeud->push_back(_PndRoot);
+// _tabPnoeuds.push_back(_Pracine);
+
+ _Pracine->AjouterFils(tabPNoeuds[pos1]);
+ _Pracine->AjouterFils(tabPNoeuds[pos2]);
+ _Pracine->AjouterFils(tabPNoeuds[pos3]);
+ tabPNoeuds[pos1]->set_Pnoeud(0,_Pracine);
+ tabPNoeuds[pos2]->set_Pnoeud(0,_Pracine);
+ tabPNoeuds[pos3]->set_Pnoeud(0,_Pracine);
+
+ _Pracine->set_longueur(0,((Ptab[(pos2 * taille) + pos1] + Ptab[(pos3 * taille) + pos1] - Ptab[(pos3 * taille) + pos2]) /2) - accDistances[pos1]);
+ _Pracine->set_longueur(1,((Ptab[(pos1 * taille) + pos2] + Ptab[(pos3 * taille) + pos2] - Ptab[(pos3 * taille) + pos1]) /2) - accDistances[pos2]);
+ _Pracine->set_longueur(2,((Ptab[(pos1 * taille) + pos3] + Ptab[(pos2 * taille) + pos3] - Ptab[(pos1 * taille) + pos2]) /2) - accDistances[pos3]);
+
+ delete[] etatMat;
+
+ _oui_bootstrap = false;
+ _oui_taille_branches = true;
+ //_construction = 2;
+}
+
+template<class T> void Arbre::iUPGMA(Matrice<T> & distances) {
+ reset();
+
+ Vecteur<int> etatMat;
+ vector<T> accDistances;
+ Vecteur<ArbreNdBase *> tabPNoeuds;
+ long taille(distances.GetNL());
+ long i, j, pos1(0), pos2(0);
+ T comparer;
+ ArbreNdNoeud * Pnoeud(0);
+
+ if (distances.GetType() != 2) throw Anomalie(4);
+
+ if (taille < 2) throw Anomalie(5);
+
+ for (i = 0; i < taille; i++) {
+ for (j = 0; j < i; j++) {
+ if (distances.GetCase(i,j) < 0) throw Anomalie(6);
+ }
+ }
+
+ etatMat.resize(taille);
+ accDistances.resize(taille);
+
+ tabPNoeuds.resize(taille);
+
+ for (i=0; i < taille ; i++) {
+ accDistances[i] = 0;
+ etatMat[i] = 1;
+
+ tabPNoeuds[i] = new_ArbreNdOTU(distances._tlig[i]);
+ }
+
+ while (etatMat.getNbOccurence(1) > 1) {
+ //trouver la + courte distance
+ comparer = -1;
+ for (i = 1; i < taille; i++) {
+ for (j = 0; j < i; j++) {
+ if ((etatMat[i] == 1)&&(etatMat[j] == 1)) {
+ if (comparer == -1) {
+ comparer = distances.GetCase(i,j);
+ pos1 = j;
+ pos2 = i;
+ }
+ else {
+ if (comparer > distances.GetCase(i,j)) {
+ comparer = distances.GetCase(i,j);
+ pos1 = j;
+ pos2 = i;
+ }
+ }
+ }
+ }
+ }
+ //grouper les branches dans un Noeud
+ Pnoeud = new_ArbreNdNoeud((unsigned int) 1);
+ Pnoeud->AjouterFils(tabPNoeuds[pos1]);
+ tabPNoeuds[pos1]->set_Pnoeud(0,Pnoeud);
+ Pnoeud->AjouterFils(tabPNoeuds[pos2]);
+ tabPNoeuds[pos2]->set_Pnoeud(0,Pnoeud);
+
+
+
+ tabPNoeuds[pos1]->set_longueur((unsigned int)0,(comparer/2) - accDistances[pos1]);
+ tabPNoeuds[pos2]->set_longueur((unsigned int)0,(comparer/2) - accDistances[pos2]);
+ accDistances[pos1] = (comparer/2);
+
+ tabPNoeuds[pos1] = Pnoeud;
+ etatMat[pos2] = 0;
+
+ //recalculer les distances
+ for (i = 0; i < taille; i ++) {
+ if ((etatMat[i] == 1 ) && (i != pos1)) {
+ distances.GetCase(pos1,i) = (distances.GetCase(pos1,i) + distances.GetCase(pos2,i))/2;
+ }
+ }
+
+ }
+
+ _Pracine = Pnoeud;
+ _oui_bootstrap = false;
+ _oui_taille_branches = true;
+}
+
+template<class T> void Arbre::iNeighborJoiningTopo(Matrice<T> & distances) {
+ reset();
+//cerr << "Arbre::iNeighborJoiningTopo debut" << endl;
+
+ bool *etatMat;
+ vector<ArbreNdBase *> tabPNoeuds;
+ long nblignemat;
+ long taille(distances.GetNL());
+ long i, j, pos1(0), pos2(0), pos3, id, jd, refi, refj;
+ T comparer;
+ T critere;
+ T * Ptab(distances._tab);
+ vector<T> accDistances;
+
+
+ ArbreNdNoeud * Pnoeud;
+
+ if (distances.GetType() != 2) throw Anomalie(4);
+
+ if (taille < 3) throw Anomalie(5);
+
+ for (i = 0; i < (taille * taille); i++) {
+ if (Ptab[i] < 0) throw Anomalie(6);
+ }
+/* for (i = 0; i < taille; i++) {
+ for (j = 0; j < i; j++) {
+ if (distances.GetCase(i,j) < 0) throw Anomalie(6);
+ }
+ }
+*/
+ etatMat = new bool[taille];
+ tabPNoeuds.resize(taille);
+ accDistances.resize(taille);
+
+ for (i=0; i < taille ; i++) {
+ etatMat[i] = true;
+ tabPNoeuds[i] = new_ArbreNdOTU(distances._tlig[i]);
+ }
+
+ nblignemat = taille;
+
+ while (nblignemat > 3) {
+//cerr << "Arbre::iNeighborJoiningTopo Critere Q debut" << endl;
+ comparer = 9999999;
+ for (i = 1; i < taille; i++) {
+ if (etatMat[i]) {
+ for (j = 0; j < i; j++) {
+ if (etatMat[j]) {
+ for (critere = 0, refj = (j * taille), refi = (i * taille),id = 0; id < taille; id++, refi++, refj++) {
+ if (etatMat[id]) {
+ if (id != i) critere += *(Ptab + refi);
+
+ if (id != j) critere += *(Ptab + refj);
+ }
+ }
+ critere = ((nblignemat - 2) * *(Ptab + ((i * taille) + j))) - critere;
+
+ //recherche du couple ou la distance est minimum
+ if (comparer > critere) {
+ comparer = critere;
+ pos1 = j;
+ pos2 = i;
+ }
+ }
+ }
+ }
+ }
+ // ----- Critere Q Fin ----
+
+//cerr << "Arbre::iNeighborJoining Critere Q fin" << endl;
+
+ //grouper les branches dans un Noeud
+ //creer une nouvelle Branche
+
+// Pnoeud = new Noeud(new Branche(this));
+ Pnoeud = new_ArbreNdNoeud((unsigned int) 1);
+ Pnoeud->AjouterFils(tabPNoeuds[pos1]);
+ tabPNoeuds[pos1]->set_Pnoeud(0,Pnoeud);
+ Pnoeud->AjouterFils(tabPNoeuds[pos2]);
+ tabPNoeuds[pos2]->set_Pnoeud(0,Pnoeud);
+
+
+ tabPNoeuds[pos1] = Pnoeud;
+ etatMat[pos2] = false;
+ nblignemat--;
+
+ //recalculer les distances
+ jd = pos1; //colonne pos1
+ id = (pos1 * taille); //ligne pos1
+ for (i = 0; i < taille; i ++,id ++,jd += taille) {
+ if ((etatMat[i]) && (i != pos1)) {
+ Ptab[id] += Ptab[(pos2 * taille) + i];
+ Ptab[id] /= (T) 2;
+ Ptab[jd] = Ptab[id];
+ }
+ }
+//cerr << "+" << endl;
+
+ }
+
+ pos2 = pos3 = -1;
+ for (i = 0; i < taille; i++) {
+ if ((etatMat[i]) && (i != pos1)) {
+ if (pos2 < 0) pos2 = i;
+ else if (pos3 < 0) pos3 = i;
+ // else pos3 = i;
+ }
+ }
+
+// _PndRoot = new Noeud(new Branche(this));
+//cerr << "Arbre::iNeighborJoining racine" << endl;
+ _Pracine = new_ArbreNdNoeud();
+
+ _Pracine->AjouterFils(tabPNoeuds[pos1]);
+ _Pracine->AjouterFils(tabPNoeuds[pos2]);
+ _Pracine->AjouterFils(tabPNoeuds[pos3]);
+ tabPNoeuds[pos1]->set_Pnoeud(0,_Pracine);
+ tabPNoeuds[pos2]->set_Pnoeud(0,_Pracine);
+ tabPNoeuds[pos3]->set_Pnoeud(0,_Pracine);
+
+
+ delete[] etatMat;
+
+ _oui_bootstrap = false;
+ _oui_taille_branches = false;
+ //_construction = 2;
+}
+
+double ArbreNdOTU::get_longueur_max()const {
+ if (get_longueur_branche() < 0) return (0);
+ else return (get_longueur_branche());
+}
+
+unsigned int ArbreNdOTU::get_nbnoeuds_max()const {
+ return (1);
+}
+
+
+void Arbre::f_tri_ind_alpha() {
+
+ unsigned int i;
+
+//cerr << "Arbre::f_tri_ind_alpha debut " << _tabPind.size() << endl;
+ if (_tabPind.size() < 2) return;
+
+ //f_tribulle_ind_alpha();
+ sort (_tabPind.begin(),_tabPind.end(),moins<ArbreNdOTU *> ());
+/* if (_tabPind.size() < 4) f_tribulle_ind_alpha();
+// if (size() < 4) return;
+ else f_trishell_ind_alpha(0, _tabPind.size()-1);
+//cerr << "Arbre::f_tri_ind_alpha num"<< endl;
+*/
+ for (i=0; i < _tabPind.size(); i++) {
+ _tabPind[i]->set_id(i);
+
+//cerr << _tabPind[i]->get_nom_c_str() << endl;
+ }
+//cerr << "Arbre::f_tri_ind_alpha fin"<< endl;
+}
+
+
+void Arbre::f_tribulle_ind_alpha() {
+ unsigned int ok,i;
+ ArbreNdOTU * swap;
+ unsigned int n(_tabPind.size());
+
+ do{
+ ok=1;
+ for(i=1;i<n;i++) if (strcmp(_tabPind[i-1]->get_reference(), _tabPind[i]->get_reference()) > 0) {
+ ok=0;
+ swap = _tabPind[i];
+ _tabPind[i] = _tabPind[i-1];
+ _tabPind[i-1] = swap;
+ }
+ }while(!ok);
+}
+
+void Arbre::f_trishell_ind_alpha(unsigned int lb, unsigned int ub) {
+ //tri de _tabPind en fonction du nom des individus
+ //T *a,
+ unsigned int n, h, i, j;
+// unsigned int t;
+ ArbreNdOTU * Pswap;
+
+ /**************************
+ * sort array a[lb..ub] *
+ **************************/
+//cerr << "Arbre::f_trishell_ind_alpha debut "<< lb << " " << ub << endl;
+
+ /* compute largest increment */
+ n = ub - lb + 1;
+ h = 1;
+ if (n < 14) h = 1;
+// else if (sizeof(unsigned int) == 2 && n > 29524)
+ // h = 3280;
+ else {
+ while (h < n) h = 3*h + 1;
+ h /= 3;
+ h /= 3;
+ }
+
+ while (h > 0) {
+
+ /* sort-by-insertion in increments of h */
+ for (i = lb + h; i <= ub; i++) {
+//cerr << "Arbre::f_trishell_ind_alpha i "<< i << endl;
+ Pswap = _tabPind[i];
+//cerr << "Arbre::f_trishell_ind_alpha ok " << endl;
+//cerr << "i-h " << (i-h) << endl;
+ for (j = i-h; ((j >= lb) && (strcmp(_tabPind[j]->get_reference(), Pswap->get_reference()) > 0)); j -= h)
+ _tabPind[j+h] = _tabPind[j];
+ _tabPind[j+h] = Pswap;
+ }
+
+ /* compute next increment */
+ h /= 3;
+ }
+//cerr << "Arbre::f_trishell_ind_alpha fin "<< lb << " " << ub << endl;
+}
+
+void ArbreVectUINT::f_tri() {
+ //tri du vecteur
+ sort(begin(), end(), less<unsigned int>());
+ //return;
+ //vector<unsigned int>::sort();
+ //return;
+//cerr << "ArbreVectUINT::f_tri debut " << endl;
+ //if (size() < 2) return;
+ //if (size() == 2) {
+ // unsigned int swap;
+ // if (operator[](0) > operator[](1)) {
+ // swap = operator[](0);
+ // operator[](0) = operator[](1);
+ // operator[](1) = swap;
+ // }
+ // return;
+ //}
+ //if (size() == 3) f_tribulle();
+// if (size() < 4) return;
+ //else f_tribulle();
+// else f_trishell(0,size()-1);
+//cerr << "ArbreVectUINT::f_tri fin " << endl;
+}
+
+
+void ArbreVectUINT::f_tribulle() {
+ unsigned int ok,i, swap;
+ unsigned int n(size());
+
+ do{
+ ok=1;
+ for(i=1;i<n;i++) if (operator[](i-1)>operator[](i)) {
+ ok=0;
+ swap = operator[](i-1);
+ operator[](i-1) = operator[](i);
+ operator[](i) = swap;
+ }
+ } while(!ok);
+}
+
+void ArbreVectUINT::f_trishell(unsigned int lb, unsigned int ub) {
+ //T *a,
+ unsigned int n, h, i, j;
+ unsigned int t;
+
+ /**************************
+ * sort array a[lb..ub] *
+ **************************/
+
+ /* compute largest increment */
+ n = ub - lb + 1;
+ h = 1;
+ if (n < 14)
+ h = 1;
+// else if (sizeof(unsigned int) == 2 && n > 29524)
+ // h = 3280;
+ else {
+ while (h < n) h = 3*h + 1;
+ h /= 3;
+ h /= 3;
+ }
+
+ while (h > 0) {
+
+ /* sort-by-insertion in increments of h */
+ for (i = lb + h; i <= ub; i++) {
+ t = operator[](i);
+// for (j = i-h; j >= lb && compGT(operator[](j), t); j -= h)
+ for (j = i-h; ((j >= lb) && (operator[](j)> t)); j -= h)
+ operator[](j+h) = operator[](j);
+ operator[](j+h) = t;
+ }
+
+ /* compute next increment */
+ h /= 3;
+ }
+}
+
+bool ArbreVectUINT::operator== (const ArbreVectUINT &rval) {
+ //=>remplir les vecteurs avant
+//cerr << "ArbreNdNoeud::operator==" << endl;
+ unsigned int i, taille (size());
+
+ if (taille != rval.size()) return (false);
+
+ for (i = 0; i < taille; i ++) {
+ if (operator[](i) != rval[i]) return (false);
+ }
+ return (true);
+}
+
+void ArbreVectUINT::affiche() const {
+
+ string affichage;
+ unsigned int i, taille (size());
+
+ for (i = 0; i < taille; i ++) {
+ cout << " " << operator[](i);
+ }
+
+}
+
+void Arbre::iDistances(MatriceLD & matrice) {
+ iNeighborJoining(matrice);
+// f_tri_ind_alpha();
+}
+
+void Arbre::iDistances(MatriceF & distances, int methode) {
+//reconstruction d'arbres a partir d'une matrice de distances:
+ // int -> methode de reconstruction
+ // 1 -> UPGMA
+ // 2 -> Neighbor Joining
+ //on efface l'arbre si il yen a deja un
+//cerr << "Arbre::iDistances(MatriceLD & distances, int methode) debut" << endl;
+ reset();
+
+ switch (methode) {
+ case 1: // UPGMA
+ iUPGMA(distances);
+ break;
+ case 101: // UPGMA, topologie seulement
+ iUPGMA(distances);
+ break;
+ case 2: // Neighbor Joining
+ iNeighborJoining(distances);
+ break;
+ case 102: // Neighbor Joining, topologie seulement
+ iNeighborJoiningTopo(distances);
+ break;
+ }
+//cerr << "Arbre::iDistances(MatriceLD & distances, int methode) tri" << endl;
+// f_tri_ind_alpha();
+}
+
+void Arbre::iDistances(MatriceLD & distances, int methode) {
+//reconstruction d'arbres a partir d'une matrice de distances:
+ // int -> methode de reconstruction
+ // 1 -> UPGMA
+ // 2 -> Neighbor Joining
+//cerr << "Arbre::iDistances(MatriceLD & distances, int methode) debut" << endl;
+ //on efface l'arbre si il yen a deja un
+ reset();
+
+
+ switch (methode) {
+ case 1: // UPGMA
+ iUPGMA(distances);
+ break;
+ case 101: // UPGMA
+ iUPGMA(distances);
+ break;
+ case 2: // Neighbor Joining
+ iNeighborJoining(distances);
+ break;
+ case 102: // Neighbor Joining, topologie seulement
+ iNeighborJoiningTopo(distances);
+ break;
+ }
+//cerr << "Arbre::iDistances(MatriceLD & distances, int methode) tri" << endl;
+// f_tri_ind_alpha();
+}
+
+void Arbre::f_forceiDistances(MatriceLD & distancesRef,int methodeArbre) {
+ bool continuer(true);
+
+ while (continuer) {
+ try {
+ continuer = false;
+ iDistances(distancesRef,methodeArbre);
+ }
+ catch (Anomalie pb) {
+ cout << _("Error while building tree...") << endl;
+ switch (pb.le_pb) {
+ case 4:
+ cout << _("Inconsistant matrix file format") << endl;
+ throw Anomalie(4);
+ break;
+ case 5:
+ cout << _("the matrix is too small") << endl;
+ throw Anomalie(5);
+ break;
+ case 6:
+ cout << _("Negative distances in the matrix...") << endl;
+ cout << _("the smallest value is: ") << distancesRef.get_ppvaleur() << endl;
+ cout << _("all negative values are replaced by zero to proceed") << endl;
+ distancesRef.f_neg2zero();
+ continuer = true;
+ break;
+ default:
+ throw Anomalie(pb.le_pb);
+ break;
+ }
+ }
+ }
+}
+
+void Arbre::iNimbus(unsigned int nbessais , unsigned int nbind, unsigned int * Ptemp, char * * PPotu) {
+ unsigned int i, j;
+ ChaineCar nom;
+ MatriceF tab_nimbus(nbind, nbessais) ;
+ unsigned int * Puint(Ptemp);
+//cerr << "Arbre::iNimbus debut" << endl;
+// Visu.reset((long unsigned int) nbind, (long unsigned int) nbessais);
+ for (i=0; i < nbind ; i++) {
+ tab_nimbus._tlig[i].assign(PPotu[i]);
+ for (j=0; j < nbessais ; j++) {
+ tab_nimbus.GetCase(i, j) = *Puint;
+ Puint++;
+ }
+ }
+ tab_nimbus.SetFlag(1);
+// tab_nimbus.oExcel(cerr);
+
+ reset();
+
+ for (i=0; i < nbind ; i++) {
+ new_ArbreNdOTU("");
+ _tabPind[i]->set_nom(tab_nimbus._tlig[i]);
+ }
+
+ _Pracine = new_ArbreNdNoeud();
+
+ iNimbusRec(_Pracine, tab_nimbus, 0, 0, nbind);
+
+ _Pracine->AjouterFils(new_ArbreNdOTU(""));
+ _tabPind.back()->set_nom("____");
+ _tabPind.back()->set_longueur((unsigned int) 0, (float) nbessais);
+
+ _oui_bootstrap = false;
+ _oui_taille_branches = true;
+
+//cerr << "Arbre::iNimbus fin " << _tabPind.size() << endl;
+
+}
+
+void Arbre::iNimbusRec(ArbreNdNoeud * Pnoeud, MatriceF & tab_nimbus, unsigned int numessai, unsigned int deb, unsigned int fin, unsigned int longueur) {
+// pos: position en nb d'essais
+ // branche regroupant les otus de 'deb' a 'fin'
+ unsigned int i, nbessais(tab_nimbus.GetNC());
+ unsigned int pos;
+// ArbreNdNoeud * Pnoeud (_tabPnoeud.back());
+
+//cerr << "Arbre::iNimbusRec debut" << endl;
+ if ((numessai >= nbessais)&&(numessai != 0)) { //dernière colonne
+//cerr << "Arbre::iNimbusRec derniere col numessai " << numessai << endl;
+ Pnoeud->AjouterFils(new_ArbreNdNoeud((unsigned int) 1));
+//cerr << "coucou1 " << Pnoeud->get_nbbranches() << endl;
+// PPnoeudnov = _tabPnoeuds.back();
+//cerr << "coucou2 nbb " << _tabPnoeuds.back()->get_nbbranches() << endl;
+ _tabPnoeuds.back()->set_longueur(0, longueur);
+//cerr << "coucou3" << endl;
+//cerr << "Arbre::iNimbusRec dernier deb " << _tabPind[deb]->get_nom() << endl;
+ _tabPnoeuds.back()->AjouterFils(_tabPind[deb]);
+ _tabPind[deb]->set_longueur((unsigned int) 0, 0.25);
+ for (i = deb+1; i < fin; i++) {
+//cerr << "coucou4" << endl;
+//cerr << "Arbre::iNimbusRec dernier " << _tabPind[i]->get_nom() << endl;
+ _tabPnoeuds.back()->AjouterFils(_tabPind[i]);
+ _tabPind[i]->set_longueur((unsigned int) 0, 0.25);
+ }
+ return;
+ }
+
+ if ((fin - deb) == 1) {
+//cerr << "Arbre::iNimbusRec one " << _tabPind[deb]->get_nom() << endl;
+ // branche terminale
+ Pnoeud->AjouterFils(_tabPind[deb]);
+ _tabPind[deb]->set_longueur((unsigned int) 0, nbessais - numessai);
+ return;
+ }
+
+ for (pos = numessai; pos < nbessais; pos ++) {
+
+//cerr << "Arbre::iNimbusRec pos "<< pos << " numessai " << numessai << endl;
+ for (i = deb+1; i < fin; i ++) {
+ if (tab_nimbus.GetCase(i-1, pos) != tab_nimbus.GetCase(i, pos)) {
+ //nouveau noeud
+ Pnoeud->AjouterFils(new_ArbreNdNoeud((unsigned int) 1));
+ Pnoeud = _tabPnoeuds.back();
+ Pnoeud->set_longueur(0, pos-numessai);
+ iNimbusRec(Pnoeud, tab_nimbus, pos, deb,i,pos-numessai);
+ //les autres
+ deb = i;
+ i++;
+ while (i < fin) {
+ if (tab_nimbus.GetCase(i-1, pos) != tab_nimbus.GetCase(i, pos)){
+ iNimbusRec(Pnoeud, tab_nimbus, pos, deb,i,pos-numessai);
+ deb = i;
+ }
+ i ++;
+ }
+ iNimbusRec(Pnoeud, tab_nimbus, pos, deb,fin,pos-numessai);
+ return;
+ }
+
+ }
+
+ }
+
+ iNimbusRec(Pnoeud, tab_nimbus, pos, deb,fin,pos-numessai);
+}
+
+void Arbre::operator>>(ostream& sortie) {
+ switch (_oFormat) {
+ case 1:
+ oPhylip(sortie);
+ break;
+ default:
+ oPhylip(sortie);
+ break;
+ }
+}
+
+const ArbreNdOTU * Arbre::RecherchePOTU(unsigned int id) const {
+
+ unsigned int i;
+
+ for (i=0 ; i < _tabPind.size(); i++) {
+ if (_tabPind[i]->get_id() == id) return(_tabPind[i]);
+ }
+ return (0);
+}
+
+void ArbreNdOTU::set_nom(const string & nom) {
+ //a faire : vérifier l'unicité du nom
+ _nom.assign(nom);
+}
+
+void Arbre::oXML(ostream & fichier) const {
+//écriture d'arbres au format XML
+/*
+<!ELEMENT trees (tree+)>
+<!ELEMENT tree (comments?,branch,branch,branch?,length?)>
+<!ELEMENT branch (node,length?)>
+<!ELEMENT node ((branch,branch)|specie)>
+<!ELEMENT length (#PCDATA)>
+<!ELEMENT specie (#PCDATA)>
+
+*/
+ fichier << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" << endl;
+ fichier << "<!DOCTYPE trees SYSTEM \"treefile.dtd\">" << endl;
+ fichier << "<!-- " << endl;
+ fichier << "created by biolib library" << endl;
+ fichier << "Olivier Langella <Olivier.Langella at pge.cnrs-gif.fr>" << endl;
+ fichier << "http://www.pge.cnrs-gif.fr/bioinfo" << endl;
+ fichier << "-->" << endl;
+
+ fichier << "<trees>" << endl;
+ fichier << "<tree>" << endl;
+ unsigned int i;
+
+ if (_titre.size() > 0) {
+ fichier << "<comments>" << endl;
+ for (i=0; i < _titre.size() ; i++) {
+ fichier << _titre[i];
+ }
+ //oPhylipEcritGroupes(fichier);
+ fichier << "</comments>" << endl;
+ }
+
+ _Pracine->oXML(fichier);
+
+ fichier << "</tree>" << endl;
+ fichier << "</trees>" << endl;
+}
+
+
+void ArbreNdNoeud::oXML(ostream & fichier) const {
+ //écriture d'arbres au format Phylip
+ unsigned int i;
+// char car;
+//cerr << "ArbreNdNoeud::oPhylipRec debut" << endl;
+
+ if (_racine) {
+ fichier << "<branch>" << endl;
+ _tabPNoeuds[0]->oXML(fichier);
+ fichier << "</branch>" << endl;
+ }
+ else fichier << "<node>" << endl;
+
+ for (i=1; i < _tabPNoeuds.size(); i++) {
+ fichier << "<branch>" << endl;
+ _tabPNoeuds[i]->oXML(fichier);
+ fichier << "</branch>" << endl;
+ }
+ if (!(_racine)) fichier << "</node>" << endl;
+ if (_Parbre->get_oui_bootstrap() && _force != -999) {
+ fichier << "<force>" << endl;
+ fichier << _force;
+ fichier << "<force>" << endl;
+ }
+ if ((_racine == false) && (_Parbre->get_oui_taille_branches())) {
+ fichier << "<length>" << endl;
+ fichier << _tabLgBranches[0] << endl;
+ fichier << "</length>" << endl;
+// if ((_tabLgBranches[0] < 1e-6) || (_tabLgBranches[0] < 0)) fichier << 0;
+// else fichier << _tabLgBranches[0];
+ }
+
+}
+
+void ArbreNdOTU::oXML(ostream & fichier) const {
+ //écriture d'arbres au format Phylip
+// char car;
+//cerr << "ArbreNdNoeud::oPhylipRec debut" << endl;
+
+ fichier << "<branch>" << endl;
+ fichier << "<species>" << endl;
+ fichier << get_nom() << endl;
+ fichier << "</species>" << endl;
+ if (_Parbre->get_oui_taille_branches()) {
+ fichier << "<length>" << endl;
+ fichier << _tabLgBranches[0] << endl;
+ fichier << "</length>" << endl;
+ }
+ fichier << "</branch>" << endl;
+}
+
+} //namespace biolib {
+} //namespace arbres {
+
diff --git a/src/arbre.h b/src/arbre.h
new file mode 100644
index 0000000..682a8b2
--- /dev/null
+++ b/src/arbre.h
@@ -0,0 +1,346 @@
+/***************************************************************************
+ arbre.h - description
+ -------------------
+ begin : Mon Dec 18 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+
+//modifications le 2/1/2001
+//modifications le 4/6/2001
+
+#ifndef ARBRE_H
+#define ARBRE_H
+
+#include <string.h>
+#include <stdlib.h>
+#include <fstream>
+#include <vector>
+#include <string>
+#include <cmath>
+#include <algorithm>
+#include <functional>
+
+#include "internat.h"
+#include "matrices.h"
+//#define _(String) gettext (String)
+# ifndef _
+# define _(String) gettext (String)
+# endif
+
+namespace biolib {
+namespace arbres {
+
+
+using namespace std;
+using namespace biolib::vecteurs;
+
+template <class _Tp>
+struct moins
+{
+ bool operator()(const _Tp& x, const _Tp& y) const { return *x < *y; }
+};
+
+class ArbreVectUINT:public vector<unsigned int> {
+public:
+ void f_tri();
+
+ bool Existe (unsigned int element) const {
+//cerr << "ArbreVectUINT::Existe " << endl;
+//affiche();
+ unsigned int i;
+ for (i= 0 ; i < size(); i++) {
+//cerr << "ArbreVectUINT::Existe i " << i << endl;
+ if (operator[](i) == element) return(true);
+ }
+
+ return (false);
+ };
+
+ void affiche() const;
+
+ bool operator== (const ArbreVectUINT &rval);
+
+private:
+ void f_trishell(unsigned int n,unsigned int j);
+ void f_tribulle();
+};
+
+class Arbre;
+class ArbreNdNoeud;
+class ArbreNdOTU;
+
+class ArbreNdBase {
+public:
+ ArbreNdBase(Arbre * Parbre);
+ ArbreNdBase(const ArbreNdBase &) {};
+ virtual ~ArbreNdBase();
+
+ virtual void set_longueur(unsigned int pos, float taille);
+// virtual void set_longueur(float longueur) {};
+
+ virtual void set_longueur(ArbreNdBase * Pnoeudbase, float taille);
+ virtual void oPhylipRec(ostream & fichier) const;//écriture d'arbres au format Phylip
+ virtual void oXML(ostream & fichier) const {};//écriture d'arbres au format XML
+ virtual ArbreNdBase * get_Pracine() const;
+ virtual ArbreNdBase * get_Pnoeud(unsigned int i) const {return(_tabPNoeuds[i]);};
+ virtual unsigned int get_nbbranches() const;
+ virtual double get_longueur_branche() const;
+ virtual double get_tabLgBranches(unsigned int i) const;
+ virtual bool est_racine() const ;
+ virtual void set_nom(const string & nom);
+ virtual void f_chgt_sens(ArbreNdNoeud * Pancracine, ArbreNdNoeud * Pnvsens);
+ virtual int get_posnoeuds(ArbreNdNoeud * Pnoeud) const;
+
+ void set_Pnoeud(unsigned int pos, ArbreNdBase * Pnoeud);
+
+ virtual void fCalcValBootstrap(unsigned int total_bootstrap) {return;};
+ virtual double get_longueur_max()const {return(0);} ;
+ virtual unsigned int get_nbnoeuds_max()const {return(0);} ;
+
+ virtual ArbreVectUINT* f_load_id_ind() {return (0);};
+
+//interface pour PointPlotArbreBase
+protected:
+
+ Arbre * _Parbre;
+ vector<ArbreNdBase *> _tabPNoeuds;
+ vector<float> _tabLgBranches;
+};
+
+
+class ArbreNdOTU: public ArbreNdBase {
+public:
+ ArbreNdOTU(Arbre * Parbre, ArbreNdNoeud * Pnoeud);
+ ArbreNdOTU(Arbre * Parbre, const string & nom);
+ ArbreNdOTU(const ArbreNdOTU & original):ArbreNdBase(original) {};
+ virtual ~ArbreNdOTU();
+
+ void set_nom(const string & nom);
+// void set_nom(const char * nom){_nom.assign(nom);};
+
+// void set_longueur(float longueur){ArbreNdBase::set_longueur((unsigned int) 0,longueur);};
+
+ void set_reference(const string & ref) {strcpy(_reference, ref.c_str());};
+ void set_reference(const char * ref){strcpy(_reference, ref);};
+ const char * get_reference() const {return (_reference);};
+
+ void set_id(unsigned int id) { _id = id;};
+ const string & get_nom() const {return(_nom);};
+
+ inline bool operator== (const ArbreNdOTU &rval){return (_nom == rval._nom);};
+ virtual void oPhylipRec(ostream & fichier) const;//écriture d'arbres au format Phylip
+ virtual void oXML(ostream & fichier) const;//écriture d'arbres au format XML
+ virtual double get_longueur_max()const;
+ virtual unsigned int get_nbnoeuds_max()const;
+ unsigned int get_id() const {return(_id);};
+
+ virtual ArbreVectUINT* f_load_id_ind();
+
+ inline bool operator< (const ArbreNdOTU &rval){return (strcmp(_reference, rval._reference) < 0);};
+
+private:
+
+// char _nomchar[50];
+ char _reference[50];
+ string _nom;
+
+ unsigned int _id;
+};
+
+
+class ArbreNdNoeud: public ArbreNdBase {
+public:
+ ArbreNdNoeud(Arbre * Parbre, ArbreNdNoeud * Pnoeud=0);
+ ArbreNdNoeud(const ArbreNdNoeud & original):ArbreNdBase(original) {};
+ ArbreNdNoeud(Arbre * Parbre, unsigned int nbbranches);
+ virtual ~ArbreNdNoeud();
+ inline bool operator== (const ArbreNdNoeud &rval);
+
+ void AjouterFils(ArbreNdBase * Pnoeud);
+ void AjBootstrap();
+
+ double get_val_bootstrap() const;
+ void set_force(float force);
+ void set_longueur(unsigned int pos, float taille);
+ void set_racine(bool oui) {_racine = oui;};
+ virtual void oPhylipRec(ostream & fichier) const;//écriture d'arbres au format Phylip
+ virtual void oXML(ostream & fichier) const;
+ virtual ArbreNdBase * get_Pracine() const;
+ virtual unsigned int get_nbbranches() const;
+ virtual bool est_racine() const;
+ virtual bool ExisteBranche(const ArbreVectUINT & tabInd) const;
+
+ void f_chgt_racine(ArbreNdNoeud * Pracine);
+ void f_load_vectind();
+
+ virtual ArbreVectUINT* f_load_id_ind();
+
+ void fCalcValBootstrap(unsigned int total_bootstrap);
+ virtual double get_longueur_max() const;
+ virtual unsigned int get_nbnoeuds_max()const;
+
+protected:
+ void f_chgt_sens(ArbreNdNoeud * Pancracine, ArbreNdNoeud * Pnvsens);
+
+ bool _racine;
+ int _force;
+// vector<VectArbreNdOTU *> _tabPPind;
+ vector<ArbreVectUINT *> _tabP_tab_id_ind;
+ unsigned int _accuvalboot;
+};
+
+class Arbre {
+public:
+ Arbre();
+// Arbre(unsigned int nbessais , unsigned int nbind, unsigned int * Ptemp, char * * PPotu);
+ Arbre(const Arbre &) {};
+
+ virtual ~Arbre();
+
+ virtual ArbreNdOTU * new_ArbreNdOTU(const string & nom);
+ virtual ArbreNdOTU * new_ArbreNdOTU(ArbreNdNoeud * PArbreNdNoeudere);
+ virtual ArbreNdNoeud * new_ArbreNdNoeud(unsigned int nbbranches);
+ virtual ArbreNdNoeud * new_ArbreNdNoeud(ArbreNdNoeud * PArbreNdNoeudere=0);
+
+ void AjBootstrap(Arbre &);
+
+ virtual void iFichier(istream &);
+
+ void iPhylip(istream &);//lecture d'arbres au format Phylip
+ void iNimbus(unsigned int nbessais , unsigned int nbind, unsigned int * Ptemp, char * * PPotu);
+
+ void iDistances(MatriceLD &, int);
+ void iDistances(MatriceF &, int);
+ void iDistances(MatriceLD & matrice);
+ void f_forceiDistances(MatriceLD & distancesRef,int methodeArbre);
+
+ void oFichier(ostream & fichier, unsigned int format=0) const;
+// void iMega(istream &);//lecture d'arbres au format Mega
+ void set_Pracine(ArbreNdNoeud * Pracine);
+
+ void f_test();
+ void SquizNoeud(ArbreNdNoeud * Pndaeffacer);
+
+ int PositionInd(const char *) const;
+
+ virtual void f_load_vect_id_ind();
+
+ void reset();
+ void fCalcValBootstrap();
+ bool get_oui_bootstrap() const {return(_oui_bootstrap);};
+ bool get_oui_taille_branches() const {return(_oui_taille_branches);};
+ void set_oformat(unsigned int nbformat=1) {_oFormat = nbformat;};
+ unsigned int get_nbind() const {return(_tabPind.size());};
+ void f_tri_ind_alpha();
+
+ void operator>>(ostream& sortie);
+
+ Titre _titre;
+
+protected:
+ ArbreNdNoeud * RechercheNoeud(const ArbreVectUINT &) const;
+ const ArbreNdOTU * RecherchePOTU(unsigned int id) const;
+
+ template<class T> void iNeighborJoining(Matrice<T> & distances);
+ template<class T> void iNeighborJoiningTopo(Matrice<T> & distances);
+ template<class T> void iUPGMA(Matrice<T> & distances);
+
+ float iPhylipRecGetTaille(istream & fichier);
+ float iPhylipRecGetForce(istream & fichier);
+ void i_PhylipRecGetNom(istream & fichier, char *);
+ void iPhylipRec(istream & fichier, ArbreNdNoeud * Pnoeud=0 );//lecture d'arbres au format Phylip
+ virtual void iPhylipDefGroupe(const string &) {}; //définition d'un groupe
+ void oPhylip(ostream &) const;//écriture d'arbres au format Phylip
+ void oXML(ostream & fichier) const;
+ virtual void oPhylipEcritGroupes(ostream &) const {};
+
+ void iNimbusRec(ArbreNdNoeud * Pnoeud, MatriceF & tab_nimbus, unsigned int numessai, unsigned int deb, unsigned int fin, unsigned int longueur=0);
+// void iPhylipRecPasser(istream & fichier);
+ void f_trishell_ind_alpha(unsigned int lb, unsigned int ub);
+ void f_tribulle_ind_alpha();// void f_tri_ind_alpha();
+
+ ArbreNdNoeud * _Pracine;
+ vector<ArbreNdNoeud *> _tabPnoeuds;
+ vector<ArbreNdOTU *> _tabPind;
+
+ bool _oui_taille_branches;
+ bool _oui_bootstrap;
+ bool _ind_charge;
+ unsigned int _cumulbootstrap;
+ unsigned int _oFormat; //format de sortie (1 = phylip/newick)
+
+public:
+ struct Anomalie{
+ Anomalie (int i):le_pb(i){};
+
+ // 1-> Echec de RechercheNoeud
+ int le_pb;
+ string _message;
+
+ string& fmessage(int num){
+ switch (num) {
+ case 1:
+ _message = _("Error n°1 in Arbre: leaf not found");
+ break;
+ case 100:
+ _message = _("Error reading treefile");
+ break;
+
+ default:
+ _message = _("Error in Arbre");
+ break;
+ }
+ return(_message);
+ }
+ };
+
+};
+
+
+inline bool ArbreNdNoeud::operator== (const ArbreNdNoeud &rval) {
+ //=>remplir les vecteurs avant
+//cerr << "ArbreNdNoeud::operator==" << endl;
+ unsigned int taille(_tabP_tab_id_ind.size());
+ if (taille != rval._tabP_tab_id_ind.size()) return (false);
+ if (taille == 0) cerr << "ArbreNdNoeud::operator== vide" << endl;
+ if (taille == 1) return (*_tabP_tab_id_ind[0] == *rval._tabP_tab_id_ind[0]);
+
+ unsigned int i,j;
+
+ bool ok;
+
+// bool * tab_dejatrouve;
+// tab_dejatrouve = new bool[taille];
+ // for (i = 0; i < taille; i++) tab_dejatrouve[i] = false;
+
+ for (i=0; i < (taille - 1); i++) {
+ ok = false;
+ for (j=0; ((ok == false) && (j < taille)); j++)
+// if (!tab_dejatrouve[j])
+ ok = (*_tabP_tab_id_ind[i] == *rval._tabP_tab_id_ind[j]);
+// if (ok = (*_tabPPind[i] == *rval._tabPPind[j])) tab_dejatrouve[j] = true;
+//if (ok) cerr << "ArbreNdNoeud::operator== ok " << this << endl;
+
+ if (!ok) return (false);
+ }
+// delete tab_dejatrouve;
+
+ return(true);
+}
+
+}//namespace arbres
+}//namespace biolib
+#endif
+
+
diff --git a/src/arbreplus.cpp b/src/arbreplus.cpp
new file mode 100644
index 0000000..1a78e39
--- /dev/null
+++ b/src/arbreplus.cpp
@@ -0,0 +1,175 @@
+/***************************************************************************
+ arbreplus.cpp - description
+ -------------------
+ begin : Mon Jun 4 2001
+ copyright : (C) 2001 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "arbreplus.h"
+
+namespace biolib {
+namespace arbres {
+
+ArbrePlGroupes::ArbrePlGroupes(const ArbrePlus * Parbre): _Parbre(Parbre) {
+}
+ArbrePlGroupes::~ArbrePlGroupes(){
+// while (size() > 0) delete back();
+}
+
+ArbrePlus::ArbrePlus(): _tabGroupes(this), _couleur_neutre(0,0,0){
+}
+ArbrePlus::~ArbrePlus(){
+}
+
+
+void ArbrePlGroupes::push_back_groupe(const string & nom, const string & couleur) {
+// push_back(new ArbreVectUINT());
+ ArbreVectUINT nouveau;
+
+ push_back(nouveau);
+
+ _tabNom.push_back(nom);
+ _tabCouleur.push_back(Couleur(couleur));
+
+}
+
+int ArbrePlGroupes::RechercheGroupeOTU(unsigned int id) const {
+
+ unsigned int i;
+
+ for (i=0 ; i < size(); i++) {
+ if (operator[](i).Existe(id)) return(i);
+ }
+ return (-1);
+}
+
+
+void ArbrePlus::define_outgroup(const ChaineCar & outgroup){
+ unsigned int nbmots,i;
+ int pos(-1);
+ string mot;
+
+ if (outgroup == "") return;
+ nbmots = outgroup.GetNbMots();
+ _Vind_outgroup.resize(0);
+ for (i = 0; i < nbmots; i++) {
+ outgroup.GetMot(i+1, mot);
+ pos = PositionInd(mot.c_str());
+ if (pos == -1) {
+ cerr << "Erreur TreePlotter::define_outgroup" << endl;
+ cerr << mot << _(" was not found") << endl ;
+ return;
+ }
+//cerr << "TreePlotter::define_outgroup pos" << pos << endl;
+ _Vind_outgroup.push_back(_tabPind[pos]->get_id());
+ }
+
+ //Recherche du noeud contenant une branche avec _Vind_outgroup
+ // => charger les "vecteurs d'individus" de l'arbre
+//cerr << "TreePlotter::define_outgroup" << endl;
+ _Vind_outgroup.f_tri();
+ f_load_vect_id_ind();
+//cerr << RechercheNoeud(_Vind_outgroup) << endl;
+ set_Pracine(RechercheNoeud(_Vind_outgroup));
+//cerr << "TreePlotter::define_outgroup fin"<< endl;
+}
+
+void ArbrePlus::ajouter_groupe(const ChaineCar & groupe, const string & couleur, const string & nom){
+ unsigned int nbmots,i;
+ signed int pos(-1);
+ ChaineCar mot;
+//cerr << "ArbrePlus::ajouter_groupe " << groupe << endl;
+// Couleur bidon("");
+
+// if (lacouleur == "") lacouleur.assign(bidon.get_couleur_diff());
+
+ _tabGroupes.push_back_groupe(nom, couleur);
+//cerr << "TreePlotter::define_outgroup groupes " << groupe << endl;
+
+ if (groupe == "") return;
+ nbmots = groupe.GetNbMots();
+ _tabGroupes.back().resize(0);
+ for (i = 0; i < nbmots; i++) {
+ groupe.GetMot(i+1, mot);
+ pos = (int) mot;
+ if (((mot.EstUnChiffre()) && (pos > 0) && ((unsigned int) pos < _tabPind.size())) || (mot == "0")){
+//cerr << "ArbrePlus::ajouter_groupe [" << mot << endl;
+ if ((mot == "0") && (_tabPind.size() == 1)) _tabGroupes.back().push_back(0);
+ else _tabGroupes.back().push_back(pos);
+ }
+ else {
+ pos = PositionInd(mot.c_str());
+//cerr << "TreePlotter::define_outgroup pos" << pos << endl;
+ if (pos == -1) {
+ cerr << "Erreur" << endl;
+ cerr << mot << _(" was not found") << endl ;
+ }
+ else if ((unsigned int) pos < _tabPind.size()) _tabGroupes.back().push_back(_tabPind[pos]->get_id());
+ }
+ }
+
+ //Recherche du noeud contenant une branche avec _Vind_outgroup
+ // => charger les "vecteurs d'individus" de l'arbre
+//cerr << "TreePlotter::define_outgroup" << endl;
+ _tabGroupes.back().f_tri();
+}
+
+const Couleur & ArbrePlus::get_couleur_otu (unsigned int id) const {
+ int numgroupe(_tabGroupes.RechercheGroupeOTU(id));
+
+ if (numgroupe == -1) return(get_couleur_neutre());
+ else return(_tabGroupes.get_couleur((unsigned int)numgroupe));
+}
+
+void ArbrePlus::iPhylipDefGroupe(const string & ligne) {
+ //définition d'un groupe (lecture de fichier Phylip
+ //#G nom couleur 'groupe'
+ Titre tabArguments;
+cerr << "ArbrePlus::iPhylipDefGroupe(const string & ligne)" << ligne << endl;
+ tabArguments.GetArguments(ligne);
+cerr << tabArguments[1] << endl;
+cerr << tabArguments[2] << endl;
+cerr << tabArguments[3] << endl;
+
+ if (tabArguments.size() == 4) ajouter_groupe(tabArguments[3], tabArguments[2], tabArguments[1]);
+ else if (tabArguments.size() == 3) ajouter_groupe(tabArguments[2], tabArguments[1], "");
+
+}
+
+void ArbrePlus::oPhylipEcritGroupes(ostream & fichier) const {
+ //ecrit les groupes au format phylip traffiqué Olivier:
+ // #G Couleur 'pop1 pop2 ...popn'
+ // dans le fichier
+ unsigned int i,j;
+ if (_tabGroupes.size() == 0) return;
+
+ if (_titre.size() == 0) fichier << "[";
+ else fichier << "\\";
+
+ for (i = 0; i < _tabGroupes.size(); i++) {
+ fichier << "#G '" << _tabGroupes.get_nom(i) << "' '" << _tabGroupes.get_couleur(i).get_nom() << "' '";
+
+ for (j=0; j < _tabGroupes[i].size(); j++) {
+ fichier << _tabGroupes[i][j];
+
+ if (j != (_tabGroupes[i].size()-1)) fichier << " ";
+ }
+ fichier << "'";
+ if (i != (_tabGroupes.size()-1)) fichier << "\\";
+ }
+ if (_titre.size() == 0) fichier << "]" << endl;
+}
+
+} //namespace biolib {
+} //namespace arbres {
+
diff --git a/src/arbreplus.h b/src/arbreplus.h
new file mode 100644
index 0000000..cbc7481
--- /dev/null
+++ b/src/arbreplus.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ arbreplus.h - description
+ -------------------
+ begin : Mon Jun 4 2001
+ copyright : (C) 2001 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef ARBREPLUS_H
+#define ARBREPLUS_H
+
+#include "arbre.h"
+#include "couleur.h"
+
+namespace biolib {
+namespace arbres {
+
+/**Arbre + informations sur les groupes d'OTUs
+ *@author Olivier Langella
+ */
+class ArbrePlus;
+
+class ArbrePlGroupes : public vector<ArbreVectUINT> {
+// ArbreGroupe contient des groupes d'individus valables pour 1 ArbrePlus
+public:
+ ArbrePlGroupes(const ArbrePlus * Parbre);
+ ~ArbrePlGroupes();
+
+ const Couleur & get_couleur(unsigned int i) const {return (_tabCouleur[i]);};
+ const string & get_nom(unsigned int i) const {return (_tabNom[i]);};
+
+ void push_back_groupe(const string & nom, const string & couleur);
+
+ int RechercheGroupeOTU(unsigned int id) const;
+
+protected:
+
+ const ArbrePlus * _Parbre;
+
+ vector<Couleur> _tabCouleur;
+ vector<string> _tabNom;
+// vector<string> _tabReference;
+
+};
+
+class ArbrePlus : public Arbre {
+public:
+ ArbrePlus();
+ ~ArbrePlus();
+
+ const Couleur & get_couleur_neutre () const {return(_couleur_neutre);};
+ const Couleur & get_couleur_otu (unsigned int id) const;
+
+ void define_outgroup(const ChaineCar & outgroup);
+ void ajouter_groupe(const ChaineCar & groupe, const string & couleur, const string & nom="");
+
+protected:
+
+ virtual void iPhylipDefGroupe(const string &); //définition d'un groupe
+ virtual void oPhylipEcritGroupes(ostream &) const;
+
+
+ ArbrePlGroupes _tabGroupes;
+
+ ArbreVectUINT _Vind_outgroup;
+
+ Couleur _couleur_neutre;
+};
+
+} //namespace biolib {
+} //namespace arbres {
+
+
+#endif
diff --git a/src/chaineficpop.cpp b/src/chaineficpop.cpp
new file mode 100644
index 0000000..3ecc09c
--- /dev/null
+++ b/src/chaineficpop.cpp
@@ -0,0 +1,250 @@
+//
+// 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 Library 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.
+
+//created:
+//mer sep 06 14:23:39 CEST 2000 Langella <Olivier.Langella at pge.cnrs-gif.fr>
+
+
+/***************************************************************************
+ chaineficpop.cpp - Objet pour faciliter la lecture de fichiers genepop/populations
+ -------------------
+ begin : ven sep 06 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+#include "chaineficpop.h"
+
+//constructeur
+ChaineFicPop::ChaineFicPop(istream & fichier):ChaineCar(""), _fichier(fichier) {
+ //_fichier(fichier);
+ _fichier.clear();
+ _fichier.seekg(0);
+
+ _numeroligne = 0;
+ _type_fichier = 0;
+ _danspop = false;
+ _findefichier = false;
+ _boolnompop = false;
+}
+
+//destructeur
+ChaineFicPop::~ChaineFicPop() {
+ _fichier.clear();
+}
+
+int ChaineFicPop::get_titre(biolib::vecteurs::Titre & titres) {
+ //lecture des commentaires
+//cerr << " ChaineFicPop::get_titre debut" << endl;
+// assign("");
+ titres.resize(0);
+
+ if (estuntitre()) titres.push_back(*this);
+
+//cerr << " ChaineFicPop::get_titre debut 1" << endl;
+ while ((get_ligne()) && (estuntitre())) {
+ titres.push_back(*this);
+ assign("");
+ };
+
+//cerr << " ChaineFicPop::get_titre debut 2" << endl;
+ if (_fichier.fail()) throw Anomalie(1);
+
+//cerr << " ChaineFicPop::get_titre debut 3" << endl;
+ return (0);
+}
+
+int ChaineFicPop::get_locus(biolib::vecteurs::Titre & locus) {
+ //lecture des locus
+
+ locus.resize(0);
+
+ if ((estunepop()==false) && (*this != "")) ajout_locus(locus);
+
+ while ((get_ligne()) && (estunepop()==false)) {
+ ajout_locus(locus);
+ };
+
+ if (_fichier.fail()) throw Anomalie(1);
+ if (estunepop()==false) throw Anomalie(2);
+
+ return (0);
+
+}
+
+int ChaineFicPop::get_lignepop() {
+ if (_findefichier) return(1);
+ get_ligne();
+ return(0);
+}
+
+int ChaineFicPop::get_nompop(biolib::vecteurs::ChaineCar & nompop) const {
+
+ nompop.assign(_nompop);
+// nompop.Remplacer(" ","_");
+/* if ((GetNbMots()) > 1) GetMot(2, nompop);
+ else nompop.assign("");
+*/
+ return(0);
+}
+
+int ChaineFicPop::get_nomind(biolib::vecteurs::ChaineCar & nomind) const {
+ if (!(_danspop)) return (1);
+ int pos;
+
+ pos = find(",", 0);
+ if (pos != -1) {
+// ChaineCar mot;
+
+ nomind.assign(*this,0, pos);
+ nomind.fsupprgauche();
+ nomind.fsupprdroite();
+// nomind.assign(mot);
+ }
+// nomind.Remplacer(" ","_");
+
+ return(0);
+
+}
+
+int ChaineFicPop::get_alleles(biolib::vecteurs::Titre & alleles) const {
+//cerr << " ChaineFicPop::get_alleles" << endl;
+ if (!(_danspop)) return (1);
+ alleles.resize(0);
+ int pos;
+
+ ChaineCar mots;
+ string mot;
+ long nbmots, i;
+
+ pos = find(",", 0) + 1;
+ if (pos != -1) {
+ mots.assign(*this,pos, size() - pos);
+
+ nbmots = mots.GetNbMots();
+
+ for (i=0; i < nbmots; i++) {
+ mots.GetMot(i+1, mot);
+ if (mot != "") alleles.push_back(mot);
+ }
+ }
+ else return (1);
+
+//cerr << " ChaineFicPop::get_alleles fin 0" << endl;
+ return(0);
+}
+
+long ChaineFicPop::get_numeroligne() const{
+ return(_numeroligne);
+}
+
+bool ChaineFicPop::get_ligne() {
+//cerr << " ChaineFicPop::get_ligne debut" << endl;
+ GetLigneFlot(_fichier);
+ _numeroligne++;
+
+ if (_fichier.eof()) _findefichier = true;
+
+//cerr << " ChaineFicPop::get_ligne fin" << endl;
+ return (_fichier.good());
+}
+
+bool ChaineFicPop::estuntitre() {
+// détecte les signes d'un titre: """, "Title Line:" ...
+ string titre;
+
+ if (size() < 1) return (false);
+//cerr << " ChaineFicPop::estuntitre debut" << endl;
+ if (operator[](0) == '"') {
+// if (operator[](size()-1) == '"') string titre(*this,1, size() -2);
+//cerr << " ChaineFicPop::estuntitre titre " << (size() - 1) << endl;
+ titre.assign(*this,1, size() -1);
+//cerr << " ChaineFicPop::estuntitre titre " << titre << endl;
+ assign(titre);
+ return (true);
+ }
+//cerr << " ChaineFicPop::estuntitre debut 2" << endl;
+ int pos;
+ string mot("Title line: ");
+
+//cerr << " ChaineFicPop::estuntitre debut 3" << endl;
+ pos = find(mot, 0);
+ if (pos != -1) {
+ titre.assign(*this,pos + mot.size(), size() - mot.size() - pos);
+ assign(titre);
+ return (true);
+ }
+
+//cerr << " ChaineFicPop::estuntitre debut 4" << endl;
+ if (_numeroligne == 1) return(true);
+
+ return (false);
+}
+
+bool ChaineFicPop::estunepop() {
+// détecte les signes d'un titre: """, "Title Line:" ...
+// string _chainetemp;
+ int pos;
+
+ GetMot(1, _chainetemp);
+ if ((_chainetemp == "POP")||(_chainetemp == "pop")||(_chainetemp == "Pop")) {
+ pos = find(",", 0);
+ if (pos > 0) return (false);
+
+ _danspop = true;
+ if (size() > 4) {
+ _nompop = substr(4, (size() - 4));
+ _boolnompop = true; //les noms de pop sont derrière le mot clé pop
+ }
+ else _nompop.assign("");
+
+ return (true);
+ }
+ return (false);
+
+}
+
+bool ChaineFicPop::estunindividu() const {
+// détecte les signes d'un titre: """, "Title Line:" ...
+ if (!(_danspop)) return (false);
+
+// string mot;
+
+ if (GetNbMots(",") == 2) return (true);
+ else return (false);
+/* GetMot(1, mot);
+ if (mot[mot.size()-1] == ',') return (true);
+ else {
+ GetMot(2, mot);
+ if (mot == ",") return true;
+ }
+ return (false); */
+}
+
+void ChaineFicPop::ajout_locus(biolib::vecteurs::Titre & locus) const {
+ long nbmots, i;
+ string mot;
+
+ nbmots = GetNbMots();
+
+ for (i=0; i < nbmots; i++) {
+ GetMot(i+1, mot);
+ if (mot != "") locus.push_back(mot);
+ }
+
+}
+
+bool ChaineFicPop::findefichier() const {
+ return (_findefichier);
+}
+
+bool ChaineFicPop::get_boolnompop() const {
+ return (_boolnompop);
+}
diff --git a/src/chaineficpop.h b/src/chaineficpop.h
new file mode 100644
index 0000000..7d4abc6
--- /dev/null
+++ b/src/chaineficpop.h
@@ -0,0 +1,86 @@
+// 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 Library 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.
+
+//created:
+//mer sep 06 14:23:39 CEST 2000 Langella <Olivier.Langella at pge.cnrs-gif.fr>
+
+
+/***************************************************************************
+ chaineficpop.h - Objet pour faciliter la lecture de fichiers genepop/populations
+ -------------------
+ begin : ven sep 06 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+#ifndef CHAINEFICPOP_H
+#define CHAINEFICPOP_H
+
+#include"vecteurs.h"
+
+//typedef biolib::vecteurs::ChaineCar ChaineCar;
+
+class ChaineFicPop: public biolib::vecteurs::ChaineCar {
+public:
+ ChaineFicPop(istream & fichier);
+ ~ChaineFicPop();
+
+ int get_titre(biolib::vecteurs::Titre & titres);
+ int get_locus(biolib::vecteurs::Titre & locus);
+
+ int get_lignepop();
+ int get_nompop(biolib::vecteurs::ChaineCar & nompop) const;
+ int get_nomind(biolib::vecteurs::ChaineCar & nomind) const;
+ int get_alleles(biolib::vecteurs::Titre & alleles) const;
+
+ long get_numeroligne() const;
+
+ bool estunepop();
+ bool estunindividu() const;
+ bool findefichier() const;
+ bool get_boolnompop() const;
+
+protected:
+ void ajout_locus(biolib::vecteurs::Titre & locus) const;
+
+ bool get_ligne();
+ bool estuntitre();
+
+ int _type_fichier; //1-> genepop 2-> populations 0-> indéterminé -1 -> non reconnu
+ long _numeroligne;
+ bool _danspop;
+ bool _findefichier;
+ bool _boolnompop;
+
+ istream & _fichier;
+
+ string _chainetemp;
+ string _nompop;
+public:
+ struct Anomalie {
+ // 1-> fin de fichier précoce
+ // 2-> Le début de pop n'est pas indiqu
+ // 3-> fichier XML
+
+ int le_pb;
+ Anomalie(int i) :
+ le_pb(i) {
+ }
+ ;
+ };
+
+};
+
+#endif
+
diff --git a/src/config.h b/src/config.h
new file mode 100644
index 0000000..29523ad
--- /dev/null
+++ b/src/config.h
@@ -0,0 +1,8 @@
+#ifndef _CONFIG_H
+#define _CONFIG_H
+
+#define POPULATIONS_VERSION "1.2.32"
+
+#include <QDebug>
+
+#endif /* _CONFIG_H */
diff --git a/src/config.h.cmake b/src/config.h.cmake
new file mode 100644
index 0000000..5f3d28a
--- /dev/null
+++ b/src/config.h.cmake
@@ -0,0 +1,8 @@
+#ifndef _CONFIG_H
+#define _CONFIG_H
+
+#define POPULATIONS_VERSION "@POPULATIONS_VERSION@"
+
+#include <QDebug>
+
+#endif /* _CONFIG_H */
diff --git a/src/couleur.cpp b/src/couleur.cpp
new file mode 100644
index 0000000..3120362
--- /dev/null
+++ b/src/couleur.cpp
@@ -0,0 +1,117 @@
+/***************************************************************************
+ couleur.cpp - description
+ -------------------
+ begin : Mon Jun 4 2001
+ copyright : (C) 2001 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "couleur.h"
+
+vector<string> Couleur::_tab_couleurs;
+unsigned int Couleur::_pos_tab_couleurs(0);
+
+Couleur::Couleur(unsigned long rouge, unsigned long vert, unsigned long bleu) {
+ _boolrgb = true;
+ _boolnom = false;
+
+ _rouge = rouge;
+ _vert= vert;
+ _bleu = bleu;
+}
+
+Couleur::Couleur(const biolib::vecteurs::ChaineCar & couleur){
+ //couleur peut contenir 3 chiffres (rgb) ou un nom de couleur en Anglais
+ biolib::vecteurs::ChaineCar mot, lacouleur(couleur);
+
+ _boolrgb = false;
+ _boolnom = false;
+
+ if (lacouleur == "") lacouleur.assign(get_couleur_diff());
+
+ if (lacouleur.GetNbMots() == 3) {
+ _boolrgb = true;
+ lacouleur.GetMot(1, mot);
+ if (mot.EstUnChiffre()) {
+ _rouge = (int) mot;
+ _rouge *= 256;
+ }
+ else _boolrgb = false;
+ lacouleur.GetMot(2, mot);
+ if ((_boolrgb) && (mot.EstUnChiffre())) {
+ _vert = (int) mot;
+ _vert *= 256;
+ }
+ else _boolrgb = false;
+ lacouleur.GetMot(3, mot);
+ if ((_boolrgb) && (mot.EstUnChiffre())) {
+ _bleu = (int) mot;
+ _bleu *= 256;
+ }
+ else _boolrgb = false;
+
+ }
+ if (_boolrgb == false) {//nom de couleur en Anglais
+ _boolnom = true;
+ _nom.assign(lacouleur);
+ }
+
+}
+
+Couleur::~Couleur(){
+}
+
+bool Couleur::operator== (const Couleur &rval) const {
+ if ((_boolrgb) && (rval._boolrgb) && (_rouge == rval._rouge) && (_vert == rval._vert) && (_bleu == rval._bleu)) return true;
+
+ if ((_boolnom) && (rval._boolnom) && (_nom == rval._nom)) return true;
+
+ return false;
+}
+
+const string & Couleur::get_couleur_diff() {
+ unsigned int i;
+
+ if ( Couleur::_tab_couleurs.size() == 0 ) Couleur::f_rempli_tab_couleurs();
+ i = Couleur::_pos_tab_couleurs;
+ Couleur::_pos_tab_couleurs++;
+ if (Couleur::_pos_tab_couleurs == Couleur::_tab_couleurs.size()) Couleur::_pos_tab_couleurs = 0;
+
+ return (Couleur::_tab_couleurs[i]);
+}
+
+
+void Couleur::f_rempli_tab_couleurs() {
+
+ _tab_couleurs.push_back("red");
+ _tab_couleurs.push_back("green");
+ _tab_couleurs.push_back("blue");
+ _tab_couleurs.push_back("turquoise");
+ _tab_couleurs.push_back("pink");
+ _tab_couleurs.push_back("yellow");
+ _tab_couleurs.push_back("brown");
+ _tab_couleurs.push_back("purple");
+ _tab_couleurs.push_back("sea green");
+ _tab_couleurs.push_back("salmon");
+ _tab_couleurs.push_back("sky blue");
+ _tab_couleurs.push_back("yellow green");
+ _tab_couleurs.push_back("brown1");
+ _tab_couleurs.push_back("aquamarine");
+ _tab_couleurs.push_back("orange");
+ _tab_couleurs.push_back("brown2");
+ _tab_couleurs.push_back("navy blue");
+ _tab_couleurs.push_back("goldenrod");
+ _tab_couleurs.push_back("tomato");
+ _tab_couleurs.push_back("violet");
+ _tab_couleurs.push_back("gold");
+
+}
diff --git a/src/couleur.h b/src/couleur.h
new file mode 100644
index 0000000..ac5560a
--- /dev/null
+++ b/src/couleur.h
@@ -0,0 +1,96 @@
+/***************************************************************************
+ couleur.h - description
+ -------------------
+ begin : Mon Jun 4 2001
+ copyright : (C) 2001 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef COULEUR_H
+#define COULEUR_H
+
+
+/**stockage de couleur (RGB ou nom en Anglais)
+ *@author Olivier Langella
+ */
+#include "vecteurs.h"
+
+//typedef biolib::vecteurs::ChaineCar ChaineCar;
+
+class Couleur {
+public:
+
+ static const string & get_couleur_diff();
+
+ Couleur(const biolib::vecteurs::ChaineCar & couleur);
+ Couleur(unsigned long rouge, unsigned long vert, unsigned long bleu);
+ ~Couleur();
+
+// void set_rgb(unsigned long rouge, unsigned long vert, unsigned long bleu);
+
+ bool EstNom() const {return(_boolnom);};
+ bool EstRGB() const {return(_boolrgb);};
+
+ void set_nom(const char * nom) {_boolrgb = false; _boolnom = true; _nom.assign(nom);};
+ const string & get_nom() const {return(_nom);};
+ unsigned long get_rouge() const {return(_rouge);};
+ unsigned long get_vert() const {return(_vert);};
+ unsigned long get_bleu() const {return(_bleu);};
+
+
+ bool operator== (const Couleur &rval) const;
+
+protected:
+
+ static void f_rempli_tab_couleurs();
+
+ static vector<string> _tab_couleurs;
+ static unsigned int _pos_tab_couleurs;
+
+ bool _boolrgb;
+ bool _boolnom;
+
+ string _nom;
+
+ unsigned long _rouge;
+ unsigned long _vert;
+ unsigned long _bleu;
+
+
+};
+
+//unsigned int Couleur::_pos_tab_couleurs = 0;
+/*
+inline const string & Couleur::get_couleur_diff() {
+ unsigned int i;
+
+ if ( Couleur::_tab_couleurs.size() == 0 ) Couleur::f_rempli_tab_couleurs();
+ i = Couleur::_pos_tab_couleurs;
+ Couleur::_pos_tab_couleurs++;
+ if (Couleur::_pos_tab_couleurs == Couleur::_tab_couleurs.size()) Couleur::_pos_tab_couleurs = 0;
+
+ return (Couleur::_tab_couleurs[i]);
+}
+*/
+/*
+inline void Couleur::f_rempli_tab_couleurs() {
+ _pos_tab_couleurs = 0;
+
+ _tab_couleurs.push_back("red");
+ _tab_couleurs.push_back("green");
+ _tab_couleurs.push_back("blue");
+
+}
+*/
+#endif
+
+
diff --git a/src/distgnt.cpp b/src/distgnt.cpp
new file mode 100644
index 0000000..f1d7e98
--- /dev/null
+++ b/src/distgnt.cpp
@@ -0,0 +1,2286 @@
+
+/***************************************************************************
+ distgnt.cpp - Librairie d'objets permettant de manipuler
+ des distances entre populations
+ -------------------
+ begin : ven sep 01 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#include "distgnt.h"
+#include "arbreplus.h"
+
+
+vector<string> DistancesGnt::_tab_noms_methodes;
+
+DistancesGnt::DistancesGnt(int methode, bool square_distance, Jeupop * Pjeupop, unsigned int niveau) {
+//cerr << "DistancesGnt::DistancesGnt debut" << endl;
+ unsigned long j;
+
+ _methode = methode;
+ _Pjeupop = Pjeupop;
+
+ if ((niveau == 100) & (Pjeupop->_VcalcStrucPop.size() >0)) {
+ //stuct pop level is already defined
+ }
+ else {Pjeupop->f_rempliVcalcStrucPop(niveau);
+ }
+
+ _tabPstrucpop = Pjeupop->_VcalcStrucPop;
+
+ _tabPloc = Pjeupop->_tabPloc;
+ _nbpop = Pjeupop->get_nbstrucpopVcalc();
+ _PtabFreq = 0;
+ _PtabMu = 0;
+ _tabEviteLocus = 0;
+ _squareDistance = square_distance;
+ _pi = ((long double) acos((double)-1));
+// _tabNbAll = 0;
+
+ _nbloc = Pjeupop->get_nbloc();
+ _tabNbAll = new unsigned long [_nbloc];
+
+ _bootind = false;
+
+ for (j=0; j < _nbloc; j++) {
+ _tabNbAll[j] = _tabPloc[j]->get_nball();
+ }
+//cerr << "DistancesGnt::DistancesGnt fin" << endl;
+}
+
+DistancesGnt::~DistancesGnt() {
+ if (_tabNbAll != 0) delete[] _tabNbAll;
+ if (_PtabFreq != 0) {
+ delete[] _PtabFreq[0];
+ delete[] _PtabFreq;
+ }
+ if (_PtabMu != 0) {
+ delete[] _PtabMu;
+ }
+ if (_tabEviteLocus != 0) delete[] _tabEviteLocus;
+
+// _nbloc = Pjeupop->get_nbloc();
+}
+
+long double DistancesGnt::r_allsimilnul(Individu * pind1, Individu * pind2) const{
+ //Calcul de la similarit� entre deux individus
+ //valable pour nploides
+ Vecteur<Allele*> tabPall1;//, tabPallNuls;
+ long pos;//, nballnuls(0);
+ unsigned long allele, taille, nb_all_communs(0);
+ unsigned long j, i;
+ unsigned long nploidie(_Pjeupop->get_nploidie());
+ unsigned long nb_all_comparables(0);
+ unsigned long nblocus(_VcalcLocus.size());
+
+ taille = nblocus * nploidie;
+
+ for (j = 0 ; j < nblocus; j++) {
+ i = pind1->get_nballnuls(_VcalcLocus[j]);
+ if (pind2->get_nballnuls(_VcalcLocus[j]) > i) i = pind2->get_nballnuls(_VcalcLocus[j]);
+ nb_all_comparables += nploidie - i;
+ }
+ if (nb_all_comparables == 0) {
+ throw Jeupop::Anomalie(6);
+ return (0);
+ }
+
+//cerr << nb_all_comparables << " ";
+
+ for (j = 0 ; j < nblocus; j++) {
+ for (i = 0; i < nploidie; i++) {
+ allele = (_VcalcLocus[j] * nploidie) + i;
+ if (pind1->_tabPall[allele]->_miss) {}
+ else tabPall1.push_back(pind1->_tabPall[allele]);
+ }
+ }
+
+//cerr << pind1->get_nom() << " " << pind2->get_nom() << endl;
+ for (j = 0 ; j < nblocus; j++) {
+ for (i = 0; i < nploidie; i++) {
+ allele = (_VcalcLocus[j] * nploidie) + i;
+ if (pind2->_tabPall[allele]->_miss) {}
+ else {
+ pos = tabPall1.Position(pind2->_tabPall[allele]);
+ if (pos != -1) {
+// cerr << pind2->_tabPall[allele]->get_Nom() << " " << tabPall1[pos]->get_Nom() << endl;
+
+ nb_all_communs++;
+ tabPall1.Suppr(pos);
+ }
+ }
+ }
+ }
+//cerr << nb_all_communs << " " << nb_all_comparables << endl;
+ return ((long double) nb_all_communs / (long double) nb_all_comparables);
+}
+
+long double DistancesGnt::r_dist2ind(unsigned long nbind1, unsigned long nbind2) const {
+ //renvoi de la distance
+ long double resultat(0);
+// int Smoy(get_nbloc()), nball;
+// int nbloc(get_nbloc());
+// long i;
+
+ switch (_methode) {
+ case 5:
+ //methode simple correct: moyenne de ressemblance
+ //sur population nploide
+ // 0 allele en commun => 1
+ // 1 allele en commun => 0.5
+ // 2 alleles en commun => 0
+ // ne fait pas de calcul sur les all�les 00 && 00
+ // applique 0.5 pour 0001 avec 0101 ou 0103
+ // et 0 pour 0001 avec 0302
+// ATTENTION pour les donn�es manquantes: la similitude est maximisee
+ resultat = (double) 1 - (double) r_allsimilnul(_tabPind[nbind1], _tabPind[nbind2]);
+//cerr << r_allsimilnul(pind1, pind2) << endl;
+ break;
+ default:
+ resultat = r_dist2pop(nbind1, nbind2);
+ break;
+ }
+
+ return resultat;
+}
+
+long double DistancesGnt::r_distDasPsAi(unsigned long nbind1, unsigned long nbind2) const {
+ return (r_distDasPsAi(_tabPind[nbind1], _tabPind[nbind2]));
+}
+
+long double DistancesGnt::r_distDasPsAi(const Individu * Pind1, const Individu * Pind2) const {
+ //Calcul de la similarit� entre deux individus (Das)
+ //valable pour nploides
+ Vecteur<Allele*> tabPall1;//, tabPallNuls;
+ long pos;//, nballnuls(0);
+ unsigned long allele, taille, nb_all_communs(0);
+ unsigned long j, i;
+ unsigned long nploidie(_Pjeupop->get_nploidie());
+ unsigned long nb_all_comparables(0);
+ unsigned long nblocus(_VcalcLocus.size());
+
+ taille = nblocus * nploidie;
+
+ for (j = 0 ; j < nblocus; j++) {
+ i = Pind1->get_nballnuls(_VcalcLocus[j]);
+ if (Pind2->get_nballnuls(_VcalcLocus[j]) > i) i = Pind2->get_nballnuls(_VcalcLocus[j]);
+ nb_all_comparables += nploidie - i;
+ }
+ if (nb_all_comparables == 0) {
+ throw Jeupop::Anomalie(6);
+ return (0);
+ }
+
+//cerr << nb_all_comparables << " ";
+
+ for (j = 0 ; j < nblocus; j++) {
+ for (i = 0; i < nploidie; i++) {
+ allele = (_VcalcLocus[j] * nploidie) + i;
+ if (Pind1->_tabPall[allele]->_miss) {}
+ else tabPall1.push_back(Pind1->_tabPall[allele]);
+ }
+ }
+
+//cerr << pind1->get_nom() << " " << pind2->get_nom() << endl;
+ for (j = 0 ; j < nblocus; j++) {
+ for (i = 0; i < nploidie; i++) {
+ allele = (_VcalcLocus[j] * nploidie) + i;
+ if (Pind2->_tabPall[allele]->_miss) {}
+ else {
+ pos = tabPall1.Position(Pind2->_tabPall[allele]);
+ if (pos != -1) {
+// cerr << pind2->_tabPall[allele]->get_Nom() << " " << tabPall1[pos]->get_Nom() << endl;
+
+ nb_all_communs++;
+ tabPall1.Suppr(pos);
+ }
+ }
+ }
+ }
+//cerr << nb_all_communs << " " << nb_all_comparables << endl;
+ return ((long double) nb_all_communs / (long double) nb_all_comparables);
+}
+
+
+long double DistancesGnt::r_dist2ind(Individu* Pind1, Individu* Pind2) const {
+ //renvoi de la distance
+ long double resultat(0);
+
+ switch (_methode) {
+ case 5:
+ //methode simple correct: moyenne de ressemblance
+ //sur population nploide
+ // 0 allele en commun => 1
+ // 1 allele en commun => 0.5
+ // 2 alleles en commun => 0
+ // ne fait pas de calcul sur les all�les 00 && 00
+ // applique 0.5 pour 0001 avec 0101 ou 0103
+ // et 0 pour 0001 avec 0302
+// ATTENTION pour les donn�es manquantes: la similitude est maximisee
+ resultat = (double) 1 - (double) r_allsimilnul(Pind1,Pind2);
+//cerr << r_allsimilnul(pind1, pind2) << endl;
+ break;
+ }
+
+ return resultat;
+}
+
+void DistancesGnt::newTabFreq() {
+ //calcul et stockage des frequences alleliques
+ // tabPfreq contient les adresses de tableaux de frequences
+ // tabNbAll contient le nombre d'alleles a chaque locus
+ // _tabEviteLocus contient les locus � �viter (qui ne contiennent que des all�les nuls)
+
+ unsigned long i, j;
+ unsigned long indice(0);
+
+//cerr << "coucou newTabFreq" <<endl ;
+ if (_PtabFreq != 0) {
+ delete[] _PtabFreq[0];
+ delete[] _PtabFreq;
+ _PtabFreq = 0;
+ }
+ if (_tabEviteLocus != 0) {
+ delete[] _tabEviteLocus;
+ _tabEviteLocus = 0;
+ }
+
+ _PtabFreq = new long double * [_nbloc * _nbpop];
+ _tabEviteLocus = new bool [_nbloc * _nbpop];
+
+ for (j=0; j < _nbloc; j++) {
+ indice += _tabNbAll[j];
+ }
+
+ long double* adresse;
+ adresse = new long double[_nbloc * _nbpop * indice];
+
+ indice = 0;
+ for (i=0; i < _nbpop; i++) {
+ for (j=0; j < _nbloc; j++) {
+ _tabEviteLocus[indice] = false;
+
+ _PtabFreq[indice] = adresse;
+ adresse += _tabNbAll[j];
+ indice++;
+ }
+ }
+}
+
+void DistancesGnt::newTabFreqTot() {
+ //fr�quence des all�les � chaque locus sur toutes les pops
+ //�a ne sert pas pour l'instant (26/02/2002)
+ unsigned long i;
+ unsigned long nballtot(0);
+
+ newTabFreq();
+
+ for (i=0; i < _nbloc; i++) {
+ nballtot += _tabNbAll[i];
+ }
+
+ if (_PtabFreqTot != 0) {
+ delete[] _PtabFreqTot;
+ _PtabFreqTot = 0;
+ }
+ /*
+ if (_tabEviteLocus != 0) {
+ delete[] _tabEviteLocus;
+ _tabEviteLocus = 0;
+ }
+ */
+ _PtabFreqTot = new long double [nballtot];
+ //_tabEviteLocus = new (bool [_nbloc * _nbpop]);
+ //for (i=0; i < (_nbloc * _nbpop); i++) _tabEviteLocus[i] = false;
+}
+
+void DistancesGnt::newTabMu() {
+ unsigned long i;
+
+ if (_PtabMu != 0) {
+ delete[] _PtabMu;
+ _PtabMu = 0;
+ }
+ if (_tabEviteLocus != 0) {
+ delete[] _tabEviteLocus;
+ _tabEviteLocus = 0;
+ }
+
+ _PtabMu = new long double [_nbloc * _nbpop];
+ _tabEviteLocus = new bool [_nbloc * _nbpop];
+ for (i=0; i < (_nbloc * _nbpop); i++) _tabEviteLocus[i] = false;
+}
+
+void DistancesGnt::newTabMuInd() {
+ unsigned long i;
+
+ if (_PtabMu != 0) {
+ delete[] _PtabMu;
+ _PtabMu = 0;
+ }
+ if (_tabEviteLocus != 0) {
+ delete[] _tabEviteLocus;
+ _tabEviteLocus = 0;
+ }
+
+ _PtabMu = new long double [_nbloc * _tabPind.size()];
+ _tabEviteLocus = new bool [_nbloc * _tabPind.size()];
+ for (i=0; i < (_nbloc * _tabPind.size()); i++) _tabEviteLocus[i] = false;
+}
+
+void DistancesGnt::newTabFreqInd() {
+ //calcul et stockage des frequences alleliques
+ //pour chaque individus
+ // tabPfreq contient les adresses de tableaux de frequences
+ // tabNbAll contient le nombre d'alleles a chaque locus
+ // _tabEviteLocus contient les locus � �viter (qui ne contiennent que des all�les nuls)
+
+ unsigned long nbind(_tabPind.size());
+ unsigned long i, j, indice(0);
+
+ if (_PtabFreq != 0) {
+ delete[] _PtabFreq[0];
+ delete[] _PtabFreq;
+ _PtabFreq = 0;
+ }
+ if (_tabEviteLocus != 0) {
+ delete[] _tabEviteLocus;
+ _tabEviteLocus = 0;
+ }
+
+//cerr << "coucou newTabFreq" <<endl ;
+ _PtabFreq = new long double * [_nbloc * nbind];
+ _tabEviteLocus = new bool [_nbloc * nbind];
+
+ for (j=0; j < _nbloc; j++) {
+ indice += _tabNbAll[j];
+ }
+
+ long double * adresse;
+ adresse = new long double[_nbloc * nbind * indice];
+
+ indice = 0;
+ for (i=0; i < nbind; i++) {
+ for (j=0; j < _nbloc; j++) {
+ _tabEviteLocus[indice] = false;
+
+ _PtabFreq[indice] = adresse;
+ adresse += _tabNbAll[j];
+ indice++;
+ }
+ }
+}
+
+void DistancesGnt::f_bootstrapLocus(Arbre &arbreRef, int methodeArbre, unsigned int nbrepet, Vecteur<unsigned int> * PVcalcLocusRef, bool sur_ind) {
+ // Boostrap sur les locus
+ // ********creer des exceptions pour v�rifier l'arbreRef *********
+ unsigned long i, j;
+ unsigned int tirage;
+ MatriceLD distancesRef;
+ unsigned long nbLocus(PVcalcLocusRef->size());
+ Arbre bootArbre;
+ MatriceLD distancesBoot;
+ unsigned long taillemat;
+
+// calcul de l'arbre de r�f�rence arbreRef
+// arbreRef => arbre vide !!!
+//ofstream sortie_test;
+//sortie_test.open("test_boot", ios::out);
+
+
+cerr << "distances ref:";
+ if (sur_ind) f_distgntInd(distancesRef, PVcalcLocusRef);
+ else f_distgntpop(distancesRef, PVcalcLocusRef);
+cerr << "+"<< endl;
+
+cerr << "arbre ref:";
+ arbreRef.f_forceiDistances(distancesRef,methodeArbre);
+// arbreRef.iDistances(distancesRef,methodeArbre);
+cerr << "+"<< endl;
+ //_tabPOtu de arbre est cree avec les titres des lignes
+ // de la matrice, dans le meme ordre
+//cerr << "sortie du fichier" << endl;
+//sortie_test << arbreRef << endl;
+
+
+ srand ((unsigned) time( NULL ) );
+
+ taillemat = distancesRef.GetNC();
+ distancesBoot.resize(taillemat, taillemat);
+ distancesBoot.SetType(2);
+ distancesBoot.SetFlag(1);
+ for (j = 0; j < taillemat; j++) {
+ distancesBoot._tcol[j] = distancesBoot._tlig[j] = distancesRef._tcol[j];
+ }
+//cerr << distancesBoot._tcol[1] << endl;
+//cerr << distancesRef._tcol[1] << endl;
+
+// arbreRef.fRempliTabNumOtusNoeuds();
+// arbreRef.f_load_vectind();
+ arbreRef.f_load_vect_id_ind();
+
+ for (i = 0; i < nbrepet; i ++ ) { //boucle du bootstrap
+
+cerr <<endl; // tirage des locus
+ for (j = 0; j < nbLocus; j ++ ) {
+ tirage = (unsigned int) (nbLocus * ((long double)rand() / ((long double) RAND_MAX)));
+ _VcalcLocus[j] = PVcalcLocusRef->operator[](tirage);
+ }
+
+cerr <<endl;
+cerr << "tirage: " << i+1 << " sur: " << nbrepet << endl;
+cerr << "distances:";
+ // calcul de distances
+ if (sur_ind) f_distgntIndVcalc(distancesBoot._tab);
+ else f_distgntpopVcalc(distancesBoot._tab);
+
+cerr << "+"<< endl;
+cerr << "arbre:";
+
+ // construction de l'arbre � examiner
+ bootArbre.f_forceiDistances(distancesBoot,100 + methodeArbre);
+// bootArbre.iDistances(distancesBoot,100 + methodeArbre);
+cerr << "+"<< endl;
+cerr << "ajboot:";
+
+//cout << endl << bootArbre << endl;
+//cerr << "sortie du fichier" << endl;
+//sortie_test << bootArbre << endl;
+
+
+ // comparaison avec l'arbre de r�f�rence
+ arbreRef.AjBootstrap(bootArbre);
+cerr << "+"<< endl;
+//cerr << "sortie du fichier" << endl;
+//sortie_test << arbreRef << endl;
+
+ }// fin de boucle du bootstrap
+//sortie_test.close();
+
+ arbreRef.fCalcValBootstrap();
+}
+
+void DistancesGnt::f_bootstrapIndividus(Arbre &arbreRef, int methodeArbre, unsigned int nbrepet, Vecteur<unsigned int> * PVcalcLocusRef) {
+ // Boostrap sur les individus
+ // ********creer des exceptions pour v�rifier l'arbreRef *********
+ unsigned long i, j;
+ MatriceLD distancesRef;
+ Arbre bootArbre;
+ MatriceLD distancesBoot;
+
+// calcul de l'arbre de r�f�rence arbreRef
+// arbreRef => arbre vide !!!
+ _bootind = false;
+
+cerr << "distances ref:";
+ f_distgntpop(distancesRef, PVcalcLocusRef);
+cerr << "+"<< endl;
+
+cerr << "arbre ref:";
+ arbreRef.f_forceiDistances(distancesRef,methodeArbre);
+// bootArbre.iDistances(distancesRef,methodeArbre);
+cerr << "+"<< endl;
+ //_tabPOtu de arbre est cree avec les titres des lignes
+ // de la matrice, dans le meme ordre
+
+
+ srand ((unsigned) time( NULL ) );
+ _bootind = true;
+
+ distancesBoot.resize(_nbpop, _nbpop);
+ distancesBoot.SetType(2);
+ distancesBoot.SetFlag(1);
+ for (j = 0; j < _nbpop; j++) {
+ distancesBoot._tcol[j] = distancesBoot._tlig[j] = _tabPstrucpop[j]->get_nom();
+ }
+//cerr << distancesBoot._tcol[1] << endl;
+//cerr << distancesRef._tcol[1] << endl;
+
+// arbreRef.fRempliTabNumOtusNoeuds();
+//cerr << "DistancesGnt::f_bootstrapIndividus top1" <<endl;
+// arbreRef.f_load_vectind();
+ arbreRef.f_load_vect_id_ind();
+//cerr << "DistancesGnt::f_bootstrapIndividus top2" <<endl;
+
+ for (i = 0; i < nbrepet; i ++ ) { //boucle du bootstrap
+
+cerr <<endl;
+
+cerr <<endl;
+cerr << "tirage: " << i+1 << " sur: " << nbrepet << endl;
+cerr << "distances:";
+ // calcul de distances
+ f_distgntpopVcalc(distancesBoot._tab);
+
+cerr << "+"<< endl;
+cerr << "arbre:";
+
+ // construction de l'arbre � examiner
+ bootArbre.f_forceiDistances(distancesBoot,100 + methodeArbre);
+// bootArbre.iDistances(distancesBoot,100 + methodeArbre);
+cerr << "+"<< endl;
+cerr << "ajboot: ";
+
+//cout << endl << bootArbre << endl;
+
+ // comparaison avec l'arbre de r�f�rence
+ arbreRef.AjBootstrap(bootArbre);
+cerr << "+"<< endl;
+
+ }// fin de boucle du bootstrap
+
+ arbreRef.fCalcValBootstrap();
+}
+
+void DistancesGnt::f_distgntpop (MatriceLD &resultat, Vecteur<unsigned int> *PVcalcLocus) {
+ //distances G�n�tiques entre Populations
+ unsigned long i;
+// pr�paration de _VcalcLoc:
+ _VcalcLocus = *PVcalcLocus;
+
+ biolib::vecteurs::ChaineCar mot;
+
+ resultat.resize(_nbpop, _nbpop);
+ resultat._titre.push_back(_("Genetic distances on "));
+ mot.AjEntier(_nbpop);
+
+ resultat._titre[resultat._titre.size() - 1] += mot;
+ resultat._titre[resultat._titre.size() - 1] += " populations";
+
+ resultat._titre.push_back(get_nom_methode(_methode));
+ if (_squareDistance) resultat._titre[resultat._titre.size() - 1] += _(" (squared distances)");
+
+ switch (_methode) {
+ case 5:
+ break;
+ case 101:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 102:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 103:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 104:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 106:
+ // stockage des Mu
+ newTabMu();
+ f_calcTabMu();
+ break;
+ case 107:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 108:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 109:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 110:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 111:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 112:
+ // stockage des Mu
+ newTabMu();
+ f_calcTabMu();
+ break;
+ case 113:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 114:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ case 115:
+ // stockage des fr�quences
+ newTabFreq();
+ f_calcTabFreq();
+ break;
+ default:
+ break;
+ }
+ resultat.SetType(2);
+ resultat.SetFlag(1); //titres sur les lignes
+
+ for (i = 0; i < _nbpop; i++) {
+ resultat._tcol[i] = resultat._tlig[i] = _tabPstrucpop[i]->get_nom();
+ }
+
+ f_distgntpopVcalc (resultat._tab);
+// try {
+// f_distgntpopVcalc (resultat._tab);
+// }
+// catch (Anomalie lepb) {
+// cerr << endl << lepb.fmessage(lepb.le_pb) << endl;
+// }
+}
+
+void DistancesGnt::f_distgntInd (MatriceLD &resultat, Vecteur<unsigned int> *PVcalcLocus) {
+// _VcalcLocus.resize(PVcalcLocus->size());
+ _VcalcLocus = *PVcalcLocus;
+
+//cerr << "f_distgntIndVcalc deb" << endl;
+
+ unsigned long i, k, nbind; //(_Pjeupop->get_nbind());
+ unsigned long j;
+ biolib::vecteurs::ChaineCar mot;
+ //vector<Individu*> tabPind;
+ nbind = get_nbind();
+
+ _tabPind.resize(nbind);
+
+ resultat.resize(nbind, nbind);
+ resultat._titre.push_back(_("Genetic distances on "));
+ resultat._titre[resultat._titre.size() - 1].AjEntier(nbind); // += mot;
+ resultat._titre[resultat._titre.size() - 1] += _(" individuals");
+
+ resultat._titre.push_back(get_nom_methode(_methode));
+ if (_squareDistance) resultat._titre[resultat._titre.size() - 1] += _(" (squared distances)");
+
+ resultat.SetType(2);
+ resultat.SetFlag(1); //titres sur les lignes
+
+ k=0;
+ for (i = 0; i < _nbpop; i++) {
+ for (j = 0; j < _tabPstrucpop[i]->get_nbind(); j++) {
+ mot.assign(_tabPstrucpop[i]->_tabPind[j]->_nom);
+// mot.AjEntier(i+1);
+// mot += '_';
+// mot += _tabPstrucpop[i]->_tabPind[j]->_nom;
+ resultat._tlig[k] = mot;
+ resultat._tcol[k] = mot;
+ _tabPind[k] = _tabPstrucpop[i]->_tabPind[j];
+ k++;
+ }
+ }
+
+ resultat._titre.push_back(get_nom_methode(_methode));
+ switch (_methode) {
+ case 5:
+ break;
+ case 101:
+ // stockage des fr�quences
+ newTabFreqInd();
+ f_calcTabFreqInd();
+ break;
+ case 102:
+ // stockage des fr�quences
+ newTabFreqInd();
+ f_calcTabFreqInd();
+ break;
+ case 103:
+ // stockage des fr�quences
+ newTabFreqInd();
+ f_calcTabFreqInd();
+ break;
+ case 104:
+ // stockage des fr�quences
+ newTabFreqInd();
+ f_calcTabFreqInd();
+ break;
+ case 106:
+ // stockage des Mu
+ newTabMuInd();
+ f_calcTabMuInd();
+ break;
+ case 107:
+ // stockage des fr�quences
+ newTabFreqInd();
+ f_calcTabFreqInd();
+ break;
+ case 108:
+ // stockage des fr�quences
+ newTabFreqInd();
+ f_calcTabFreqInd();
+ break;
+ case 109:
+ // stockage des fr�quences
+ newTabFreqInd();
+ f_calcTabFreqInd();
+ break;
+ case 110:
+ // stockage des fr�quences
+ newTabFreqInd();
+ f_calcTabFreqInd();
+ break;
+ case 111:
+ // stockage des fr�quences
+ newTabFreqInd();
+ f_calcTabFreqInd();
+ break;
+ case 112:
+ // stockage des Mu
+ newTabMuInd();
+ f_calcTabMuInd();
+ break;
+ case 113:
+ throw Anomalie(4, get_nom_methode(13));
+ break;
+ case 114:
+ throw Anomalie(4, get_nom_methode(14));
+ break;
+ case 115:
+ throw Anomalie(4, get_nom_methode(15));
+ break;
+ default:
+ break;
+ }
+ resultat.SetType(2);
+ resultat.SetFlag(1); //titres sur les lignes
+
+ f_distgntIndVcalc (resultat._tab);
+}
+
+void DistancesGnt::f_distgntpopDas(long double * Ptab) const {
+ // calcul de distance g�n�tique avec la Das entre Populations
+ // combinaison des individus entre les 2 pops (moyPsAB),
+ // combinaison des individus dans la pop1 (moyPsA1),
+ // combinaison des individus dans la pop2 (moyPsA2)
+
+ long double moyPsAB(0);
+ long double moyPsA1(0);
+ long double moyPsA2(0);
+ unsigned long i,j;
+
+ if (_bootind) {
+ for (j = 0; j < _nbpop; j++) {
+ _tabPstrucpop[j]->f_bootstrap();
+ }
+ }
+
+ for (j = 0; j < _nbpop; j++) {
+ for (i = 0; i < j; i++) {
+ moyPsAB = r_distDasMoyPsAB(_tabPstrucpop[i], _tabPstrucpop[j]);
+ moyPsA1 = r_distDasMoyPsA(_tabPstrucpop[i]);
+ moyPsA2 = r_distDasMoyPsA(_tabPstrucpop[j]);
+
+ Ptab[(i * _nbpop) + j] = Ptab[(j * _nbpop) + i] = (long double)1 - (((long double) 2 * moyPsAB)/(moyPsA1 + moyPsA2));
+ }
+ }
+}
+
+long double DistancesGnt::r_distDasMoyPsA(const StrucPop * Ppop) const {
+ //n�cessaire au calcul de distance � l'int�rieur d'une population pour la Das
+
+ long double somme(0);
+ unsigned long calcsomme(0);
+ unsigned long k,l, nbind;
+
+
+ if (_bootind) {
+ nbind = (Ppop->_VcalcInd.size());
+
+ if (nbind < 2) throw Anomalie(2, Ppop->get_nom() );
+
+ for (k=0; k < nbind; k++) { //scan des individus de la pop
+ for (l=(k+1); l < nbind; l++) { //scan des individus de la pop
+ calcsomme++;
+ try {
+ somme += r_distDasPsAi(Ppop->_VcalcInd[k], Ppop->_VcalcInd[l]);
+ }
+ catch (Jeupop::Anomalie erreur) {
+ if (erreur.le_pb == 6) calcsomme--;
+ }
+ }
+ }
+ }
+ else {
+ nbind = (Ppop->get_nbind());
+
+ if (nbind < 2) throw Anomalie(2, Ppop->get_nom());
+
+ for (k=0; k < nbind; k++) { //scan des individus de la pop
+ for (l=(k+1); l < nbind; l++) { //scan des individus de la pop
+ calcsomme++;
+ try {
+ somme += r_distDasPsAi(Ppop->get_Pind(k), Ppop->get_Pind(l));
+ }
+ catch (Jeupop::Anomalie erreur) {
+ if (erreur.le_pb == 6) calcsomme--;
+ }
+ }
+ }
+ }
+
+ return (somme / ((long double) calcsomme));
+}
+
+long double DistancesGnt::r_distDasMoyPsAB(const StrucPop * Ppop1, const StrucPop * Ppop2) const {
+ //n�cessaire au calcul de distance entre 2 pops pour la Das
+
+ long double somme(0);
+ unsigned long calcsomme;
+ unsigned long k,l, nbind1(0), nbind2(0);
+
+
+ if (_bootind) {
+ nbind1 = (Ppop1->_VcalcInd.size());
+ nbind2 = (Ppop2->_VcalcInd.size());
+ calcsomme = nbind1 * nbind2;
+
+ for (k=0; k < nbind1; k++) { //scan des individus de la pop1
+ for (l=0; l < nbind2; l++) { //scan des individus de la pop2
+ try {
+ somme += r_distDasPsAi(Ppop1->_VcalcInd[k], Ppop2->_VcalcInd[l]);
+ }
+ catch (Jeupop::Anomalie erreur) {
+ if (erreur.le_pb == 6) calcsomme--;
+ }
+ }
+ }
+ }
+ else {
+ nbind1 = (Ppop1->get_nbind());
+ nbind2 = (Ppop2->get_nbind());
+ calcsomme = nbind1 * nbind2;
+
+ for (k=0; k < nbind1; k++) { //scan des individus de la pop1
+ for (l=0; l < nbind2; l++) { //scan des individus de la pop2
+ try {
+ somme += r_distDasPsAi(Ppop1->get_Pind(k), Ppop2->get_Pind(l));
+ }
+ catch (Jeupop::Anomalie erreur) {
+ if (erreur.le_pb == 6) calcsomme--;
+ }
+ }
+ }
+ }
+
+ return (somme / ((long double) calcsomme));
+}
+
+void DistancesGnt::f_distgntpopVcalc(long double * Ptab) const {
+ unsigned long i,j;
+
+
+ if (_methode == 5) f_distgntpopDas(Ptab);
+ else {
+ if (_bootind) f_calcTabBootInd();
+
+ for (j = 0; j < _nbpop; j++) {
+ for (i = 0; i < j; i++) {
+ Ptab[(i * _nbpop) + j] = Ptab[(j * _nbpop) + i] = r_dist2pop(i, j);
+ }
+ }
+ }
+}
+
+long double DistancesGnt::r_dist2pop(unsigned long pop1, unsigned long pop2) const{
+ long double result(0);
+ //renvoi de la distance entre 2 Populations
+ switch (_methode) {
+ case 101:
+ // Nei's minimum genetic distance (1972)
+ result = r_dpopNei(pop1, pop2, false);
+// return(r_dpopNei(pop1, pop2, false));
+ break;
+ case 102:
+ // Nei's standard genetic distance (1972)
+ result = r_dpopNei(pop1, pop2, true);
+// return(r_dpopNei(pop1, pop2, true));
+ break;
+ case 103:
+ // Cavalli-Sforza and Edwards' (1967)
+ result = r_dpopCavalli(pop1, pop2);
+ break;
+ case 104:
+ // Nei et al's, Da (1983)
+ result = r_dpopNeiDa(pop1, pop2);
+// return(r_dpopNeiDa(pop1,pop2));
+ break;
+ case 106:
+ // Goldstein et al. (1995a)
+ result = r_dpopGoldsteinMu(pop1, pop2);
+// return(r_dpopGoldsteinMu(pop1,pop2));
+ break;
+ case 107:
+ // Latter's Fst (1972)
+ result = r_dpopFst(pop1, pop2);
+// return(r_dpopFst(pop1, pop2));
+ break;
+ case 108:
+ // Prevosti et al.'s, Cp (1975)
+ result = r_dpopPrevosti(pop1, pop2);
+// return(r_dpopPrevosti(pop1, pop2));
+ break;
+ case 109:
+ // Rogers', Dr (1972)
+ result = r_dpopRoger(pop1, pop2);
+// return(r_dpopRoger(pop1, pop2));
+ break;
+ case 110:
+ // Goldstein et al. (1995b) Slatkin 1995
+ result = r_dpopGoldsteinASD(pop1, pop2);
+// return(r_dpopGoldsteinASD(pop1, pop2));
+ break;
+ case 111:
+ // Shriver et al's, Dsw (1995)
+ result = r_dpopShriver(pop1, pop2);
+// return(r_dpopShriver(pop1, pop2));
+ break;
+ case 112:
+ // Zhivotovsky , DR (1999)
+ result = r_dpopZhivotovsky(pop1, pop2);
+ // return(r_dpopZhivotovsky(pop1, pop2));
+ break;
+ case 113:
+ // Reynolds unweighted (1983)
+ result = r_dpopReynoldsUnweighted(pop1, pop2);
+// return(r_dpopReynoldsUnweighted(pop1, pop2));
+ break;
+ case 114:
+ // Reynolds weighted (1983)
+ result = r_dpopReynoldsWeighted(pop1, pop2);
+// return(r_dpopReynoldsWeighted(pop1, pop2));
+ break;
+ case 115:
+ // Reynolds least squares (1983)
+ result = r_dpopReynoldsLeast(pop1, pop2);
+// return(r_dpopReynoldsLeast(pop1, pop2));
+ break;
+
+ }
+ if (_squareDistance) return (result * result);
+ else return (result);
+
+ throw Anomalie(1);
+ return(0);
+}
+
+
+long double DistancesGnt::r_dpopCavalli(unsigned long pop1,unsigned long pop2) const {
+
+ //distances de Cavalli-Sforza and Edwards' (1967) entre 2 populations
+ // tir� de Naoko Takezaki and Masatoshi Nei
+ // "Genetic Distances and Reconstruction of Phylogenetic
+ // Trees From Microsatellite DNA"
+ // Genetics society of America 144: 389-399.1996.
+
+ long double Sracinelocus(0);
+ long double Sracinealleles;
+ unsigned long i, l, locus;
+ unsigned long nblocus(_VcalcLocus.size()); // soit r
+ unsigned long nblocusdivise;
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = ( _PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = ( _PtabFreq + (pop2 * _nbloc));
+
+ nblocusdivise = nblocus;
+
+
+ for (l = 0; l < nblocus; l++) {
+ // l numero du locus
+//cerr << "DistancesGnt::r_dpopCavalli entre " << l << endl;
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+//cerr << "DistancesGnt::r_dpopCavalli sort " << l << endl;
+
+ Sracinealleles = 0;
+ for (i = 0; i < _tabNbAll[locus]; i++) {
+ //i numero de l'allele
+ //Pall = _tabPloc[locus]->getPall(i);
+ //if (_Pjeupop->_tabPloc[locus]->getPall(i)->_nul) continue;
+
+ Sracinealleles += (long double) sqrt(*(tabfreq1[locus] + i) * *(tabfreq2[locus] + i));
+ }
+
+ //necessaire: racine carree de zero ne fonctionne pas.
+ if (Sracinealleles < 1) Sracinelocus += (long double)sqrt ((long double)2 * ((long double)1 - Sracinealleles));
+ }
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+ return (((long double)2 * Sracinelocus) / (_pi * (long double)nblocusdivise));
+}
+
+long double DistancesGnt::r_dpopFst(unsigned long pop1,unsigned long pop2) const {
+
+ //Latter's Fst (1972) entre 2 populations
+ // tir� de Naoko Takezaki and Masatoshi Nei
+ // "Genetic Distances and Reconstruction of Phylogenetic
+ // Trees From Microsatellite DNA"
+ // Genetics society of America 144: 389-399.1996.
+
+ long double resultat(0), inter;
+ long double Jx(0), Jy(0), Jxy(0);
+ unsigned long i, l, locus;
+ unsigned long nblocus(_VcalcLocus.size());
+ unsigned long nblocusdivise;
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = (_PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = (_PtabFreq + (pop2 * _nbloc));
+
+ nblocusdivise = nblocus;
+
+ for (l = 0; l < nblocus; l++) {
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+
+ for (i = 0; i < _tabNbAll[locus]; i++) {
+ //Pall = _tabPloc[locus]->getPall(i);
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_miss) continue;
+
+ //frequence de l'allele i dans la population 1
+ inter = *(tabfreq1[locus] + i);
+ //inter = ((long double) ppop1->r_nbcopall(Pall) / (long double) nballpop1);
+ resultat = inter * inter;
+ // resultat /= nblocus;
+ Jx += resultat;
+
+ //frequence de l'allele i dans la population 2
+ resultat = *(tabfreq2[locus] + i);
+ //resultat = ((long double) ppop2->r_nbcopall(Pall) / (long double) nballpop2);
+ inter = inter * resultat;
+ resultat = resultat * resultat;
+ // resultat /= nblocus;
+ Jy += resultat;
+
+ // inter /= nblocus;
+ Jxy += inter;
+ }
+ }
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+ Jx /= (long double)nblocusdivise;
+ Jy /= (long double)nblocusdivise;
+ Jxy /= (long double)nblocusdivise;
+
+ //distance de Nei classique:
+ resultat = ((Jx + Jy) / (long double)2 ) - Jxy;
+
+ // Fst :
+ resultat /= ((long double)1 - Jxy);
+
+
+ return (resultat);
+}
+
+/*
+long double DistancesGnt::r_dpopFstClassique(long double ** tabfreq1,long double ** tabfreq2) const {
+
+ //Fst entre 2 populations
+
+ long double somme;
+ long double HT, moyHS;
+ unsigned long i, l, locus;
+ long double nblocus((long double) _VcalcLocus.size());
+
+
+ for (l = 0; l < nblocus; l++) {
+ locus = _VcalcLocus[l];
+
+ for (i = 0; i < _tabNbAll[locus]; i++) {
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_nul) continue;
+
+ //pour chaque locus, chaque allele
+ //calcul de HT
+ somme = (*(tabfreq1[locus] + i) * nbind1)
+ }
+ }
+
+ // Fst :
+ resultat /= ((long double)1 - Jxy);
+
+
+ return (resultat);
+}
+*/
+
+long double DistancesGnt::r_dpopGoldsteinASD(unsigned long pop1,unsigned long pop2) const {
+
+ //distances de Goldstein et al., ASD (1995b; Slatkin 1995) entre 2 populations
+ // Average Square Distance
+ // tir� de Naoko Takezaki and Masatoshi Nei
+ // "Genetic Distances and Reconstruction of Phylogenetic
+ // Trees From Microsatellite DNA"
+ // Genetics society of America 144: 389-399.1996.
+
+ long double freqxil;
+ long double freqyjl;
+ long double Slocus(0);
+ long double DblSommeij(0);
+ unsigned long i,j, l, locus;
+ unsigned long nblocus(_VcalcLocus.size()); // soit r
+ unsigned long nballdiff;
+ unsigned long nblocusdivise;
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = (_PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = (_PtabFreq + (pop2 * _nbloc));
+
+ nblocusdivise = nblocus;
+
+ for (l = 0; l < nblocus; l++) {
+ // l numero du locus
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+//cerr << "DistancesGnt::r_dpopGoldsteinASD" << nblocusdivise << endl;
+ continue;
+ }
+
+ nballdiff = _tabNbAll[locus];
+ DblSommeij = 0;
+ for (i = 0; i < nballdiff; i++) {
+ //Palli = _tabPloc[locus]->getPall(i);
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_miss) continue;
+
+ //frequence de l'allele i dans la population 1
+ freqxil = *(tabfreq1[locus] + i);
+ //freqxil = ((long double) ppop1->r_nbcopall(Palli) / (long double) nballpop1);
+//cerr << "DistancesGnt::r_dpopGoldsteinASD freqxil" << freqxil << endl;
+ if (freqxil == 0) continue;
+
+ for (j = 0; j < nballdiff; j++) {
+ //double somme
+ if (i == j) continue;
+ //Pallj = _tabPloc[locus]->getPall(j);
+ if (_Pjeupop->_tabPloc[locus]->getPall(j)->_miss) continue;
+
+
+//cerr << "DistancesGnt::r_dpopGoldsteinASD nbrepet1" << _tabPloc[locus]->getPall(i)->_nbrepet << endl;
+//cerr << "DistancesGnt::r_dpopGoldsteinASD nbrepet2" << _tabPloc[locus]->getPall(j)->_nbrepet << endl;
+ freqyjl = ((long double)_tabPloc[locus]->getPall(i)->_nbrepet - (long double)_tabPloc[locus]->getPall(j)->_nbrepet);
+//cerr << "DistancesGnt::r_dpopGoldsteinASD freqyjl" << freqyjl << endl;
+ freqyjl = freqyjl * freqyjl;
+//cerr << "DistancesGnt::r_dpopGoldsteinASD freqyjl" << freqyjl << endl;
+ //frequence de l'allele j dans la population 2
+ freqyjl = freqyjl * (*(tabfreq2[locus] + j));
+//cerr << "DistancesGnt::r_dpopGoldsteinASD freqyjl" << freqyjl << endl;
+ //freqyjl *= ((long double) ppop2->r_nbcopall(Pallj) / (long double) nballpop2);
+
+ DblSommeij += (freqxil * freqyjl);
+//cerr << "DistancesGnt::r_dpopGoldsteinASD DblSommeij" << DblSommeij << endl;
+ }
+ }
+
+ //Slocus += (DblSommeij / nblocus);
+ Slocus += DblSommeij;
+//cerr << "DistancesGnt::r_dpopGoldsteinASD Slocus" << Slocus << endl;
+ }
+
+// resultat = (long double)1 - (Sracinelocus * ((long double)1 / nblocus));
+ if (nblocusdivise == 0) throw Anomalie(3);
+ Slocus /= (long double) nblocusdivise;
+
+ return (Slocus);
+}
+
+
+long double DistancesGnt::r_dpopGoldsteinMu(unsigned long pop1,unsigned long pop2) const {
+
+ //distances de Goldstein et al. (1995a) entre 2 populations
+ // deltaMu carre
+ // tir� de Naoko Takezaki and Masatoshi Nei
+ // "Genetic Distances and Reconstruction of Phylogenetic
+ // Trees From Microsatellite DNA"
+ // Genetics society of America 144: 389-399.1996.
+
+ long double Slocus(0);
+ long double Mu2;
+ unsigned long l, locus;
+ unsigned long nblocus(_VcalcLocus.size()); // soit r
+ unsigned long nblocusdivise;
+ long double * tabmu1(_PtabMu + (pop1 * _nbloc));
+ long double * tabmu2(_PtabMu + (pop2 * _nbloc));
+
+ nblocusdivise = nblocus;
+
+ for (l = 0; l < nblocus; l++) {
+ // l numero du locus
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+
+ //Muxj = Muxj - Muyj;
+ Mu2 = tabmu1[locus] - tabmu2[locus];
+ Mu2 *= Mu2;
+
+ //Slocus += (Muxj / nblocus);
+ Slocus += Mu2;
+ }
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+ Slocus /= (long double) nblocusdivise;
+
+// resultat = (long double)1 - (Sracinelocus * ((long double)1 / nblocus));
+
+ return (Slocus);
+}
+
+
+long double DistancesGnt::r_dpopZhivotovsky(unsigned long pop1,unsigned long pop2) const {
+
+ //distances de Lev A. Zhivotovsky (1999) entre 2 populations
+ // tir� de Lev A. Zhivotovsky
+ // "A new Genetic Distance with Application to constrained
+ // Variation at Microsatellite Loci"
+ // Mol. Biol. Evol. 16(4) 144: 389-399.1996.
+
+ long double Cab(0);
+ long double MoyRa(0), MoyRb(0);
+ long double SRa2(0), SRb2(0);
+ unsigned long l, locus;
+ unsigned long nblocus(_VcalcLocus.size());
+ unsigned long nblocusdivise;
+ long double * tabmu1(_PtabMu + (pop1 * _nbloc));
+ long double * tabmu2(_PtabMu + (pop2 * _nbloc));
+
+ nblocusdivise = nblocus;
+
+//cerr << "zhivotovski deb" << endl;
+ //ce calcul peut �tre externalis�
+ for (l = 0; l < nblocus; l++) {
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+
+ MoyRa += tabmu1[locus];
+ MoyRb += tabmu2[locus];
+ SRa2 += (tabmu1[locus] * tabmu1[locus]);
+ SRb2 += (tabmu2[locus] * tabmu2[locus]);
+ Cab += (tabmu1[locus] * tabmu2[locus]);
+ }
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+
+ MoyRa /= (long double) nblocusdivise;
+ MoyRb /= (long double) nblocusdivise;
+ //--------------
+
+//cerr << Cab << " - " << (((long double) nblocus) * MoyRa * MoyRb) << endl;
+ Cab -= (((long double) nblocusdivise) * MoyRa * MoyRb);
+ Cab /= (long double)(nblocusdivise - 1);
+ // c'est bon pour Cab
+ // pour Va et Vb, utilisons respectivement SRa2 et SRb2
+ SRa2 -= (((long double) nblocusdivise) * MoyRa * MoyRa);
+ SRb2 -= (((long double) nblocusdivise) * MoyRb * MoyRb);
+ SRa2 /= (long double)(nblocusdivise - 1);
+ SRb2 /= (long double)(nblocusdivise - 1);
+
+ SRa2 += SRb2;
+ SRa2 /= (long double) 2;
+
+//cerr << Cab << " " << SRa2 << endl;
+ //Attention a l'approximation:
+ if (Cab < 1) Cab = 1; //sans ca, ca risque de planter...
+ Cab = ((long double) log(Cab / SRa2) * (long double)-1);
+
+//cerr << "zhivotovski fin " << Cab << endl;
+ return (Cab);
+
+}
+
+long double DistancesGnt::r_dpopNei(unsigned long pop1,unsigned long pop2, bool standard) const {
+ //distances de Nei (1972) entre 2 populations (standard et minimum)
+ // Ds et Dm
+ // tir� de Jin et Chakraborty
+ // mol.Biol. Evol. 11(1): 120-127.1994.
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = (_PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = (_PtabFreq + (pop2 * _nbloc));
+
+// long double * tabfreq1( _PtabFreq[(pop1 * _nbloc)]);
+// long double * tabfreq2( _PtabFreq[(pop2 * _nbloc)]);
+// tabfreq1 = *tabfreq1 + (pop1 * _nbloc);
+
+ long double resultat(0), inter;
+ long double Jx(0), Jy(0), Jxy(0);
+ unsigned long i, l, locus;
+ unsigned long nblocus(_VcalcLocus.size());
+ unsigned long nblocusdivise;
+
+ nblocusdivise = nblocus;
+// long nballdiff, nballpop1, nballpop2;
+// Allele * Pall;
+
+ for (l = 0; l < nblocus; l++) {
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+// nballdiff = tabNbAll[locus];
+ for (i = 0; i < _tabNbAll[locus]; i++) {
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_miss) continue;
+
+ //frequence de l'allele i dans la population 1
+ inter = *(tabfreq1[locus] + i);
+ resultat = inter * inter;
+ Jx += resultat;
+
+ //frequence de l'allele i dans la population 2
+ resultat = *(tabfreq2[locus] + i);
+ inter = inter * resultat;
+ resultat = resultat * resultat;
+ Jy += resultat;
+
+ Jxy += inter;
+ }
+ }
+ if (nblocusdivise == 0) throw Anomalie(3);
+
+ Jx /= (long double)nblocusdivise;
+ Jy /= (long double)nblocusdivise;
+ Jxy /= (long double)nblocusdivise;
+
+ if (standard) {
+ //resultat = ((log(Jx) + log(Jy)) / 2 ) - log(Jxy);
+ //cerr << "Ds Nei " << endl;
+ resultat = ( - log (Jxy/(sqrt(Jx * Jy))));
+ }
+ else {
+ resultat = ((Jx + Jy) / 2 ) - Jxy;
+ }
+
+ return (resultat);
+}
+
+
+long double DistancesGnt::r_dpopNeiDa(unsigned long pop1,unsigned long pop2) const {
+
+ //distances de Nei et al's, Da (1983) entre 2 populations
+ // tir� de Naoko Takezaki and Masatoshi Nei
+ // "Genetic Distances and Reconstruction of Phylogenetic
+ // Trees From Microsatellite DNA"
+ // Genetics society of America 144: 389-399.1996.
+
+ long double resultat(0);
+ long double freqil;
+ long double Sracinelocus(0);
+ long double Sracinealleles(0);
+// long double pi(acos(-1));
+ unsigned long i, l, locus;
+ unsigned long nblocus(_VcalcLocus.size()); // soit r
+ unsigned long nblocusdivise;
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = (_PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = (_PtabFreq + (pop2 * _nbloc));
+
+
+ nblocusdivise = nblocus;
+
+ for (l = 0; l < nblocus; l++) {
+ // l numero du locus
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+
+ Sracinealleles = 0;
+ for (i = 0; i < _tabNbAll[locus]; i++) {
+ //i numero de l'allele
+ //Pall = _tabPloc[locus]->getPall(i);
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_miss) continue;
+
+ //frequence de l'allele i dans la population 1
+ freqil = *(tabfreq1[locus] + i);
+ //freqil = ((long double) ppop1->r_nbcopall(Pall) / (long double) nballpop1);
+
+ //frequence de l'allele i dans la population 2
+ freqil *= *(tabfreq2[locus] + i);
+ //freqil *= ((long double) ppop2->r_nbcopall(Pall) / (long double) nballpop2);
+
+ Sracinealleles += (long double) sqrt(freqil);
+ }
+
+ Sracinelocus += Sracinealleles;
+ }
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+ resultat = (long double)1 - (Sracinelocus / (long double)nblocusdivise);
+
+ return (resultat);
+}
+
+long double DistancesGnt::r_dpopPrevosti(unsigned long pop1,unsigned long pop2) const {
+
+ //distances de Prevosti et al.'s, Cp (1975) entre 2 populations
+ // tir� de Naoko Takezaki and Masatoshi Nei
+ // "Genetic Distances and Reconstruction of Phylogenetic
+ // Trees From Microsatellite DNA"
+ // Genetics society of America 144: 389-399.1996.
+
+ long double freqil;
+ long double Sracinelocus(0);
+ long double Salleles(0);
+ unsigned long i, l, locus;
+ unsigned long nblocus(_VcalcLocus.size()); // soit r
+ unsigned long nblocusdivise;
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = (_PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = (_PtabFreq + (pop2 * _nbloc));
+
+ nblocusdivise = nblocus;
+
+ for (l = 0; l < nblocus; l++) {
+ // l numero du locus
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+
+ Salleles = 0;
+ for (i = 0; i < _tabNbAll[locus]; i++) {
+ //i numero de l'allele
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_miss) continue;
+ //frequence de l'allele i dans la population 1
+ freqil = *(tabfreq1[locus] + i);
+
+ //frequence de l'allele i dans la population 2
+ freqil -= *(tabfreq2[locus] + i);
+
+ Salleles += (freqil < 0)?((long double)-1 * freqil):(freqil);
+ }
+
+ //Sracinelocus += (Salleles / ((long double)2 * nblocus));
+ Sracinelocus += Salleles;
+ }
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+ Sracinelocus /= (((long double)2 * (long double)nblocusdivise));
+
+ return (Sracinelocus);
+}
+
+
+long double DistancesGnt::r_dpopRoger(unsigned long pop1,unsigned long pop2) const {
+
+ //distances de Rogers', Dr (1972) entre 2 populations
+ // tir� de Naoko Takezaki and Masatoshi Nei
+ // "Genetic Distances and Reconstruction of Phylogenetic
+ // Trees From Microsatellite DNA"
+ // Genetics society of America 144: 389-399.1996.
+
+ long double freqil;
+ long double Sracinelocus(0);
+ long double Salleles(0);
+ unsigned long i, l, locus;
+ unsigned long nblocus(_VcalcLocus.size()); // soit r
+ unsigned long nblocusdivise;
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = (_PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = (_PtabFreq + (pop2 * _nbloc));
+
+
+ nblocusdivise = nblocus;
+
+
+ for (l = 0; l < nblocus; l++) {
+ // l numero du locus
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+
+ Salleles = 0;
+ for (i = 0; i < _tabNbAll[locus]; i++) {
+ //i numero de l'allele
+ //Pall = _tabPloc[locus]->getPall(i);
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_miss) continue;
+ //frequence de l'allele i dans la population 1
+ freqil = *(tabfreq1[locus] + i);
+ //freqil = ((long double) ppop1->r_nbcopall(Pall) / (long double) nballpop1);
+
+ //frequence de l'allele i dans la population 2
+ freqil -= *(tabfreq2[locus] + i);
+ //freqil -= ((long double) ppop2->r_nbcopall(Pall) / (long double) nballpop2);
+
+ Salleles += freqil * freqil;
+ }
+
+ Sracinelocus += (long double)sqrt (Salleles / (long double)2);
+ }
+
+// resultat = Sracinelocus * ((long double)2 / (pi * nblocus));
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+ return (Sracinelocus / (long double) nblocusdivise);
+}
+
+long double DistancesGnt::r_dpopShriver(unsigned long pop1,unsigned long pop2) const {
+
+ // Dsw Shriver et al's(1995)
+ //distances de Shriver (1995) entre 2 populations
+ // "A novel Measure of Genetic Distance for Highly Polymorphic Tandem Repeat Loci"
+ // Mark D. Shriver, Li Jin, Eric Boerwinkle, Ranjan Deka, Robert E. Ferrell and Ranajit Chakraborty
+ // Mol. Bio. Evol. 12(5):914-920. 1995.
+
+ long double freqxil;
+ long double freqxjl;
+ long double freqyil;
+ long double freqyjl;
+ long double Resultat(0);
+ int Absdiffij(0);
+// long double Wxy(0);
+// long double Wx(0);
+// long double Wy(0);
+ long double SWxy(0);
+ long double SWx(0);
+ long double SWy(0);
+// long double pi(acos(-1));
+ unsigned long i,j, l, locus;
+ unsigned long nblocus(_VcalcLocus.size()); // soit r
+// long nploidie(get_nploidie());
+// long nballdiff, nballpop1, nballpop2;
+ unsigned long nballdiff;
+ unsigned long nbrepet;
+ unsigned long nblocusdivise;
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = (_PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = (_PtabFreq + (pop2 * _nbloc));
+
+ nblocusdivise = nblocus;
+
+ for (l = 0; l < nblocus; l++) {
+ // l numero du locus
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+
+ nballdiff = _tabNbAll[locus];
+ //SWxy = 0;
+ //SWy = 0;
+ //SWx = 0;
+ for (i = 0; i < nballdiff; i++) {
+ //Palli = _tabPloc[locus]->getPall(i);
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_miss) continue;
+
+ //frequence de l'allele i dans la population 1
+ freqxil = *(tabfreq1[locus] + i);
+ //freqxil = ((long double) ppop1->r_nbcopall(Palli) / (long double) nballpop1);
+ //frequence de l'allele i dans la population 2
+ freqyil = *(tabfreq2[locus] + i);
+ //freqyil = ((long double) ppop2->r_nbcopall(Palli) / (long double) nballpop2);
+
+ nbrepet = _tabPloc[locus]->getPall(i)->_nbrepet;
+ for (j = 0; j < nballdiff; j++) {
+ //double somme
+ if (i == j) continue;
+ //Pallj = _tabPloc[locus]->getPall(j);
+ if (_tabPloc[locus]->getPall(j)->_miss) continue;
+
+//cerr << Palli->_nom << " " << Pallj->_nom << endl;
+ Absdiffij = (int)nbrepet - (int)_tabPloc[locus]->getPall(j)->_nbrepet;
+ Absdiffij = (Absdiffij < 0)?(-1 * Absdiffij):(Absdiffij);
+
+ //frequence de l'allele j dans la population 2
+ freqyjl = *(tabfreq2[locus] + j);
+ //freqyjl = ((long double) ppop2->r_nbcopall(Pallj) / (long double) nballpop2);
+ //frequence de l'allele j dans la population 1
+ freqxjl = *(tabfreq1[locus] + j);
+ //freqxjl = ((long double) ppop1->r_nbcopall(Pallj) / (long double) nballpop1);
+
+
+ SWxy += freqxil * freqyjl * (long double)Absdiffij;
+ SWx += freqxil * freqxjl * (long double)Absdiffij;
+ SWy += freqyil * freqyjl * (long double)Absdiffij;
+//cerr << SWxy << " " << SWx << " " << SWy << endl;
+ }
+ }
+
+ //Wxy += (SWxy / nblocus);
+ //Wx += (SWx / nblocus);
+ //Wy += (SWy / nblocus);
+ }
+//cin >> Resultat;
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+ SWxy /= (long double) nblocusdivise;
+ SWx /= (long double) nblocusdivise;
+ SWy /= (long double) nblocusdivise;
+
+ Resultat = SWxy - ((SWx + SWy)/(long double)2);
+
+// cerr << SWxy << " " << SWx << " " << SWy << " " << Resultat << endl;
+//cin >> SWxy;
+
+ return (Resultat);
+}
+
+
+inline void DistancesGnt::f_calcTabFreq() const{
+ //calcul des frequences alleliques
+ // tabPfreq contient les adresses de tableaux de frequences
+ // tabNbAll contient le nombre d'alleles a chaque locus
+
+ unsigned long nball, nballnonnuls;
+ unsigned long i, j, k;
+
+ long double* adresse(_PtabFreq[0]);
+
+ for (i=0; i < _nbpop; i++) {
+ for (j=0; j < _nbloc; j++) {
+ nball = _tabNbAll[j];
+ nballnonnuls = _tabPstrucpop[i]->r_nballnonnuls(j);
+ if (nballnonnuls == 0) {
+ _tabEviteLocus[(i*_nbloc)+j] = true; // calculs de fr�quences impossible sur ce locus
+
+ for (k=0; k < nball; k++, adresse++) *adresse = 0;
+ continue;
+// throw Anomalie(3, _tabPstrucpop[i]->get_nom());
+ }
+
+ for (k=0; k < nball; k++) {
+ if (_tabPloc[j]->getPall(k)->_miss) *adresse = 0;
+ else *adresse = (long double) _tabPstrucpop[i]->r_nbcopall(_tabPloc[j]->getPall(k)) / (long double) nballnonnuls;
+ adresse++;
+ }
+ }
+ }
+}
+
+void DistancesGnt::f_calcTabFreqTot() const{
+ //calcul des frequences alleliques moyennes � chaque locus pour toutes les pops
+ //�a ne sert pas pour l'instant (26/02/2002)
+ unsigned long j,k,nball, nballnonnuls;
+ MetaPop * Pracinepop(_Pjeupop->get_Pracinepop());
+ long double* adresse(_PtabFreqTot);
+
+ f_calcTabFreq();
+
+ for (j=0; j < _nbloc; j++) {
+ nball = _tabNbAll[j];
+ nballnonnuls = Pracinepop->r_nballnonnuls(j);
+ if (nballnonnuls == 0) {
+ // calculs impossibles non trait�
+
+ //_tabEviteLocus[(i*_nbloc)+j] = true; // calculs de fr�quences impossible sur ce locus
+
+ //for (k=0; k < nball; k++, adresse++) *adresse = 0;
+ //continue;
+// throw Anomalie(3, _tabPstrucpop[i]->get_nom());
+ }
+
+ for (k=0; k < nball; k++) {
+ if (_tabPloc[j]->getPall(k)->_miss) *adresse = 0;
+ else *adresse = (long double) Pracinepop->r_nbcopall(_tabPloc[j]->getPall(k)) / (long double) nballnonnuls;
+ adresse++;
+ }
+ }
+
+
+}
+
+void DistancesGnt::f_calcTabFreqInd() const{
+ //calcul des frequences alleliques
+ // pour chaque individu
+ // tabPfreq contient les adresses de tableaux de frequences
+ // tabNbAll contient le nombre d'alleles a chaque locus
+ // _tabEviteLocus contient les locus � �viter (qui ne contiennent que des all�les nuls)
+
+ unsigned long nball, nballnonnuls;
+ unsigned long nbind(_tabPind.size());
+ unsigned int nploidie(_Pjeupop->get_nploidie());
+ unsigned long i, j, k;
+
+ long double* adresse(_PtabFreq[0]);
+
+ for (i=0; i < nbind; i++) {
+ for (j=0; j < _nbloc; j++) {
+ nball = _tabNbAll[j];
+ nballnonnuls = _tabPind[i]->r_nballnonnuls(j, nploidie);
+
+ if (nballnonnuls == 0) {
+ _tabEviteLocus[(i*_nbloc)+j] = true; // calculs de fr�quences impossible sur ce locus
+
+ for (k=0; k < nball; k++, adresse++) *adresse = 0;
+ continue;
+ }
+
+ for (k=0; k < nball; k++) {
+ if (_tabPloc[j]->getPall(k)->_miss) *adresse = 0;
+ else *adresse = (long double) _tabPind[i]->r_nbcopall(_tabPloc[j]->getPall(k)) / (long double) nballnonnuls;
+ adresse++;
+ }
+ }
+ }
+}
+
+void DistancesGnt::f_calcTabFreqBootInd() const{
+ //calcul des frequences alleliques
+ // tabPfreq contient les adresses de tableaux de frequences
+ // tabNbAll contient le nombre d'alleles a chaque locus
+ // sp�cifique aux calculs avec des bootstrap sur les individus
+
+ unsigned long nball, nballnonnuls;
+ unsigned long i, j, k;
+
+ long double* adresse(_PtabFreq[0]);
+
+//cerr << "f_calcTabFreqBootInd deb" << endl;
+ for (i=0; i < _nbpop; i++) {
+ _tabPstrucpop[i]->f_bootstrap();
+ for (j=0; j < _nbloc; j++) {
+ nball = _tabNbAll[j];
+ nballnonnuls = _tabPstrucpop[i]->r_nballnonnulsBootInd(j);
+
+ if (nballnonnuls == 0) {
+ _tabEviteLocus[(i*_nbloc)+j] = true; // calculs de fr�quences impossible sur ce locus
+ for (k=0; k < nball; k++, adresse++) *adresse = 0;
+//cerr << "f_calcTabFreqBootInd" << endl;
+ continue;
+ }
+
+ for (k=0; k < nball; k++) {
+ if (_tabPloc[j]->getPall(k)->_miss) *adresse = 0;
+ else *adresse = (long double) _tabPstrucpop[i]->r_nbcopallBootInd(_tabPloc[j]->getPall(k)) / (long double) nballnonnuls;
+ adresse++;
+ }
+ }
+ }
+//cerr << "f_calcTabFreqBootInd fin" << endl;
+
+}
+
+inline void DistancesGnt::f_calcTabBootInd() const{
+ //recalcul des tableaux
+ switch (_methode) {
+ case 106:
+ // calculs des Mu
+ f_calcTabMuBootInd();
+ break;
+ case 112:
+ // calculs des Mu
+ f_calcTabMuBootInd();
+ break;
+
+ default:
+ // calculs des fr�quences
+ f_calcTabFreqBootInd();
+ break;
+ }
+}
+
+void DistancesGnt::f_calcTabMu() const{
+ //calcul des Mu (moyenne du nombre de repetitions (au sens
+ // microsat) pond�r�e par la frequence allelique pour chaque locus)
+ // tabNbAll contient le nombre d'alleles a chaque locus
+
+ unsigned long nball;
+ long double nballnonnuls;
+ unsigned long i, j, k;
+
+ long double* adresse(_PtabMu);
+
+ for (i=0; i < _nbpop; i++) {
+ for (j=0; j < _nbloc; j++) {
+ nball = _tabNbAll[j];
+ nballnonnuls = (long double) _tabPstrucpop[i]->r_nballnonnuls(j);
+ if (nballnonnuls == 0) {
+ _tabEviteLocus[(i*_nbloc)+j] = true; // calculs de fr�quences impossible sur ce locus
+
+ for (k=0; k < nball; k++, adresse++) *adresse = 0;
+ continue;
+// throw Anomalie(3, _tabPstrucpop[i]->get_nom());
+ }
+ *adresse = 0;
+
+ for (k=0; k < nball; k++) {
+ if (_tabPloc[j]->getPall(k)->_miss) continue;
+ *adresse += (long double) _tabPloc[j]->getPall(k)->_nbrepet * ((long double) _tabPstrucpop[i]->r_nbcopall(_tabPloc[j]->getPall(k)) / nballnonnuls);
+ }
+ adresse++;
+ }
+ }
+}
+
+void DistancesGnt::f_calcTabMuInd() const{
+ //calcul des Mu (moyenne du nombre de repetitions (au sens
+ // microsat) pond�r�e par la frequence allelique pour chaque locus)
+ // tabNbAll contient le nombre d'alleles a chaque locus
+
+ //pour chaque individu
+
+ unsigned long nball;
+ long double nballnonnuls;
+ unsigned long nbind(_tabPind.size());
+ unsigned int nploidie(_Pjeupop->get_nploidie());
+ unsigned long i, j, k;
+
+ long double* adresse(_PtabMu);
+
+ for (i=0; i < nbind; i++) {
+ for (j=0; j < _nbloc; j++) {
+ nball = _tabNbAll[j];
+ nballnonnuls = (long double) _tabPind[i]->r_nballnonnuls(j, nploidie);
+ if (nballnonnuls == 0) {
+ _tabEviteLocus[(i*_nbloc)+j] = true; // calculs de fr�quences impossible sur ce locus
+ for (k=0; k < nball; k++, adresse++) *adresse = 0;
+ continue;
+ }
+
+ *adresse = 0;
+
+ for (k=0; k < nball; k++) {
+ if (_tabPloc[j]->getPall(k)->_miss) continue;
+ *adresse += (long double) _tabPloc[j]->getPall(k)->_nbrepet * ((long double) _tabPind[i]->r_nbcopall(_tabPloc[j]->getPall(k)) / nballnonnuls);
+ }
+ adresse++;
+ }
+ }
+}
+
+void DistancesGnt::f_calcTabMuBootInd() const{
+ //calcul des Mu (moyenne du nombre de repetitions (au sens
+ // microsat) pond�r�e par la frequence allelique pour chaque locus)
+ // tabNbAll contient le nombre d'alleles a chaque locus
+ // sp�cifique aux calculs avec des bootstrap sur les individus
+
+
+ unsigned long nball;
+ long double nballnonnuls;
+ unsigned long i, j, k;
+
+ long double* adresse(_PtabMu);
+
+ for (i=0; i < _nbpop; i++) {
+ _tabPstrucpop[i]->f_bootstrap();
+ for (j=0; j < _nbloc; j++) {
+ nball = _tabNbAll[j];
+ nballnonnuls = (long double) _tabPstrucpop[i]->r_nballnonnulsBootInd(j);
+ if (nballnonnuls == 0) {
+ _tabEviteLocus[(i*_nbloc)+j] = true; // calculs de fr�quences impossible sur ce locus
+ for (k=0; k < nball; k++, adresse++) *adresse = 0;
+ continue;
+ }
+
+ *adresse = 0;
+
+ for (k=0; k < nball; k++) {
+ if (_tabPloc[j]->getPall(k)->_miss) continue;
+ *adresse += (long double) _tabPloc[j]->getPall(k)->_nbrepet * ((long double) _tabPstrucpop[i]->r_nbcopallBootInd(_tabPloc[j]->getPall(k)) / nballnonnuls);
+ }
+ adresse++;
+ }
+ }
+}
+
+void DistancesGnt::f_distgntIndVcalc (long double * Ptab) const{
+ //distances G�n�tiques entre individus
+ long nbind (_tabPind.size());
+ long j,i;
+
+ for (j = 0; j < nbind; j++) {
+ for (i = 0; i < j; i++) {
+ try {
+ Ptab[(j * nbind) + i] = r_dist2ind(i, j);
+ Ptab[(i * nbind) + j] = Ptab[(j * nbind) + i];
+ }
+ catch (Jeupop::Anomalie erreur) {
+ if (erreur.le_pb == 6) {
+ Ptab[(j * nbind) + i] = -1;
+ Ptab[(i * nbind) + j] = Ptab[(j * nbind) + i];
+ }
+ }
+ }
+ }
+//cerr << "f_distgntIndVcalc fin" << endl;
+
+}
+
+unsigned long DistancesGnt::get_nbind() const {
+ unsigned long i, res(0);
+
+ for (i = 0; i < _nbpop; i++) {
+ res += _tabPstrucpop[i]->get_nbind();
+ }
+ return (res);
+}
+
+
+unsigned int DistancesGnt::get_nb_methodes() {
+ if (_tab_noms_methodes.size() == 0) f_rempli_tab_noms_methodes();
+ return(_tab_noms_methodes.size());
+}
+
+const string & DistancesGnt::get_nom_methode(unsigned int methode) {
+ if (_tab_noms_methodes.size() == 0) f_rempli_tab_noms_methodes();
+ if (methode > 100) methode -= 100;
+ if (methode < _tab_noms_methodes.size()) return (_tab_noms_methodes[methode]);
+ else throw Anomalie(6);
+}
+
+void DistancesGnt::f_rempli_tab_noms_methodes() {
+// _map_noms_methodes.resize(0);
+
+/* _map_noms_methodes[1] = string("Nei's minimum genetic distance, Dm (1972)");
+ _map_noms_methodes[2] = string("Nei's standard genetic distance, Ds (1972)");
+ _map_noms_methodes[3] = string("Cavalli-Sforza and Edwards, Dc (1967)"); //3
+ //_map_noms_methodes[16] = string("Cavalli-Sforza and Edwards, Dc (1967)"); //3
+ _map_noms_methodes[4] = string("Nei et al's, Da (1983)"); //4
+ _map_noms_methodes[5] = string("DAS"); //5
+ _map_noms_methodes[6] = string("Goldstein et al. , dmu2 (1995a)"); //6
+ _map_noms_methodes[7] = string("Latter, Fst (1972)"); //7
+ _map_noms_methodes[8] = string("Prevosti et al.'s, Cp (1975)"); //8
+ _map_noms_methodes[9] = string("Rogers', Dr (1972)"); //9
+ _map_noms_methodes[10] = string("Goldstein et al. (1995b) Slatkin, ASD (1995)"); //10
+ _map_noms_methodes[11] = string("Shriver et al's, Dsw (1995)"); //11
+ _map_noms_methodes[12] = string("Lev A. Zhivotovsky, DR (1999)"); //12
+ _map_noms_methodes[13] = string("Reynolds J., unweighted (1983)"); //13
+ _map_noms_methodes[14] = string("Reynolds J., weighted (1983)"); //14
+ _map_noms_methodes[15] = string("Reynolds J., least squares (1983)"); //15
+
+*/ _tab_noms_methodes.resize(0);
+// _tab_numeros_methodes.resize(0);
+ _tab_noms_methodes.push_back(""); //0
+ _tab_noms_methodes.push_back("Nei's minimum genetic distance, Dm (1972)"); //1
+ _tab_noms_methodes.push_back("Nei's standard genetic distance, Ds (1972)"); //2
+ _tab_noms_methodes.push_back("Cavalli-Sforza and Edwards, Dc (1967)"); //3
+ _tab_noms_methodes.push_back("Nei et al's, Da (1983)"); //4
+ _tab_noms_methodes.push_back("DAS"); //5
+ _tab_noms_methodes.push_back("Goldstein et al. , dmu2 (1995a)"); //6
+ _tab_noms_methodes.push_back("Latter, Fst (1972)"); //7
+ _tab_noms_methodes.push_back("Prevosti et al.'s, Cp (1975)"); //8
+ _tab_noms_methodes.push_back("Rogers', Dr (1972)"); //9
+ _tab_noms_methodes.push_back("Goldstein et al. (1995b) Slatkin, ASD (1995)"); //10
+ _tab_noms_methodes.push_back("Shriver et al's, Dsw (1995)"); //11
+ _tab_noms_methodes.push_back("Lev A. Zhivotovsky, DR (1999)"); //12
+ _tab_noms_methodes.push_back("Reynolds J., unweighted (1983)"); //13
+ _tab_noms_methodes.push_back("Reynolds J., weighted (1983)"); //14
+ _tab_noms_methodes.push_back("Reynolds J., least squares (1983)"); //15
+
+}
+
+long double DistancesGnt::r_dpopReynoldsUnweighted(unsigned long pop1,unsigned long pop2) const {
+
+ //distance de Reynolds (1983) entre 2 populations
+ // tir� de {Reynolds, J.} and {Weir, B.S.} and {Cockerham, C.}
+ // "Estimation of the coancestry coefficient: basis for a short-term genetic distance"
+ // Genetics society of America
+ // 105: 767-779.1983.
+
+ long double al, alpbl;
+ long double sommeu(0);
+ long double sommetheta(0);
+ long double alpha1(0), alpha2(0);
+ long double intermediaire;
+ long double effpop1(_tabPstrucpop[pop1]->get_nbind()), effpop2(_tabPstrucpop[pop2]->get_nbind());
+ // _nbpop => nombre de populations
+
+ unsigned long i, l, locus;
+ unsigned long nblocus(_VcalcLocus.size());
+ unsigned long nblocusdivise;
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = (_PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = (_PtabFreq + (pop2 * _nbloc));
+
+ nblocusdivise = nblocus;
+
+ for (l = 0; l < nblocus; l++) {
+ // l numero du locus
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+
+ sommeu = 0;
+ alpha1 = 0;
+ alpha2 = 0;
+
+ for (i = 0; i < _tabNbAll[locus]; i++) {
+ //i numero de l'allele
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_miss) continue;
+ //frequence de l'allele i dans la population 1
+ alpha1 += ( (*(tabfreq1[locus] + i)) * (*(tabfreq1[locus] + i)) );
+
+ //frequence de l'allele i dans la population 2
+ alpha2 += ( (*(tabfreq2[locus] + i)) * (*(tabfreq2[locus] + i)) );
+
+ intermediaire = ((*(tabfreq1[locus] + i)) - (*(tabfreq2[locus] + i)));
+ intermediaire *= intermediaire;
+ sommeu += intermediaire;
+ }
+ sommeu /= ((long double) 2);
+
+ alpha1 = (long double)1 - alpha1;
+ alpha2 = (long double)1 - alpha2;
+
+ al = (effpop1 * alpha1);
+ al += (effpop2 * alpha2);
+ al /= (((long double)4 * effpop1 * effpop2) * (effpop1 + effpop2 - (long double)1));
+
+ alpbl = (((long double)4 * effpop1 * effpop2) - effpop1 - effpop2);
+ alpbl *= al;
+
+ al *= (effpop1 + effpop2);
+ al *= (- (long double)1);
+
+ al += sommeu;
+ alpbl += sommeu;
+
+
+ //Sracinelocus += (Salleles / ((long double)2 * nblocus));
+ sommetheta += (al / alpbl);
+ }
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+ sommetheta /= ((long double)nblocusdivise);
+
+ return ( - log ((long double)1 - sommetheta));
+}
+
+long double DistancesGnt::r_dpopReynoldsWeighted(unsigned long pop1,unsigned long pop2) const {
+
+ //distance de Reynolds (1983) entre 2 populations
+ // tir� de {Reynolds, J.} and {Weir, B.S.} and {Cockerham, C.}
+ // "Estimation of the coancestry coefficient: basis for a short-term genetic distance"
+ // Genetics society of America
+ // 105: 767-779.1983.
+
+ long double al, alpbl;
+ long double sommeal(0);
+ long double sommealpbl(0);
+ long double sommeu(0);
+ long double thetaw(0);
+ long double alpha1(0), alpha2(0);
+ long double intermediaire;
+ long double effpop1(_tabPstrucpop[pop1]->get_nbind()), effpop2(_tabPstrucpop[pop2]->get_nbind());
+ // _nbpop => nombre de populations
+
+ unsigned long i, l, locus;
+ unsigned long nblocus(_VcalcLocus.size());
+ unsigned long nblocusdivise;
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = (_PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = (_PtabFreq + (pop2 * _nbloc));
+
+ nblocusdivise = nblocus;
+
+ for (l = 0; l < nblocus; l++) {
+ // l numero du locus
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+
+ //sommeal = 0;
+ //sommealpbl = 0;
+ sommeu = 0;
+ alpha1 = 0;
+ alpha2 = 0;
+
+ for (i = 0; i < _tabNbAll[locus]; i++) {
+ //i numero de l'allele
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_miss) continue;
+ //frequence de l'allele i dans la population 1
+ alpha1 += ( (*(tabfreq1[locus] + i)) * (*(tabfreq1[locus] + i)) );
+
+ //frequence de l'allele i dans la population 2
+ alpha2 += ( (*(tabfreq2[locus] + i)) * (*(tabfreq2[locus] + i)) );
+
+ intermediaire = ((*(tabfreq1[locus] + i)) - (*(tabfreq2[locus] + i)));
+ intermediaire *= intermediaire;
+ sommeu += intermediaire;
+ }
+ sommeu /= ((long double) 2);
+
+ alpha1 = (long double)1 - alpha1;
+ alpha2 = (long double)1 - alpha2;
+
+ al = (effpop1 * alpha1);
+ al += (effpop2 * alpha2);
+ al /= (((long double)4 * effpop1 * effpop2) * (effpop1 + effpop2 - (long double)1));
+
+ alpbl = (((long double)4 * effpop1 * effpop2) - effpop1 - effpop2);
+ alpbl *= al;
+
+ al *= (effpop1 + effpop2);
+ al *= (- (long double)1);
+
+ al += sommeu; // al
+ alpbl += sommeu; // al + bl
+
+
+ //Sracinelocus += (Salleles / ((long double)2 * nblocus));
+ sommeal += al;
+ sommealpbl += alpbl;
+ }
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+ thetaw = sommeal / sommealpbl;
+
+ return ( - log ((long double)1 - thetaw));
+}
+
+
+long double DistancesGnt::r_dpopReynoldsLeast(unsigned long pop1,unsigned long pop2) const {
+
+ //distance de Reynolds (1983) entre 2 populations
+ // tir� de {Reynolds, J.} and {Weir, B.S.} and {Cockerham, C.}
+ // "Estimation of the coancestry coefficient: basis for a short-term genetic distance"
+ // Genetics society of America
+ // 105: 767-779.1983.
+
+ long double al, alpbl, bl;
+ long double sommealcarre(0);
+ long double sommeblcarre(0);
+ long double sommealbl(0);
+ long double sommeu(0);
+ long double thetal1(0);
+ long double thetal2(0);
+ long double alpha1(0), alpha2(0);
+ long double intermediaire;
+ long double effpop1(_tabPstrucpop[pop1]->get_nbind()), effpop2(_tabPstrucpop[pop2]->get_nbind());
+ // _nbpop => nombre de populations
+
+ unsigned long i, l, locus;
+ unsigned long nblocus(_VcalcLocus.size());
+ unsigned long nblocusdivise;
+ long double ** tabfreq1;
+ long double ** tabfreq2;
+ tabfreq1 = (_PtabFreq + (pop1 * _nbloc));
+ tabfreq2 = (_PtabFreq + (pop2 * _nbloc));
+
+ nblocusdivise = nblocus;
+
+ for (l = 0; l < nblocus; l++) {
+ // l numero du locus
+ locus = _VcalcLocus[l];
+ if ((_tabEviteLocus[(pop1 * _nbloc) + locus]) || (_tabEviteLocus[(pop2 * _nbloc) + locus])) {
+ nblocusdivise--;
+ continue;
+ }
+
+ //sommealcarre = 0;
+ //sommeblcarre = 0;
+ //sommealpbl = 0;
+ sommeu = 0;
+ alpha1 = 0;
+ alpha2 = 0;
+
+ for (i = 0; i < _tabNbAll[locus]; i++) {
+ //i numero de l'allele
+ if (_Pjeupop->_tabPloc[locus]->getPall(i)->_miss) continue;
+ //frequence de l'allele i dans la population 1
+ alpha1 += ( (*(tabfreq1[locus] + i)) * (*(tabfreq1[locus] + i)) );
+
+ //frequence de l'allele i dans la population 2
+ alpha2 += ( (*(tabfreq2[locus] + i)) * (*(tabfreq2[locus] + i)) );
+
+ intermediaire = ((*(tabfreq1[locus] + i)) - (*(tabfreq2[locus] + i)));
+ intermediaire *= intermediaire;
+ sommeu += intermediaire;
+ }
+ sommeu /= ((long double) 2);
+
+ alpha1 = (long double)1 - alpha1;
+ alpha2 = (long double)1 - alpha2;
+
+ al = (effpop1 * alpha1);
+ al += (effpop2 * alpha2);
+ al /= (((long double)4 * effpop1 * effpop2) * (effpop1 + effpop2 - (long double)1));
+
+ alpbl = (((long double)4 * effpop1 * effpop2) - effpop1 - effpop2);
+ alpbl *= al;
+
+ al *= (effpop1 + effpop2);
+ al *= (- (long double)1);
+
+ al += sommeu; // al
+ alpbl += sommeu; // al + bl
+ bl = alpbl - al; // bl
+
+
+ //Sracinelocus += (Salleles / ((long double)2 * nblocus));
+ sommealcarre += (al * al);
+ sommealbl += (al * bl);
+ sommeblcarre += (bl * bl);
+ }
+
+ if (nblocusdivise < 1) throw Anomalie(3);
+
+//cerr << "DistancesGnt::r_dpopReynoldsLeast" << endl;
+ //caclcul des 2 solutions possibles
+ intermediaire = (long double)2 * (sommeblcarre - sommealcarre);
+ al = (((long double)2 * sommealbl) + sommeblcarre + sommealcarre);
+ bl = sqrt(((sommealcarre - sommeblcarre)*(sommealcarre - sommeblcarre)) + ( (long double)4 * sommealbl * sommealbl) );
+ thetal1 = (al + bl) / intermediaire;
+ thetal2 = (al - bl) / intermediaire;
+
+//cerr << "numerateur de theta: " << intermediaire << endl;
+
+ // calcul des "Residual sum of squares" pour pouvoir choisir thetal1 ou thetal2
+ alpbl = ((long double)2 * sommealbl) + sommealcarre + sommeblcarre;
+
+ //al devient la Residual sum of squares 1
+ intermediaire = ((long double)1 - ((long double)2 * thetal1) + ((long double)2 * thetal1 * thetal1));
+
+//cerr << "numerateur de R1: " << intermediaire << endl;
+ al = ((alpbl * thetal1 * thetal1) - ((long double)2 * (sommealbl + sommealcarre) * thetal1) + sommealcarre) / intermediaire;
+
+ //bl devient la Residual sum of squares 2
+ intermediaire = ((long double)1 - ((long double)2 * thetal2) + ((long double)2 * thetal2 * thetal2));
+//cerr << "numerateur de R2: " << intermediaire << endl;
+ bl = ((alpbl * thetal2 * thetal2) - ((long double)2 * (sommealbl + sommealcarre) * thetal2) + sommealcarre) / intermediaire;
+
+ //calculs des distances:
+//cerr << "thetal1: " << thetal1 << " thetal2: " << thetal2 << endl;
+
+//cerr << "D1: " << thetal1 << " D2: " << thetal2 << endl;
+//cerr << "R1: " << al << " R2: " << bl << endl;
+ if ((al < bl) && (thetal1 < 1)) return (- log ((long double)1 - thetal1));
+ else if (thetal2 < 1) return (- log ((long double)1 - thetal2));
+ else throw Anomalie(5);
+}
diff --git a/src/distgnt.h b/src/distgnt.h
new file mode 100644
index 0000000..56c7a40
--- /dev/null
+++ b/src/distgnt.h
@@ -0,0 +1,177 @@
+
+/***************************************************************************
+ distgnt.h - Librairie d'objets permettant de manipuler
+ des distances entre populations
+ -------------------
+ begin : ven sep 01 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef DISTGNT_H
+#define DISTGNT_H
+
+#include <cmath>
+//#include<map>
+#include <time.h>
+
+#include "matrices.h"
+#include "jeupop.h"
+//class Arbre;
+
+// calculs de distances génétiques
+class DistancesGnt {
+public :
+ static const string & get_nom_methode(unsigned int methode);
+ static unsigned int get_nb_methodes();
+
+ DistancesGnt(int methode, bool square_distance, Jeupop * Pjeupop, unsigned int niveau=100);
+ ~DistancesGnt();
+
+ unsigned long get_nbind() const;
+
+
+private :
+ static void f_rempli_tab_noms_methodes();
+
+ void f_distgntpop (MatriceLD &resultat, Vecteur<unsigned int> *PVcalcLocus);
+ void f_distgntInd (MatriceLD &resultat, Vecteur<unsigned int> *PVcalcLocus);
+ void f_distgntpopDas(long double * Ptab) const;
+ void f_distgntpopVcalc(long double * Ptab) const;
+ void f_distgntIndVcalc (long double * Ptab) const;
+ void f_bootstrapIndividus(Arbre &arbreRef, int methodeArbre, unsigned int nbrepet, Vecteur<unsigned int> * PVcalcLocusRef);
+ void f_bootstrapLocus(Arbre &arbreRef, int methodeArbre, unsigned int nbrepet, Vecteur<unsigned int> * PVcalcLocus, bool sur_ind);
+ long double r_dist2pop(unsigned long pop1, unsigned long pop2) const;
+ long double r_dist2ind(unsigned long nbind1, unsigned long nbind2) const;
+ long double r_dist2ind(Individu* Pind1, Individu* Pind2) const;
+ long double r_allsimilnul(Individu * pind1, Individu * pind2) const;
+ long double r_distDasPsAi(unsigned long nbind1, unsigned long nbind2) const;
+ long double r_distDasPsAi(const Individu * Pind1, const Individu * Pind2) const;
+ long double r_distDasMoyPsAB(const StrucPop * Ppop1, const StrucPop * Ppop2) const;
+ long double r_distDasMoyPsA(const StrucPop * Ppop) const;
+
+ long double r_dpopCavalli(unsigned long pop1, unsigned long pop2) const;
+ long double r_dpopFst(unsigned long pop1,unsigned long pop2) const;
+// long double r_dpopFstClassique(long double ** tabfreq1,long double ** tabfreq2) const;
+ long double r_dpopGoldsteinASD(unsigned long pop1,unsigned long pop2) const;
+ long double r_dpopGoldsteinMu(unsigned long pop1,unsigned long pop2) const;
+ long double r_dpopNei(unsigned long pop1,unsigned long pop2, bool standard) const;
+ long double r_dpopNeiDa(unsigned long pop1,unsigned long pop2) const;
+ long double r_dpopPrevosti(unsigned long pop1,unsigned long pop2) const;
+ long double r_dpopRoger(unsigned long pop1,unsigned long pop2) const;
+ long double r_dpopShriver(unsigned long pop1,unsigned long pop2) const;
+ long double r_dpopZhivotovsky(unsigned long pop1,unsigned long pop2) const;
+ long double r_dpopReynoldsUnweighted(unsigned long pop1,unsigned long pop2) const;
+ long double r_dpopReynoldsWeighted(unsigned long pop1,unsigned long pop2) const;
+ long double r_dpopReynoldsLeast(unsigned long pop1,unsigned long pop2) const;
+
+ void f_calcTabFreq() const;
+ void f_calcTabFreqInd() const;
+ void f_calcTabFreqTot() const;
+ void f_calcTabFreqBootInd() const;
+ void f_calcTabMu() const;
+ void f_calcTabMuInd() const;
+ void f_calcTabMuBootInd() const;
+ void f_calcTabBootInd() const;
+ void newTabMu();
+ void newTabMuInd();
+ void newTabFreq();
+ void newTabFreqInd();
+ void newTabFreqTot();
+
+// static map<unsigned int, string> _map_noms_methodes;
+ static vector<string> _tab_noms_methodes;
+// static vector<unsigned int> _tab_numeros_methodes;
+
+ Vecteur<unsigned int> _VcalcLocus;
+ Vecteur<Locus*> _tabPloc;
+ vector<Individu*> _tabPind;
+ vector<StrucPop*> _tabPstrucpop;
+
+ Jeupop * _Pjeupop;
+ int _methode;
+ unsigned long _nbpop;
+ unsigned long _nbloc;
+ long double _pi;
+
+ long double ** _PtabFreq;
+ long double * _PtabFreqTot; // moyennes des fréquences allèliques sur toutes les pops
+ long double * _PtabMu;
+ unsigned long * _tabNbAll;
+ bool * _tabEviteLocus;// pour ne pas tenir compte des locus qui ne contiennent que des allèles nuls
+
+ bool _bootind;
+ bool _squareDistance;
+
+public:
+ friend class Jeupop;
+
+ struct Anomalie{
+ // 1-> _methode non précisée, calcul impossible
+ // 2-> Pas assez d'individus dans la pop pour calculer la distance
+
+ int le_pb;
+ Anomalie (int i, const string & nompop=""):le_pb(i){
+ switch (i) {
+ case 1:
+ _message = _("ERROR 1 in \"DistancesGnt\": The distance method was not precised");
+ break;
+ case 2:
+ _message = _("ERROR 2 in \"DistancesGnt\": Too few individuals in the population \"");
+ _message += nompop;
+ _message += _("\" to compute distances");
+ break;
+ case 3:
+ _message = _("ERROR 3 in \"DistancesGnt\": division by zero computing allelic frequencies for population \"");
+ _message += nompop;
+ _message += "\"";
+ break;
+
+ case 4:
+ //_message += "\"";
+ _message = _("ERROR 4 in \"DistancesGnt\": this distance method \"");
+ _message += nompop;
+ _message += "\" could not be applied to individuals";
+ break;
+
+ case 5:
+ //_message += "\"";
+ _message = _("ERROR 5 in \"DistancesGnt\": log of a negative number is not defined ");
+ //_message += nompop;
+ //_message += "\" could not be applied to individuals";
+ break;
+
+ case 6:
+ //_message += "\"";
+ _message = _("ERROR 6 in \"DistancesGnt\": this distance method does not exist ");
+ //_message += nompop;
+ //_message += "\" could not be applied to individuals";
+ break;
+
+ default:
+ _message = _("ERROR in \"DistancesGnt\"");
+ break;
+ }
+ };
+
+ string _message;
+
+ string& fmessage(){
+ return(_message);
+ }
+ };
+
+
+};
+
+#endif
+
diff --git a/src/fstat.cpp b/src/fstat.cpp
new file mode 100644
index 0000000..00004a1
--- /dev/null
+++ b/src/fstat.cpp
@@ -0,0 +1,131 @@
+/***************************************************************************
+ fstat.cpp - bibliotheque permettant de calculer et de
+ présenter les indices de Wright
+ -------------------
+ begin : Wed Oct 11 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+
+#include "fstat.h"
+
+Fstat::Fstat(MetaPop * Pmetapop):_Pmetapop(Pmetapop) {
+ _Pjeupop = _Pmetapop->get_Pjeu();
+}
+
+Fstat::~Fstat() {
+
+}
+
+void Fstat::f_affparlocus (ostream & sortie) const {
+
+//affichage simple
+ unsigned long nbloc (_Pjeupop->get_nbloc()),l;
+
+ try {
+ for (l=0;l < nbloc;l++) {
+ sortie << "locus: " << _Pjeupop->get_nomlocus(l) << endl;
+ sortie << "Fis: " << _Pmetapop->f_M_Fis(l);
+ sortie << " Fst: " << _Pmetapop->f_M_Fst(l);
+
+ sortie << " Fit: " << _Pmetapop->f_M_Fit(l) << endl << endl;
+ }
+ }
+ catch (StrucPop::Anomalie lepb) {
+ cerr << "exception dans strucpop: " << lepb.le_pb;
+ }
+}
+
+void Fstat::f_calcFstFisFit (MatriceLD & matrice, const MetaPop * Pmetapop) const {
+
+ unsigned long nbloc (_Pjeupop->get_nbloc()),l;
+
+ matrice.resize(6,nbloc);
+
+ //get_nbpop()
+
+// matrice._titre.push_back(_("generated by Populations "));
+// matrice._titre.back() += version_populations;
+ matrice._titre.push_back(_("Fis, Fst, Fit for one population ("));
+ if (Pmetapop == _Pmetapop) matrice._titre.back() += _("root");
+ else matrice._titre.back() += Pmetapop->get_nom();
+ matrice._titre.back() += _(") and ");
+ matrice._titre.back().AjEntier(Pmetapop->get_nbpop());
+ matrice._titre.back() += _(" subpopulations");
+ matrice._titre.push_back(_("locus by columns"));
+ matrice._titre.push_back(_("rows:"));
+ matrice._titre.push_back(_("Fis"));
+ matrice._titre.push_back(_("Fst"));
+ matrice._titre.push_back(_("Fit"));
+ matrice._titre.push_back(_("Ho --> observed heterozygosity (mean overall subpopulations)"));
+ matrice._titre.push_back(_("Hs --> expected heterozygosity (mean overall subpopulations)"));
+ matrice._titre.push_back(_("Ht --> total expected heterozygosity"));
+
+ matrice.SetFlag(3);
+ matrice.SetType(1);
+
+ matrice._tlig[0] = "Fis";
+ matrice._tlig[1] = "Fst";
+ matrice._tlig[2] = "Fit";
+ matrice._tlig[3] = "Ho";
+ matrice._tlig[4] = "Hs";
+ matrice._tlig[5] = "Ht";
+//affichage simple
+
+ try {
+ for (l=0;l < nbloc;l++) {
+ matrice._tcol[l] = _Pjeupop->get_nomlocus(l);
+ matrice.GetCase(0,l) = Pmetapop->f_M_Fis(l);
+ matrice.GetCase(1,l) = Pmetapop->f_M_Fst(l);
+ matrice.GetCase(2,l) = Pmetapop->f_M_Fit(l);
+ matrice.GetCase(3,l) = Pmetapop->f_Mheterozygotieobs(l);
+ matrice.GetCase(4,l) = Pmetapop->f_Mheterozygotieatt(l);
+ matrice.GetCase(5,l) = Pmetapop->f_Mheterozygotietotale(l);
+ //sortie << "locus: " << _Pjeupop->get_nomlocus(l) << endl;
+ //sortie << "Fis: " << _Pjeupop->_Pracinepops->f_M_Fis(l);
+ //sortie << " Fst: " << _Pjeupop->_Pracinepops->f_M_Fst(l);
+
+ //sortie << " Fit: " << _Pjeupop->_Pracinepops->f_M_Fit(l) << endl << endl;
+ }
+ }
+ catch (StrucPop::Anomalie lepb) {
+ cerr << "exception dans strucpop: " << lepb.le_pb;
+ }
+}
+
+void Fstat::f_calcFstFisFit (JeuMatriceLD & matrices) const {
+//calcul récursif de toutes les Fst, Fis, Fit possibles (pour les populations hiérarchisées
+ f_calcFstFisFit(matrices, _Pmetapop);
+
+}
+
+void Fstat::f_calcFstFisFit (JeuMatriceLD & matrices, const MetaPop * Pmetapop) const {
+//calcul récursif de toutes les Fst, Fis, Fit possibles (pour les populations hiérarchisées
+ unsigned int i;
+
+
+ // ajouter une matrice
+ if (Pmetapop == _Pmetapop) matrices.push_back(new(MatriceLD), _("root"));
+ else matrices.push_back(new(MatriceLD), Pmetapop->get_nom());
+
+
+ //remplir la matrice
+ f_calcFstFisFit (matrices.back(), Pmetapop);
+
+ //on fait le reste:
+ for (i=0; i < Pmetapop->get_nbmetapop(); i++) {
+ f_calcFstFisFit (matrices, Pmetapop->get_tabPmetapop(i));
+ }
+
+}
+
diff --git a/src/fstat.h b/src/fstat.h
new file mode 100644
index 0000000..31686b1
--- /dev/null
+++ b/src/fstat.h
@@ -0,0 +1,61 @@
+/***************************************************************************
+ fstat.h - bibliotheque permettant de calculer et de
+ présenter les indices de Wright
+ -------------------
+ begin : Wed Oct 11 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef FSTAT_H
+#define FSTAT_H
+
+#include"jeupop.h"
+#include"metapop.h"
+
+// calculs et affichage de Fstat
+class Fstat {
+public :
+ Fstat(MetaPop * Pmetapop);
+ ~Fstat();
+
+ void f_affparlocus (ostream & sortie) const;
+ //void f_calcFstFisFit (MatriceLD & matrice) const {f_calcFstFisFit (matrice, _Pmetapop);};
+ void f_calcFstFisFit (JeuMatriceLD & matrices) const;
+
+ void f_rempliVcalcStrucPop (unsigned int niveau) {
+ _Pjeupop->f_rempliVcalcStrucPop(niveau);
+
+ _tabPstrucpop = _Pjeupop->_VcalcStrucPop;
+ }
+
+private :
+ void f_calcFstFisFit (MatriceLD & matrice, const MetaPop * Pmetapop) const;
+ void f_calcFstFisFit (JeuMatriceLD & matrices, const MetaPop * Pmetapop) const;
+
+ MetaPop * _Pmetapop;
+ Jeupop * _Pjeupop;
+
+ vector<StrucPop*> _tabPstrucpop;
+
+public:
+
+ struct Anomalie{
+
+ int le_pb;
+ Anomalie (int i):le_pb(i){};
+ };
+
+
+};
+#endif
+
diff --git a/src/individu.cpp b/src/individu.cpp
new file mode 100644
index 0000000..72e1cbf
--- /dev/null
+++ b/src/individu.cpp
@@ -0,0 +1,415 @@
+/***************************************************************************
+ individu.cpp - description
+ -------------------
+ begin : Thu Sep 14 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+
+#include "individu.h"
+#include "population.h"
+#include "jeupop.h"
+
+
+void Individu::creation (Population * Ppop) {
+ _Ppop = Ppop;
+ _nploidie = Ppop->get_nploidie();
+ if (Ppop->get_nploidie() == 0) _nploidie = 0;
+ else _nploidie = Ppop->get_nploidie();
+ _tabPall.resize(Ppop->get_nbloc() * _nploidie);
+}
+
+//constructeur
+Individu::Individu (Population * Ppop) {
+
+ creation(Ppop);
+ _nom.assign("");
+}
+
+Individu::Individu (Population * Ppop, const string& nom) {
+
+ creation(Ppop);
+ _nom.assign(nom);
+}
+
+//destructeur
+Individu::~Individu () {
+//cerr << "Individu::~Individu ()" << endl;
+// delete [] _tabPall;
+}
+
+void Individu::resize_alleles() {
+
+ _nploidie = _Ppop->get_nploidie();
+ _tabPall.resize(_Ppop->get_nbloc() * _nploidie);
+}
+
+const Individu& Individu::operator= (const Individu & rval) {
+ unsigned long i; //index
+ unsigned long j; //locus
+ string nomlocus;
+ unsigned long nball(rval._tabPall.size());
+ unsigned long nploidie(_Ppop->get_nploidie());
+ unsigned long nbloc(_Ppop->get_nbloc());
+
+ if (_tabPall.size() != nball) throw Anomalie (1);
+
+
+ _nom = rval._nom;
+
+//cerr << "operator= individu debut " << _nom << endl;
+ for (j=0; j < nbloc; j ++) {
+ nomlocus = rval._Ppop->_Pjeu->get_nomlocus(j);
+ for (i=0; i < nploidie; i ++) {
+//cerr << "operator= individu numall " << (j*nploidie) + i << endl;
+ if (rval._tabPall[(j * nploidie) + i] == 0) {
+ _tabPall[(j * nploidie) + i] = (_Ppop->_Pjeu->get_Plocus(nomlocus))->getPallNul();
+ }
+ else {
+//cerr << "operator= individu nom de l'allele " << rval._tabPall[(j * nploidie) + i]->_nom << endl;
+ _tabPall[(j * nploidie) + i] = _Ppop->get_Pall(nomlocus, rval._tabPall[(j * nploidie) + i]->_nom);
+ }
+ }
+ }
+//cerr << "operator= individu fin" << endl;
+
+ return(*this);
+}
+
+bool Individu::r_estnul() const {
+ long i; //index
+ long nball(_tabPall.size());
+
+ for (i=0; i < nball; i ++) if (_tabPall[i]->_miss == false ) return (false);
+ return (true);
+}
+
+bool Individu::r_esthetero (unsigned long locus) const {
+ //lancer une exception si l'individu n'est pas diploide !!!!
+
+ unsigned long nploidie(_Ppop->get_nploidie());
+ unsigned long nbloc(_Ppop->get_nbloc());
+
+ if (locus >= nbloc) throw Anomalie(11);
+ if (nploidie != 2) throw Anomalie(12);
+
+ if ((_tabPall[(locus * 2)]->_miss)||(_tabPall[(locus * 2)+1]->_miss)) {
+ throw Anomalie(13);
+ return(false);
+ }
+ if (_tabPall[(locus * 2)] == _tabPall[(locus * 2) + 1]) return(false);
+ else return (true);
+
+}
+
+bool Individu::operator== (const Individu & rval) const {
+
+ //pas operationnel !!!!
+
+ unsigned long i; //index
+ unsigned long j; //locus
+ string nomlocus;
+ unsigned long nball(rval._tabPall.size());
+ unsigned long nploidie(_Ppop->get_nploidie());
+ unsigned long nbloc(_Ppop->get_nbloc());
+
+// cerr << "truc";
+ if (rval == 0) {
+// cerr << "truc";
+ nball = _tabPall.size();
+ for (i=0; i < nball; i ++) if (_tabPall[i]->_miss == false ) return (false);
+ return (true);
+ }
+
+ if (_tabPall.size() != nball) return (false);
+
+
+// _nom = rval._nom;
+
+ for (j=0; j < nbloc; j ++) {
+// nomlocus = rval._Ppop->_Pjeu->get_nomlocus(j);
+ for (i=0; i < nploidie; i ++) {
+ if (_tabPall[(j*nploidie) + i] != rval._tabPall[(j*nploidie) + i]) return (false);
+// _tabPall[(j*nploidie) + i] = _Ppop->get_Pall(nomlocus, rval._tabPall[(j*nploidie) + i]->_nom);
+ }
+ }
+
+ return(true);
+}
+
+
+Individu::Individu (const Individu & rval, Population * Ppop){
+ unsigned long i; //index
+ unsigned long j; //locus
+ string nomlocus;
+ unsigned long nball(rval._tabPall.size());
+//cerr << "Individu::Individu construct copie début "<< nball << endl;
+ unsigned long nploidie(Ppop->get_nploidie());
+//cerr << "Individu::Individu construct copie début "<< nball << endl;
+ unsigned long nbloc(Ppop->get_nbloc());
+
+//cerr << "Individu::Individu construct copie début " << endl;
+ _Ppop = Ppop;
+ resize_alleles();
+ if (_tabPall.size() != nball) throw Anomalie (1);
+
+ _nom = rval._nom;
+
+//cerr << "operator= individu debut " << _nom << endl;
+ for (j=0; j < nbloc; j ++) {
+ nomlocus = rval._Ppop->_Pjeu->get_nomlocus(j);
+ for (i=0; i < nploidie; i ++) {
+//cerr << "operator= individu numall " << (j*nploidie) + i << endl;
+ if (rval._tabPall[(j * nploidie) + i] == 0) {
+ _tabPall[(j * nploidie) + i] = (_Ppop->_Pjeu->get_Plocus(nomlocus))->getPallNul();
+ }
+ else {
+//cerr << "operator= individu nom de l'allele " << rval._tabPall[(j * nploidie) + i]->_nom << endl;
+ _tabPall[(j * nploidie) + i] = _Ppop->get_Pall(nomlocus, rval._tabPall[(j * nploidie) + i]->_nom);
+ }
+ }
+ }
+//cerr << "operator= individu fin" << endl;
+//cerr << "Individu::Individu construct copie fin " << endl;
+
+}
+
+
+void Individu::ifPlacerAllele(Locus* Ploc, long position, const Allele * Pall) {
+ // numall < nploidie
+// long position((Ploc->get_numloc()
+//cerr << "coucou 3" << endl;
+ if ((_tabPall[position] == 0) || (_tabPall[position]->_miss)) {
+ //on remplace, normal
+//cerr << "coucou 3 if" << endl;
+ _tabPall[position] = Ploc->getPall(Pall->get_nom());
+ }
+ else {
+ if (*_tabPall[position] == *Pall) {
+ //c'est bon
+ return;
+ }
+ else {
+ // ca veut dire qu'il y a un allele, et qu'il est different
+ // => pb, mais on ignore pour l'instant
+ return;
+ }
+ }
+}
+
+void Individu::ifFusionnerIndividu(const Individu& individu) {
+ unsigned long nbloc(_Ppop->get_nbloc());
+ unsigned long nploidie(_Ppop->get_nploidie());
+ unsigned long taille,i,j;
+ Locus * Ploc;
+// string nomloc;
+
+ taille = nbloc * nploidie;
+
+ while (_tabPall.size() < taille) {
+ _tabPall.push_back(0);
+ }
+//cerr << "coucou 1" << endl;
+
+ taille = individu._tabPall.size();
+ for (i = 0; i < taille; i += nploidie) {
+ Ploc = _Ppop->_Pjeu->get_Plocus(individu._tabPall[i]->get_NomLocus());
+//cerr << "coucou 2" << Ploc->get_nom() << endl;
+ for (j=0; j < nploidie; j++) {
+ ifPlacerAllele(Ploc,((Ploc->get_numloc() * nploidie) + j),individu._tabPall[i+j]);
+ }
+ }
+}
+
+
+unsigned long Individu::r_nballnonnuls(unsigned long locus, unsigned int nploidie) const {
+ // retourne le nb de copies d'allèles non nuls pour un locus
+ unsigned long resultat(0);
+ unsigned int j;
+
+ for (j=0;j < nploidie;j++) {
+ if (_tabPall[(locus * nploidie) + j]->_miss) continue;
+ resultat++;
+ }
+
+ return(resultat);
+}
+
+
+const string& Individu::get_nom_all(unsigned long numlocus, unsigned long numall) const {
+// unsigned long nploidie(_Ppop->get_nploidie());
+ unsigned long nbloc(_Ppop->get_nbloc());
+
+ if (numlocus >= nbloc) throw Anomalie(11);
+ if (numall >= _nploidie) throw Anomalie(12);
+
+ return(_tabPall[(numlocus * _nploidie) + numall]->get_Nom());
+}
+
+
+
+void Individu::affiche (ostream& sortie, int choix) const {
+ unsigned long i,j;
+ unsigned int nploidie(_Ppop->get_nploidie());
+
+ switch (choix) {
+ case 1:
+ //affichage d'un individu au format genepop
+ sortie << _nom << " ,";
+
+ for (i=0;i< _tabPall.size(); i+=2) {
+ sortie << " " << _tabPall[i]->_nom << _tabPall[i+1]->_nom;
+ }
+ break;
+
+ case 2:
+ //affichage d'un individu au format genepop en tenant compte des introgressions
+ sortie << _nom << " ,";
+
+ for (i=0;i< _tabPall.size(); i+=2) {
+ sortie << " ";
+ if (_Ppop->_tabAllIntrogressant.Existe(_tabPall[i])) {
+ sortie << "00";
+ }
+ else {
+ sortie << _tabPall[i]->_nom;
+ }
+ if (_Ppop->_tabAllIntrogressant.Existe(_tabPall[i+1])) {
+ sortie << "00";
+ }
+ else {
+ sortie << _tabPall[i+1]->_nom;
+ }
+ }
+ break;
+
+ case 3:
+ //affichage d'un individu au format populations en tenant compte des introgressions
+ sortie << _nom << " ,";
+
+ for (i=0;i< _tabPall.size(); i+=nploidie) {
+ for (j=0; j < nploidie; j++) {
+ if (j==0) sortie << " ";
+ else sortie << ":";
+ if (_Ppop->_tabAllIntrogressant.Existe(_tabPall[i+j])) {
+ sortie << "*";
+ }
+ if (_tabPall[i+j]->r_estnul()) {
+ sortie << "00";
+ }
+ else {
+ sortie << _tabPall[i+j]->_nom;
+ }
+ // sortie << _tabPall[i+j]->_nom;
+ }
+ }
+ break;
+ case 4:
+ //affichage d'un individu au format genetix
+ sortie << _nom;
+ for (i=0; i < (10 - _nom.size());i ++) sortie << " ";
+
+ for (i=0;i< _tabPall.size(); i+=2) {
+ if ((_tabPall[i]->r_estnul()) || (_tabPall[i+1]->r_estnul())) sortie << " 000000";
+ else {
+ sortie << " ";
+ if (_tabPall[i]->_nom.size() == 2) sortie << "0";
+ else if (_tabPall[i]->_nom.size() == 1) sortie << "00";
+ sortie << _tabPall[i]->_nom;
+ if (_tabPall[i+1]->_nom.size() == 2) sortie << "0";
+ else if (_tabPall[i+1]->_nom.size() == 1) sortie << "00";
+ sortie << _tabPall[i+1]->_nom;
+
+ }
+ }
+ break;
+ case 5:
+ //affichage d'un individu au format Fstat
+
+ for (i=0;i< _tabPall.size(); i+=2) {
+ if ((_tabPall[i]->r_estnul()) || (_tabPall[i+1]->r_estnul())) sortie << "\t0";
+ else sortie << "\t" << _tabPall[i]->_nom << _tabPall[i+1]->_nom;
+ }
+ break;
+ default:
+ break;
+ }
+
+}
+
+
+unsigned long Individu::get_nballnuls (unsigned long locus) const {
+ //retourne le nombre d'alleles nuls de l'individu pour le locus
+// long taille (_tabPall.size());
+ unsigned long i;
+// unsigned long nploidie(_Ppop->get_nploidie());
+ unsigned long resultat(0);
+
+ for (i = 0; i < _nploidie; i++) {
+ if (_tabPall[(locus * _nploidie) + i]->_miss) resultat++;
+ }
+ return(resultat);
+}
+/** Suppresssion d'un locus */
+void Individu::supprLocus(unsigned int numlocus){
+ unsigned int nbloc(_Ppop->get_nbloc());
+ unsigned int i;
+
+ if (numlocus >= nbloc) throw Anomalie(11);
+
+ for (i = 0; i < _nploidie; i ++) {
+ _tabPall.Suppr(numlocus * _nploidie);
+ }
+}
+
+void Individu::oPopulationsXML(unsigned int id, ostream & sortie, ostream & infos) const {
+ unsigned int i, j, nploidie(_Ppop->get_nploidie()), nbloc(_Ppop->get_nbloc());
+ biolib::vecteurs::ChaineCar idXML;
+
+ sortie << "<individual";
+ idXML = _Ppop->get_idXML();
+ idXML += "i";
+ idXML.AjEntier(id);
+ //set_idXML(idXML);
+ sortie << " id=\"" << idXML << "\"";
+ sortie << " nploidy=\"" << nploidie << "\"";
+ sortie << " name=\"" << get_nom() << "\"";
+ sortie << ">" << endl;
+
+ for (i=0; i < nbloc; i++) {
+ sortie << "<locus";
+ sortie << " allid=\"";
+ for (j=0; j < nploidie; j++) {
+ sortie << _tabPall[(i*nploidie)+j]->get_idXML();
+ if (j < (nploidie-1)) sortie << " ";
+ }
+ sortie << "\">";
+ sortie << "</locus>" << endl;
+ }
+
+ sortie << "</individual>" << endl;
+
+
+
+}
+
+void Individu::set_Pallele (Allele * Pall, unsigned int pos) {
+ unsigned int nploidie(get_nploidie());
+
+ if (pos >= nploidie) throw Anomalie(12);
+
+ pos = (Pall->get_Ploc()->get_numloc() * nploidie) + pos;
+
+ _tabPall[pos] = Pall;
+
+}
diff --git a/src/individu.h b/src/individu.h
new file mode 100644
index 0000000..5d999ad
--- /dev/null
+++ b/src/individu.h
@@ -0,0 +1,107 @@
+/***************************************************************************
+ individu.h - description
+ -------------------
+ begin : Thu Sep 14 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+// individu
+#ifndef INDIVIDU_H
+#define INDIVIDU_H
+
+#include "allele.h"
+
+using namespace biolib::vecteurs;
+
+class Individu {
+public :
+//
+ Individu (Population *);
+ Individu (Population * Ppop, const string& nom);
+ Individu (Population *, const ConstGnt &, int);
+
+ Individu (const Individu &, Population *);
+
+// Individu (int nball=0);
+ ~Individu();
+
+ const Individu& operator= (const Individu &);
+ bool operator== (const Individu &) const;
+ bool r_estnul () const;
+ bool r_esthetero (unsigned long locus) const;
+ inline unsigned long r_nbcopall(Allele * Pall) const {return(_tabPall.getNbOccurence(Pall));};
+ unsigned long r_nballnonnuls(unsigned long locus, unsigned int nploidie) const;
+
+ inline unsigned long get_nballnuls () const;
+ unsigned long get_nballnuls (unsigned long) const;
+ void set_Pallele (Allele * Pall, unsigned int pos);
+
+ inline const string& get_nom() const {return(_nom);};
+ unsigned int get_nploidie() const {return(_nploidie);};
+ const Vecteur<Allele*>& get_tabPall() const {return(_tabPall);};
+ const string& get_nom_all(unsigned long numlocus, unsigned long numall) const;
+
+ void resize_alleles();
+
+ void affiche (ostream&, int) const;
+
+ friend class Population;
+ friend class StrucPop;
+ friend class DistancesGnt;
+ friend class Allele;
+ friend class Jeupop;
+
+ void ifFusionnerIndividu(const Individu& individu);
+ void ifPlacerAllele(Locus* Ploc, long position, const Allele * Pall);
+
+ void oPopulationsXML(unsigned int id, ostream & sortie, ostream & infos) const;
+
+private :
+ void creation (Population * Ppop);
+ /** Suppresssion d'un locus */
+ void supprLocus(unsigned int);
+
+ string _nom;
+// char _nom[20];
+ Population * _Ppop;
+// unsigned long _nball; //nb allèles= nb de loci* n ploidie
+ unsigned int _nploidie;
+ Vecteur<Allele*> _tabPall;
+
+public:
+ struct Anomalie{
+ // 1-> copie impossible: pas le meme nombre d'alleles
+ // 11-> numero de locus inexistant
+ // 12-> numéro d'allele inexistant
+ // 13-> un allele nul fausse la determination de l'heterozygotie de l'individu pour un locus
+ int le_pb;
+ Anomalie (int i):le_pb(i){};
+ };
+
+};
+
+
+inline unsigned long Individu::get_nballnuls () const {
+ //retourne le nombre d'alleles nuls de l'individu
+ unsigned long taille (_tabPall.size());
+ unsigned long i;
+ unsigned long resultat(0);
+
+ for (i = 0; i < taille; i++) {
+ if (_tabPall[i]->_miss) resultat++;
+ }
+ return(resultat);
+}
+
+#endif
+
diff --git a/src/internat.h b/src/internat.h
new file mode 100644
index 0000000..5d12cc3
--- /dev/null
+++ b/src/internat.h
@@ -0,0 +1,52 @@
+ /***************************************************************************
+ internat.h - description
+ -------------------
+ begin : Thu Sep 21 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+//internationalisation
+#ifndef INTERNAT_H
+# define INTERNAT_H
+# ifdef MINGW32
+# define OLIV_INTERNAT 0
+# endif
+# ifdef OLIV_INTERNAT
+# include <locale.h>
+//# include <libintl.h>
+# define _(String) (String)
+# define gettext(String) (String)
+# define textdomain(String) (String)
+# define setlocale(String1, String2) (String1, String2)
+# define bindtextdomain(String1, String2) (String1, String2)
+# define LOCALEDIR ""
+//# define LC_ALL ""
+//# define LC_NUMERIC ""
+# define PACKAGE ""
+# else
+# ifndef _LOCALE_H
+# include <locale.h>
+# ifndef LOCALEDIR
+# define LOCALEDIR "/usr/share/locale"
+# endif
+# endif
+# ifndef _LIBINTL_H
+# include <libintl.h>
+# ifndef _
+# define _(String) gettext (String)
+# endif
+# endif
+# endif
+#endif
+
+
diff --git a/src/jeupop.cpp b/src/jeupop.cpp
new file mode 100644
index 0000000..e70de3e
--- /dev/null
+++ b/src/jeupop.cpp
@@ -0,0 +1,1676 @@
+/***************************************************************************
+ jeupop.cpp - Librairie d'objets permettant de manipuler des donn�es
+ sp�cifiques aux populations
+ -------------------
+ begin : ven sep 06 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+
+
+#include "jeupop.h"
+#include "distgnt.h"
+
+//constructeur
+Jeupop::Jeupop () {
+
+//cerr << "Jeupop::Jeupop () debut" << endl;
+
+
+ _nbpop = 0;
+ _nbloc = 0;
+ _nploidie = 0;
+
+ _tabPpop.resize(0);
+ _tabPloc.resize(0);
+
+ _Pracinepops = new MetaPop(this);
+//cerr << "Jeupop::Jeupop () fin" << endl;
+}
+
+/*Jeupop::Jeupop (long nbpop, long nbloc) {
+ long i;
+
+
+ _nbpop = nbpop;
+ _nbloc = nbloc;
+ _nploidie = 0;
+
+ _tabPpop.resize(0);
+ _tabPloc.resize(0);
+// _tabPpop = new (Population*[nbpop]);
+// _tabPloc = new (Locus*[nbloc]);
+
+ for (i=0;i < nbpop;i++) _tabPpop.push_back(new Population (this));
+ for (i=0;i < nbloc;i++) _tabPloc.push_back(new Locus (this,0));
+
+ _Pracinepops = new MetaPop(this);
+
+}
+*/
+Jeupop::Jeupop(const Jeupop& original) {
+ //constructeur de copies
+ unsigned long i;
+
+//cerr << "Jeupop::Jeupop construct copie debut " << endl;
+ _nploidie = original.get_nploidie();
+ _commentaires = original._commentaires;
+
+//cerr << "Jeupop::Jeupop construct delete _Pracine " << endl;
+// delete _Pracinepops;
+//cerr << "Jeupop::Jeupop construct delete _Pracine " << endl;
+ _tabPpop.resize(0);
+//cerr << "Jeupop::Jeupop construct delete _Pracine " << endl;
+// for (i=0;i < _tabPloc.size();i++) delete (_tabPloc[i]);
+ _tabPloc.resize(0);
+
+
+ _nbloc = original.get_nbloc();
+ for (i=0;i < _nbloc;i++) {
+//cerr << "Jeupop::Jeupop construct copie locus " << endl;
+ _tabPloc.push_back(new Locus (*original._tabPloc[i], this));
+ }
+
+//cerr << "Jeupop::Jeupop construct copie metapop " << endl;
+ _Pracinepops = new MetaPop(*original._Pracinepops,0, this);
+//cerr << "Jeupop::Jeupop construct copie fin " << endl;
+}
+
+//destructeur
+Jeupop::~Jeupop () {
+ unsigned long i;
+
+ //for (i=0;i < _tabPpop.size();i++) delete (_tabPpop[i]);
+ for (i=0;i < _tabPloc.size();i++) delete (_tabPloc[i]);
+
+ delete _Pracinepops;
+}
+
+
+void Jeupop::reset() {
+
+ unsigned long i;
+
+//cerr << "Jeupop::reset(long nbpop, long nbloc) debut"<< endl;
+ _nbloc = _tabPloc.size();
+ delete _Pracinepops;
+ _tabPpop.resize(0);
+ _nbpop = 0;
+
+ for (i=0;i < _nbloc;i++) delete (_tabPloc[i]);
+ _nbloc = 0;
+ _tabPloc.resize(0);
+ _VcalcStrucPop.resize(0);
+ _VcalcLocus.resize(0);
+
+
+ _Pracinepops = new MetaPop(this);
+
+//cerr << "Jeupop::reset(long nbpop, long nbloc) fin" << endl;
+
+}
+
+
+void Jeupop::oGenepopCano(ostream& sortie) const{
+ //�criture de fichiers au format genepop
+ // type canonique (avec Pop nomdepop)
+// pas adapt�e � un traitement sur fichiers haploides
+ unsigned long i,j;
+ char car(0);
+ unsigned long nbpop(get_nbpop());
+ unsigned long nbloc(get_nbloc());
+ unsigned long nbind;
+ int format(1);
+
+ if (_nploidie != 2) {
+ //le format Genepop ne permet que le stockage de pop diplo�des
+ throw Anomalie(1);
+ }
+
+ if (!(f_verifnum(1))) {
+ //il faut renum�roter les all�les pour le format genepop
+ throw Anomalie(2);
+ }
+
+
+ //commentaires
+ car = '"';
+ if (_commentaires.size() == 0) sortie << car << endl;
+ else {
+ sortie << _commentaires.get_titre(0) << endl;
+ for (i=1; i < _commentaires.size(); i++) {
+ sortie << car << _commentaires.get_titre(i) << endl;
+ }
+ }
+
+ //nom des locus
+ for (i=0; i < nbloc;i++) {
+ sortie << _tabPloc[i]->get_nom() << endl ;
+ }
+
+ // populations
+ for (i=0; i < nbpop;i++) {
+ sortie << "POP " << _tabPpop[i]->get_nom_chemin() << endl ;
+ // individus
+ if (_tabPpop[i]->_tabAllIntrogressant.size() > 0) format = 2;
+ else format = 1;
+
+
+ nbind = _tabPpop[i]->get_nbind();
+ for (j=0; j < nbind;j++) {
+ _tabPpop[i]->_tabPind[j]->affiche(sortie,format);
+ sortie << endl;
+ }
+ }
+
+}
+
+void Jeupop::oGenepop(ostream& sortie) const{
+ //�criture de fichiers au format genepop
+// pas adapt�e � un traitement sur fichiers haploides
+ long i,j;
+ char car;
+ long nbpop(get_nbpop());
+ long nbloc(get_nbloc());
+ long nbind;
+ int format(1);
+
+ if (_nploidie != 2) {
+ //le format Genepop ne permet que le stockage de pop diplo�des
+ throw Anomalie(1);
+ }
+
+ if (!(f_verifnum(1))) {
+ //il faut renum�roter les all�les pour le format genepop
+ throw Anomalie(2);
+ }
+
+
+ //nom des populations
+ car = '"';
+ sortie << car;
+
+ i = 0;
+ for (i=0; i < (nbpop-1);i++) {
+ sortie << _tabPpop[i]->get_nom() << ";" ;
+ }
+ sortie << _tabPpop[i]->get_nom() << car << endl;
+
+
+ //nom des locus
+ for (i=0; i < nbloc;i++) {
+ sortie << _tabPloc[i]->get_nom() << endl ;
+ }
+
+ // populations
+ for (i=0; i < nbpop;i++) {
+ sortie << "POP" << endl ;
+ // individus
+ if (_tabPpop[i]->_tabAllIntrogressant.size() > 0) format = 2;
+ else format = 1;
+
+ nbind = _tabPpop[i]->get_nbind();
+ for (j=0; j < nbind;j++) {
+ _tabPpop[i]->_tabPind[j]->affiche(sortie,format);
+ sortie << endl;
+ }
+ }
+
+}
+
+void Jeupop::oPopulations(ostream& sortie) const{
+ //�criture de fichiers au format populations
+// adapt� � toutes les ploidies
+ unsigned long i,j;
+ char car;
+ unsigned long nbpop(get_nbpop());
+ unsigned long nbloc(get_nbloc());
+ unsigned long nbind;
+ int format(3);
+
+ //commentaires
+//cerr << "Jeupop::oPopulations(ostream& sortie)" << _commentaires.size() << "comm size" << endl;
+ car = '"';
+ if (_commentaires.size() == 0) sortie << car << endl;
+ else {
+ for (i=0; i < _commentaires.size(); i++) {
+ sortie << car << _commentaires.get_titre(i) << endl;
+ }
+ }
+
+// sortie << _tabPpop[i]->get_nom() << car << endl;
+
+
+ //nom des locus
+ for (i=0; i < nbloc;i++) {
+ sortie << _tabPloc[i]->get_nom() << endl ;
+ }
+//cerr << "Jeupop::oPopulations(ostream& sortie) 2" << endl;
+
+ // populations
+ for (i=0; i < nbpop;i++) {
+ sortie << "POP " << _tabPpop[i]->get_nom_chemin() << endl ;
+//cerr << "Jeupop::oPopulations(ostream& sortie) pop " << _tabPpop[i]->get_nom_chemin() << endl;
+ // individus
+ nbind = _tabPpop[i]->get_nbind();
+//cerr << "Jeupop::oPopulations(ostream& sortie) nbind " << nbind << endl;
+ for (j=0; j < nbind;j++) {
+ _tabPpop[i]->_tabPind[j]->affiche(sortie,format);
+ sortie << endl;
+ }
+ }
+//cerr << "Jeupop::oPopulations(ostream& sortie) 3" << endl;
+
+}
+
+void Jeupop::oImmanc(ostream& sortie) const{
+ //format d'entr�e pour :
+ //Immanc - detects individual that are immigrants or have recent immigrant ancestry
+ //by using multilocus genotypes.
+ //Version 5.0, released October 8, 1998
+ //Reference: Rannala, B., and J.L., Mountain. 1997. Detecting immigration by using
+ //multilocus genotypes. Proceedings of the National Academy of Sciences USA 94:
+ //9197-9201.
+
+// pas adapt�e � un traitement sur fichiers haploides
+ if (_nploidie != 2) {
+ //le format Immanc ne permet que le stockage de pop diplo�des
+ throw Anomalie(1);
+ }
+
+ if (!(f_verifnum(1))) {
+ //il faut renum�roter les all�les pour le format Immanc
+ throw Anomalie(2);
+ }
+
+ long i,j,k, nbind, nbloc(get_nbloc()), nbpop(get_nbpop());
+ string nomloc;
+ string nompop;
+ for (i=0; i< nbloc-1;i++) {//scan de chaque locus
+ nomloc = _tabPloc[i]->_nom;
+ for (j=0; j< nbpop;j++) {//scan des pops
+ nompop = _tabPpop[j]->get_nom();
+ nbind = _tabPpop[j]->get_nbind();
+ for (k=0; k < nbind;k++) {// scan des individus
+ //nom de l'ind, nom de la pop, nom du locus, les 2 all�les
+ sortie << " " << _tabPpop[j]->_tabPind[k]->_nom;
+ sortie << " " << nompop;
+ sortie << " " << nomloc;
+ sortie << " " << _tabPpop[j]->_tabPind[k]->_tabPall[i * 2]->_nom;
+ sortie << " " << _tabPpop[j]->_tabPind[k]->_tabPall[(i * 2) + 1]->_nom;
+ sortie << " " << endl;
+ }
+ }
+ }
+}
+
+void Jeupop::oMsat(ostream& sortie) const{
+ //format d'entr�e pour :
+ //distances microsat de D. Goldstein
+
+ if (!(f_verifnum(2))) {
+ //les noms d'alleles ne correspondent pas a des tailles de microsat
+ throw Anomalie(2);
+ }
+
+ // 1 ligne = 1 allele, d'un locus d'un individu
+
+ long i,j,k,l , nbind, nbloc(get_nbloc()), nbpop(get_nbpop());
+ long nploidie(get_nploidie());
+ string nomind;
+ string nomloc;
+ string nomall;
+
+ Individu * Pind;
+
+ for (i=0; i< nbpop;i++) {//scan des pops
+ nbind = _tabPpop[i]->get_nbind();
+ for (j=0; j< nbind;j++) {// scan des individus
+ // nomind = _tabPpop[i]->_tabPind[j]->get_nom();
+ Pind = _tabPpop[i]->_tabPind[j];
+ nomind = Pind->get_nom();
+
+ for (k=0; k < nbloc;k++) {// scan des locus
+ nomloc = _tabPloc[k]->_nom;
+
+ for (l=0; l < nploidie;l++) {// scan des alleles
+ nomall = Pind->get_nom_all(k,l);
+ //nom de l'ind, nom de la pop, nom du locus, les 2 all�les
+ sortie << nomind << " " << nomloc << " " << nomall << endl;
+ }
+ }
+ }
+ }
+}
+
+void Jeupop::oMsatFreq(ostream& sortie) const{
+ //format d'entr�e pour :
+ //distances microsat de D. Goldstein
+
+ if (!(f_verifnum(2))) {
+ //les noms d'alleles ne correspondent pas a des tailles de microsat
+ throw Anomalie(2);
+ }
+
+ // 1 ligne = 1 allele, d'un locus d'un individu
+
+ long i,k,l , nball, nbloc(get_nbloc()), nbpop(get_nbpop());
+// long nploidie(get_nploidie());
+ string nompop;
+ string nomloc;
+ string nomall;
+
+// Individu * Pind;
+
+ for (i=0; i< nbpop;i++) {//scan des pops
+ nompop = _tabPpop[i]->get_nom();
+
+
+ for (k=0; k < nbloc;k++) {// scan des locus
+ nomloc = _tabPloc[k]->_nom;
+ nball = _tabPloc[k]->get_nball();
+
+ for (l=0; l < nball;l++) {// scan des alleles
+ nomall = _tabPloc[k]->_tabPall[l]->get_Nom();
+ //nom de l'ind, nom de la pop, nom du locus, les 2 all�les
+ sortie << nompop << " " << nomloc << " " << nomall << endl;
+ sortie << " " << _tabPpop[i]->r_nbcopall(_tabPloc[k]->_tabPall[l]) << endl;
+ }
+ }
+ }
+}
+
+/*int Jeupop::r_allcommun(Individu * pind1, Individu * pind2, unsigned int numlocus) const{
+ //renvoi du nombre d'all�les en commun
+ // fonctionne pour N ploides
+ Vecteur<Allele*> tabPall1;
+ unsigned int i,j;
+ long pos;
+
+ j = numlocus * _nploidie;
+
+ for (i = 0; i < _nploidie; i++) {
+ tabPall1.push_back(pind1->_tabPall[i+j]);
+ }
+
+ for (i = 0; i < _nploidie; i++) {
+ pos = tabPall1.Position(pind2->_tabPall[i+j]);
+ if (pos != -1) tabPall1.Suppr(pos);
+ }
+
+ return (_nploidie - tabPall1.size());
+}
+*/
+/*
+int Jeupop::r_allcommunnul(Individu * pind1, Individu * pind2, int numlocus) const{
+ //renvoi du nombre d'all�les en commun
+ // saute les all�les nuls
+ // fonctionne pour N ploides
+ Vecteur<Allele*> tabPall1;
+ unsigned int i,j;
+ int pos;
+
+ j = numlocus * _nploidie;
+
+ for (i = 0; i < _nploidie; i++) {
+ tabPall1.push_back(pind1->_tabPall[i+j]);
+ }
+
+ for (i = 0; i < _nploidie; i++) {
+ if (pind2->_tabPall[i+j]->_nul) {}
+ else {
+ pos = tabPall1.Position(pind2->_tabPall[i+j]);
+ if (pos != -1) tabPall1.Suppr(pos);
+ }
+ }
+
+ return (_nploidie - tabPall1.size());
+}
+*/
+/*
+long Jeupop::r_allcommunnul(Individu * pind1, Individu * pind2) const{
+ //renvoi du nombre d'all�les en commun
+ // saute les all�les nuls
+ // fonctionne pour N ploides
+ Vecteur<Allele*> tabPall1;
+ int i,pos;
+ long taille;
+
+ taille = pind2->_tabPall.size();
+
+ tabPall1 = pind1->_tabPall;
+
+ for (i = 0; i < taille; i++) {
+ if (pind2->_tabPall[i]->_nul) {}
+ else {
+ pos = tabPall1.Position(pind2->_tabPall[i]);
+ if (pos != -1) tabPall1.Suppr(pos);
+ }
+ }
+
+ return (taille - tabPall1.size());
+}
+*/
+
+void Jeupop::f_rarefaction(MatriceLD& resultat, int effectif) const {
+
+ //calcul de la nouvelle diversit� all�lique, pour un �chantillon
+ // r�duit: r�sultats stock�s dans Matrice, int => effectif r�duit
+ long i,j;
+// char temp[10];
+ int nbloc(get_nbloc());
+ int nbpop(get_nbpop());
+
+ resultat.resize(nbpop,nbloc);
+
+ resultat._titre.push_back("Nouvelle diversit� all�lique pour un effectif r�duit de : ");
+
+// resultat._titre[resultat._titre.size()-1] += itoa(effectif,temp,10);
+ resultat._titre[resultat._titre.size()-1].AjEntier(effectif);
+ resultat.SetType(1);
+ resultat.SetFlag(3);
+
+ for (i=0;i<nbloc;i++) {
+ resultat._tcol[i] = _tabPloc[i]->_nom;
+ }
+
+ for (j=0;j<nbpop;j++) {
+ resultat._tlig[j] = _tabPpop[j]->_nom;
+
+ for (i=0;i<nbloc;i++) {
+ resultat.GetCase(j,i) = _tabPpop[j]->r_rare(effectif,i);
+// cerr << "coucou";
+ }
+ }
+}
+
+
+
+const string & Jeupop::get_nomlocus(long nblocus) const {
+ // donne le nom du locus nblocus
+ return (_tabPloc[nblocus]->get_nom());
+}
+
+const string & Jeupop::get_nompop(long nbpop) const{
+ // donne le nom de la populations nbpop
+ return (_tabPpop[nbpop]->get_nom());
+
+}
+
+Locus* Jeupop::get_Plocus(const string & nom) const{
+ // donne un pointeur sur le locus du nom 'nom'
+ Locus* res;
+ unsigned long i;
+
+ res = 0;
+ for (i=0; i < _tabPloc.size(); i++) {
+ if(_tabPloc[i]->_nom == nom) {
+ res = _tabPloc[i];
+ break;
+ }
+ }
+ if (res == 0) throw Anomalie(8);
+
+ return (res);
+}
+
+Locus* Jeupop::get_Plocus(unsigned long i) const {
+ // donne le pointeur sur le locus i
+ if (i >= _tabPloc.size()) throw Anomalie(8);
+
+ return (_tabPloc[i]);
+}
+
+Population* Jeupop::get_Ppop(string & nom) const{
+ // donne un pointeur sur le locus du nom 'nom'
+ Population* res;
+ unsigned long i;
+
+ res = 0;
+ for (i=0; i < _tabPpop.size(); i++) {
+ if(_tabPpop[i]->_nom == nom) {
+ res = _tabPpop[i];
+ break;
+ }
+ }
+ if (res == 0) throw Anomalie(9);
+
+ return (res);
+}
+
+Population* Jeupop::get_Ppop(unsigned long p) const{
+ // donne un pointeur sur la population p
+ if (p >= _tabPpop.size()) throw Anomalie(9);
+
+ return (_tabPpop[p]);
+}
+
+/*
+long double Jeupop::r_dist2pop(long double ** tabFreq1, long double ** tabFreq2, long * tabNbAll, Population * ppop1, Population * ppop2, int methode) const {
+ //renvoi de la distance entre 2 Populations
+ long double resultat(0);
+ long double somme;
+ long nbpop1(ppop1->get_nbind()), nbpop2(ppop2->get_nbind());
+ long calcsomme(ppop1->get_nbind() * ppop2->get_nbind());
+ long i,j;
+
+ if (methode < 100) {
+ //distance entre populations bas�e sur distances entre individus
+ somme = 0;
+ for (i=0; i < nbpop1; i++) { //scan des individus de la pop1
+ for (j=0; j < nbpop2; j++) { //scan des individus de la pop2
+ try {
+ somme += r_dist2ind(ppop1->get_Pind(i), ppop2->get_Pind(j), methode);
+ }
+ catch (Anomalie erreur) {
+ if (erreur.le_pb == 6) calcsomme--;
+ }
+ }
+ }
+
+ if (calcsomme < 1) return (0);
+ resultat = somme / calcsomme;
+ }
+ else {
+ switch (methode) {
+ case 101:
+ // Nei's minimum genetic distance (1972)
+ resultat = r_dpopNei(tabFreq1, tabFreq2, tabNbAll, false);
+ break;
+ case 102:
+ // Nei's standard genetic distance (1972)
+ resultat = r_dpopNei(tabFreq1, tabFreq2, tabNbAll, true);
+ break;
+ case 103:
+ // Cavalli-Sforza and Edwards' (1967)
+ resultat = r_dpopCavalli(tabFreq1, tabFreq2, tabNbAll);
+ break;
+
+ case 104:
+ // Nei et al's, Da (1983)
+ resultat = r_dpopNeiDa(tabFreq1, tabFreq2, tabNbAll);
+ break;
+ case 106:
+ // Goldstein et al. (1995a)
+ resultat = r_dpopGoldsteinMu(tabFreq1, tabFreq2, tabNbAll);
+ break;
+ case 107:
+ // Latter's Fst (1972)
+ resultat = r_dpopFst(tabFreq1, tabFreq2, tabNbAll);
+ break;
+ case 108:
+ // Prevosti et al.'s, Cp (1975)
+ resultat = r_dpopPrevosti(tabFreq1, tabFreq2, tabNbAll);
+ break;
+ case 109:
+ // Rogers', Dr (1972)
+ resultat = r_dpopRoger(tabFreq1, tabFreq2, tabNbAll);
+ break;
+ case 110:
+ // Goldstein et al. (1995b) Slatkin 1995
+ resultat = r_dpopGoldsteinASD(tabFreq1, tabFreq2, tabNbAll);
+ break;
+ case 111:
+ // Shriver et al's, Dsw (1995)
+ resultat = r_dpopShriver(tabFreq1, tabFreq2, tabNbAll);
+ break;
+
+ }
+ }
+
+ return resultat;
+}
+*/
+
+
+istream& operator>>(istream& ientree,Jeupop& LesPops) {
+ int nbformat(5),i(1);
+ char car;
+ bool autre(true);
+
+ ientree.get(car);
+ if (ientree.fail()) {
+ cerr << _("The file is not readable... ") << endl;
+ throw Jeupop::Anomalie(5);
+ }
+ while ((autre) && (i < nbformat)) {
+ try {
+ ientree.clear();
+ ientree.seekg(0);
+ LesPops.iFichier(ientree,i);
+
+ autre = false;
+ }
+ catch (Jeupop::Anomalie erreur) {
+ if (erreur.le_pb > 0) {
+ autre = true;
+ if (i == (nbformat-1)) {
+ cerr << _("unknown file format") << endl;
+ autre = false;
+ throw Jeupop::Anomalie(5);
+ }
+ erreur.le_pb = 0;
+ }
+ }
+ i++;
+ }
+
+ return (ientree);
+}
+
+void Jeupop::iFichier(istream & entree, int i) {
+//cerr << "Jeupop::iFichier debut " << i << endl;
+ switch (i) {
+ case 1:
+ iPopulationsXML(entree);
+// set_nploidie(_nploidie);
+ return;
+ case 2:
+ iGenepop(entree);
+// set_nploidie(_nploidie);
+ return;
+ case 3:
+ iPopulations(entree);
+// set_nploidie(_nploidie);
+ return;
+ case 4:
+ iGenetix(entree);
+// set_nploidie(_nploidie);
+ return;
+ default:
+ return;
+ }
+}
+
+
+void Jeupop::iGenepop(istream &fichier){
+ //lecture de fichiers au format genepop
+// pas adapt�e � un traitement sur fichiers haploides
+
+//cerr << "Jeupop::iGenepop debut" << endl;
+ ChaineFicPop lecturePop(fichier);
+ biolib::vecteurs::ChaineCar mot;
+ biolib::vecteurs::ChaineCar nomall1;
+ biolib::vecteurs::ChaineCar nomall2;
+
+ Titre titres;
+
+ Population * Ppop;
+ Individu * Pind;
+
+ unsigned int nbloc,i,j;
+ unsigned int nbdigits(0);
+
+//cerr << "Jeupop::iGenepop debut2" << endl;
+ // lecture des commentaires
+ try {
+ lecturePop.get_titre(_commentaires);
+ }
+ catch (ChaineFicPop::Anomalie pb) {
+ throw Anomalie(4);
+ }
+//cerr << "Jeupop::iGenepop get_titre " << _commentaires[0] << endl;
+
+ reset();
+
+ // lecture des locus
+ try {
+ lecturePop.get_locus(titres);
+ }
+ catch (ChaineFicPop::Anomalie pb) {
+ throw Anomalie(4);
+ }
+ nbloc = titres.size();
+
+ for (i=0; i < nbloc; i++) {
+ _tabPloc.push_back(new Locus(this, 0));
+ _tabPloc.back()->set_nom(titres[i]);
+ }
+//cerr << "Jeupop::iGenepop locus " << titres[0] << " " << nbloc << " " << _tabPloc.size() << endl;
+
+
+ //lecture des populations
+// _nploidie = 2;
+ set_nploidie(2);
+
+ while (lecturePop.estunepop()) {
+ //creation d'une nouvelle population
+//cerr << "Jeupop::iGenepop get_nompop(mot) " << mot << endl;
+ lecturePop.get_nompop(mot);
+//cerr << "Jeupop::iGenepop get_nompop(mot) " << mot << endl;
+
+ Ppop = NewPop(mot);
+//cerr << "Jeupop::iGenepop get_nompop(mot) " << mot << endl;
+
+ try {
+ if (lecturePop.get_lignepop()==1) break;
+ }
+ catch (ChaineFicPop::Anomalie pb) {
+ throw Anomalie(4);
+ }
+ while (lecturePop.estunindividu()) {
+ //creation d'un nouvel individu
+ lecturePop.get_nomind(mot);
+ Pind = new Individu(_tabPpop.back(), mot);
+ Ppop->AjouterIndividu(Pind);
+
+ lecturePop.get_alleles(titres);
+
+ if (titres.size() != nbloc) {//erreur
+ cout << endl;
+ cout << _("error in data file.") << endl;
+ cout << _("wrong number of locus at line : ") << lecturePop.get_numeroligne() << endl;
+
+ throw Anomalie(4);
+ }
+
+ //enregistrement de chaque locus
+ for (i=0; i < nbloc; i++) {
+ mot = titres[i];
+ if (nbdigits == 0) nbdigits = (mot.size() / 2);
+ if (nbdigits == 1) {
+ throw Anomalie(4);
+ }
+ if (mot.size() != (nbdigits * 2)) {
+ throw Anomalie(4);
+ }
+ if (mot.EstUnChiffre() == false) {
+ throw Anomalie(4);
+ }
+
+ nomall1.assigner(mot, 0, nbdigits - 1);
+ nomall2.assigner(mot, nbdigits, (nbdigits * 2) - 1);
+
+ Pind->_tabPall[i*2] = _tabPloc[i]->getPall(nomall1);
+ if (Pind->_tabPall[i*2] == 0) {
+ Pind->_tabPall[i*2] = new Allele(_tabPloc[i], nomall1);
+ _tabPloc[i]->_tabPall.push_back(Pind->_tabPall[i*2]);
+ }
+
+ Pind->_tabPall[i*2 + 1] = _tabPloc[i]->getPall(nomall2);
+ if (Pind->_tabPall[i*2 + 1] == 0) {
+ Pind->_tabPall[i*2 + 1] = new Allele(_tabPloc[i], nomall2);
+ _tabPloc[i]->_tabPall.push_back(Pind->_tabPall[i*2 + 1]);
+ }
+ }
+
+ try {
+ if (lecturePop.get_lignepop()==1) break;
+// lecturePop.get_lignepop();
+ }
+ catch (ChaineFicPop::Anomalie pb) {
+ throw Anomalie(4);
+ }
+ }//lecture est un individu
+ }
+
+ // traitement sp�cifique au cas des fichiers JM Cornuet
+ if (lecturePop.get_boolnompop() == false) { //il n'y avait pas de noms de pop
+ // derriere le mot cle pop => tentative d'extraction style JMC
+//cerr << "coucou";
+
+ // lecture des noms de populations dans les commentaires
+ for (i=0,j=0; i < _commentaires.size(); i++) {
+//cerr << "coucou " << _commentaires[i].GetNbMots(",") << " " << _tabPpop.size();
+ if (_commentaires[i].GetNbMots(",") == _tabPpop.size()) {
+ //extraction des noms;
+ for (j=0; j < _tabPpop.size(); j++) {
+ _commentaires[i].GetMot(j+1,_tabPpop[j]->_nom,",");
+ }
+ break;
+ }
+ }
+
+ if (j == 0) {
+ //il n'y a vraiment pas de noms... on num�rote
+ for (i=0; i < _tabPpop.size(); i++) {
+ if (_tabPpop[i]->_nom == "") {
+ ostringstream tampon;
+ tampon << "POP_";
+ tampon << (i+1);
+ _tabPpop[i]->_nom = tampon.str();
+ }
+ }
+ }
+ }
+}
+
+
+void Jeupop::iPopulations(istream &fichier){
+ //lecture de fichiers au format Populations
+// adapt�s � un traitement sur fichiers haploides
+//
+// modification du 31/07/2000:
+// rajout du mot cl� "DIFF" (nom d'all�le) qui permet de compter comme diff�rents 2 all�les
+// utile pour le traitement de donn�es RFLP
+//
+// refait le 07/9/2000
+
+ ChaineFicPop lecturePop(fichier);
+ biolib::vecteurs::ChaineCar mot;
+ biolib::vecteurs::ChaineCar nomall;
+
+ Titre titres;
+
+ Population * Ppop;
+ Individu * Pind;
+ Allele * Palldiff;
+ Allele * Pall;
+
+ bool allestintrogressant(false);
+
+ unsigned int nbloc,i, j;
+
+ // lecture des commentaires
+ try {
+ lecturePop.get_titre(_commentaires);
+ }
+ catch (ChaineFicPop::Anomalie pb) {
+ throw Anomalie(4);
+ }
+//cerr << "Jeupop::iGenepop get_titre " << _commentaires[0] << endl;
+
+ reset();
+
+ // lecture des locus
+ try {
+ lecturePop.get_locus(titres);
+ }
+ catch (ChaineFicPop::Anomalie pb) {
+ throw Anomalie(4);
+ }
+ _nbloc = nbloc = titres.size();
+
+ for (i=0; i < nbloc; i++) {
+ _tabPloc.push_back(new Locus(this, 0));
+ _tabPloc.back()->set_nom(titres[i]);
+ }
+//cerr << "Jeupop::iGenepop locus " << titres[0] << " " << nbloc << " " << _tabPloc.size() << endl;
+
+
+ //lecture des populations
+ _nploidie = 0; //pas encore d�termin�
+
+ while (lecturePop.estunepop()) {
+ //creation d'une nouvelle population
+ lecturePop.get_nompop(mot);
+ Ppop = NewPop(mot);
+
+ try {
+ if (lecturePop.get_lignepop()==1) break;
+// lecturePop.get_lignepop();
+ }
+ catch (ChaineFicPop::Anomalie pb) {
+ throw Anomalie(4);
+ }
+ while (lecturePop.estunindividu()) {
+ //creation d'un nouvel individu
+ //
+ lecturePop.get_nomind(mot);
+
+ Pind = new Individu(Ppop, mot);
+ Ppop->AjouterIndividu(Pind);
+
+//cerr << "Jeupop::iGenepop lecture: " <<lecturePop << endl;
+// lecturePop.get_nomind(Pind->_nom);
+//cerr << "Jeupop::iGenepop individu: " << Pind->_nom << endl;
+
+
+ lecturePop.get_alleles(titres);
+//cerr << "Jeupop::iGenepop alleles : " << titres.size() << endl;
+//for (j =0 ; j < titres.size(); j++) cerr << titres[j] << " ";
+ if (titres.size() != nbloc) {//erreur
+ cout << endl;
+ cout << _("error in data file.") << endl;
+ cout << _("wrong number of locus at line : ") << lecturePop.get_numeroligne() << endl;
+
+ throw Anomalie(4);
+ }
+//cerr << "Jeupop::iPopulations nbloc " <<nbloc << endl;
+ //enregistrement de chaque locus
+ for (i=0; i < nbloc; i++) {
+ mot = titres[i];
+//cerr << "Jeupop::iPopulations mot " << mot << endl;
+ if (_nploidie == 0) {
+ set_nploidie(mot.GetNbMots(":"));
+ //Ppop->set_nploidie();
+ }
+
+//cerr << "Jeupop::iPopulations set_nploidie : " << mot.GetNbMots(":") << " "<< _nploidie << endl;
+ if (mot.GetNbMots(":") != _nploidie) {//erreur
+ cout << endl;
+ cout << _("error in data file.") << endl;
+ cout << _("wrong number of alleles at line : ") << lecturePop.get_numeroligne() << endl;
+
+ throw Anomalie(4);
+ }
+
+ Palldiff = 0;
+ for (j = 0; j < _nploidie; j++) { //boucle pour chaque allele d'un locus
+ Pall = 0;
+ allestintrogressant = false;
+
+ mot.GetMot(j+1 ,nomall, ":");
+ //cas des alleles introgressants:
+ // marqu�s par une *
+ if (nomall[0] == '*') {
+//cerr << "Jeupop::iPopulations all introgressant" << endl;
+ allestintrogressant = true;
+ nomall.erase(0,1);
+ }
+//cerr << "Jeupop::iPopulations nomall" << nomall << endl;
+
+ if ((Palldiff == 0) && (nomall == "DIFF")) {
+ // creation d'un allele diff�rent pour ce locus pour cet individu
+ Pall = Palldiff = new Allele(_tabPloc[i], "DIFF");
+ Pind->_tabPall[i*_nploidie + j] = Palldiff;
+ _tabPloc[i]->_tabPall.push_back(Palldiff);
+ }
+ else {
+ if (nomall == "DIFF") {
+ // assignation de l'all�le diff�rent
+ Pind->_tabPall[i*_nploidie + j] = Pall = Palldiff;
+ }
+ else {
+ // recherche de l'allele
+ Pall = Pind->_tabPall[i*_nploidie + j] = _tabPloc[i]->getPall(nomall);
+
+ if (Pall == 0) {
+ // si la recherche n'a rien donner: creation de l'all�le
+ Pall = Pind->_tabPall[i*_nploidie + j] = new Allele(_tabPloc[i], nomall);
+ _tabPloc[i]->_tabPall.push_back(Pall);
+
+ }
+ }
+ }
+
+ if (allestintrogressant) {
+ // si il n'est pas deja not� dans le tableau de la pop, l'indiquer
+//cerr << "Jeupop::iPopulations all introgressant" << endl;
+ Ppop->AjouterAllIntrogressant(Pall);
+ // allestintrogressant = false;
+ }
+ }
+
+ }
+
+//Pind->affiche(cout,1);
+
+ try {
+ if (lecturePop.get_lignepop()==1) break;
+// lecturePop.get_lignepop();
+ }
+ catch (ChaineFicPop::Anomalie pb) {
+ throw Anomalie(4);
+ }
+ } // boucle while (lecturePop.estunepop())
+ } // boucle while (lecturePop.estunepop())
+
+ // lecture des noms de populations dans les commentaires
+
+/* for (i=0; i < _tabPpop.size(); i++) {
+ if (_tabPpop[i]->_nom == "_") {
+ _tabPpop[i]->_nom = "POP_";
+ _tabPpop[i]->_nom.AjEntier(i+1);
+ }
+ }*/
+}
+
+bool Jeupop::f_verifnum(int typedenum) const {
+ // V�rification du type de num�rotation des all�les
+// 1 => type Genepop stricte (2digits)
+// 2 => nom d'alleles = num�ros
+// 3 => nom d'alleles = num�ros < 999
+ //Anomalie 2-> les num�ros d'all�les format genepop ne sont pas pr�sents
+
+ long nbloc(get_nbloc());
+ long i;
+
+ for (i=0; i < nbloc; i++) {
+ if (!(_tabPloc[i]->f_verifnum(typedenum))) return(false);
+ }
+
+ return(true);
+}
+
+void Jeupop::f_rempliVcalcStrucPop(unsigned int niveau) {
+ // remplir le tableau _VcalcStrucPop,
+ // en vue de calcul sur des m�tapopulations (ex: DistGnt)
+ unsigned long i;
+
+ f_resetVcalcStrucPop();
+//cerr << "Jeupop::f_rempliVcalcStrucPop(unsigned int niveau) debut" << endl;
+// if (_VcalcStrucPop.size() != 0) return;
+
+ if (niveau == 100) {
+ //Populations normales
+ _VcalcStrucPop.resize(_tabPpop.size());
+
+ for (i = 0; i < _VcalcStrucPop.size(); i++) _VcalcStrucPop[i] = _tabPpop[i];
+ return;
+
+ }
+ //cerr << "Jeupop::f_rempliVcalcStrucPop(unsigned int niveau) " << niveau << endl;
+ _Pracinepops->f_rempliTabStrucPop(_VcalcStrucPop, niveau);
+
+//cerr << "Jeupop::f_rempliVcalcStrucPop(unsigned int niveau)" << endl;
+//for (i = 0; i < _VcalcStrucPop.size(); i++) cerr << _VcalcStrucPop[i]->get_nom();
+
+}
+
+void Jeupop::f_trad2Gpop(ostream& tableCorrespondances) {
+
+ long nbloc(get_nbloc());
+ long i;
+
+// 1-> op�ration possible seulement sur les diploides
+ if (get_nploidie() != 2) throw Anomalie(1);
+
+ //verification sur le nombre d'alleles maximum (99)
+ //pas fait
+ tableCorrespondances << "correspondances Anciens_Noms <---> Noms_Genepop" << endl;
+ for (i=0; i < nbloc; i++) {
+ _tabPloc[i]->f_trad2Gpop(tableCorrespondances);
+ }
+}
+
+void Jeupop::ifAjouterLocus(const Locus * Ploc) {
+ //ajout d'un locus dans une pop, avec les alleles correspondants
+ // => recherche un locus preexistant
+ long i, taille(_tabPloc.size()), nbloc(-1);
+ string nomloc;
+ nomloc = Ploc->get_nom();
+
+ for (i = 0 ; i < taille; i++) {
+ if (nomloc == get_nomlocus(i)) {
+ nbloc = i;
+ break;
+ }
+ }
+ if (nbloc >= 0) { //le locus existe deja
+ //il faut ajouter les alleles que l'original n'a pas
+ taille = Ploc->get_nball();
+ for (i = 0; i < taille; i++ ){
+ get_Plocus(nbloc)->ifAjouterAllele(Ploc->getPall(i));
+ }
+ }
+ else { //il faut le creer, avec les alleles du nouveau locus
+ _tabPloc.push_back(new Locus(*Ploc, this));
+ }
+
+ _nbloc = _tabPloc.size(); //precaution
+}
+
+/*void Jeupop::ifAjouterPop(const Population * Ppop) {
+ //ajout d'un population dans un jeupop, avec les individus correspondants
+ // => recherche d'une population preexistante
+ long i, taille(get_nbpop()), nbpop(-1);
+ const string nompop(Ppop->get_nom());
+
+ for (i = 0 ; i < taille; i++) {
+ if (nompop == get_nompop(i)) {
+ nbpop = i;
+ break;
+ }
+ }
+ if (nbpop >= 0) { //la population existe deja
+ //il faut ajouter les individus que l'original n'a pas
+ // et completer les alleles des individus preexistants
+ // pb � r�soudre: incoh�rence entre alleles d'un meme locus,
+ // d'un meme individu...
+ get_pop(nbpop)->_nploidie = get_nploidie();
+ get_pop(nbpop)->_nbloc = 0;// _Pjeu->get_nbloc();
+
+ get_pop(nbpop)->resize_loc();
+
+ taille = Ppop->get_nbind();
+ for (i = 0; i < taille; i++ ){
+
+//cerr << "if ajouterpop" << endl;
+ get_pop(nbpop)->ifAjouterIndividu(Ppop->get_Pind(i));
+ }
+ }
+ else { //il faut creer une nouvelle population
+ _tabPpop.push_back(new Population(this, *Ppop));
+ }
+}
+
+*/
+/*
+Jeupop Jeupop::operator+ (const Jeupop &rval) const {
+ long i , taille;
+
+ if (get_nploidie() != rval.get_nploidie()) throw Anomalie(7);
+ // if (_nc != rval._nc) throw Anomalie(4);
+// for (i=0; i < rval._commentaires.size(); i++) {
+//cerr << rval.GetTitre(i);
+// _commentaires.push_back(rval._commentaires.GetTitre(i));
+// }
+
+//cerr << _commentaires[0] << " " << _commentaires[1];
+
+ Jeupop Resultat;
+ //on peut fixer la ploidie, et commencer � remplir Resultat
+ // avec le 1er jeu de populations:
+//cerr << "operator + debut " << endl;
+ Resultat = *this;
+
+ Resultat._commentaires = _commentaires + rval._commentaires;
+ // Il faut savoir combien de locus differents comportera le r�sultat
+ // => parcours du tableau de locus du 2eme JeuPop
+ taille = rval.get_nbloc();
+ for (i = 0; i < taille; i++) {
+//cerr << "ajout locus " << i << endl;
+ Resultat.ifAjouterLocus(rval.get_Plocus(i));
+ }
+
+ // A ce stade, Resultat contient tout le 1er jeupop
+ // et tous les locus et alleles du 2eme
+ // Il faut maintenant remplir les populations de resultat
+ taille = rval.get_nbpop();
+ for (i = 0; i < taille; i++) {
+//cerr << "ajout pop " << i << endl;
+ Resultat.ifAjouterPop(rval.get_pop(i));
+ }
+
+ taille = Resultat.get_nbpop();
+ for (i = 0; i < taille; i++) {
+//cerr << "resize " << i << endl;
+ Resultat.get_pop(i)->resize_loc();
+ }
+
+//cerr << "operator + fin " << endl;
+ return Resultat;
+
+}*/
+
+
+void Jeupop::f_BootstrapLocus(Arbre &arbreRef, int methodeArbre, int methodeDist, bool square_distance, int nbrepet,bool sur_ind, Vecteur<unsigned int> * PVcalcLocus) {
+ // Boostrap sur les locus => arbre d'individus si sur_ind est vrai
+ // Boostrap sur les locus => arbre de populations si sur_ind est faux
+ // ********creer des exceptions pour v�rifier l'arbreRef *********
+
+ DistancesGnt distgnt(methodeDist, square_distance, this);
+ unsigned long i;
+
+// pr�paration de _VcalcLoc:
+ if (PVcalcLocus == NULL) {
+ PVcalcLocus = new Vecteur<unsigned int>;
+ _VcalcLocus.resize(get_nbloc());
+ PVcalcLocus->resize(get_nbloc());
+ for (i = 0; i < _VcalcLocus.size(); i ++) {
+ _VcalcLocus[i] = i;
+ PVcalcLocus->operator[](i) = i;
+ }
+ }
+
+ try {
+ distgnt.f_bootstrapLocus(arbreRef, methodeArbre, nbrepet, PVcalcLocus, sur_ind);
+ }
+ catch (DistancesGnt::Anomalie lepb) {
+ cerr << endl << lepb.fmessage() << endl;
+ throw Anomalie(101);
+ }
+}
+
+void Jeupop::f_BootstrapIndividus(Arbre &arbreRef, int methodeArbre, int methodeDist, bool square_distance, int nbrepet, Vecteur<unsigned int> * PVcalcLocus) {
+ // Boostrap sur les locus => arbre d'individus si sur_ind est vrai
+ // Boostrap sur les locus => arbre de populations si sur_ind est faux
+ // ********creer des exceptions pour v�rifier l'arbreRef *********
+
+ DistancesGnt distgnt(methodeDist, square_distance, this);
+ unsigned long i;
+
+// pr�paration de _VcalcLoc:
+ if (PVcalcLocus == NULL) {
+ PVcalcLocus = new Vecteur<unsigned int>;
+ _VcalcLocus.resize(get_nbloc());
+ PVcalcLocus->resize(get_nbloc());
+ for (i = 0; i < _VcalcLocus.size(); i ++) {
+ _VcalcLocus[i] = i;
+ PVcalcLocus->operator[](i) = i;
+ }
+ }
+
+ try {
+ distgnt.f_bootstrapIndividus(arbreRef, methodeArbre, nbrepet, PVcalcLocus);
+ }
+ catch (DistancesGnt::Anomalie lepb) {
+ cerr << endl << lepb.fmessage() << endl;
+ throw Anomalie(101);
+ }
+}
+
+void Jeupop::f_distgntpop (MatriceLD &resultat,int methode, bool square_distance, unsigned int niveau, Vecteur<unsigned int> *PVcalcLocus) {
+//cerr << "Jeupop::f_distgntpop debut" << endl;
+ //distances G�n�tiques entre Populations
+ DistancesGnt distgntpop(methode, square_distance, this, niveau);
+ unsigned long i;
+
+// pr�paration de _VcalcLoc:
+ if (PVcalcLocus == NULL) {
+ _VcalcLocus.resize(get_nbloc());
+ for (i = 0; i < _VcalcLocus.size(); i ++) {
+ _VcalcLocus[i] = i;
+ }
+ }
+ else {
+ _VcalcLocus = *PVcalcLocus;
+ }
+//cerr << "Jeupop::f_distgntpop 1" << endl;
+
+ try {
+ distgntpop.f_distgntpop(resultat, &_VcalcLocus);
+ }
+ catch (DistancesGnt::Anomalie lepb) {
+ cerr << endl << lepb.fmessage() << endl;
+ throw Anomalie(101);
+ }
+
+//cerr << "Jeupop::f_distgntpop fin" << endl;
+
+}
+
+void Jeupop::f_distgnt (MatriceLD &resultat,int methode, bool square_distance, Vecteur<unsigned int> *PVcalcLocus) {
+ //distances G�n�tiques entre individus
+ DistancesGnt distgntind(methode, square_distance, this);
+ unsigned long i;
+// pr�paration de _VcalcLoc:
+//cerr << "f_distgnt (jeupop) deb" << endl;
+ if (PVcalcLocus == NULL) {
+ _VcalcLocus.resize(get_nbloc());
+ for (i = 0; i < _VcalcLocus.size(); i ++) {
+ _VcalcLocus[i] = i;
+ }
+ }
+ else {
+ _VcalcLocus = *PVcalcLocus;
+ }
+
+// f_distgntVcalc (resultat, methode);
+
+ try {
+ distgntind.f_distgntInd(resultat, &_VcalcLocus);
+ }
+ catch (DistancesGnt::Anomalie lepb) {
+ cerr << endl << lepb.fmessage() << endl;
+ throw Anomalie(101);
+ }
+//cerr << "f_distgnt (jeupop) fin" << endl;
+
+}
+
+
+/*long Jeupop::get_numloc(Locus * Ploc) const {
+ long i;
+
+ for (i= 0; i < _nbloc; i++) {
+// cerr << "getnumloc" << endl;
+ if (_tabPloc[i] == Ploc) return (i);
+ }
+ return (-1);
+}*/
+
+
+
+Population* Jeupop::get_pop(unsigned long numpop) const{
+ if (numpop < get_nbpop()) { //ok
+ return(_tabPpop[numpop]);
+ }
+ else {
+ return (0);
+ }
+}
+
+unsigned int Jeupop::get_nploidie() const {
+ return(_nploidie);
+}
+
+unsigned long Jeupop::get_nbloc() const {
+ return(_tabPloc.size());
+}
+
+unsigned long Jeupop::get_nbpop() const {
+ return(_tabPpop.size());
+}
+
+unsigned long Jeupop::get_nbind() const {
+ return(_Pracinepops->get_nbind());
+}
+
+/*Allele* Jeupop::get_Pall(int loc, int all) const {
+ return(_tabPloc[loc]->_tabPall[all]);
+}
+*/
+
+Allele* Jeupop::get_Pall(unsigned long loc, unsigned long all) const {
+ return(_tabPloc[loc]->_tabPall[all]);
+}
+
+void Jeupop::get_nomniveauxstruc(Titre & nom_niveaux) const {
+
+ _Pracinepops->get_nomniveauxstruc(nom_niveaux);
+
+}
+
+
+void Jeupop::set_nploidie(unsigned int nploidie) {
+ _nploidie = nploidie;
+ _nbloc = get_nbloc();
+
+//cerr << "Jeupop::set_nploidie " << _nploidie << " " << _nbloc << endl;
+ _Pracinepops->set_nploidie();
+//cerr << "Jeupop::set_nploidie fin" << _nploidie << " " << _nbloc << endl;
+}
+
+
+void Jeupop::AjouterPopulation(Population * Ppop) {
+// _tabPpop.push_back(Ppop);
+ //AjouterTabPop(Ppop);
+ _Pracinepops->AjouterPopulation(Ppop);
+}
+
+void Jeupop::AjouterTabPop(Population * Ppop) {
+ _tabPpop.push_back(Ppop);
+ _nbpop++;
+// _Pracinepops->AjouterPopulation(Ppop);
+}
+
+Locus * Jeupop::new_locus(const string & name) {
+ Locus * Plocus (new Locus(this, 0));
+ Plocus->set_nom(name);
+ _tabPloc.push_back(Plocus);
+ return (Plocus);
+}
+
+Population * Jeupop::NewPop(const biolib::vecteurs::ChaineCar & chemin) {
+// cr�ation de Population et de MetaPop en fonction du chemin
+ Titre tabchemin;
+ biolib::vecteurs::ChaineCar mot;
+ unsigned long i;
+ MetaPop * Pmetapop(_Pracinepops);
+ Population * Ppop;
+
+//cerr << "Jeupop::NewPop(ChaineCar & chemin) d�but " << endl;
+
+ mot.assign("");
+
+ for (i = 0; i < chemin.GetNbMots("/"); i ++) {
+ chemin.GetMot(i+1,mot, "/");
+ if (mot == "") continue;
+ tabchemin.push_back(mot);
+ }
+
+ if (tabchemin.size() > 0) {
+ for (i = 0; i < tabchemin.size()-1; i ++) {
+ //cr�er une m�tapopulation
+ Pmetapop = Pmetapop->NewMetaPop(tabchemin[i]);
+ mot = tabchemin[tabchemin.size()-1];
+ }
+ }
+
+ Ppop = new Population(Pmetapop);
+//cerr << "Jeupop::NewPop(ChaineCar & chemin) set_nom " << endl;
+ Ppop->set_nom(mot);
+
+ Pmetapop->AjouterPopulation(Ppop);
+
+//cerr << "Jeupop::NewPop(ChaineCar & chemin) fin " << endl;
+
+ return (Ppop);
+}
+
+
+void Jeupop::affind (int numpop, int numind) const {
+ _tabPpop[numpop]->_tabPind[numind]->affiche(cout,1);
+}
+
+/** Suppression de la population p du Jeupop */
+void Jeupop::SupprPop(StrucPop * Ppop){
+//cerr << "Jeupop::SupprPop debut" << endl;
+ unsigned long i;
+
+ _Pracinepops->SupprPop(Ppop);
+ for (i = 0; i < _tabPpop.size(); i++) {
+ if (_tabPpop[i] == Ppop) _tabPpop.Suppr(i);
+ }
+ _nbpop--;
+//cerr << "Jeupop::SupprPop fin" << endl;
+}
+/** D�place la pop Ppop a � la position b */
+void Jeupop::f_deplacePop(Population * Ppop, unsigned long b){
+ signed long a;
+ a = _tabPpop.Position(Ppop);
+ if (a < 0) return;
+ if (b > _tabPpop.size()) return;
+ if ((unsigned long)a == b) return;
+
+ _tabPpop[a] = _tabPpop[b];
+ _tabPpop[b] = Ppop;
+}
+/** enl�ve les all�les qui ne sont pas repr�sent�s dans les populations
+ */
+void Jeupop::f_nettoieAlleles(){
+ unsigned long l;
+
+ for (l = 0; l < _tabPloc.size(); l++) _tabPloc[l]->f_nettoieAlleles();
+}
+
+/** Retourne vrai, si l'allele n'est pas pr�sent dans jeupop */
+bool Jeupop::r_allelenonpresent(Allele * Pall) const{
+
+ return(_Pracinepops->r_allelenonpresent(Pall));
+}
+/** construit le vecteur Vlocus avec les numeros de tous les locus */
+void Jeupop::f_selectlocustous(vector<unsigned int> & Vlocus) const{
+ unsigned int nblocus(get_nbloc());
+ unsigned int i;
+
+ Vlocus.resize(0);
+
+ for (i = 0; i < nblocus; i ++) Vlocus.push_back(i);
+}
+/** Suppression des locus qui ne sont pas pr�sents dans Vnumloc */
+void Jeupop::GarderVlocus(Vecteur<unsigned int> & Vnumloc){
+
+ unsigned int i;
+ _nbloc = _tabPloc.size();
+
+//cerr << "Jeupop::GarderVlocus " << _nbloc << endl ;
+ for (i = _nbloc; i > 0 ; i--) {
+//cerr << "Jeupop::GarderVlocus " << i-1 << endl ;
+ // si i-1 n'est pas pr�sent dans Vnumloc: on supprime le locus
+ if (!Vnumloc.Existe(i-1)) supprLocus(i-1);
+ }
+}
+/** Suppression d'un locus */
+void Jeupop::supprLocus(unsigned int numlocus){
+ unsigned long i;
+
+ if (numlocus >= _tabPloc.size()) throw Anomalie(8);
+ //suppression du locus chez tous les individus
+ for (i = 0; i < _Pracinepops->_tabPind.size(); i++) _Pracinepops->_tabPind[i]->supprLocus(numlocus);
+
+ delete _tabPloc[numlocus];
+ _tabPloc.Suppr(numlocus);
+
+ set_nbloc();
+}
+/** R�affectation du nombre de locus */
+void Jeupop::set_nbloc(){
+
+ _nbloc = _tabPloc.size();
+ _Pracinepops->set_nbloc();
+
+}
+/** obtenir le num�ro d'un locus avec son nom */
+signed int Jeupop::get_numloc(const string & nomlocus) const{
+ signed int numloc(-1);
+ unsigned int nbloc(get_nbloc()), i;
+
+ for (i=0; i < nbloc; i++) {
+//cerr << "Jeupop::get_numloc " << nomlocus << " " << _tabPloc[i]->get_nom()<<endl;
+ if (nomlocus == _tabPloc[i]->get_nom()) {
+ numloc = i;
+ break;
+ }
+ }
+
+ return (numloc);
+}
+
+
+void Jeupop::iGenetix(istream &fichier){
+ //lecture de fichiers au format Genetix
+// pas adapt�e � un traitement sur fichiers haploides ou nploides
+
+//cerr << "Jeupop::iGenetix debut" << endl;
+ ChaineFicPop objetGenetix(fichier);
+ Titre titres;
+ biolib::vecteurs::ChaineCar mot, nomall1, nomall2;
+
+ Population * Ppop;
+ Individu * Pind;
+
+ unsigned int nbpop, nbloc, nball(0), nbind, i,j, k;
+ unsigned int nbdigits(3);
+
+ reset();
+
+ set_nploidie(2);
+
+ objetGenetix.get_lignepop();
+ objetGenetix.GetMot(1, mot);
+ nbloc = (int) mot;
+ if ((nbloc < 1) || (nbloc > 100)) throw Anomalie(5);
+ _commentaires.push_back(objetGenetix);
+
+
+//cerr << "Jeupop::iGenetix nbloc " << nbloc << endl;
+ objetGenetix.get_lignepop();
+ objetGenetix.GetMot(1, mot);
+ nbpop = (int) mot;
+// fichier >> nbpop;
+ if ((nbpop < 1) || (nbpop > 1000)) throw Anomalie(5);
+ _commentaires.push_back(objetGenetix);
+
+//cerr << "Jeupop::iGenetix nbpop " << nbpop << endl;
+
+ //lecture et cr�ation des locus et des all�les
+ for (i=0; i < nbloc; i++) {
+ _tabPloc.push_back(new Locus(this, 0));
+ objetGenetix.get_lignepop();
+ _tabPloc.back()->set_nom(objetGenetix);
+//cerr << "Jeupop::iGenetix locus " << objetGenetix << endl;
+ fichier >> nball;
+ objetGenetix.get_lignepop();
+ if (objetGenetix.GetNbMots() != (int) nball) throw Anomalie(5);
+ for (j=0; j < nball; j++) {
+ objetGenetix.GetMot(j+1, nomall1);
+ _tabPloc[i]->_tabPall.push_back(new Allele(_tabPloc[i], nomall1));
+ }
+ }
+ set_nbloc();
+
+ for (i=0; i < nbpop; i++) {
+ objetGenetix.get_lignepop();
+
+ Ppop = NewPop(objetGenetix);
+
+//cerr << "Jeupop::iGenetix pop " << objetGenetix << endl;
+ objetGenetix.get_lignepop();
+ if (objetGenetix.EstUnChiffre() == false) {
+ cout << endl;
+ cout << _("error in Genetix data file.") << endl;
+ cout << _("wrong number of individuals at line : ") << objetGenetix.get_numeroligne() << endl;
+
+ throw Anomalie(201);
+ }
+ else nbind = (unsigned int) objetGenetix;
+
+//cerr << "Jeupop::iGenetix nbind " << nbind << endl;
+ for (j=0; j < nbind; j++) {
+ //creation d'un nouvel individu
+ fichier >> mot;
+ Pind = new Individu(_tabPpop.back(), mot);
+ Ppop->AjouterIndividu(Pind);
+
+//cerr << "Jeupop::iGenetix ind " << mot << endl;
+
+ objetGenetix.get_lignepop();
+ if (objetGenetix.GetNbMots() != (int) nbloc){
+ cout << endl;
+ cout << _("error in Genetix data file.") << endl;
+ cout << _("wrong number of locus at line : ") << objetGenetix.get_numeroligne() << endl;
+
+ throw Anomalie(201);
+ }
+
+ for (k=0; k < nbloc; k++) {
+//cerr << "Jeupop::iGenetix nbloc nbmots " << nbloc << " " << objetGenetix.GetNbMots() << endl;
+ objetGenetix.GetMot(k+1, mot);
+ if (mot.EstUnChiffre() == false) {
+ throw Anomalie(5);
+ }
+//cerr << "Jeupop::iGenetix mot " << mot << endl;
+ nomall1.assigner(mot, 0, nbdigits - 1);
+ nomall2.assigner(mot, nbdigits, (nbdigits * 2) - 1);
+
+//cerr << "Jeupop::iGenetix all " << nomall1 << " " << nomall2 << endl;
+ if (nomall1 == "000") Pind->_tabPall[k*2] = _tabPloc[k]->getPallNul();
+ else Pind->_tabPall[k*2] = _tabPloc[k]->getPall(nomall1);
+
+ if (nomall2 == "000") Pind->_tabPall[k*2 + 1] = _tabPloc[k]->getPallNul();
+ else Pind->_tabPall[k*2 + 1] = _tabPloc[k]->getPall(nomall2);
+//cerr << "Jeupop::iGenetix Pall " << Pind->_tabPall[k*2] << " " << Pind->_tabPall[k*2 + 1] << endl;
+ }
+ }
+ }
+//cerr << "Jeupop::iGenetix fin "<< endl;
+}
+
+void Jeupop::iPopulationsXML(istream &fichier){
+ #ifdef XMLREADPOPULATIONS_H
+//cerr << "Jeupop::iPopulationsXML debut "<< endl;
+ // string mot;
+
+ // fichier >> mot;
+//cerr << "Jeupop::iPopulationsXML mot " << mot << endl;
+ // if (mot != "<?xml") {
+ // fichier.seekg(0);
+ // throw Jeupop::Anomalie(5);
+ // return;
+ // }
+ // fichier.seekg(0);
+
+ try {
+
+ XMLreadPopulations * Plecture;
+ Plecture = new XMLreadPopulations(*this);
+ Plecture->iParseFlux(fichier);
+cerr << "Jeupop::iPopulationsXML(istream &fichier)" << endl;
+ }
+ catch (XMLreadPopulations::Anomalie pb) {
+ cout << endl << pb.message << endl << endl;
+ throw Jeupop::Anomalie(5);
+ }
+
+ #else
+ throw Anomalie(5);
+ #endif
+}
+
+void Jeupop::set_commentaires(const string & commentaires){
+ _commentaires.push_back(commentaires);
+}
+
diff --git a/src/jeupop.h b/src/jeupop.h
new file mode 100644
index 0000000..3401c3e
--- /dev/null
+++ b/src/jeupop.h
@@ -0,0 +1,229 @@
+/***************************************************************************
+ jeupop.h - Librairie d'objets permettant de manipuler des donn�es
+ sp�cifiques aux populations
+ -------------------
+ begin : ven sep 06 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef JEUPOP_H
+#define JEUPOP_H
+
+//#include"internat.h"
+
+#include "matrices.h"
+#include "allele.h"
+#include "individu.h"
+#include "strucpop.h"
+#include "metapop.h"
+#include "population.h"
+#include "locus.h"
+
+#include "chaineficpop.h"
+
+#include "arbre.h"
+
+//# ifdef XmlParse_INCLUDED
+//# include "xmlreadpopulations.h"
+//# endif
+//#include "vecteurs.h"
+
+//typedef biolib::arbres::ArbrePlus ArbrePlus;
+typedef biolib::arbres::Arbre Arbre;
+//typedef biolib::vecteurs::ChaineCar ChaineCar;
+//class Arbre;
+
+// jeu de populations
+class Jeupop {
+public :
+ Jeupop();//npop, nloc
+ //Jeupop(long nbpop, long nbloc);//npop, nloc
+
+ Jeupop(const Jeupop&); //constructeur de copies
+
+ ~Jeupop();
+
+ Population * NewPop(const biolib::vecteurs::ChaineCar &);
+ Locus * new_locus(const string &);
+
+ void reset();//npop, nloc
+ Population* get_pop(unsigned long) const;
+ //mieux en inline
+ unsigned int get_nploidie() const;
+ unsigned long get_nbloc() const;
+ unsigned long get_nbpop() const;
+ //unsigned long Jeupop::get_nbpop() const {
+
+ unsigned long get_nbstrucpopVcalc() const {return (_VcalcStrucPop.size());};
+ MetaPop * get_Pracinepop() const {return (_Pracinepops);};
+ const StrucPop * get_PstrucpopVcalc(unsigned int numpop) const {return (_VcalcStrucPop[numpop]);};
+ unsigned long get_nbind() const;
+ //inline Allele* get_Pall(int loc, int all) const;
+ Allele* get_Pall(unsigned long loc, unsigned long all) const;
+
+ void AjouterPopulation(Population * Ppop);
+ void AjouterTabPop(Population * Ppop);
+
+ Locus* get_Plocus(const string &) const;
+ Locus* get_Plocus(unsigned long i) const;
+ Population* get_Ppop(string &) const;
+ Population* get_Ppop(unsigned long p) const;
+ const string & get_nomlocus(long nblocus) const;
+ const string & get_nompop(long nbpop) const;
+ signed long get_numloc(Locus * Ploc) const {return((signed long)_tabPloc.Position(Ploc));};
+ signed long get_numpop(Population * Ppop) const {return((signed long)_tabPpop.Position(Ppop));};
+// long get_numloc(Locus * Ploc) const;
+ void get_nomniveauxstruc(Titre & nom_niveaux) const;
+ const Titre & get_commentaires() const {return(_commentaires);};
+
+ void set_nploidie(unsigned int nploidie);
+ void set_commentaires(const string & commentaires);
+
+ void iFichier(istream & entree, int i);
+
+ void iIntrogression(istream&);
+ void oPopulations(ostream& sortie) const;
+ void oGenepop(ostream&) const;
+ void oGenepopCano(ostream&) const;
+
+ void oImmanc(ostream&) const;
+ //Immanc - detects individual that are immigrants or have recent immigrant ancestry
+ //by using multilocus genotypes.
+ //Version 5.0, released October 8, 1998
+ //Reference: Rannala, B., and J.L., Mountain. 1997. Detecting immigration by using
+ //multilocus genotypes. Proceedings of the National Academy of Sciences USA 94:
+ //9197-9201.
+
+ void oMsat(ostream&) const;
+ void oMsatFreq(ostream&) const;
+ // microsat.c version 1.5e
+ // Eric Minch
+ // Dept. of Genetics
+ // Stanford University Medical Center
+ // Stanford, CA 94305
+ // minch at lotka.stanford.edu
+ //http://lotka.stanford.edu/microsat/microsat.html
+
+ void affind(int, int) const; //num�ro de la pop, num�ro de l'ind
+
+// g�n�tique
+
+ void f_trad2Gpop(ostream&);
+
+ //calcul de la nouvelle diversit� all�lique, pour un �chantillon
+ // r�duit: r�sultats stock�s dans Matrice, int => effectif r�duit
+ void f_rarefaction(MatriceLD &, int) const;
+
+ // calcul de distance g�n�tique entre Populations sur tous les individus, 2 a 2
+ void f_distgntpop (MatriceLD &resultat, int methode, bool square_distance, unsigned int niveau=100, Vecteur<unsigned int> * PVcalcLocus = NULL);
+ // calcul de distance g�n�tique sur tous les individus, 2 a 2
+ void f_distgnt (MatriceLD &resultat, int methode, bool square_distance, Vecteur<unsigned int> * PVcalcLocus = NULL);
+
+ // V�rification du type de num�rotation des all�les
+ bool f_verifnum (int) const;
+
+ // Boostrap sur les locus => arbre d'individus ou populations
+ void f_BootstrapLocus(Arbre & arbreRef, int methodeArbre, int methodeDist, bool square_distance, int nbrepet, bool sur_ind=true , Vecteur<unsigned int> * PVcalcLocus = NULL);
+ void f_BootstrapIndividus(Arbre & arbreRef, int methodeArbre, int methodeDist, bool square_distance, int nbrepet , Vecteur<unsigned int> * PVcalcLocus = NULL);
+// void f_BootstrapLocus(Arbre & arbreRef, int methodeArbre, int methodeDist, int nbrepet , Vecteur<int> * PVcalcLocus = NULL);
+// void f_BootstrapLocuspop(Arbre & arbreRef, int methodeArbre, int methodeDist, int nbrepet , Vecteur<int> * PVcalcLocus = NULL);
+
+ void f_rempliVcalcStrucPop(unsigned int niveau=100);
+ void f_resetVcalcStrucPop() {_VcalcStrucPop.resize(0);};
+
+ friend class Population;
+ friend class DistancesGnt;
+ friend class Fstat;
+/// friend class Locus;
+
+// static int _tmot;
+
+// const Jeupop& operator= (const Jeupop &);
+ Jeupop operator+ (const Jeupop &rval) const;
+ /** Suppression de la population p du Jeupop */
+ void SupprPop(StrucPop * Ppop);
+ /** D�place la pop a � la position b */
+ void f_deplacePop(Population * Ppop, unsigned long b);
+ /** enl�ve les all�les qui ne sont pas repr�sent�s dans les populations
+ */
+ void f_nettoieAlleles();
+ /** Retourne vrai, si l'allele n'est pas pr�sent dans jeupop */
+ bool r_allelenonpresent(Allele * Pall) const;
+ /** construit le vecteur Vlocus avec les numeros de tous les locus */
+ void f_selectlocustous(vector<unsigned int> & Vlocus) const;
+ /** Suppression des locus qui ne sont pas pr�sents dans Vnumloc */
+ void GarderVlocus(Vecteur<unsigned int> & Vnumloc);
+ /** obtenir le num�ro d'un locus avec son nom */
+ signed int get_numloc(const string &) const;
+
+private :
+ MetaPop * _Pracinepops;
+
+ Titre _commentaires;
+ void iGenetix(istream&);
+ void iGenepop(istream&);
+ void iPopulations(istream&);
+ void ifAjouterLocus(const Locus * Ploc);
+ void iPopulationsXML(istream &fichier);
+// void ifAjouterPop(const Population * Ppop);
+ //nombre d'alleles en commun sur un locus
+// int r_allcommun(Individu *, Individu *, unsigned int) const; //renvoi du nombre d'all�les en commun
+// int r_allcommunnul(Individu *, Individu *, int) const; //renvoi du nombre d'all�les en commun
+// long r_allcommunnul(Individu *, Individu *) const; //renvoi du nombre d'all�les en commun
+// long double r_allsimilnul(Individu *, Individu *) const;
+ //distance entre 2 individus
+// double r_dist2ind(Individu *, Individu *, int) const; //renvoi de la distance
+
+ unsigned int _nploidie; // haploide=1 diploide=2...
+ unsigned int _nbpop; //nb de populations dans ce jeu
+ Vecteur<Population*> _tabPpop;
+ unsigned int _nbloc; //nb de loci dans ce jeu
+ Vecteur<Locus*> _tabPloc;
+
+ Vecteur<unsigned int> _VcalcLocus;
+ Vecteur<StrucPop*> _VcalcStrucPop;
+
+protected: // Protected methods
+ /** Suppression d'un locus */
+ void supprLocus(unsigned int);
+ /** R�affectation du nombre de locus */
+ void set_nbloc();
+
+public :
+ struct Anomalie{
+ // 1-> op�ration possible seulement sur les diploides
+ // 2-> les num�ros d'all�les format genepop ne sont pas pr�sents
+ // 3-> donnee erronee dans le fichier d'entree
+ // 4-> format Genepop incorrect en entree
+ // 5-> format de fichier non reconnu
+ // 6-> calcul de similitude impossible
+ // 7-> op�ration impossible sur des populations de ploidie differentes
+ // 8-> Locus introuvable
+ // 9-> Population introuvable
+ // 101-> erreur dans un calcul de distances
+ // 201-> erreur de lecture dans un fichier G�n�tix
+
+ unsigned int le_pb;
+ Anomalie (unsigned int i):le_pb(i){};
+ };
+
+};
+
+
+
+istream& operator>>(istream& ientree,Jeupop& LesPops);
+
+
+
+#endif
+
diff --git a/src/jeupopexp.cpp b/src/jeupopexp.cpp
new file mode 100644
index 0000000..7a4a0c5
--- /dev/null
+++ b/src/jeupopexp.cpp
@@ -0,0 +1,401 @@
+/***************************************************************************
+ jeupopexp.cpp - description
+ -------------------
+ begin : Tue Oct 24 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+//#include "strucpop.h"
+#include "jeupopexp.h"
+
+JeuPopExp::JeuPopExp(Jeupop * Pjeu):_Pjeu(Pjeu) {
+
+ _Pcopie = 0;
+}
+
+JeuPopExp::~JeuPopExp(){
+ if (_Pcopie != 0) delete _Pcopie;
+
+}
+
+
+void JeuPopExp::oLea(unsigned long P1,unsigned long P2,unsigned long H, ostream & sortie, ostream & infos) {
+ f_prepP1P2H(P1,P2,H,infos);
+
+ unsigned long nbpop;
+ unsigned long nbloc(_Pcopie->get_nbloc());
+ unsigned long nball; //nb d'alleles pour chaque locus
+ unsigned long i,l,p;
+ Locus * Plocus;
+ bool proms;
+
+ nbpop = _Pcopie->get_nbpop();
+
+ sortie << "0" << endl;
+ sortie << nbpop << endl;
+ sortie << nbloc << endl;
+
+ for (l=0; l < nbloc; l++) {
+ Plocus = _Pcopie->get_Plocus(l);
+ nball = Plocus->get_nball();
+ sortie << Plocus->get_nballnonnuls() <<endl;
+ for (p=0; p < nbpop; p++) {
+ proms = true;
+ for (i=0; i < nball; i++) {
+ if (!proms) sortie << " ";
+ if (Plocus->getPall(i)->r_nonnul()) {
+// sortie << _Pcopie->get_Ppop(p)->f_calcfreq(Plocus->getPall(i));
+ sortie << _Pcopie->get_Ppop(p)->f_calcfreqabsolue(Plocus->getPall(i));
+ if (proms) proms = false;
+ }
+ }
+ sortie << endl;
+ }
+ }
+
+}
+/** Exportation au format "admix" de G. Bertorelle
+voir le site:
+http://www.unife.it/genetica/Giorgio/giorgio.html
+ */
+void JeuPopExp::oAdmix_dat(unsigned long P1,unsigned long P2,unsigned long H, ostream & sortie, ostream & infos){
+
+ f_prepP1P2H(H,P1,P2,infos); //inversion de l'ordre pour corriger le bug trouvé par Andrea Taylor (15/5/2002)
+
+
+ unsigned long nbpop;
+ unsigned long nbloc(_Pcopie->get_nbloc());
+ unsigned long nball; //nb d'alleles pour chaque locus
+ unsigned long i,l,p;
+ Locus * Plocus;
+ bool proms;
+
+ nbpop = _Pcopie->get_nbpop();
+
+ for (l=0; l < nbloc; l++) {
+ Plocus = _Pcopie->get_Plocus(l);
+ sortie << Plocus->get_nom() << endl;
+ proms = true;
+ for (p=0; p < nbpop; p++) {
+ // affichage du total (nb d'alles non nuls de chaque pop pour ce locus)
+ if (!proms) sortie << " ";
+ sortie << _Pcopie->get_Ppop(p)->r_nballnonnuls(l);
+ if (proms) proms = false;
+ }
+ sortie << endl;
+
+ nball = Plocus->get_nball();
+ for (i=0; i < nball; i++) {
+ if (Plocus->getPall(i)->r_nonnul()) {
+ proms = true;
+ for (p=0; p < nbpop; p++) {
+ if (!proms) sortie << " ";
+ sortie << _Pcopie->get_Ppop(p)->f_calcfreqabsolue(Plocus->getPall(i));
+ if (proms) proms = false;
+ }
+ sortie << endl;
+ }
+ }
+ }
+}
+
+void JeuPopExp::oAdmix_mtx(ostream & sortie, ostream & infos){
+// f_prepP1P2H(P1,P2,H,infos);
+
+ unsigned long nbpop;
+ unsigned long nbloc(_Pcopie->get_nbloc());
+ unsigned long nball; //nb d'alleles pour chaque locus
+ unsigned long i,l,p;
+ unsigned long diffcarre;
+ Locus * Plocus;
+// bool proms;
+
+ if (_Pcopie == 0) throw Anomalie(1, "Admix_mtx");
+ nbpop = _Pcopie->get_nbpop();
+ if (nbpop != 3) throw Anomalie(1, "Admix_mtx");
+
+ sortie << nbloc << endl;
+ for (l=0; l < nbloc; l++) {
+ Plocus = _Pcopie->get_Plocus(l);
+ sortie << Plocus->get_nom() << endl;
+ nball = Plocus->get_nballnonnuls();
+ // nb d'alleles différents non nuls pour ce locus
+ sortie << nball << endl;
+ // matrice de distance "squared difference in allele size"
+ for (i=0; i < Plocus->get_nball(); i++) {
+ if (Plocus->getPall(i)->r_estnul()) continue;
+ for (p=0; p < i; p++) {
+ if (Plocus->getPall(p)->r_estnul()) continue;
+ diffcarre =(Plocus->getPall(p)->get_nbrepet() - Plocus->getPall(i)->get_nbrepet());
+ diffcarre *= diffcarre;
+ sortie << diffcarre << " ";
+//cerr << ",nrepet:" << Plocus->getPall(p)->get_nbrepet();
+ }
+ sortie << "0" << endl;
+ }
+ }
+}
+
+/** Prépare une copie de jeupop avec 3
+populations P1, P2, H (special admixture) */
+void JeuPopExp::f_prepP1P2H(unsigned long P1,unsigned long P2,unsigned long H, ostream & infos){
+ unsigned long nbpop(_Pjeu->get_nbpop());
+ unsigned long p;
+ Population * PP1;
+ Population * PP2;
+ Population * PH;
+ Population * Ppop;
+ //-------préparation des données:
+ if (_Pcopie != 0) delete (_Pcopie);
+ _Pcopie = new Jeupop(*_Pjeu);
+
+ PP1 = _Pcopie->get_Ppop(P1);
+ PP2 = _Pcopie->get_Ppop(P2);
+ PH = _Pcopie->get_Ppop(H);
+
+ _Pcopie->f_deplacePop(PP1,0);
+ _Pcopie->f_deplacePop(PP2,1);
+ _Pcopie->f_deplacePop(PH,2);
+
+
+//cerr << "JeuPopExp::oAile" << endl;
+//cerr << _Pcopie->get_nbpop() << " " <<_Pcopie->get_nbind() << endl;
+
+ p=nbpop;
+ while (nbpop > 3) {
+ p--;
+ Ppop = _Pcopie->get_Ppop(p);
+ if (Ppop == PP1) continue;
+ if (Ppop == PP2) continue;
+ if (Ppop == PH) continue;
+ _Pcopie->SupprPop(Ppop);
+ nbpop--;
+//cerr << _Pcopie->get_nbpop() << " " <<_Pcopie->get_nbind() << endl;
+ }
+
+// _Pcopie->oGenepop(cout);
+ // elimination des alleles inutiles (non présents dans l'échantillon)
+ _Pcopie->f_nettoieAlleles();
+
+}
+
+void JeuPopExp::oGenetix(ostream & sortie, ostream & infos){
+// sortie au format Genetix
+// http://www.univ-montp2.fr/~genetix/genetix.htm
+// 1ere ligne : nb de locus
+// 2eme ligne : nb de populations
+//description des locus:
+// nom de locus sur une ligne (5 caracteres max)
+// nombre d'alleles, et numéros d'allèles sur 3 chiffres
+// description des populations:
+// nom de population sur une ligne
+// taille de l'échantillon sur une ligne
+// Identifiant de l'individu sur 10 caractères, suivi du génotype
+// retour chariot : CRLF
+
+//cerr << "JeuPopExp::oGenetix(ostream & sortie, ostream & infos)" << endl;
+ unsigned long nbpop;
+ unsigned long nbind;
+ unsigned long nbloc(_Pjeu->get_nbloc());
+ unsigned long nball; //nb d'alleles pour chaque locus
+ unsigned long i,l,p;
+ Locus * Plocus;
+ Population * Ppop;
+ Individu * Pind;
+
+ char crlf[3];
+
+ crlf[0] = 13;
+ crlf[1] = 10;
+ crlf[2] = '\0';
+// bool proms;
+
+ if (_Pjeu == 0) throw Anomalie(1, "Genetix");
+
+ if (_Pjeu->get_nploidie() != 2) {
+ //le format Genetix ne permet que le stockage de pop diploïdes
+ throw Anomalie(100, "Genetix");
+ }
+
+ if (!(_Pjeu->f_verifnum(3))) {
+ //il faut renuméroter les allèles pour le format génétix
+ throw Anomalie(2, "Genetix");
+ }
+
+
+ nbpop = _Pjeu->get_nbpop();
+// if (nbpop != 3) throw Anomalie(1);
+
+ sortie << nbloc << crlf;
+ sortie << nbpop << crlf;
+
+ for (l=0; l < nbloc; l++) {
+ Plocus = _Pjeu->get_Plocus(l);
+ sortie << Plocus->get_nom() << crlf; //attention ! pas plus de 5 caractères
+ if (Plocus->get_nom().size() > 5) throw Anomalie(1000, "Genetix");
+ nball = Plocus->get_nball();
+ // nb d'alleles pour ce locus
+ sortie << Plocus->get_nballnonnuls();
+ // matrice de distance "squared difference in allele size"
+ for (i=0; i < nball; i++) {
+ if (Plocus->getPall(i)->r_estnul() != true) {
+ sortie << " ";
+ if (Plocus->getPall(i)->get_nom().size() == 2) sortie << "0";
+ else if (Plocus->getPall(i)->get_nom().size() == 1) sortie << "00";
+ sortie << Plocus->getPall(i)->get_nom();
+ }
+ }
+ sortie << crlf;
+ }
+
+ for (p=0; p < nbpop; p++) {
+ // _Pcopie->get_Ppop(p);
+ Ppop = _Pjeu->get_Ppop(p);
+ sortie << Ppop->get_nom() << crlf;
+ nbind = Ppop->get_nbind();
+ sortie << nbind << crlf;
+
+ for (i=0; i < nbind; i++) {
+ Pind = Ppop->get_Pind(i);
+ if (Pind->get_nom().size() > 10) throw Anomalie(1001, "Genetix");
+ Pind->affiche (sortie, 4); //affichage de l'individu au format genetix
+ sortie << crlf;
+ }
+ }
+}
+
+void JeuPopExp::oFstat(ostream & sortie, ostream & infos){
+// sortie au format FSTAT 2.91
+// http://www.unil.ch/izea/softwares/fstat.html
+// 1ere ligne : nb de pop, nb de locus, plus grand numero d'allele, nb de digits
+// nom des locus sur n lignes
+
+ unsigned long nbpop;
+ unsigned long nbind;
+ unsigned long nbloc(_Pjeu->get_nbloc());
+ unsigned long i,l,p;
+ Locus * Plocus;
+ Population * Ppop;
+ Individu * Pind;
+ char crlf[3];
+
+ crlf[0] = 13;
+ crlf[1] = 10;
+ crlf[2] = '\0';
+// bool proms;
+
+ if (_Pjeu == 0) throw Anomalie(1, "Fstat");
+
+ if (_Pjeu->get_nploidie() != 2) {
+ //le format Fstat ne permet que le stockage de pop diploïdes
+ throw Anomalie(100, "Fstat");
+ }
+
+ if (!(_Pjeu->f_verifnum(2))) {
+ //il faut renuméroter les allèles pour le format Fstat
+ throw Anomalie(2, "Fstat");
+ }
+
+
+ nbpop = _Pjeu->get_nbpop();
+// if (nbpop != 3) throw Anomalie(1);
+
+ p = 0;
+ for (l=0; l < nbloc; l++) {
+ if (_Pjeu->get_Plocus(l)->get_nballnonnuls() > p) p = _Pjeu->get_Plocus(l)->get_nballnonnuls();
+ }
+
+ //sortie << nbpop << "\t" << nbloc << "\t" << p << "\t2"<< crlf;
+ sortie << nbpop << "\t" << nbloc << "\t" << "99" << "\t2"<< crlf;
+
+ for (l=0; l < nbloc; l++) {
+ Plocus = _Pjeu->get_Plocus(l);
+ sortie << Plocus->get_nom() << crlf;
+ }
+
+ for (p=0; p < nbpop; p++) {
+ // _Pcopie->get_Ppop(p);
+ Ppop = _Pjeu->get_Ppop(p);
+ nbind = Ppop->get_nbind();
+
+ for (i=0; i < nbind; i++) {
+ if (p < 9) sortie << " ";
+ else if (p < 99) sortie << " ";
+ else if (p < 999) sortie << " ";
+
+ sortie << (p+1);
+ Pind = Ppop->get_Pind(i);
+ //if (Pind->get_nom().size() > 10) throw Anomalie(1001, "Fstat");
+ Pind->affiche (sortie, 5); //affichage de l'individu au format Fstat
+ sortie << crlf;
+ }
+ }
+}
+
+void JeuPopExp::oPopulationsXML(ostream & sortie, ostream & infos) const{
+ unsigned int l, i, nball(0), nbloc(_Pjeu->get_nbloc());
+ Locus * Plocus;
+ biolib::vecteurs::ChaineCar idXML;
+
+ //export into "populations" XML format
+ // pas fini
+ sortie << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" << endl;
+ sortie << "<!-- " << endl;
+ sortie << "created by Populations" << endl;
+ sortie << "http://www.pge.cnrs-gif.fr/bioinfo/populations" << endl;
+ sortie << "-->" << endl;
+
+ sortie << "<populations version=\"0.1\">" << endl;
+ sortie << "<comments>" << endl;
+ for (l=0; l < _Pjeu->get_commentaires().size(); l++) {
+ sortie << _Pjeu->get_commentaires().operator[](l) << endl;
+ }
+ sortie << "</comments>" << endl;
+
+ sortie << "<loci>" << endl;
+ for (l=0; l < nbloc; l++) {
+ Plocus = _Pjeu->get_Plocus(l);
+ sortie << "<locus";
+ sortie << " id=\"l" << l << "\"";
+ sortie << " name=\"" << Plocus->get_nom() << "\"";
+ sortie << ">" << endl;
+ //if (Plocus->get_nom().size() > 5) throw Anomalie(1000, "Genetix");
+ nball = Plocus->get_nball();
+ // nb d'alleles pour ce locus
+ for (i=0; i < nball; i++) {
+ sortie << "<allele";
+ idXML = "l";
+ idXML.AjEntier(l);
+ idXML += "a";
+ idXML.AjEntier(i);
+ Plocus->getPall(i)->set_idXML((string) idXML);
+ sortie << " id=\"" << Plocus->getPall(i)->get_idXML() << "\"";
+ if (Plocus->getPall(i)->r_estnul()) sortie << " name=\"missing\"";
+ else {
+ sortie << " name=\"" << Plocus->getPall(i)->get_nom() << "\"";
+ sortie << " nbrepeat=\"" << Plocus->getPall(i)->get_nbrepet() << "\"";
+ }
+ sortie << ">" << endl;
+
+ sortie << "</allele>" << endl;
+ }
+ sortie << "</locus>" << endl;
+ }
+ sortie << "</loci>" << endl;
+
+ _Pjeu->get_Pracinepop()->oPopulationsXML(0, sortie, infos);
+
+ sortie << "</populations>" << endl;
+
+}
+
diff --git a/src/jeupopexp.h b/src/jeupopexp.h
new file mode 100644
index 0000000..cd3dc83
--- /dev/null
+++ b/src/jeupopexp.h
@@ -0,0 +1,97 @@
+/***************************************************************************
+ jeupopexp.h - Classe dérivée de Jeupop, spécialisée
+ dans l'exportation des données
+ -------------------
+ begin : Tue Oct 24 2000
+ copyright : (C) 2000 by Olivier Langella
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef JEUPOPEXP_H
+#define JEUPOPEXP_H
+
+//#include <String.h>
+#include <iomanip>
+#include "jeupop.h"
+#include "vecteurs.h"
+
+/**
+ *@author Olivier Langella
+ */
+
+class JeuPopExp {
+public:
+ JeuPopExp(Jeupop *);
+ ~JeuPopExp();
+
+ void oLea(unsigned long P1,unsigned long P2,unsigned long H, ostream & sortie, ostream & infos);
+ /** Exportation au format "admix" de G. Bertorelle
+voir le site:
+http://www.unife.it/genetica/Giorgio/giorgio.html
+ */
+ void oAdmix_dat(unsigned long P1,unsigned long P2,unsigned long H, ostream & sortie, ostream & infos);
+ void oAdmix_mtx(ostream & sortie, ostream & infos);
+ void oGenetix(ostream & sortie, ostream & infos);
+ void oFstat(ostream & sortie, ostream & infos);
+ void oPopulationsXML(ostream & sortie, ostream & infos) const;
+
+private:
+ const Jeupop * _Pjeu;
+ Jeupop * _Pcopie;
+ /** Prépare une copie de jeupop avec 3
+populations P1, P2, H (special admixture) */
+ void f_prepP1P2H(unsigned long P1,unsigned long P2,unsigned long H, ostream & infos);
+
+public:
+ struct Anomalie{
+
+ int le_pb;
+ Anomalie (int i, string format):le_pb(i), _format(format){};
+ string _message;
+ string _format;
+
+ string& fmessage(int num){
+ switch (num) {
+ case 1:
+ _message = _("Error n°1 in JeuPopExp while exporting to ");
+ _message += _format;
+ break;
+ case 2:
+ _message = _("Error n°2 in JeuPopExp: incompatible alleles names to export in ");
+ _message += _format;
+ break;
+ case 100:
+ _message = _("Error n°100 in JeuPopExp: ");
+ _message += _format;
+ _message += _(" require diploid populations");
+ break;
+
+ case 1000:
+ _message = _("Error n°1000 in JeuPopExp: locus names do not exceed 5 caracters in ");
+ _message += _format;
+ break;
+ case 1001:
+ _message = _("Error n°1001 in JeuPopExp: individual names do not exceed 10 caracters in ");
+ _message += _format;
+ break;
+ default:
+ _message = _("Error in JeuPopExp");
+ break;
+ }
+ return(_message);
+ }
+ };
+
+};
+
+#endif
+
diff --git a/src/locus.cpp b/src/locus.cpp
new file mode 100644
index 0000000..ea6d3bb
--- /dev/null
+++ b/src/locus.cpp
@@ -0,0 +1,420 @@
+/***************************************************************************
+ locus.cpp - Librairie d'objets permettant de manipuler des données
+ spécifiques aux locus
+ -------------------
+ begin : ven sep 01 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include"jeupop.h"
+#include "locus.h"
+
+//typedef biolib::vecteurs::ChaineCar ChaineCar;
+
+// quelques fonctions mathématiques...
+
+long double fact (int n) {
+ long double res (n);
+ long double i;
+
+ if (n == 0) return (1);
+
+ for (i = n-1; i > 1 ; i--) {
+ // res = res * i;
+ res *= i;
+ }
+
+ return (res);
+}
+
+long double fact (int n, int m) {
+ long double res (1);
+ int i;
+///equivalent a: fact (n) / fact (m)
+ if (n == m) return(1);
+ if (n > m) {
+ res = n;
+ for (i = n-1; i > m ; i--) {
+ // res = res * i;
+ res *= i;
+ }
+ return (res);
+ }
+ else {
+ res = m;
+ for (i = m-1; i > n ; i--) {
+ res *= i;
+ }
+ return (1/res);
+ }
+}
+long double comb (int n, int m) {
+ long double res;
+ int a(m),b(n-m), swap;
+
+ if (b > a) {
+ swap = a;
+ a = b;
+ b = swap;
+ }
+ res = fact (n,a);
+// res = fact (n) / fact (m);
+ res = res / fact (b);
+
+ return (res);
+}
+
+/*
+//constructeur
+Individu::Individu (int nball) {
+
+ _nom.assign("");
+ _Ppop = 0;
+ _nball = nball;
+// _tabPall = new (Allele*[nball]);
+ _tabPall.resize(nball);
+// for (i=0;i < nball;i++) _tabPall.push_back(0);
+}
+*/
+
+//constructeur de copies
+Locus::Locus(const Locus& original, Jeupop * Pjeu) {
+
+ unsigned long i;
+ unsigned long nball(original.get_nball());
+
+ _nom = original._nom;
+ _Pjeu = Pjeu;
+
+ for (i=0;i < nball;i++) {
+ _tabPall.push_back(new Allele(*original._tabPall[i],this));
+// _tabPall[i]->set_Plocus(this);
+ }
+}
+
+/*//constructeur de copies
+Locus::Locus(const Locus& original) {
+
+ long i;
+ long nball(original.get_nball());
+
+ _nom = original._nom;
+// _Pjeu = original._Pjeu;
+
+ for (i=0;i < nball;i++) {
+ _tabPall.push_back(new Allele(this, original.get_nomall(i)));
+// if (original.getPall(i)->_nul) nul = true;
+ }
+
+}
+*/
+
+//constructeur
+Locus::Locus (long nball) {
+ long i;
+
+ _nom.assign("");
+ _Pjeu = 0;
+
+ for (i=0;i < nball;i++) _tabPall.push_back(new Allele(this));
+}
+
+Locus::Locus (Jeupop * pjeu, long nball) {
+ long i;
+
+ _Pjeu = pjeu;
+
+ _nom.assign("");
+
+ for (i=0;i < nball;i++) _tabPall.push_back(new Allele(this));
+}
+
+//constructeur
+
+//destructeur
+Locus::~Locus () {
+//cerr << "Locus::~Locus debut" << endl;
+ int i;
+ int nball(get_nball());
+
+ for (i=0;i < nball;i++) delete (_tabPall[i]);
+
+//cerr << "Locus::~Locus fin" << endl;
+// delete [] _tabPall;
+}
+
+
+
+void Locus::reset(Jeupop * Pjeu, long nballnew) {
+ long i;
+ long nball(get_nball());
+
+ for (i=0;i < nball;i++) delete (_tabPall[i]);
+
+// delete [] _tabPall;
+
+ _Pjeu = Pjeu;
+// _nball = nball;
+// _tabPall = new (Allele*[nball]);
+ _tabPall.resize(nballnew);
+
+ for (i=0;i < nballnew;i++) {
+ _tabPall[i] = new Allele(this);
+ }
+
+}
+
+//constructeur
+/*Population::Population (int nbind) {
+ int i;
+
+ _nom.assign("");
+ _Pjeu = 0;
+ _nbind = nbind;
+// _tabPind = new (Individu*[nbind]);
+
+ _nbloc = 0;
+ _nploidie = 0;
+// _tabPall = new (Allele*[0]);
+
+ for (i=0;i < _nbind;i++) _tabPind.push_back(new(Individu));
+}*/
+
+
+
+/*void Population::sort_all() {
+ //tri de _tabPall par loci
+ Allele * Pallswap;
+ int nbcopies(_nploidie * _nbind);
+ int i, j, pos;
+
+ for (i=0;i < _nbloc; i++) {
+
+ for (j=1; j<nbcopies; j++) {
+ if (_tabPall[(i * nbcopies) + j] < _tabPall[(i * nbcopies) + j-1]) {
+ //swap
+ pos = j;
+ while((_tabPall[(i * nbcopies) + pos] < _tabPall[(i * nbcopies) + pos-1]) && (pos>0)) {
+ Pallswap = _tabPall[(i * nbcopies) + pos-1];
+ _tabPall[(i * nbcopies) + pos-1] = _tabPall[(i * nbcopies) + pos];
+ _tabPall[(i * nbcopies) + pos] = Pallswap;
+ pos--;
+ }
+ }
+ }
+ }
+}*/
+
+
+Allele * Locus::getPallNul() {
+ // donne un pointeur sur l'allele nul
+ Allele* res;
+ unsigned long i;
+
+ res = 0;
+ for (i=0; i < _tabPall.size(); i++) {
+ if(_tabPall[i]->_miss) {
+ res = _tabPall[i];
+ break;
+ }
+ }
+
+ if (res == 0) { //on crée l'allèle nul
+ _tabPall.push_back(new Allele(this, "00"));
+ res = _tabPall.back();
+ }
+
+ return (res);
+}
+
+Allele* Locus::getPall(const string & nom) const{
+ // donne un pointeur sur l'allele du nom 'nom'
+ Allele* res;
+ unsigned long i;
+
+ res = 0;
+//cerr << "getPall dans Locus debut " << nom << endl;
+ for (i=0; i < _tabPall.size(); i++) {
+//cerr << "coucou " << _tabPall[i]->_nom << endl;
+ if(_tabPall[i]->_nom == nom) {
+ res = _tabPall[i];
+ break;
+ }
+ }
+//cerr << "getPall dans Locus fin " << res << endl;
+
+ return (res);
+}
+
+
+bool Locus::f_verifnum(int typedenum) const {
+ // Vérification du type de numérotation des allèles
+// 1 => type Genepop stricte (2digits)
+// 2 => nom d'alleles = numéros
+// 3 => nom d'alleles = numéros < 999
+ //Anomalie 2-> les numéros d'allèles format genepop ne sont pas présents
+
+ long nball(get_nball());
+ long i;
+
+ for (i=0; i < nball; i++) {
+ if (!(_tabPall[i]->f_verifnum(typedenum))) return(false);
+ }
+
+ return(true);
+}
+
+
+void Locus::ifAjouterAllele(const Allele * Pall) {
+ //ajout d'un allele dans un locus
+ // => recherche un allele preexistant
+ // vérifié le 11/09/2000
+ unsigned long i, taille(get_nball());
+ long nball(-1);
+
+ for (i = 0 ; i < taille; i++) {
+ if (*Pall == *getPall(i)) {
+ nball = i;
+ break;
+ }
+ }
+ if (nball >= 0) { //l'allele existe deja
+ return;
+ }
+ else { //il faut le creer
+ _tabPall.push_back(new Allele(*Pall, this));
+ }
+}
+
+const Locus& Locus::operator= (const Locus & rval) {
+ long i;
+ long nball(rval.get_nball());
+
+ reset(_Pjeu, nball);
+ _nom = rval._nom;
+
+ for (i=0;i < nball;i++) {
+ *(_tabPall[i]) = *(rval._tabPall[i]);
+ // _tabPall[i]->set_Plocus(this);
+ }
+
+ return(*this);
+}
+
+void Locus::f_trad2Gpop(ostream& sortie) {
+//transformation des noms d'alleles en chiffres < a 100
+ long i;
+ long nball(get_nball());
+// char mot[5];
+ biolib::vecteurs::ChaineCar mot;
+
+ sortie << endl;
+ sortie << "Locus: " << _nom << endl;
+
+ for (i=0; i < nball; i++) {
+ mot.assign("");
+
+ if (_tabPall[i]->_miss) {
+ sortie << _tabPall[i]->_nom << " <--> ";
+ _tabPall[i]->set_nom("00");
+ sortie << _tabPall[i]->_nom << endl;
+ }
+ else {
+ sortie << _tabPall[i]->_nom << " <--> ";
+
+ // itoa(i+1,mot,10);
+ // mot[2] = '\0';
+ if ((i+1) < 10) {
+ // mot[1] = mot[0];
+ // mot[0] = '0';
+ mot += '0';
+ mot.AjEntier(i+1);
+ }
+ else if ((i+1) < 100) {
+ mot.AjEntier(i+1);
+ }
+ else cerr <<"erreur..."<< endl;
+ _tabPall[i]->set_nom(mot);
+
+ sortie << _tabPall[i]->_nom << endl;
+ }
+ }
+}
+
+
+
+void Locus::set_PJeupop(Jeupop * Pjeu) {
+ _Pjeu = Pjeu;
+}
+
+unsigned long Locus::get_numloc() {
+ return(_Pjeu->get_numloc(this));
+}
+/** Enlève les allèles non représentés dans Jeupop
+ */
+void Locus::f_nettoieAlleles(){
+ unsigned long i;
+
+ for (i = 0; i < _tabPall.size(); ) {
+//cerr << i << " " << _tabPall.size() << endl;
+ if (_Pjeu->r_allelenonpresent(_tabPall[i])) {
+ delete _tabPall[i];
+ _tabPall.erase(_tabPall.begin()+i);
+ }
+ else i++;
+ }
+}
+
+unsigned long Locus::get_nballnonnuls() const{
+/** Retourne le nombre d'allèles non nuls pour ce locus */
+ unsigned long nball(0);
+ unsigned long i;
+
+ for (i=0; i < _tabPall.size(); i++) if (_tabPall[i]->r_nonnul()) nball++;
+
+ return (nball);
+}
+
+
+void Locus::set_microsat_correction(long double valmin, long double valmax, unsigned int value) {
+ // corrige la taille des allèles microsats dans l'intervalle valmin<>valmax avec la valeur value
+
+ // 1) trouver les allèles compris entre valmin et valmax
+ vector<long double> tab_tailles;
+ biolib::vecteurs::ChaineCar nom;
+ unsigned int i;
+
+ tab_tailles.resize(_tabPall.size());
+ for (i=0; i < _tabPall.size(); i++) {
+ tab_tailles[i] = (long double) atof(_tabPall[i]->get_nom().c_str());
+ }
+
+ for (i=0; i < tab_tailles.size(); i++) {
+ if ((tab_tailles[i]>=valmin) && (tab_tailles[i]<=valmax)) {
+ _tabPall[i]->set_nbrepet(value);
+ nom = "C";
+ nom.AjEntier(value);
+ _tabPall[i]->set_nom(nom);
+ }
+ }
+
+
+}
+
+Allele * Locus::new_allele(const string & name, unsigned int nbrepeat) {
+ Allele * Pallele(new Allele(this,name));
+ //Pallele->set_nom(name);
+ Pallele->set_nbrepet(nbrepeat);
+ _tabPall.push_back(Pallele);
+ return(Pallele);
+}
diff --git a/src/locus.h b/src/locus.h
new file mode 100644
index 0000000..802c794
--- /dev/null
+++ b/src/locus.h
@@ -0,0 +1,87 @@
+/***************************************************************************
+ locus.h - Librairie d'objets permettant de manipuler des données
+ spécifiques aux locus
+ -------------------
+ begin : ven sep 01 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+// bibliothèque d'objets permettant de manipuler des
+// donnees sur des populations
+// ecrit par Olivier Langella le 21/4/98
+// modifie le 01/09/2000 par Olivier Langella pour apporter les capacités de structurations
+// de populations
+
+
+#ifndef LOCUS_H
+#define LOCUS_H
+
+class Jeupop;
+#include"allele.h"
+#include "vecteurs.h"
+//typedef biolib::vecteurs::ChaineCar ChaineCar;
+
+
+long double fact (int n);
+long double fact (int n, int m);
+long double comb (int n, int m);
+
+// locus
+class Locus {
+public :
+// Locus(const Locus&); //constructeur de copies
+ Locus(const Locus& original, Jeupop * Pjeu);//constructeur de copies
+ Locus(long nball);
+ Locus(Jeupop *, long nball);
+ ~Locus();
+ void reset(Jeupop *,long);//pointeur sur Jeupop,nball
+ Allele * new_allele(const string & name, unsigned int nbrepeat);
+
+
+// int getnballdif() const;
+ unsigned long get_nball() const {return(_tabPall.size());};
+ unsigned long get_numloc() ;
+ Allele * getPall(const string & nom) const ;
+ Allele * getPallNul();
+ Allele * getPall(long i) const {return(_tabPall[i]);};
+ const char * get_nomall(int i) const {return(_tabPall[i]->_nom.c_str());};
+// const char * get_nom() {return(_nom.c_str());};
+ const string& get_nom() const {return(_nom);};
+ bool f_verifnum(int) const;
+
+ inline void set_PJeupop(Jeupop * Pjeu);
+ void set_nom(const string& mot) {_nom.assign(mot);};
+ void set_microsat_correction(long double valmin, long double valmax, unsigned int value);
+
+ void ifAjouterAllele(const Allele * Pall);
+
+
+ friend class Jeupop;
+
+ const Locus & operator= (const Locus &);
+ /** Enlève les allèles non représentés dans Jeupop
+ */
+ void f_nettoieAlleles();
+ /** Retourne le nombre d'allèles non nuls pour ce locus */
+ unsigned long get_nballnonnuls() const;
+
+private :
+ void f_trad2Gpop(ostream&);
+
+ string _nom;
+ Jeupop * _Pjeu;
+ vector<Allele*> _tabPall;
+};
+
+#endif
+
diff --git a/src/matrices.cpp b/src/matrices.cpp
new file mode 100644
index 0000000..83a08dc
--- /dev/null
+++ b/src/matrices.cpp
@@ -0,0 +1,2597 @@
+/***************************************************************************
+ matrices.cpp - Librairie d'objets pour manipuler des matrices
+ -------------------
+ begin : ven aug 14 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "matrices.h"
+
+namespace biolib {
+namespace vecteurs {
+
+//template<class T> int Matrice<T>::_oformat = 1; //Format de sortie: par d�faut
+
+
+template<class T> Matrice<T>::Matrice(const Matrice<T>& original) {
+ //constructeur de copie
+ unsigned long i;
+
+ // if (_tab != 0) delete [] _tab;
+ _oformat = 1;
+ _nc = original._nc;
+ _nl = original._nl;
+ _t = _nc * _nl;
+
+ _tab = new T[_t];
+
+ _titre = original._titre;
+ _flag = original._flag;
+ _tcol = original._tcol;
+ _tlig = original._tlig;
+ _miss = original._miss;
+ _type = original._type;
+
+ for (i = 0; i < _t; i++) {
+ //nouvelle s�quence
+ _tab[i] = original._tab[i];
+ }
+
+}
+
+template<class T> Matrice<T>::Matrice() {
+
+ // _Pointeur = *( new (Pointeur<T>));
+ _oformat = 1;
+ _nc = 0;
+ _nl = 0;
+ _t = 0;
+ _tab = 0;
+ _type = 0;
+ _miss = 0;
+ _flag = 0;
+}
+
+template<class T> Matrice<T>::Matrice(unsigned long nl, unsigned long nc) {
+ unsigned long i;
+
+ _oformat = 1;
+ _nc = nc;
+ _nl = nl;
+ _t = nc * nl;
+ _tab = new T[_t];
+ _type = 1;
+
+ _miss = 0;
+ _flag = 0;
+ _titre.resize(0);
+
+ _tcol.reserve(_nc);
+ _tlig.reserve(_nl);
+ for (i = 0; i < _nc; i++)
+ _tcol.push_back("");
+ for (i = 0; i < _nl; i++)
+ _tlig.push_back("");
+
+ for (i = 0; i < _t; i++)
+ _tab[i] = 0;
+
+}
+
+template<class T> bool Matrice<T>::SetType(int type) {
+
+ switch (type) {
+ case 1: //rectangulaire normale
+ _type = type;
+ break;
+ case 2: //matrice triangulaire (distances)
+ if (_nc == _nl) {
+ unsigned long i, j;
+ for (i = 0; i < _nc; i++) {
+ for (j = 0; j < i; j++) {
+ if (GetCase(i, j) != GetCase(j, i)) {
+ qDebug() << "Matrices::Anomalie "
+ << "failed to convert into symetric matrix (i,j)!=(j,i) "
+ << (float) GetCase(i, j) << " "
+ << (float) GetCase(j, i) << " i " << i << " j "
+ << j;
+ return (false);
+ //throw typename biolib::vecteurs::Matrice<T>::Anomalie(5);
+ }
+ }
+ }
+ _type = type;
+ } else {
+ qDebug() << "Matrices::Anomalie "
+ << "failed to convert into symetric matrix nc!=nl " << _nc
+ << " " << _nl;
+ return (false);
+ //throw typename biolib::vecteurs::Matrice<T>::Anomalie(5); //Echec de conversion
+ }
+ break;
+ default:
+ break;
+ }
+ return (true);
+}
+
+template<class T> const Matrice<T>& Matrice<T>::operator=(
+ const Matrice<T> &rval) {
+
+ unsigned long i;
+
+ if (_tab != 0)
+ delete[] _tab;
+
+ _type = rval._type;
+ _flag = rval._flag;
+ _nc = rval._nc;
+ _nl = rval._nl;
+ _t = rval._t;
+ _tab = new T[rval._t];
+
+ _titre = rval._titre;
+
+ _tlig = rval._tlig;
+ _tcol = rval._tcol;
+
+ for (i = 0; i < _t; i++)
+ _tab[i] = rval._tab[i];
+
+ return (*this);
+}
+
+template<class T> const Matrice<T>& Matrice<T>::operator=(vector<T> &rval) {
+
+ int i;
+
+ if (_tab != 0)
+ delete[] _tab;
+
+ _type = 1;
+ _flag = 0;
+ _nc = rval.size();
+ _nl = 1;
+ _t = _nc;
+ _tab = new T[_nc];
+
+ // _titre = rval._titre;
+
+ // _tlig = rval._tlig;
+ // _tcol = rval._tcol;
+
+ for (i = 0; i < _t; i++)
+ _tab[i] = rval[i];
+
+ return (*this);
+}
+
+template<class T> void Matrice<T>::oExcel(ostream& fichier) {
+ unsigned long i, j;
+
+ // fichier.setf(ios::scientific);
+ //fichier << "coucou";
+ // �criture du titre
+ for (i = 0; i < _titre.size(); i++) {
+ fichier << _titre[i];
+ fichier << endl;
+ }
+
+ fichier << "#";
+ if ((_flag == 2) || (_flag == 3)) {
+ //�tiquettes des colonnes
+ fichier << '\t' << _tcol[0];
+ for (i = 1; i < _nc; i++)
+ fichier << '\t' << _tcol[i];
+ }
+ fichier << endl;
+
+ //�criture de la matrice
+ for (i = 0; i < _nl; i++) {
+ if ((_flag == 1) || (_flag == 3)) {
+ //�tiquettes des lignes
+ fichier << _tlig[i];
+ }
+
+ for (j = 0; j < _nc; j++) {
+ // fichier << '\t' << _tab [i * _nc + j];
+ fichier << '\t' << GetCase(i, j);
+ }
+ fichier << endl;
+ }
+
+}
+
+template<class T> void Matrice<T>::oGnumeric(ostream& fichier) {
+ QString * p_output_xml = new QString("");
+ QXmlStreamWriter xml_stream(p_output_xml);
+ xml_stream.setAutoFormatting(true);
+ xml_stream.writeStartDocument();
+
+ xml_stream.writeNamespace("http://www.gnumeric.org/v10.dtd", "gmr");
+ xml_stream.writeNamespace("http://www.w3.org/2001/XMLSchema-instance",
+ "xsi");
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Workbook");
+ xml_stream.writeAttribute("http://www.w3.org/2001/XMLSchema-instance",
+ "schemaLocation", "http://www.gnumeric.org/v8.xsd");
+
+ //fichier
+ // << "<gmr:Workbook xmlns:gmr=\"http://www.gnumeric.org/v10.dtd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.gnumeric.org/v8.xsd\">"
+ // << endl;
+
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd",
+ "Attributes");
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Attribute");
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "WorkbookView::show_horizontal_scrollbar");
+ //fichier << "<gmr:Attributes>" << endl;
+ //fichier << " <gmr:Attribute>" << endl;
+ //fichier << "<gmr:name>WorkbookView::show_horizontal_scrollbar</gmr:name>"
+ // << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "type", "4");
+ //fichier << " <gmr:type>4</gmr:type>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "value",
+ "TRUE");
+ //fichier << " <gmr:value>TRUE</gmr:value>" << endl;
+ xml_stream.writeEndElement();
+ // fichier << " </gmr:Attribute>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Attribute");
+ //fichier << " <gmr:Attribute>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "WorkbookView::show_vertical_scrollbar");
+ //fichier << " <gmr:name>WorkbookView::show_vertical_scrollbar</gmr:name>"
+ // << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "type", "4");
+ //fichier << " <gmr:type>4</gmr:type>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "value",
+ "TRUE");
+ //fichier << " <gmr:value>TRUE</gmr:value>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Attribute>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Attribute");
+ //fichier << " <gmr:Attribute>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "WorkbookView::show_notebook_tabs");
+ //fichier << " <gmr:name>WorkbookView::show_notebook_tabs</gmr:name>"
+ // << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "type", "4");
+ //fichier << " <gmr:type>4</gmr:type>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "value",
+ "TRUE");
+ //fichier << " <gmr:value>TRUE</gmr:value>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Attribute>" << endl;
+
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Attribute");
+ //fichier << " <gmr:Attribute>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "WorkbookView::do_auto_completion");
+ //fichier << " <gmr:name>WorkbookView::do_auto_completion</gmr:name>"
+ // << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "type", "4");
+ //fichier << " <gmr:type>4</gmr:type>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "value",
+ "TRUE");
+ //fichier << " <gmr:value>TRUE</gmr:value>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Attribute>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Attributes>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Summary");
+ //fichier << " <gmr:Summary>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Item");
+ //fichier << " <gmr:Item>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "biology softwares");
+ //fichier << " <gmr:name>biology softwares</gmr:name>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd",
+ "val-string", "http://www.pge.cnrs-gif.fr/bioinfo");
+ //fichier
+ // << " <gmr:val-string>http://www.pge.cnrs-gif.fr/bioinfo</gmr:val-string>"
+ // << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Item>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Item");
+ //fichier << " <gmr:Item>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "author");
+ //fichier << " <gmr:name>author</gmr:name>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd",
+ "val-string", "Olivier Langella <Olivier.Langella at moulon.inra.fr>");
+ //fichier
+ // << " <gmr:val-string>Olivier Langella, Olivier.Langella at pge.cnrs-gif.fr</gmr:val-string>"
+ // << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Item>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << "</gmr:Summary>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd",
+ "SheetNameIndex");
+ //fichier << "<gmr:SheetNameIndex>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "SheetName",
+ "Matrix 1");
+ //fichier << " <gmr:SheetName>Matrix 1</gmr:SheetName>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << "</gmr:SheetNameIndex> " << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Sheets");
+ //fichier << "<gmr:Sheets> " << endl;
+ // fichier.setf(ios::scientific);
+
+ QString sheetname("Matrix 1");
+ oGnumericSheet(xml_stream, sheetname);
+
+ //fichier << " </gmr:Sheets> " << endl;
+ //fichier << "</gmr:Workbook> " << endl;
+
+ xml_stream.writeEndDocument();
+
+ fichier << p_output_xml->toStdString();
+ delete (p_output_xml);
+
+}
+
+template<class T> void Matrice<T>::oGnumericSheet(QXmlStreamWriter& xml_stream,
+ const QString & sheetname) const {
+
+ qDebug()
+ << "Matrice<T>::oGnumericSheet(QXmlStreamWriter& xml_stream, const QString & sheetname) begin";
+ unsigned long i, j, irow(0), jcol(0);
+ const QString value_format("0.000000");
+
+ /*fichier << "<gmr:Sheet ";
+ fichier
+ << "DisplayFormulas=\"false\" HideZero=\"false\" HideGrid=\"false\" HideColHeader=\"false\" HideRowHeader=\"false\" DisplayOutlines=\"true\" OutlineSymbolsBelow=\"true\" OutlineSymbolsRight=\"true\">"
+ << endl;*/
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Sheet");
+ xml_stream.writeAttribute("DisplayFormulas", "false");
+ xml_stream.writeAttribute("HideZero", "false");
+ xml_stream.writeAttribute("HideGrid", "false");
+ xml_stream.writeAttribute("HideColHeader", "false");
+ xml_stream.writeAttribute("HideRowHeader", "false");
+ xml_stream.writeAttribute("DisplayOutlines", "true");
+ xml_stream.writeAttribute("OutlineSymbolsBelow", "true");
+ xml_stream.writeAttribute("OutlineSymbolsRight", "true");
+
+ /*_p_xml_stream->writeAttribute("xml", "lang", "en");
+ _p_xml_stream->writeStartElement("body");
+ _p_xml_stream->writeStartElement("table");
+ _p_xml_stream->writeStartElement("tbody");*/
+
+ // fichier.imbue();
+ // fichier << "<gmr:Name>" << sheetname << "</gmr:Name>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "Name",
+ sheetname);
+
+ //fichier << "<gmr:MaxCol>" << (GetNC() + 2) << "</gmr:MaxCol>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "MaxCol",
+ QString::number(GetNC() + 2));
+ //fichier << "<gmr:MaxRow>" << (GetNL() + 5 + _titre.size())
+ // << "</gmr:MaxRow>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "MaxRow",
+ QString::number((GetNL() + 5 + _titre.size())));
+ //fichier << "<gmr:Zoom>1.000000</gmr:Zoom>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "Zoom",
+ "1.000000");
+
+ //fichier << "<gmr:Names/>" << endl;
+ xml_stream.writeEmptyElement("http://www.gnumeric.org/v10.dtd", "Names");
+
+ //fichier << "<gmr:Cells>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Cells");
+ // �criture du titre
+ for (i = 0; i < _titre.size(); i++, irow++) {
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Cell");
+ //fichier << "<gmr:Cell Col=\"0\" Row=\"" << irow
+ // << "\" ValueType=\"60\">";
+ xml_stream.writeAttribute("Row", QString::number(irow));
+ xml_stream.writeAttribute("Col", "0");
+ xml_stream.writeAttribute("ValueType", "60");
+ //fichier << _titre[i];
+ xml_stream.writeCharacters(_titre[i].c_str());
+ //fichier << "</gmr:Cell>" << endl;
+ xml_stream.writeEndElement();
+ }
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Cell");
+ xml_stream.writeAttribute("Col", "0");
+ xml_stream.writeAttribute("Row", QString::number(irow));
+ xml_stream.writeAttribute("ValueType", "60");
+ xml_stream.writeCharacters("#");
+ xml_stream.writeEndElement();
+
+ //fichier << "<gmr:Cell Col=\"0\" Row=\"" << irow
+ // << "\" ValueType=\"60\">#</gmr:Cell>";
+ if ((_flag == 2) || (_flag == 3)) {
+ //�tiquettes des colonnes
+ jcol = 1;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Cell");
+ xml_stream.writeAttribute("Col", QString::number(jcol));
+ xml_stream.writeAttribute("Row", QString::number(irow));
+ xml_stream.writeAttribute("ValueType", "60");
+ xml_stream.writeCharacters(_tcol[0].c_str());
+ xml_stream.writeEndElement();
+
+ //fichier << "<gmr:Cell Col=\"" << jcol << "\" Row=\"" << irow
+ // << "\" ValueType=\"60\">";
+ //fichier << _tcol[0];
+ //fichier << "</gmr:Cell>" << endl;
+ jcol++;
+ for (i = 1; i < _nc; i++, jcol++) {
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd",
+ "Cell");
+ xml_stream.writeAttribute("Col", QString::number(jcol));
+ xml_stream.writeAttribute("Row", QString::number(irow));
+ xml_stream.writeAttribute("ValueType", "60");
+ xml_stream.writeCharacters(_tcol[i].c_str());
+ xml_stream.writeEndElement();
+ //fichier << "<gmr:Cell Col=\"" << jcol << "\" Row=\"" << irow
+ // << "\" ValueType=\"60\">";
+ //fichier << _tcol[i];
+ //fichier << "</gmr:Cell>" << endl;
+ }
+ }
+ irow++;
+
+ //fichier.setf(ios::scientific);
+ //�criture de la matrice
+ for (i = 0; i < _nl; i++, irow++) {
+ if ((_flag == 1) || (_flag == 3)) {
+ //�tiquettes des lignes
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd",
+ "Cell");
+ xml_stream.writeAttribute("Col", "0");
+ xml_stream.writeAttribute("Row", QString::number(irow));
+ xml_stream.writeAttribute("ValueType", "60");
+ xml_stream.writeCharacters(_tlig[i].c_str());
+ xml_stream.writeEndElement();
+ //fichier << "<gmr:Cell Col=\"0\" Row=\"" << irow
+ // << "\" ValueType=\"60\">";
+ //fichier << _tlig[i];
+ //fichier << "</gmr:Cell>" << endl;
+ }
+ jcol = 1;
+ for (j = 0; j < _nc; j++, jcol++) {
+ // fichier << '\t' << _tab [i * _nc + j];
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd",
+ "Cell");
+ xml_stream.writeAttribute("Col", QString::number(jcol));
+ xml_stream.writeAttribute("Row", QString::number(irow));
+ xml_stream.writeAttribute("ValueType", "40");
+ xml_stream.writeAttribute("ValueFormat", value_format);
+ xml_stream.writeCharacters(QString::number((double) GetCase(i, j)));
+ xml_stream.writeEndElement();
+ //fichier << "<gmr:Cell Col=\"" << jcol << "\" Row=\"" << irow
+ // << "\" ValueType=\"40\" ValueFormat=\"" << value_format
+ // << "\">";
+ //fichier << GetCase(i, j);
+ //fichier << "</gmr:Cell>" << endl;
+ }
+ //fichier << endl;
+ }
+ //fichier << "</gmr:Cells>" << endl;
+ //fichier << " </gmr:Sheet> " << endl;
+ qDebug()
+ << "Matrice<T>::oGnumericSheet(QXmlStreamWriter& xml_stream, const QString & sheetname) end";
+
+}
+
+template<class T> void Matrice<T>::oNtsys(ostream& sortie) {
+ unsigned long i, j, k, tmaxligne(100);
+ long pos;
+
+ // sortie << setf(ios::fixed);
+
+ // �criture du titre
+ for (i = 0; i < _titre.size(); i++) {
+ sortie << "\"";
+ sortie << _titre[i];
+ sortie << endl;
+ }
+
+ sortie << _type << " " << _nl;
+ if ((_flag == 1) || (_flag == 3))
+ sortie << "L";
+
+ sortie << " " << _nc;
+ if ((_flag == 2) || (_flag == 3))
+ sortie << "L";
+
+ sortie << " " << _miss << endl;
+
+ //�criture des �tiquettes, lignes puis colonnes
+ if ((_flag == 1) || (_flag == 3)) {
+ //�tiquettes des lignes
+ pos = sortie.tellp();
+ sortie << _tlig[0];
+ for (i = 1; i < _nl; i++) {
+ sortie << " " << _tlig[i];
+ j = sortie.tellp();
+ if ((j - pos) > tmaxligne) {
+ sortie << endl;
+ pos = j;
+ }
+ }
+ sortie << endl;
+ }
+
+ if ((_flag == 2) || (_flag == 3)) {
+ //�tiquettes des colonnes
+ pos = sortie.tellp();
+ sortie << _tcol[0];
+ for (i = 1; i < _nc; i++) {
+ sortie << " " << _tcol[i];
+ j = sortie.tellp();
+ if ((j - pos) > tmaxligne) {
+ sortie << endl;
+ pos = j;
+ }
+ }
+ sortie << endl;
+ }
+
+ //�criture de la matrice
+ switch (_type) {
+ case 2:
+ // matrice triangulaire
+ // attention, ne sort que la partie triangle du bas
+ for (i = 0; i < _nc; i++) {
+ pos = sortie.tellp();
+ sortie << _tab[i * _nc];
+ for (j = 1; j <= i; j++) { //scan d'une moiti� (triangle)
+ //[ligne i] [colonne j] triangle du bas
+ sortie << " " << _tab[(i * _nc) + j];
+ k = sortie.tellp();
+ if ((k - pos) > tmaxligne) {
+ sortie << endl;
+ pos = k;
+ }
+
+ }
+ sortie << endl;
+ }
+ break;
+
+ case 1:
+ for (i = 0; i < _nl; i++) {
+
+ pos = sortie.tellp();
+ sortie << _tab[i * _nc];
+ for (j = 1; j < _nc; j++) {
+ sortie << " " << _tab[i * _nc + j];
+ k = sortie.tellp();
+ if ((k - pos) > tmaxligne) {
+ sortie << endl;
+ pos = k;
+ }
+ }
+ sortie << endl;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+template<class T> T Matrice<T>::get_ppvaleur() const {
+ //retourne la plus petite valeur de la matrice
+ unsigned long taille(_nc * _nl);
+ unsigned long j;
+ T ppvaleur(_tab[0]);
+
+ for (j = 1; j < taille; j++)
+ if (_tab[j] < ppvaleur)
+ ppvaleur = _tab[j];
+ return (ppvaleur);
+}
+
+template<class T> void Matrice<T>::f_neg2zero() {
+ //remet � z�ro les chiffres n�gatifs
+ unsigned long taille(_nc * _nl);
+ unsigned long j(_nc * _nl);
+
+ for (j = 0; j < taille; j++)
+ if (_tab[j] < 0)
+ _tab[j] = 0;
+}
+
+template<class T> void Matrice<T>::iGnumeric(istream& entree) {
+}
+
+template<> void Matrice<long double>::iGnumeric(istream& entree) {
+ //lecture de matrices contenues dans les fichiers Gnumeric XML
+#ifdef XmlParse_INCLUDED
+ //entree.seekg(0);
+
+ //cerr << "void Matrice<long double>::iGnumeric(istream& entree) 1" << endl;
+
+ try {
+ olivxml::ImportGnumeric parser;
+ parser.iParseFlux(entree);
+ *this = parser.get_set_of_matrix().GetConstMatrice(0);
+ }
+ catch (olivxml::ImportGnumeric::Anomalie pb) {
+ throw Anomalie(1);
+ }
+ //cerr << "void Matrice<long double>::iGnumeric(istream& entree)" << endl;
+ //cerr << "void Matrice<long double>::iGnumeric(istream& entree) apres" << endl;
+#else
+ throw Anomalie(1);
+#endif
+}
+
+template<class T> void Matrice<T>::iNtsys(istream& entree) {
+ //lecture de matrices contenues dans les fichiers NTSYS
+ char car;
+ ChaineCar mot;
+ ChaineCar sousmot;
+ int titres; //1=> titres des lignes 2=> titres des colonnes
+ //3=> les 2 //0=> rien
+ unsigned long i, j, nc, nl;
+ int miss, type;
+
+ //cerr << "Matrice<T>::iNtsys(istream& entree)" << endl;
+ entree.seekg(0);
+
+ car = entree.peek();
+ // entree.get(car);
+ // while ((car != '"') && (entree.eof()==0)) entree.get(car);
+ while ((car == '"') && (entree.eof() == 0)) {
+ entree.get(car);
+ GetLigneFlot(entree, mot);
+ // entree.getline(mot,200,'\n');
+ _titre.push_back(mot);
+ // entree.get(car);
+ car = entree.peek();
+ }
+ //cerr << "Matrice<T>::iNtsys(istream& entree) 2" << endl;
+ if ((entree.eof() != 0) || (entree.fail()))
+ throw Anomalie(1);//erreur de lecture
+ //cerr << "Matrice<T>::iNtsys(istream& entree) 3" << endl;
+
+ // mot[0] = car;
+ // mot[1] = '\0';
+ // type = atoi(mot);
+
+ GetLigneFlot(entree, mot); //ligne 0 L23 L34 missing_value
+ if ((mot.GetNbMots() != 4) || (entree.fail()) || (entree.eof() != 0))
+ throw Anomalie(1);
+
+ mot.GetMot(1, sousmot);
+ type = atoi(sousmot.c_str());
+ if ((_type > 2) || (_type < 0))
+ throw Anomalie(1);
+
+ titres = 0;
+ //nombre de lignes
+ mot.GetMot(2, sousmot);
+ // entree >> mot;
+ if (sousmot[sousmot.size() - 1] == 'L') {
+ sousmot.Remplacer("L", "");
+ titres = 1;
+ // strcpy(mot + strlen(mot) - 1,"");
+ }
+ nl = atoi(sousmot.c_str());
+ if ((nl > 9999) || (nl < 1))
+ throw Anomalie(1);
+
+ //nombre de colonnes
+ mot.GetMot(3, sousmot);
+ if (sousmot[sousmot.size() - 1] == 'L') {
+ sousmot.Remplacer("L", "");
+ titres = titres + 2;
+ // strcpy(mot + strlen(mot) - 1,"");
+ }
+ nc = atoi(sousmot.c_str());
+ if ((nc > 9999) || (nc < 1))
+ throw Anomalie(1);
+
+ // entree >> mot; //missing value
+ mot.GetMot(4, sousmot);
+ miss = atoi(mot.c_str());
+
+ resize(nl, nc);
+ //cerr << "Matrice<T>::iNtsys(istream& entree) nc nl " << _nc << _nl << endl;
+
+ _miss = miss;
+ _type = type;
+
+ _flag = titres;
+ //cerr << "Matrice<T>::iNtsys(istream& entree) 2" << endl;
+ //lecture des �tiquettes, lignes puis colonnes
+ if ((titres == 1) || (titres == 3)) {
+ //�tiquettes des lignes
+ for (i = 0; i < _nl; i++) {
+ entree >> _tlig[i];
+ //cerr << "Matrice<T>::iNtsys(istream& entree) _tlig " << _tlig[i] << endl;
+ if (entree.fail())
+ throw Anomalie(1);//erreur de lecture
+ // _tlig[i].assign(mot);
+ }
+ }
+ //cerr << "Matrice<T>::iNtsys(istream& entree) 3" << endl;
+
+ if ((titres == 2) || (titres == 3)) {
+ //�tiquettes des colonnes
+ for (i = 0; i < _nc; i++) {
+ entree >> _tcol[i];
+ //cerr << "Matrice<T>::iNtsys(istream& entree) tcol " << _tcol[i] << endl;
+ if (entree.fail())
+ throw Anomalie(1);//erreur de lecture
+ }
+ }
+
+ //lecture de la matrice proprement dite
+ switch (_type) {
+ case 1:
+ // cas des matrices rectangulaires ou carr�es
+ _t = _nc * _nl;
+ // long double chiffre;
+
+ for (i = 0; i < _t; i++) {
+ entree >> _tab[i];
+ if (entree.fail())
+ throw Anomalie(1);//erreur de lecture
+ // _tab[i] = (T) chiffre;
+ // _tab[i] = atof (mot);
+ }
+ break;
+
+ case 2:
+ // cas des matrices triangulaires
+ if (_flag == 2)
+ _tlig = _tcol;
+ if (_flag == 1)
+ _tcol = _tlig;
+
+ entree.clear();
+
+ for (i = 0; i < _nc; i++) {
+ for (j = 0; j <= i; j++) {
+ // entree >> (long double) _tab[(i*_nc) + j];
+ entree >> _tab[(i * _nc) + j];
+ //cerr << "Matrice<T>::iNtsys(istream& entree) 4 " << _tab[(i*_nc) + j] << " " << i << " " << j << endl;
+ if (entree.fail())
+ throw Anomalie(1);//erreur de lecture
+ _tab[(j * _nc) + i] = _tab[(i * _nc) + j];
+ }
+ }
+ break;
+
+ default:
+ throw Anomalie(1);
+ break;
+ }
+
+}
+
+template<class T> void Matrice<T>::iPhylip(istream& entree) {
+ //lecture de matrices contenues dans des fichiers Phylip
+ ChaineCar mot;
+ ChaineCar sousmot;
+ unsigned long nbmot;
+ unsigned long i, j;
+ long nl(0), nc(0), top(0);
+
+ // entree.seekg(0);
+ entree.clear();
+
+ //cerr << "Matrice<T>::iPhylip(istream& entree)" << endl;
+ mot.GetLigneFlot(entree);
+
+ //cerr << "Matrice<T>::iPhylip(istream& entree) 2" << endl;
+ nbmot = mot.GetNbMots();
+ if ((nbmot < 1) || (nbmot > 2))
+ throw Anomalie(1);
+
+ mot.GetMot(1, sousmot);
+ if (sousmot.EstUnChiffre() == false)
+ throw Anomalie(1);
+ nl = atol(sousmot.c_str());
+
+ //cerr << "Matrice<T>::iPhylip(istream& entree) 3" << endl;
+ _flag = 0;
+ if (nbmot == 1) {
+ resize(nl, nl);
+ // _type = 3;
+ } else {
+ mot.GetMot(2, sousmot);
+ if (sousmot.EstUnChiffre() == false)
+ throw Anomalie(1);
+ nc = atol(sousmot.c_str());
+ resize(nl, nc);
+ }
+ //cerr << nl << " " << nc << endl;
+ top = entree.tellg();
+ // GetLigneFlot(entree, mot);
+ GetLigneFlot(entree, mot);
+ mot.GetMot(1, sousmot);
+ //cerr << "Matrice<T>::iPhylip(istream& entree) coucou 1 " << sousmot << endl;
+ if (sousmot.EstUnChiffre())
+ _flag = 0;
+ else { // titre de ligne
+ _flag = 1;
+ _tlig.resize(nl);
+ }
+ /* nbmot = mot.GetNbMots();
+ if (nbmot == (_nc + 1)) {
+ _flag = 1;
+ }
+ else if (nbmot == _nc) {
+ _flag = 0;
+ }
+ else throw Anomalie(1);
+ */
+ entree.seekg(top);
+
+ for (i = 0; i < _nl; i++) {
+ if ((_flag == 1) || (_flag == 3))
+ entree >> _tlig[i];
+ //cerr << "Matrice<T>::iPhylip(istream& entree) coucou 2 " << _tlig[i] << endl;
+ if (entree.fail())
+ throw Anomalie(1);//erreur de lecture
+ for (j = 0; j < _nc; j++) {
+ entree >> GetCase(i, j);
+ if (entree.fail())
+ throw Anomalie(1);//erreur de lecture
+ }
+ }
+ SetType(1);
+ SetType(2);
+
+ //cerr << "Matrice<T>::iPhylip(istream& entree) fin" << endl;
+
+}
+
+template<class T> void Matrice<T>::iExcel(istream& entree) {
+ //lecture de matrices contenues dans des fichiers Excel
+ // la matrice doit �tre indiqu�e par "/" ou "#" et commencer
+ // 1 case en dessous et � gauche.
+ char car;
+ qDebug() << "Matrice<T>::iExcel(istream& entree) begin";
+ ChaineCar mot;
+ // char mot[200];
+ // string ligne;
+ //1=> titres des lignes 2=> titres des colonnes
+ //3=> les 2 //0=> rien
+ unsigned long i, j;
+ long nc(0), nl(0);
+ long debut, top;
+
+ entree.seekg(0);
+ qDebug() << "Matrice<T>::iExcel(istream& entree) 1";
+
+ entree.get(car);
+ // while ((car != '"') && (entree.eof()==0)) entree.get(car);
+ while (((car != '/') && (car != '#')) && (entree.good())) {
+ // mot = car;
+ GetLigneFlot(entree, mot);
+ mot = car + mot;
+ _titre.push_back(mot);
+ entree.get(car);
+ }
+
+ qDebug() << "Matrice<T>::iExcel(istream& entree) 2";
+ //cerr << "coucou excel 2";
+ if (entree.fail())
+ throw Anomalie(1);//erreur de lecture
+ nc = 0;
+ nl = 0;
+ _flag = 0;
+ debut = entree.tellg();
+ GetLigneFlot(entree, mot);
+ if ((mot[0] > 4) && (mot[1] != '\t')) {
+ _flag = 2; //il ya des titres de colonnes
+ }
+ if (entree.eof() != 0)
+ throw Anomalie(1);//erreur de lecture
+ //cerr << "coucou " << mot << endl ;
+ qDebug() << "Matrice<T>::iExcel(istream& entree) 3 " << mot.c_str();
+
+ top = entree.tellg();
+ //cerr << top << endl;
+
+ GetLigneFlot(entree, mot);
+ for (i = 0; i < mot.size(); i++) {
+ if (mot[i] > 64) {
+ _flag++; //il ya les titres des lignes
+ //cerr << mot << endl;
+ break;
+ }
+ }
+ qDebug() << "Matrice<T>::iExcel(istream& entree) 4 ";
+
+ //determination du nombre de colonnes:
+ nc = 0;
+ entree.seekg(top);
+ entree.clear();
+ if ((_flag == 1) || (_flag == 3)) {
+ entree >> mot;
+ }
+ car = '3';
+ GetLigneFlot(entree, mot);
+ nc = mot.GetNbMots();
+ //cerr << " nc " << nc << endl;
+ qDebug() << "Matrice<T>::iExcel(istream& entree) 5 nc " << nc;
+
+ //cerr << "coucou " << mot << endl ;
+ // if (entree.eof() != 0) throw Anomalie(1);//erreur de lecture
+ //cerr << "coucou2 " << mot << endl ;
+ //determination du nombre de lignes:
+ nl = 1;
+ entree.seekg(top);
+ GetLigneFlot(entree, mot);
+ entree >> mot;
+ while ((mot.GetNbMots() > 0) && (entree.eof() == 0)) {
+ GetLigneFlot(entree, mot);
+ nl++;
+ entree >> mot;
+ //cerr << mot << endl;
+ //cin >> i;
+ }
+ entree.clear();
+
+ qDebug() << "Matrice<T>::iExcel(istream& entree) 6 nl " << nl << " nc "
+ << nc;
+ //cerr << nl << endl;
+ //cerr << nc << endl;
+
+ // on a le nb de colonnes, le nb de lignes, les �tiquettes,
+ // remplissons !!!
+ resize(nl, nc);
+ entree.clear();
+
+ if ((_flag == 2) || (_flag == 3)) { //saisie des titres des colonnes
+ entree.seekg(debut);
+ // entree >> _tcol[i];
+ for (i = 0; i < _nc; i++) {
+ entree >> _tcol[i];
+ //cerr << _tcol[i] << endl;
+ if (entree.fail())
+ throw Anomalie(1);//erreur de lecture
+ }
+ }
+ entree.clear();
+
+ qDebug() << "Matrice<T>::iExcel(istream& entree) 7 ";
+
+ // entree.seekg(top);
+ entree.seekg(debut);
+ GetLigneFlot(entree, mot);
+ //cerr << "coucou" << top << endl;
+ for (i = 0; i < _nl; i++) {
+ if ((_flag == 1) || (_flag == 3))
+ entree >> _tlig[i];
+ //cerr << _tlig[i] << endl;
+ for (j = 0; j < _nc; j++) {
+ entree >> _tab[(i * _nc) + j];
+ //cerr << _tab[(i * _nc) + j] << endl;
+ if (entree.fail())
+ throw Anomalie(1);//erreur de lecture
+ }
+ }
+ qDebug() << "Matrice<T>::iExcel(istream& entree) 8 ";
+
+ //try {
+ SetType(1);
+ SetType(2);
+ //} catch (biolib::vecteurs::Matrice<T>::Anomalie erreur) {
+ // cerr << erreur.fmessage(erreur.le_pb);
+ //SetType(1);
+ //}
+}
+
+template<class T> void Matrice<T>::resize(unsigned long nblig,
+ unsigned long nbcol) {
+ unsigned long i;
+
+ if (_tab != 0)
+ delete[] _tab;
+
+ if (_nl > nblig)
+ _tlig.erase(_tlig.begin() + _nl, _tlig.end());
+ if (_nc > nbcol)
+ _tcol.erase(_tcol.begin() + _nc, _tcol.end());
+
+ _tcol.reserve(nbcol);
+ _tlig.reserve(nblig);
+
+ for (i = _nc; i < nbcol; i++)
+ _tcol.push_back("");
+ for (i = _nl; i < nblig; i++)
+ _tlig.push_back("");
+
+ _nc = nbcol;
+ _nl = nblig;
+ _t = _nc * _nl;
+ _tab = new T[_t];
+ // _miss = 0;
+ // _flag = 0;
+
+ for (i = 0; i < _t; i++)
+ _tab[i] = 0;
+
+}
+
+template<class T> bool Matrice<T>::redim(unsigned long nblig,
+ unsigned long nbcol) {
+ unsigned long i, j, t;
+ T* Ptab;
+
+ if (_tab == 0)
+ return (false);
+ if ((_type == 3) && (nblig != nbcol))
+ return (false);
+
+ if (_nl > nblig)
+ _tlig.erase(_tlig.begin() + _nl, _tlig.end());
+ if (_nc > nbcol)
+ _tcol.erase(_tcol.begin() + _nc, _tcol.end());
+
+ _tcol.reserve(nbcol);
+ _tlig.reserve(nblig);
+ for (i = _nc; i < nbcol; i++)
+ _tcol.push_back("");
+ for (i = _nl; i < nblig; i++)
+ _tlig.push_back("");
+
+ Ptab = _tab;
+ t = nblig * nbcol;
+ _tab = new T[t];
+
+ for (i = 0; i < nblig; i++) {
+ for (j = 0; j < nbcol; j++) {
+ if ((j < _nc) && (i < _nl))
+ *(_tab + (i * nbcol) + j) = *(Ptab + (i * _nc) + j);
+ else
+ *(_tab + (i * nbcol) + j) = 0;
+ }
+ }
+
+ delete[] Ptab;
+ _nc = nbcol;
+ _nl = nblig;
+ _t = t;
+ return (true);
+}
+
+template<class T> void Matrice<T>::fslig(vector<long double>& somme) const {
+
+ int i, j;
+
+ if (_type == 3)
+ throw Anomalie(3); //op�ration impossible sur ce type de matrice
+
+ if (somme.size() < _nl)
+ somme.resize(_nl);
+
+ for (i = 0; i < _nl; i++) {
+ somme[i] = _tab[i * _nc];
+ }
+ for (j = 1; j < _nc; j++) {
+ for (i = 0; i < _nl; i++) {
+ somme[i] += _tab[j + (i * _nc)];
+ }
+ }
+}
+
+template<class T> void Matrice<T>::fscol(vector<long double>& somme) const {
+
+ int pos, i, j;
+
+ if (_type == 3)
+ throw Anomalie(3); //op�ration impossible sur ce type de matrice
+
+ if (somme.size() < _nc)
+ somme.resize(_nc);
+
+ for (i = 0; i < _nc; i++) {
+ somme[i] = _tab[i];
+ }
+ pos = _nc;
+ for (j = 1; j < _nl; j++) {
+ for (i = 0; i < _nc; i++) {
+ somme[i] += _tab[pos];
+ pos++;
+ }
+ }
+}
+
+template<class T> void Matrice<T>::ftranspose() {
+ //transposition de matrices:
+
+ Titre swap;
+ unsigned long i, j;
+
+ swap = _tcol;
+ _tcol = _tlig;
+ _tlig = swap;
+
+ if (_type == 3)
+ return;
+
+ //_flag = 2;
+ if (_flag == 1)
+ _flag = 2;
+ else if (_flag == 2)
+ _flag = 1;
+
+ T* Ptab;
+ Ptab = new T[_t];
+
+ for (i = 0; i < _nl; i++) {
+ for (j = 0; j < _nc; j++) {
+ *(Ptab + (j * _nl) + i) = *(_tab + rindice(i, j));
+ }
+ }
+
+ i = _nc;
+ _nc = _nl;
+ _nl = i;
+
+ delete[] _tab;
+ _tab = Ptab;
+}
+
+template<class T> Matrice<T> Matrice<T>::operator*(Matrice<T> &rval) const {
+
+ //produit matriciel
+ Matrice<T> Resultat(_nl, rval._nc);
+ // long double limite(1e-030);
+
+ if (_nc != rval._nl)
+ throw Anomalie(4); // 4-> calcul impossible
+ // if (_nl != rval._nc) throw Anomalie(4); // 4-> calcul impossible
+
+ int i, j, k; //ligne, colonne
+
+
+ Resultat.SetFlag(0);
+ if ((rval.GetFlag() == 2) || (rval.GetFlag() == 3)) {
+ Resultat._tcol = rval._tcol;
+ Resultat.SetFlag(2);
+ }
+ if ((_flag == 1) || (_flag == 3)) {
+ Resultat._tlig = _tlig;
+ Resultat._flag++;
+ }
+
+ for (i = 0; i < _nl; i++) {
+ for (j = 0; j < rval._nc; j++) {
+ Resultat.GetCase(i, j) = 0;
+ for (k = 0; k < _nc; k++) {
+ Resultat.GetCase(i, j) = Resultat.GetCase(i, j)
+ + ((long double) GetCase(i, k) * rval.GetCase(k, j));
+ }
+ }
+ }
+
+ //v�rification limite
+ /* for (i=0; i < _t; i++) {
+ if (Resultat._tab[i] < limite) Resultat._tab[i] = 0;
+ }*/
+
+ return Resultat;
+}
+
+template<class T> vector<T> Matrice<T>::operator*(const vector<T> &rval) {
+ //produit d'une matrice par un vecteur
+
+ vector<T> Resultat;
+ Matrice<T>& lamatrice = *this;
+ long i, k; //ligne, colonne
+
+ Resultat.resize(lamatrice._nl);
+
+ if (lamatrice._nl != rval.size())
+ throw Anomalie(4); // 4-> calcul impossible
+
+
+ for (i = 0; i < Resultat.size(); i++) {
+ Resultat[i] = 0;
+ for (k = 0; k < lamatrice._nc; k++) {
+ Resultat[i] = Resultat[i] + (lamatrice.GetCase(i, k) * rval[i]);
+ }
+ }
+
+ return Resultat;
+}
+
+template<class T> Matrice<T> Matrice<T>::operator*(long double scalaire) {
+
+ Matrice<T> Resultat(_nl, _nc);
+ long i;
+
+ // Resultat.resize(_nl,_nc);
+ // cout << "coucou";
+ Resultat.SetType(1);
+ Resultat._titre = _titre;
+ // Resultat._titre.push_back("Produit par un scalaire");
+ Resultat._flag = 0;
+
+ if ((_flag == 2) || (_flag == 3)) {
+ //copie des �tiquettes des colonnes
+ Resultat._flag = 2;
+ Resultat._tcol = _tcol;
+ Resultat._tlig = _tcol;
+ }
+
+ for (i = 0; i < _t; i++) {
+ Resultat._tab[i] = _tab[i] * scalaire;
+ }
+
+ return Resultat;
+}
+
+template<class T> Matrice<T> Matrice<T>::operator-(Matrice<T>& rval) {
+
+ Matrice<T> Resultat(_nl, _nc);
+ long i;
+
+ if (_nl != rval._nl)
+ throw Anomalie(4);
+ if (_nc != rval._nc)
+ throw Anomalie(4);
+
+ // cout << "coucou";
+ Resultat.SetType(_type);
+ Resultat._titre = _titre;
+ // Resultat._titre.push_back("Produit par un scalaire");
+ Resultat._flag = _flag;
+
+ if ((_flag == 2) || (_flag == 3)) {
+ //copie des �tiquettes des colonnes
+ Resultat._tcol = _tcol;
+ }
+ if ((_flag == 1) || (_flag == 3)) {
+ //copie des �tiquettes des lignes
+ Resultat._tlig = _tlig;
+ }
+
+ for (i = 0; i < _t; i++) {
+ Resultat._tab[i] = _tab[i] - rval._tab[i];
+ }
+
+ return Resultat;
+
+}
+
+template<class T> Matrice<T> Matrice<T>::operator+(Matrice<T> &rval) {
+ long i;
+
+ Matrice<T> Resultat;
+
+ if (_nl != rval._nl)
+ throw Anomalie(4);
+ if (_nc != rval._nc)
+ throw Anomalie(4);
+
+ Resultat.resize(_nl, _nc);
+ // cout << "coucou";
+ Resultat.SetType(_type);
+ Resultat._titre = _titre;
+ // Resultat._titre.push_back("Produit par un scalaire");
+ Resultat._flag = _flag;
+
+ if ((_flag == 2) || (_flag == 3)) {
+ //copie des �tiquettes des colonnes
+ Resultat._tcol = _tcol;
+ }
+ if ((_flag == 1) || (_flag == 3)) {
+ //copie des �tiquettes des lignes
+ Resultat._tlig = _tlig;
+ }
+
+ for (i = 0; i < _t; i++) {
+ Resultat._tab[i] = _tab[i] + rval._tab[i];
+ }
+
+ return Resultat;
+
+}
+
+template<class T> long double Matrice<T>::fdet() const {
+ //calcul du d�terminant d'une matrice par r�cursivit
+ // Olivier Langella 29 oct 98
+ // D'apr�s J. Lefebvre "introduction aux analyses statistiques
+ // multidimensionnelle" p 36
+ long double det;
+ if (_nc != _nl)
+ throw Anomalie(4); //calcul impossible
+
+ MatriceF calculs;
+
+ calculs = *this;
+
+ det = calculs.fdetrec();
+
+ return (det);
+}
+
+template<class T> long double Matrice<T>::fdetrec() const {
+ //calcul du d�terminant d'une matrice par r�cursivit
+ // utilis� par fdet;
+ long double det(0);
+ unsigned long i;
+ long cofacteur(1);
+ Matrice<T> calculs;
+
+ if (_nc == 2) {
+ //solution
+ det = ((long double) GetCase(0, 0) * GetCase(1, 1))
+ - ((long double) GetCase(1, 0) * GetCase(0, 1));
+ return (det);
+ } else {
+
+ for (i = 0; i < _nl; i++) {
+ calculs = *this;
+ calculs.SupprCol(0);
+ calculs.SupprLig(i);
+
+ det = det + ((long double) calculs.fdetrec()
+ * ((long double) GetCase(i, 0) * cofacteur));
+ cofacteur = cofacteur * -1;
+ }
+ return (det);
+ }
+}
+
+template<class T> void Matrice<T>::SupprCol(unsigned long nbcol) {
+ unsigned long i, j, k, n;
+ T * Ptab;
+
+ // if (_nl > nblig) _tlig.erase(_tlig.begin() + _nl,_tlig.end());
+ if (nbcol < _tcol.size())
+ _tcol.erase(_tcol.begin() + nbcol);
+
+ n = _nc - 1;
+
+ Ptab = new T[n * _nl];
+ k = 0;
+
+ for (i = 0; i < _nl; i++) {
+ for (j = 0; j < _nc; j++) {
+ if (j != nbcol) {
+ Ptab[k] = GetCase(i, j);
+ k++;
+ }
+ }
+ }
+
+ _nc = _nc - 1;
+ _t = _nc * _nl;
+
+ if (_tab != 0)
+ delete[] _tab;
+ _tab = Ptab;
+ _type = 1;
+
+}
+
+template<class T> void Matrice<T>::SupprLig(unsigned long nblig) {
+ unsigned long i, j, k, n;
+ T* Ptab;
+
+ // if (_nl > nblig) _tlig.erase(_tlig.begin() + _nl,_tlig.end());
+ if (nblig < _tlig.size())
+ _tlig.erase(_tlig.begin() + nblig);
+
+ n = _nl - 1;
+
+ Ptab = new T[n * _nc];
+ k = 0;
+
+ for (i = 0; i < _nl; i++) {
+ for (j = 0; j < _nc; j++) {
+ if (i != nblig) {
+ Ptab[k] = GetCase(i, j);
+ k++;
+ }
+ }
+ }
+
+ _nl = _nl - 1;
+ _t = _nc * _nl;
+
+ if (_tab != 0)
+ delete[] _tab;
+ _tab = Ptab;
+ _type = 1;
+
+}
+
+void MatriceF::finv(MatriceF& inverse) const {
+ //calcul de l'inverse d'une matrice
+ // Olivier Langella 29 oct 98
+ // D'apr�s J. Lefebvre "introduction aux analyses statistiques
+ // multidimensionnelle" p 42
+ if (_nc != _nl)
+ throw Anomalie(4); //calcul impossible
+
+ long double detA;
+ MatriceF calculs;
+ int cofacteur, cofl(-1);
+ unsigned long i, j;
+
+ inverse = *this;
+
+ detA = fdet();
+
+ for (i = 0; i < _nl; i++) {
+ cofacteur = cofl;
+ for (j = 0; j < _nc; j++) {
+ cofacteur *= -1;
+ calculs = *this;
+ calculs.SupprCol(i);
+ calculs.SupprLig(j);
+
+ inverse.GetCase(i, j) = (calculs.fdet() * cofacteur) / detA;
+ }
+
+ cofl *= -1;
+ }
+
+}
+
+void MatriceF::fvalpropres(Matrice<float>& vectpropres,
+ vector<float>& valpropres, float precision) {
+
+ //Calcul des valeurs propres pour une matrice sym�trique
+ // M�thode de Jacobi
+ // Olivier Langella 29 oct 98
+ // D'apr�s J. Lefebvre "introduction aux analyses statistiques
+ // multidimensionnelle" p 67
+ // (m�thode it�rative)
+
+ if (GetType() != 3)
+ throw Anomalie(3); //calcul impossible
+ //ATTENTION, ne v�rifie pas si la matrice est bien symetrique !!
+
+ valpropres.resize(_nc);
+ vectpropres.resize(_nc, _nc);
+ vectpropres.SetType(1);
+ MatriceF matC;
+ MatriceF matA;
+ matA = *this;
+
+ matA._titre.push_back("Matrice A");
+ matC._titre.push_back("Matrice C");
+ vectpropres = vectpropres + 1;
+
+ //it�rations de C'AC
+ unsigned long poss, posr;
+ long double temp, teta;
+ unsigned long i, j, nc(_nc);
+ long ind1, ind2;
+
+ long double scarre(0), tracecar;
+
+ for (i = 0; i < _t; i++) {
+ scarre = scarre + (_tab[i] * _tab[i]);
+ }
+
+ matC.resize(nc, nc);
+ MatriceF matInter(nc, nc); //matrice pour les calculs
+ //intermediaires
+ do {
+ // choix du point � annuler
+ // : le plus grand non situ� sur la diagonale
+ posr = 0;
+ poss = 0;
+ temp = -1;
+ for (i = 1; i < nc; i++) {
+ for (j = 0; j < i; j++) {
+ teta = fabs(matA._tab[(i * nc) + j]);
+ if (temp < teta) {
+ temp = teta;
+ poss = i;
+ posr = j;
+ }
+ }
+ }
+
+ // calcul de teta
+ teta = (matA._tab[(posr * nc) + poss] * 2) / (matA._tab[(posr * nc)
+ + posr] - matA._tab[(poss * nc) + poss]);
+ teta = atan(teta) / 2;
+
+ // fabriquer la matrice C'
+ for (i = 0; i < nc; i++) {
+ matC._tab[(i * nc) + i] = 1;
+ if ((i == poss) || (i == posr)) {
+ matC._tab[(i * nc) + i] = cos(teta);
+ }
+ for (j = 0; j < i; j++) {
+ ind1 = (j * nc) + i;
+ ind2 = (i * nc) + j;
+ if ((i == poss) && (j == posr)) {
+ matC._tab[ind1] = sin(teta);
+ matC._tab[ind2] = matC._tab[ind1] * -1;
+ } else {
+ matC._tab[ind1] = 0;
+ matC._tab[ind2] = 0;
+ }
+ }
+ }
+
+ // matA = matC * matA;
+ matInter.fmultiplier(matC, matA); // ajoute pour optimiser
+ matC.ftranspose();
+ // matA = matA * matC;
+ matA.fmultiplier(matInter, matC); // ajoute pour optimiser
+
+ // vectpropres = vectpropres * matC;
+ for (i = 0; i < _t; i++) {
+ matInter._tab[i] = vectpropres._tab[i];
+ }
+ vectpropres.fmultiplier(matInter, matC);
+
+ tracecar = 0;
+ for (i = 0; i < nc; i++) {
+ teta = matA._tab[(i * nc) + i];
+ tracecar = tracecar + (teta * teta);
+ }
+ } while (((scarre - tracecar) / tracecar) > precision);
+
+ for (i = 0; i < _nc; i++) {
+ valpropres[i] = matA.GetCase(i, i);
+ }
+
+}
+
+template<class T> long double Matrice<T>::ftrace() const {
+ //calcul de la trace d'une matrice (somme des E diagonaux)
+ // Olivier Langella 29 oct 98
+ if (_nc != _nl)
+ throw Anomalie(4); //calcul impossible
+
+ int i, j(0);
+
+ long double res(0);
+
+ for (i = 0; i < _nc; i++) {
+ res += _tab[i + j];
+ j += _nc;
+ }
+
+ return res;
+}
+
+template<class T> Matrice<T> Matrice<T>::operator+(long double rval) {
+
+ Matrice<T> Resultat;
+
+ Resultat = *this;
+ unsigned long i;
+
+ for (i = 0; i < _nc; i++) {
+ Resultat.GetCase(i, i) = Resultat.GetCase(i, i) + rval;
+ }
+
+ return Resultat;
+
+}
+
+template<class T> void Matrice<T>::fswapcol(long i, long j) {
+ T swap;
+ long k;
+
+ for (k = 0; k < _nc; k++) {
+ swap = GetCase(k, i);
+ GetCase(k, i) = GetCase(k, j);
+ GetCase(k, j) = swap;
+ }
+}
+
+template<class T> void Matrice<T>::fmultiplier(const Matrice<T>& matA,
+ const Matrice<T>& matB) {
+ //pour multiplier 2 matrices plus rapidement
+ // A et B sont carrees !!!!
+ long i, j, k, nc(_nc);
+ T res;
+
+ for (i = 0; i < nc; i++) {
+ for (j = 0; j < nc; j++) {
+ res = 0;
+ for (k = 0; k < nc; k++) {
+ res += matA._tab[(i * nc) + k] * matB._tab[(k * nc) + j];
+ }
+ _tab[(i * nc) + j] = res;
+ }
+ }
+}
+
+template<class T> void Matrice<T>::oXgobi(const string &fnom) {
+ unsigned long i, j;
+ ofstream fichier;
+ // string fnom(nomfichier);
+ string fnomplus(fnom);
+
+ if (_type != 1)
+ throw Anomalie(3);
+
+ fnomplus = fnom + ".dat";
+ fichier.open(fnomplus.c_str(), ios::out);
+ if (fichier.is_open() == false)
+ throw Anomalie(6);
+
+ for (i = 0; i < _nl; i++) {
+ fichier << _tab[i * _nc];
+ for (j = 1; j < _nc; j++) {
+ fichier << " " << _tab[(i * _nc) + j];
+ }
+ fichier << endl;
+ }
+
+ fichier.close();
+
+ if (_titre.size() > 0) {
+ fnomplus = fnom + ".doc";
+ fichier.open(fnomplus.c_str(), ios::out);
+ if (fichier.is_open() == false)
+ throw Anomalie(6);
+
+ for (i = 0; i < _titre.size(); i++) {
+ fichier << _titre[i];
+ fichier << endl;
+ }
+ fichier.close();
+ }
+
+ if ((_flag == 1) || (_flag == 3)) {
+ fnomplus = fnom + ".row";
+ fichier.open(fnomplus.c_str(), ios::out);
+ if (fichier.is_open() == false)
+ throw Anomalie(6);
+
+ for (i = 0; i < _tlig.size(); i++) {
+ fichier << _tlig[i];
+ fichier << endl;
+ }
+
+ fichier.close();
+ }
+
+ if ((_flag == 2) || (_flag == 3)) {
+ fnomplus = fnom + ".col";
+ fichier.open(fnomplus.c_str(), ios::out);
+ if (fichier.is_open() == false)
+ throw Anomalie(6);
+
+ for (i = 0; i < _tcol.size(); i++) {
+ fichier << _tcol[i];
+ fichier << endl;
+ }
+
+ fichier.close();
+ }
+
+}
+
+////////////////////////////////////////////////
+// GLOBAL
+///////////////////////////////////////////////
+template<class T> ostream& operator<<(ostream& sortie, Matrice<T>& lamatrice) {
+ //1= Excel
+ //2= Ntsys
+ //3= xgobi ==!!!! seulement en ofstream !!!!!
+
+ lamatrice.oFormat(sortie, lamatrice._oformat);
+ return (sortie);
+
+}
+
+template<class T> ofstream& operator<<(ofstream& sortie, Matrice<T>& lamatrice) {
+ //1= Excel
+ //2= Ntsys
+ //3= xgobi ==!!!! seulement en ofstream !!!!!
+
+ if (lamatrice._oformat == 3) {
+ lamatrice.oXgobi("xgobi");
+ } else {
+ lamatrice.oFormat(sortie, lamatrice._oformat);
+ }
+ return (sortie);
+
+}
+
+/*ofstream& operator<<(ofstream& sortie,MatriceLD& lamatrice) {
+ //1= Excel
+ //2= Ntsys
+ //3= xgobi ==!!!! seulement en ofstream !!!!!
+
+ if (lamatrice._oformat == 3) {
+ lamatrice.oXgobi("xgobi");
+ }
+ else {
+ lamatrice.oFormat(sortie, lamatrice._oformat);
+ }
+ return(sortie);
+
+ }*/
+
+template<class T> istream& operator>>(istream& ientree, Matrice<T>& lamatrice) {
+
+ //cerr << "coucou";
+ lamatrice.iFichier(ientree);
+ //cerr << "coucou";
+ return (ientree);
+}
+
+template<class T> void Matrice<T>::oPhylip(ostream& fichier) {
+ unsigned long i, j;
+
+ fichier.setf(ios::scientific);
+
+ /* // �criture du titre
+ for (i=0; i < _titre.size();i++) {
+ fichier << _titre[i];
+ fichier << endl;
+ }*/
+ if (_type == 3) { //matrice triangulaire
+ fichier << '\t' << GetNL() << endl;
+ _tlig = _tcol;
+ } else {
+ fichier << '\t' << GetNL() << '\t' << GetNC() << endl;
+ }
+
+ // fichier << "#";
+ /* if ((_flag == 2)||(_flag == 3)){
+ //�tiquettes des colonnes
+ fichier << '\t' << _tcol[0];
+ for (i=1; i<_nc; i++) fichier << '\t' << _tcol[i];
+ }
+ fichier << endl;
+ */
+ //�criture de la matrice
+ for (i = 0; i < _nl; i++) {
+ if ((_flag == 1) || (_flag == 3)) {
+ //�tiquettes des lignes
+ fichier << _tlig[i];
+ }
+
+ for (j = 0; j < _nc; j++) {
+ fichier << '\t' << GetCase(i, j);
+ }
+ fichier << endl;
+ }
+
+}
+
+template<class T> void Matrice<T>::iFichier(istream& ientree) {
+ int nbformat(6), i(1);
+ char car;
+ bool autre(true);
+
+ // entree = ientree;
+ qDebug() << "Matrice<T>::iFichier(istream& ientree) begin nbformat "
+ << nbformat;
+ ientree.get(car);
+ if (ientree.fail()) {
+ // cerr << "Le fichier n'a pas pu �tre ouvert... "<< endl;
+ throw Anomalie(1);
+ }
+ while ((autre) & (i < nbformat)) {
+ qDebug() << "Matrice<T>::iFichier(istream& ientree) ifichier " << i
+ << " autre " << autre;
+ //cerr << "coucou ifichier" << i << endl;
+ if (i == 3) {
+ i = 4;
+ continue;
+ } //xgobi
+ try {
+ ientree.clear();
+ ientree.seekg(0);
+ //ientree.seekg (0, ios::beg);
+ // ientree.rewind();
+ _titre.resize(0);
+ //cerr << "coucou ifichier" << i << endl;
+ iFichier(ientree, i);
+ //cerr << "coucou ifichier" << endl;
+
+ autre = false;
+ qDebug() << "Matrice<T>::iFichier(istream& ientree) 1 autre "
+ << autre;
+ } catch (Anomalie erreur) {
+ if (erreur.le_pb > 0) {
+ autre = true;
+ if (i == (nbformat - 1)) {
+ // cerr << erreur.fmessage(erreur.le_pb)<< endl;
+ throw Anomalie(erreur.le_pb);
+ autre = false;
+ }
+ erreur.le_pb = 0;
+ }
+ }
+ qDebug() << "Matrice<T>::iFichier(istream& ientree) 2 autre " << autre;
+ i++;
+ }
+ qDebug() << "Matrice<T>::iFichier(istream& ientree) end";
+}
+
+MatriceLD::MatriceLD() :
+ Matrice<long double> () {
+}
+;
+
+void MatriceLD::fdiagonalisation(MatriceLD & matdiag, vector<long double>& pvlp) {
+ /******************************************************************************/
+ /* DIAGONALISATION DE LA MATRICE (Householder) */
+ /* 1) tridiagonalisation (tridiag) */
+ /* 2) diagonalisation par la methode Q-L (diaggl) */
+ /******************************************************************************/
+ int m;
+ unsigned long i;
+ long double *ps;
+
+ if (_type != 2)
+ throw Anomalie(3);
+ // 3-> op�ration impossible sur ce type de matrice
+ pvlp.resize(_nc);
+
+ matdiag.resize(_nc, _nc);
+ matdiag.SetType(2);
+
+ ps = new long double[_nc];
+
+ matdiag._titre = _titre;
+ matdiag._titre.push_back("diagonalisation par la methode Q-L");
+ matdiag._flag = _flag;
+
+ if ((_flag == 2) || (_flag == 3)) {
+ matdiag._tcol = _tcol;
+ matdiag._tlig = _tcol;
+ }
+
+ //copie du tableau
+ for (i = 0; i < _t; i++) {
+ matdiag._tab[i] = _tab[i];
+ }
+
+ m = matdiag.ftridiag(ps, pvlp);
+
+ matdiag.fmdiagql(m, ps, pvlp);
+
+ delete[] ps;
+
+}
+
+/*====================== methode Q-L =====================================*/
+
+void MatriceLD::fmdiagql(int m, long double *ps, vector<long double> & pvlp) {
+ long double *pcov;
+ unsigned long i, ij, j, k, l;
+ long ijk, is;
+ long double q, h, t, xp, u, b, a, v;
+ long double p1;
+
+ if (_type != 2)
+ throw Anomalie(3);
+ // 3-> op�ration impossible sur ce type de matrice
+ pcov = _tab;
+ a = (long double) 1e-10;
+
+ for (i = 1; i < _nc; i++) {
+ *(ps + i - 1) = *(ps + i);
+ }
+ *(ps + _nc - 1) = 0;
+
+ for (k = 0; k < _nc; k++) {
+ j = k;
+ while ((long double) (((long double) j < (long double) _nc - 1)
+ && fabs((long double) *(ps + j))) >= (long double) (a * (fabs(
+ (long double) pvlp[j]) + fabs((long double) pvlp[j + 1]))))
+ j++;
+ while (j != k) {
+ h = pvlp[k];
+ m = m + 1;
+ q = (pvlp[k + 1] - h) * 0.5 / (*(ps + k));
+ t = sqrt((long double) q * q + 1);
+ if (q < 0)
+ is = -1;
+ else
+ is = 1;
+ q = pvlp[j] - h + (*(ps + k)) / (q + t * is);
+ u = 1;
+ v = 1;
+ h = 0;
+ for (ijk = 1; ijk <= (long) (j - k); ijk++) {
+ i = j - ijk;
+ xp = u * (*(ps + i));
+ b = v * (*(ps + i));
+ if (q == 0 || xp == 0) {
+ // printf("cette matrice ne peut etre diagonalisee\n");
+ // erreur
+ // return();
+ delete[] ps;
+ throw Anomalie(2);
+ }
+ if (fabs((long double) xp) >= fabs((long double) q)) {
+ u = xp / q;
+ t = sqrt((long double) u * u + 1);
+ *(ps + i + 1) = q * t;
+ v = 1 / t;
+ u = u * v;
+ } else {
+ v = q / xp;
+ t = sqrt((long double) 1 + v * v);
+ *(ps + i + 1) = t * xp;
+ u = 1 / t;
+ v = v * u;
+ }
+ q = pvlp[i + 1] - h;
+ t = ((pvlp[i]) - q) * u + 2 * v * b;
+ h = u * t;
+ pvlp[i + 1] = q + h;
+ q = v * t - b;
+ l = 0;
+ while (l < _nc) {
+ xp = *(pcov + rindice(l, i + 1));
+ *(pcov + rindice(l, i + 1)) = u * (*(pcov + rindice(l, i)))
+ + v * xp;
+ *(pcov + rindice(l, i)) = v * (*(pcov + rindice(l, i))) - u
+ * xp;
+ l = l + 1;
+ }
+ }
+ pvlp[k] = pvlp[k] - h;
+ *(ps + k) = q;
+ *(ps + j) = 0;
+ j = k;
+ while (j < _nc - 1 && fabs((long double) *(ps + j)) >= a * (fabs(
+ (long double) pvlp[j]) + fabs((long double) pvlp[j + 1])))
+ j++;
+
+ }
+ }
+ for (ij = 1; ij < _nc; ij++) {
+ i = ij - 1;
+ l = i;
+ h = pvlp[i];
+ for (m = ij; m < (int) _nc; m++) {
+ if (pvlp[m] >= h) {
+ l = m;
+ h = pvlp[m];
+ }
+ }
+ if (l != i) {
+ pvlp[l] = pvlp[i];
+ pvlp[i] = h;
+ for (m = 0; m < (int) _nc; m++) {
+ p1 = *(pcov + rindice(m, i));
+ *(pcov + rindice(m, i)) = *(pcov + rindice(m, l));
+ *(pcov + rindice(m, l)) = p1;
+ }
+ }
+ }
+}
+
+int MatriceLD::ftridiag(long double *ps, vector<long double> & pvlp) {
+ long double *pcov;
+ unsigned long i, j;
+ int k, l, m(0);
+ long double b, c, q, x, xp, bp;
+
+ pcov = _tab;
+
+ for (j = 1; j < _nc; j++) {
+ b = 0;
+ c = 0;
+ i = (_nc - 1) - j + 1;
+ k = i - 1;
+
+ if (k < 1) {
+ *(ps + i) = *(pcov + rindice(i, k));
+ pvlp[i] = b;
+ continue;
+ }
+ for (l = 0; l <= k; l++) {
+ c = c + fabs((long double) *(pcov + rindice(i, l)));
+ }
+ if (c == 0) {
+ *(ps + i) = *(pcov + rindice(i, k));
+ pvlp[i] = b;
+ continue;
+ }
+ for (l = 0; l <= k; l++) {
+ x = (*(pcov + rindice(i, l))) / c;
+ *(pcov + rindice(i, l)) = x;
+ b = b + (x * x);
+ }
+ xp = *(pcov + rindice(i, k));
+ if (xp < 0) {
+ q = sqrt((long double) b);
+ } else {
+ q = (sqrt((long double) b)) * (-1);
+ }
+ *(ps + i) = c * q;
+ b = b - xp * q;
+ *(pcov + rindice(i, k)) = xp - q;
+ xp = 0;
+ for (m = 0; m <= k; m++) {
+ *(pcov + rindice(m, i)) = (*(pcov + rindice(i, m))) / (b * c);
+ q = 0;
+ for (l = 0; l <= m; l++) {
+ q = q + (*(pcov + rindice(m, l))) * (*(pcov + rindice(i, l)));
+ }
+ for (l = m + 1; l <= k; l++) {
+ q = q + ((*(pcov + rindice(l, m))) * (*(pcov + rindice(i, l))));
+
+ }
+ *(ps + m) = q / b;
+ xp = xp + (*(ps + m)) * (*(pcov + rindice(i, m)));
+ }
+ bp = xp * 0.5 / b;
+ for (m = 0; m <= k; m++) {
+ xp = *(pcov + rindice(i, m));
+ q = (*(ps + m)) - bp * xp;
+ *(ps + m) = q;
+ for (l = 0; l <= m; l++) {
+ *(pcov + rindice(m, l)) = (*(pcov + rindice(m, l))) - xp
+ * (*(ps + l)) - q * (*(pcov + rindice(i, l)));
+ }
+ }
+ for (l = 0; l <= k; l++) {
+ *(pcov + rindice(i, l)) = c * (*(pcov + rindice(i, l)));
+ }
+ pvlp[i] = b;
+ }
+ *ps = 0;
+ pvlp[0] = 0;
+ for (i = 0; i < _nc; i++) {
+ k = i - 1;
+ if (pvlp[i] != 0) {
+ for (m = 0; m <= k; m++) {
+ q = 0;
+ for (l = 0; l <= k; l++) {
+ q = q + (*(pcov + rindice(i, l)))
+ * (*(pcov + rindice(l, m)));
+ }
+ for (l = 0; l <= k; l++) {
+ *(pcov + rindice(l, m)) = (*(pcov + rindice(l, m))) - q
+ * (*(pcov + rindice(l, i)));
+ }
+ }
+ }
+ pvlp[i] = *(pcov + rindice(i, i));
+ *(pcov + rindice(i, i)) = 1;
+ for (m = 0; m <= k; m++) {
+ *(pcov + rindice(i, m)) = 0;
+ *(pcov + rindice(m, i)) = 0;
+ }
+ }
+ return (m);
+}
+
+void MatriceLD::fcoordcol(MatriceLD& stat, MatriceLD& res, MatriceLD& norm,
+ vector<long double> & pvlp) {
+ /******************************************************************************/
+ /* calcul des coordonnees */
+ /******************************************************************************/
+ /*=================== coordonnees des colonnes =============================*/
+ unsigned long p0; //nb d'axes
+ unsigned long i, j;
+ int PC, k;
+ long double tr; //somme des valeurs propres
+ long double limite; //limite des possibilit�s de calculs
+ float t; //cumul des pourcentages
+ float v; //inertie (pourcentage sur un axe)
+ long double *pcov, a1;
+ char * temp;
+ // string temps;
+
+ limite = 0.000001; //1e-010;//1e-030;
+
+ if (norm._type != 2)
+ throw Anomalie(3);
+ // 3-> op�ration impossible sur ce type de matrice
+
+ temp = new (char[50]);
+ p0 = _nc - 1;
+
+ // redimensionnement
+ res.resize(_nc, p0);
+ //
+ res.SetType(1);
+ res._titre = _titre;
+ res._titre.push_back("coordonn�es spatiales sur les colonnes");
+ res._titre.push_back("espace � ");
+ // itoa (p0,temp,10);
+ res._titre[res._titre.size() - 1].AjEntier(p0); //temp ;
+ res._titre[res._titre.size() - 1] += " dimensions";
+ res._flag = 0;
+
+ // redimensionnement
+ stat.resize(p0, 3);
+ //
+ stat.SetType(1);
+ stat._titre = _titre;
+ stat._titre.push_back(
+ "statistiques des coordonn�es spatiales sur les colonnes");
+ stat._titre.push_back("espace � ");
+ // temps = p0;
+ // itoa (p0,temp,10);
+ stat._titre[stat._titre.size() - 1].AjEntier(p0); //temps.c_str() ;
+ stat._titre[stat._titre.size() - 1] += " dimensions";
+ stat._flag = 3;
+
+ if ((_flag == 2) || (_flag == 3)) {
+ res._flag = 1;
+ //copie des �tiquettes des lignes
+ // res._tlig = _tcol;
+ res._tlig = _tlig;
+ }
+
+ res._flag = res._flag + 2; //num�rotation des axes
+ for (i = 0; i < res._nc; i++) {
+ // strcpy(temp,"axe_");
+ // itoa(i + 1,temp + 4,10);
+ // strcat(temp,"");
+ res._tcol[i].assign("axe_");
+ res._tcol[i].AjEntier(i + 1);
+
+ // res._tcol[i].assign(temp);
+ stat._tlig[i].assign(res._tcol[i]);
+ }
+ stat._tcol[0].assign("Valeur_Propre");
+ stat._tcol[1].assign("Inertie");
+ stat._tcol[2].assign("Cumul");
+
+ pcov = norm._tab;
+ PC = 100;
+
+ //test sur les valeurs propres pour �liminer l'effet Ariane V
+ j = 0;
+ while ((fabs(pvlp[j]) > limite) && (j < _nc)) {
+ j++;
+ }
+ if (j < _nc)
+ for (i = j; i < _nc; i++)
+ pvlp[i] = 0;
+
+ //somme des valeurs propres
+ tr = 0;
+ for (j = 0; j < _nc; j++)
+ tr = tr + pvlp[j];
+
+ v = 0;
+ t = 0;
+ for (i = 0; i < p0; i++) {
+ a1 = pvlp[i] / tr;
+ v = PC * (float) a1;
+ t = t + v;
+ stat._tab[i * 3] = pvlp[i];
+ stat._tab[(i * 3) + 1] = v;
+ stat._tab[(i * 3) + 2] = t;
+ }
+
+ k = 0;
+ for (i = 0; i < norm._nc; i++) { //scan sur les colonnes
+ for (j = 0; j < p0; j++) { //coord col i, axe j
+ a1 = (*(pcov + rindice(i, j))) * (sqrt((long double) pvlp[j]));
+ res._tab[k] = a1 * PC;
+ k++;
+ }
+ }
+}
+
+void MatriceLD::fscalaire(MatriceLD& pscalaire) {
+ /******************************************************************************/
+ /* calcul du produit scalaire */
+ /******************************************************************************/
+ unsigned long i, a, j;
+
+ long double dt, x, x2, z;
+ long double *pcov, *pvp, *ps;
+ unsigned long nbcolonnes(GetNC());
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) debut " << nbcolonnes << endl;
+ pvp = new long double[nbcolonnes];
+ ps = new long double[nbcolonnes];
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) coucou 1" << endl;
+ for (i = 0; i < nbcolonnes; i++) {
+ pvp[i] = 0;
+ ps[i] = 0;
+ }
+
+ pscalaire.resize(nbcolonnes, nbcolonnes);
+ pscalaire.SetType(2);
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) coucou 2" << endl;
+ pscalaire._titre = _titre;
+ pscalaire._titre.push_back("produit scalaire");
+ pscalaire._flag = _flag;
+
+ if ((_flag == 2) || (_flag == 3)) {
+ //copie des �tiquettes des colonnes
+ pscalaire._tcol = _tcol;
+ pscalaire._tlig = _tcol;
+ }
+
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) coucou 3" << endl;
+ //copie du tableau
+ a = nbcolonnes * nbcolonnes;
+ for (i = 0; i < a; i++) {
+ if (i < _t)
+ pscalaire._tab[i] = _tab[i];
+ else
+ pscalaire._tab[i] = 0;
+ }
+
+ pcov = pscalaire._tab;
+
+ dt = 0.;
+ z = (long double) 1 / nbcolonnes;
+
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) coucou 4" << endl;
+ for (i = 0; i < nbcolonnes; i++) {
+ for (j = 0; j < nbcolonnes; j++) {
+ x = *(pcov + rindice(i, j));
+ x2 = x * x;
+ *(ps + i) = (*(ps + i)) + x2;
+ dt = dt + x2;
+ }
+ *(ps + i) = (*(ps + i)) * z;
+ }
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) coucou 5 " << nbcolonnes << " " << z << endl;
+ dt = dt * z * z;
+ for (i = 0; i < nbcolonnes; i++) {
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) coucou i " << i << endl;
+ for (j = 0; ((i > 0) && (j <= (i - 1))); j++) {
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) coucou j " << j << endl;
+ a = rindice(i, j);
+ *(pcov + a) = 0.5 * ((*(ps + i)) + (*(ps + j)) - dt - (*(pcov + a))
+ * (*(pcov + a)));
+ *(pcov + rindice(j, i)) = *(pcov + a);
+ }
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) coucou 1i " << i << endl;
+ *(pcov + rindice(i, j)) = 0.5 * (2 * (*(ps + i)) - dt);
+ *(pvp + i) = (*(pcov + rindice(i, i))) / z;
+ }
+
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) delete" << endl;
+ delete[] pvp;
+ delete[] ps;
+ //cerr << "MatriceLD::fscalaire(MatriceLD& pscalaire) fin" << endl;
+
+}
+
+void MatriceLD::fatd(MatriceLD& pcoord, MatriceLD& pstat) {
+ //pmat1, matrice de d�part: tableau de distances (matrice
+ //triangulaire inf�rieure, de type 2 pour NTSYS
+ //pstat: matrice contenant les statistiques sur l'importance de
+ //chaque axe dans un espace � n dimensions
+ //pcoord: matrice contenant les coordonn�es des OTUs (r�sultat) dans cet
+ // espace � n dimensions
+
+ MatriceLD& pmat1 = *this;
+ pmat1.SetType(1);
+
+ //cerr << "MatriceLD::fatd (MatriceLD& pcoord, MatriceLD& pstat) debut" << endl;
+ if (pmat1.GetFlag() == 2)
+ pmat1.ftranspose();
+
+ // au fomat NTSys: mettre les labels sur les colonnes (2� chiffre)
+
+ MatriceLD mscalaire; //produit scalaire
+ MatriceLD mdiag;//matrice diagonalis�e
+
+ MatriceLD mnormalisee; //matrice normalisee
+ vector<long double> pvlp; //vecteurs propres
+
+ try {
+ //travail sur une matrice de distances
+ if (_type != 2)
+ pmat1.SetType(2);
+
+ //cerr << "MatriceLD::fatd (MatriceLD& pcoord, MatriceLD& pstat) coucou 1" << endl;
+ pmat1.fscalaire(mscalaire);
+
+ //cerr << "MatriceLD::fatd (MatriceLD& pcoord, MatriceLD& pstat) coucou 2" << endl;
+
+ mscalaire.fdiagonalisation(mdiag, pvlp);
+
+ //cerr << "MatriceLD::fatd (MatriceLD& pcoord, MatriceLD& pstat) coucou 3" << endl;
+ } catch (MatriceLD::Anomalie erreur) {
+ cout << erreur.fmessage(erreur.le_pb);
+ }
+
+ // mdiag.normalise(&mnormalisee, pmat1, pvlp) ;
+
+ //coordcol redimensionne pstat et pcoord
+ pmat1.fcoordcol(pstat, pcoord, mdiag, pvlp);
+ //cerr << "MatriceLD::fatd (MatriceLD& pcoord, MatriceLD& pstat) fin" << endl;
+
+}
+
+JeuMatriceLD::JeuMatriceLD(istream& entree) {
+ // Lecture de fichiers contenant plusieurs matrices
+ iFlux(entree);
+}
+
+// Lecture de fichiers contenant plusieurs matrices
+void JeuMatriceLD::iFluxXML(istream& entree) {
+
+}
+
+void JeuMatriceLD::iFlux(istream& entree) {
+ // Lecture de fichiers contenant plusieurs matrices
+
+ stringstream* tampon;
+ bool is_xml(false);
+ // iostream ensortie(tampon.rdbuf());
+ char car;
+ ChaineCar ligne;
+ vector<unsigned long> positions;
+ MatriceLD* pmat;
+ unsigned long i, j;
+
+ //balayage de l'entree pour trouver les positions
+ // (delimitee par //)
+ entree.clear();
+ entree.seekg(0);
+ positions.push_back(0);
+ positions.push_back(0);
+
+ entree.get(car);
+ while (entree.good()) {
+ if ((car == '/') && (entree.peek() == '/')) {
+ positions.back() = entree.tellg();
+ positions.back() -= 2;
+
+ //cerr <<"coucou";
+ GetLigneFlot(entree, ligne);
+ positions.push_back(entree.tellg());
+
+ positions.push_back(entree.tellg());
+ } else {
+ GetLigneFlot(entree, ligne);
+ if (ligne.find("xml version=\"1.0\"", 0) > 0) {
+ // c'est du ricqlèèèès !!!!!
+ is_xml = true;
+ break;
+ }
+ }
+ positions.back() = entree.tellg();
+ entree.get(car);
+ }
+
+ if (is_xml) {
+ iFluxXML(entree);
+ return;
+ }
+ // remplissage du buffer de matrices
+
+ for (i = 0; i < (positions.size() - 1); i += 2) {
+ if ((positions[i + 1] - positions[i]) < 6)
+ continue;
+
+ entree.clear();
+ entree.seekg(positions[i]);
+
+ _titres.push_back("");
+ if (entree.peek() == '@') {
+ entree.get(car);
+ GetLigneFlot(entree, ligne);//_titres.back());
+
+ //cerr << ligne;
+ ligne.GetMot(1, _titres.back());
+ //cerr << _titres.back();
+ }
+
+ tampon = new stringstream();
+ for (j = positions[i]; j < positions[i + 1]; j++) {
+ entree.get(car);
+ *tampon << car;
+ j = entree.tellg();
+
+ }
+ *tampon << ends;
+
+ //cin >> car;
+ // cout << tampon->str() <<endl << endl;
+ pmat = new MatriceLD();
+ try {
+ *tampon >> *pmat;
+ _tableau.push_back(pmat);
+ } catch (MatriceLD::Anomalie pb) {
+ delete pmat;
+ _titres.pop_back();
+ }
+
+ delete tampon;
+ // delete pmat;
+ // delete pensortie;
+ }
+}
+
+void JeuMatriceLD::oFlux(ostream& sortie, int format) const {
+ // Ecriture de fichiers contenant plusieurs matrices
+ if (format == 5) {
+ oGnumeric(sortie);
+ return;
+ }
+ long i, taille(_tableau.size());
+
+ for (i = 0; i < taille; i++) {
+ sortie << "@" << _titres[i] << endl;
+ _tableau[i]->oFormat(sortie, format);
+ sortie << endl << "//" << endl;
+ }
+
+}
+
+void JeuMatriceLD::oGnumeric(ostream& fichier) const {
+ QString * p_output_xml = new QString("");
+ QXmlStreamWriter xml_stream(p_output_xml);
+ xml_stream.setAutoFormatting(true);
+ xml_stream.writeStartDocument();
+ // Ecriture de fichiers contenant plusieurs matrices
+ long i, taille(_tableau.size());
+
+ xml_stream.writeNamespace("http://www.gnumeric.org/v10.dtd", "gmr");
+ xml_stream.writeNamespace("http://www.w3.org/2001/XMLSchema-instance",
+ "xsi");
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Workbook");
+ xml_stream.writeAttribute("http://www.w3.org/2001/XMLSchema-instance",
+ "schemaLocation", "http://www.gnumeric.org/v8.xsd");
+
+ //fichier
+ // << "<gmr:Workbook xmlns:gmr=\"http://www.gnumeric.org/v10.dtd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.gnumeric.org/v8.xsd\">"
+ // << endl;
+
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd",
+ "Attributes");
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Attribute");
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "WorkbookView::show_horizontal_scrollbar");
+ //fichier << "<gmr:Attributes>" << endl;
+ //fichier << " <gmr:Attribute>" << endl;
+ //fichier << "<gmr:name>WorkbookView::show_horizontal_scrollbar</gmr:name>"
+ // << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "type", "4");
+ //fichier << " <gmr:type>4</gmr:type>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "value",
+ "TRUE");
+ //fichier << " <gmr:value>TRUE</gmr:value>" << endl;
+ xml_stream.writeEndElement();
+ // fichier << " </gmr:Attribute>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Attribute");
+ //fichier << " <gmr:Attribute>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "WorkbookView::show_vertical_scrollbar");
+ //fichier << " <gmr:name>WorkbookView::show_vertical_scrollbar</gmr:name>"
+ // << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "type", "4");
+ //fichier << " <gmr:type>4</gmr:type>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "value",
+ "TRUE");
+ //fichier << " <gmr:value>TRUE</gmr:value>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Attribute>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Attribute");
+ //fichier << " <gmr:Attribute>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "WorkbookView::show_notebook_tabs");
+ //fichier << " <gmr:name>WorkbookView::show_notebook_tabs</gmr:name>"
+ // << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "type", "4");
+ //fichier << " <gmr:type>4</gmr:type>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "value",
+ "TRUE");
+ //fichier << " <gmr:value>TRUE</gmr:value>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Attribute>" << endl;
+
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Attribute");
+ //fichier << " <gmr:Attribute>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "WorkbookView::do_auto_completion");
+ //fichier << " <gmr:name>WorkbookView::do_auto_completion</gmr:name>"
+ // << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "type", "4");
+ //fichier << " <gmr:type>4</gmr:type>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "value",
+ "TRUE");
+ //fichier << " <gmr:value>TRUE</gmr:value>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Attribute>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Attributes>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Summary");
+ //fichier << " <gmr:Summary>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Item");
+ //fichier << " <gmr:Item>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "biology softwares");
+ //fichier << " <gmr:name>biology softwares</gmr:name>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd",
+ "val-string", "http://www.pge.cnrs-gif.fr/bioinfo");
+ //fichier
+ // << " <gmr:val-string>http://www.pge.cnrs-gif.fr/bioinfo</gmr:val-string>"
+ // << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Item>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Item");
+ //fichier << " <gmr:Item>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "name",
+ "author");
+ //fichier << " <gmr:name>author</gmr:name>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd",
+ "val-string", "Olivier Langella <Olivier.Langella at moulon.inra.fr>");
+ //fichier
+ // << " <gmr:val-string>Olivier Langella, Olivier.Langella at pge.cnrs-gif.fr</gmr:val-string>"
+ // << endl;
+ xml_stream.writeEndElement();
+ //fichier << " </gmr:Item>" << endl;
+ xml_stream.writeEndElement();
+ //fichier << "</gmr:Summary>" << endl;
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd",
+ "SheetNameIndex");
+
+ //fichier << " <gmr:SheetName>Matrix 1</gmr:SheetName>" << endl;
+
+
+ //fichier << "<gmr:SheetNameIndex>" << endl;
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd", "SheetName",
+ "Matrix 1");
+ for (i = 0; i < taille; i++) {
+ xml_stream.writeTextElement("http://www.gnumeric.org/v10.dtd",
+ "SheetName", _titres[i].c_str());
+ //fichier << "<gmr:SheetName>" << _titres[i] << "</gmr:SheetName>"
+ // << endl;
+ }
+ xml_stream.writeEndElement();
+ //fichier << "</gmr:SheetNameIndex> " << endl;
+
+ xml_stream.writeStartElement("http://www.gnumeric.org/v10.dtd", "Sheets");
+ // fichier.setf(ios::scientific);
+
+ for (i = 0; i < taille; i++) {
+ QString sheetname(_titres[i].c_str());
+ _tableau[i]->oGnumericSheet(xml_stream, sheetname);
+ }
+
+ fichier << " </gmr:Sheets> " << endl;
+ fichier << "</gmr:Workbook> " << endl;
+
+ xml_stream.writeEndDocument();
+
+ fichier << p_output_xml->toStdString();
+ delete (p_output_xml);
+
+}
+
+void JeuMatriceLD::SetTitre(long i, const char * chaine) {
+
+ // if ((i < 0) || (i >= _titres.size())) throw Anomalie(1);
+ // cerr << chaine << endl;
+ _titres[i].assign(chaine);
+ // cerr << "fini" << endl;
+}
+
+void JeuMatriceLD::resize(long nouvtaille) {
+ //on efface:
+ long i, taille(_tableau.size());
+
+ _titres.resize(nouvtaille);
+
+ for (i = 0; i < taille; i++)
+ delete _tableau[i];
+
+ //on r�alloue
+ _tableau.resize(nouvtaille);
+ for (i = 0; i < nouvtaille; i++)
+ _tableau[i] = new MatriceLD;
+
+}
+
+} //namespace biolib {
+} //namespace vecteurs {
diff --git a/src/matrices.h b/src/matrices.h
new file mode 100644
index 0000000..e571fe3
--- /dev/null
+++ b/src/matrices.h
@@ -0,0 +1,468 @@
+/***************************************************************************
+ matrices.h - Librairie d'objets pour manipuler des matrices
+ -------------------
+ begin : ven aug 14 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+// Objets permettant de manipuler des matrices
+// Olivier Langella le 11/3/98
+// langella at pge.cnrs-gif.fr
+
+//#include "vecteurs.h"
+
+// les matrices
+#ifndef MATRICES_H
+#define MATRICES_H
+
+//#define WITHOUT_EXPAT
+//#ifndef WITHOUT_EXPAT
+//#include "expat.h"
+//#endif
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <cstdlib>
+#include <string>
+#include <vector>
+#include <cmath>
+#include <QDebug>
+#include <QXmlStreamWriter>
+#include <QString>
+//#include <locale>
+#include "vecteurs.h"
+
+namespace biolib {
+namespace vecteurs {
+
+class MatriceLD;
+class MatriceF;
+// les matrices
+template<class T> class Matrice {
+public:
+ Matrice();
+ Matrice(unsigned long nl, unsigned long nc = 0);
+ Matrice(const Matrice&); //constructeur de copie
+ //Matrice(const MatriceLD& lamatrice):Matrice<long double>(lamatrice) {}; //constructeur de copie
+ //Matrice(const MatriceF& lamatrice):Matrice<float>(lamatrice) {}; //constructeur de copie
+ virtual ~Matrice() {
+ if (_tab != 0)
+ delete[] _tab;
+ }
+
+ virtual T& GetCase(const ChaineCar& nomLig, const ChaineCar& nomCol) const {
+ long ni(_tlig.Position(nomLig));
+ long nj(_tcol.Position(nomCol));
+ //cerr << nomLig << "GetCase ni " << ni;
+ //cerr << nomCol << "GetCase nj " << nj;
+ if ((ni < 0) || (nj < 0))
+ throw Anomalie(7);
+ return (GetCase(ni, nj));
+ }
+
+ virtual T& GetCase(unsigned long i, unsigned long j) const {
+ if ((i >= _nl) || (j >= _nc))
+ throw Anomalie(7);
+ //renvoie la valeur de la case i (ligne), j (colonne)
+ long swap;
+ if ((_type == 3) && (j > i)) {
+ swap = i;
+ i = j;
+ j = swap;
+ }
+ return (_tab[(i * _nc) + j]);
+ }
+
+ virtual void SetFlag(int i) {
+ _flag = i;
+ }
+ //etiquettes sur lignes ou colonnes
+
+
+ long GetNC() const {
+ return (_nc);
+ }
+
+ long GetNL() const {
+ return (_nl);
+ }
+
+ int GetType() const {
+ return (_type);
+ }
+
+ int GetFlag() const {
+ return (_flag);
+ }
+
+ virtual T get_ppvaleur() const; //recherche la plus petite valeur
+
+ virtual bool SetType(int type); //type de matrice:
+ //1 -> rectangulaire
+ //3 -> triangulaire
+ virtual void resize(unsigned long nblig, unsigned long nbcol); //efface et réalloue de la mémoire
+ virtual void SupprCol(unsigned long); //efface et réalloue de la mémoire
+ virtual void SupprLig(unsigned long); //efface et réalloue de la mémoire
+ virtual bool redim(unsigned long, unsigned long); //redimensionne la matrice
+
+ void ftranspose();
+ virtual void f_neg2zero();
+ void fscol(vector<long double> & somme) const; //somme des colonnes
+ void fslig(vector<long double> & somme) const; //somme des colonnes
+ void fswapcol(long i, long j);
+ long double fdet() const;
+ long double ftrace() const;
+
+ inline void fmultiplier(const Matrice<T>& matA, const Matrice<T>& matB);
+
+ Titre _titre;
+
+ Titre _tcol;
+ Titre _tlig;
+
+ virtual void iFichier(istream& ientree);
+ void iFichier(istream & entree, int i) {
+ //cerr << "coucou " << i << endl;
+
+ switch (i) {
+ case 1:
+ iExcel(entree);
+ return;
+ break;
+ case 2:
+ iNtsys(entree);
+ return;
+ break;
+ case 4:
+ iPhylip(entree);
+ return;
+ break;
+ case 5:
+ iGnumeric(entree);
+ return;
+ break;
+ default:
+ return;
+ }
+ }
+
+ virtual void oFormat(ostream & sortie, int i) {
+ switch (i) {
+ case 1:
+ oExcel(sortie);
+ break;
+ case 2:
+ oNtsys(sortie);
+ break;
+ case 3:
+ // oXgobi(sortie);
+ throw Anomalie(6);
+ break;
+ case 4:
+ oPhylip(sortie);
+ // throw Anomalie(6);
+ break;
+ case 5:
+ oGnumeric(sortie);
+ // throw Anomalie(6);
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ //1= Excel
+ //2= Ntsys
+ //3= xgobi ==!!!! seulement en ofstream !!!!!
+
+ virtual void ofFormat(ofstream & sortie, int i = 1) {
+ if (i == 3) {
+ string fichier("xgobi");
+ oXgobi(fichier);
+ } else {
+ oFormat(sortie, i);
+ }
+ }
+
+ virtual void ofFormat(ofstream & sortie, int i, const string &fichier) {
+ if (i == 3) {
+ oXgobi(fichier);
+ } else {
+ oFormat(sortie, i);
+ }
+ }
+
+ virtual void iNtsys(istream & entree);
+ virtual void iExcel(istream & entree);
+ virtual void iGnumeric(istream & entree);
+ virtual void iPhylip(istream & entree);
+ void oNtsys(ostream & sortie);
+ void oExcel(ostream & sortie);
+ void oGnumeric(ostream & sortie);
+ void
+ oGnumericSheet(QXmlStreamWriter& xml_stream,
+ const QString & sheetname) const;
+ void oPhylip(ostream& sortie);
+ void oXgobi(const string&);
+
+ virtual const Matrice<T>& operator=(const Matrice<T> &rval);
+ const Matrice<T>& operator=(vector<T> &rval);
+ Matrice<T> operator*(Matrice<T> &rval) const;
+ vector<T> operator*(const vector<T> &rval);
+ Matrice<T> operator*(long double scalaire);
+ Matrice<T> operator-(Matrice<T> &rval);
+ Matrice<T> operator+(Matrice<T> &rval);
+ Matrice<T> operator+(long double rval);
+
+protected:
+
+ long double fdetrec() const;
+
+ long rindice(long ligne, long colonne) {
+ //if (_type == 3) if (colonne > ligne) return((colonne * _nc) + ligne);
+ return ((ligne * GetNC()) + colonne);
+ }
+
+ unsigned long _t; //taille (_nc * _nl)
+ unsigned long _nc; //nb de colonnes (i)
+ unsigned long _nl; //nb de lignes (j)
+ unsigned int _type; //type de matrice
+ int _miss; //missing value
+ unsigned int _flag; //étiquettes
+ //1=> titres des lignes 2=> titres des colonnes
+ //3=> les 2 //0=> rien
+
+public:
+
+ T* _tab; // matrice
+ //formats de fichiers
+ unsigned int _oformat; //1-> Excel 2->NTsys 3->xgobi (UNIX) 4->phylip
+
+ struct Anomalie {
+ Anomalie(int i) :
+ le_pb(i) {
+ }
+
+ // 1-> erreur pendant lecture de fichier
+ // 2-> erreur dans mdiaggl
+ // 3-> opération impossible sur ce type de matrice
+ // 4-> calcul impossible
+ // 5-> Echec de la conversion de la matrice en matrice symétrique
+
+ // 6-> erreur pendant l'écriture du fichier
+ // 7-> acces hors bornes dans la matrice
+ int le_pb;
+ string _message;
+
+ string& fmessage(int num) {
+ switch (num) {
+ case 1:
+ _message = "Erreur pendant la lecture du fichier...";
+ break;
+ case 2:
+ _message = "Cette matrice ne peut être diagonalisée";
+ break;
+ case 3:
+ _message = "Opération impossible sur ce type de matrice";
+ break;
+ case 4:
+ _message = "Calcul impossible";
+ break;
+ case 5:
+ _message
+ = "Echec de la conversion de la matrice en matrice symétrique";
+ break;
+ case 6:
+ _message = "Erreur pendant l'ecriture du fichier";
+ break;
+ case 7:
+ _message = "Acces hors bornes dans la matrice";
+ break;
+
+ default:
+ _message = "";
+ break;
+ }
+ return (_message);
+ }
+ };
+
+};
+
+class MatriceF: public Matrice<float> {
+
+public:
+ MatriceF() :
+ Matrice<float> () {
+ }
+
+ MatriceF(unsigned long nl, unsigned long nc = 0) :
+ Matrice<float> (nl, nc) {
+ }
+
+ MatriceF(const MatriceF& lamatrice) :
+ Matrice<float> (lamatrice) {
+ }
+ //constructeur de copie
+ MatriceF(const Matrice<float>& lamatrice) :
+ Matrice<float> (lamatrice) {
+ }
+ //constructeur de copie
+ ~MatriceF() {
+ }
+
+ void finv(MatriceF& resultat) const;
+
+ void fvalpropres(Matrice<float>&, vector<float> &, float precision =
+ 0.000001);
+
+};
+
+// les matrices
+class MatriceLD: public Matrice<long double> {
+public:
+ MatriceLD();
+ MatriceLD(long nl, long nc = 0) :
+ Matrice<long double> (nl, nc) {
+ }
+
+ MatriceLD(const MatriceLD& lamatrice) :
+ Matrice<long double> (lamatrice) {
+ }
+ //constructeur de copie
+ MatriceLD(const Matrice<long double>& lamatrice) :
+ Matrice<long double> (lamatrice) {
+ }
+ //constructeur de copie
+ virtual ~MatriceLD() {
+ }
+
+ void fatd(MatriceLD&, MatriceLD&);
+ void fscalaire(MatriceLD& pscalaire);
+ void fdiagonalisation(MatriceLD &, vector<long double> &);
+ void fmdiagql(int m, long double *ps, vector<long double> & pvlp);
+ int ftridiag(long double *ps, vector<long double> & pvlp);
+ void fcoordcol(MatriceLD& stat, MatriceLD& res, MatriceLD& norm, vector<
+ long double> & pvlp);
+ /*
+
+ void folicovariance(MatriceLD& pcov, bool facteur=false); //ya un truc
+ void fcovariance(MatriceLD& pcov); //ya un truc
+ // pourquoi on n eprend qu'une partie de l'originale ?
+ void fnormalise(MatriceLD & ,MatriceLD & , vector<long double> &) const;
+ void ftrivectshell(int, int, vector<long double> & pvlp);
+ void fprojection(MatriceLD& mccord,MatriceLD& mstat,MatriceLD& vectpropres, vector<long double> & pvlp) const;
+
+ void fafc (MatriceLD&, MatriceLD&);
+ void foliafc (MatriceLD&, MatriceLD&, long double precision=0.000001);
+ void foliatd (MatriceLD&, MatriceLD&, long double precision=0.000001);
+ void facp (MatriceLD&, MatriceLD&, long double precision=0.000001);
+ void fvalpropres (MatriceLD&, vector<long double> &, long double precision=0.000001);
+
+ */
+};
+
+// les tableaux de matrices
+class JeuMatriceLD {
+public:
+
+ JeuMatriceLD(istream& entree);
+ JeuMatriceLD() {
+ }
+
+ // JeuMatriceLD(deque<VecteurLD *>, Titre &, ) {};
+ ~JeuMatriceLD() {
+ long i, t(_tableau.size());
+ for (i = 0; i < t; i++)
+ delete _tableau[i];
+ }
+
+ MatriceLD& GetMatrice(long i) {
+ return *(_tableau[i]);
+ }
+ const MatriceLD& GetConstMatrice(long i) const {
+ return *(_tableau[i]);
+ }
+ MatriceLD& GetMatrice(ChaineCar chaine) {
+ long i(_titres.Position(chaine));
+ if (i < 0)
+ throw Anomalie(1);
+ return GetMatrice(i);
+ }
+ MatriceLD& back() {
+ return *(_tableau.back());
+ }
+
+ void iFlux(istream& entree);
+
+ void oFlux(ostream& sortie, int format = 1) const;
+
+ void push_back(MatriceLD* Pmatrice, const string titre) {
+ _titres.push_back(titre);
+ _tableau.push_back(Pmatrice);
+ }
+
+ void SetTitre(long i, const char * chaine);
+ void resize(long i);
+ long size() const {
+ return (_tableau.size());
+ }
+
+private:
+ void iFluxXML(istream& entree);
+ void oGnumeric(ostream& sortie) const;
+
+ vector<MatriceLD*> _tableau;
+ Titre _titres;
+
+public:
+ struct Anomalie {
+ Anomalie(int i) :
+ le_pb(i) {
+ }
+
+ // 1-> Matrice introuvable
+ int le_pb;
+ string _message;
+
+ string& fmessage(int num) {
+ switch (num) {
+ case 1:
+ _message = "Matrice introuvable...";
+ break;
+
+ default:
+ _message = "";
+ break;
+ }
+ return (_message);
+ }
+ };
+
+};
+
+template<class T> ostream& operator<<(ostream& sortie, Matrice<T>& lamatrice);
+
+//ofstream& operator<<(ofstream& sortie,MatriceLD& lamatrice);
+template<class T> ofstream& operator<<(ofstream& sortie, Matrice<T>& lamatrice);
+
+template<class T> istringstream& operator>>(istringstream& ientree,
+ Matrice<T>& lamatrice);
+
+} //namespace biolib {
+} //namespace vecteurs {
+
+#endif
+
diff --git a/src/metapop.cpp b/src/metapop.cpp
new file mode 100644
index 0000000..f655eca
--- /dev/null
+++ b/src/metapop.cpp
@@ -0,0 +1,373 @@
+
+/***************************************************************************
+ MetaPop.cpp - Librairie d'objets permettant de manipuler des donn�es
+ sp�cifiques aux MetaPops
+ -------------------
+ begin : ven sep 01 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "metapop.h"
+#include "jeupop.h"
+
+//constructeur du niveau racine
+MetaPop::MetaPop(Jeupop * pdonnees):StrucPop(pdonnees) {
+
+//cerr << "MetaPop::MetaPop(Jeupop * pdonnees) constructeur debut" << endl;
+ _Pmetapop = NULL;
+ _niveau_struc = 0;
+ _nom = "TOP_LEVEL";
+
+ _tabPstrucpop.resize(0);
+//cerr << "MetaPop::MetaPop(Jeupop * pdonnees) constructeur fin" << endl;
+}
+
+//constructeur de niveau interm�diaire
+MetaPop::MetaPop(MetaPop * pmetapopsup):StrucPop(pmetapopsup->_Pjeu) {
+ _Pmetapop = pmetapopsup;
+ _niveau_struc = pmetapopsup->_niveau_struc + 1;
+
+ _tabPstrucpop.resize(0);
+}
+
+//constructeur de copies
+MetaPop::MetaPop (const MetaPop & popori, MetaPop * Pmetapop, Jeupop * Pjeu):StrucPop(popori, Pmetapop, Pjeu){
+ unsigned long i, nbpop;
+//cerr << "MetaPop::MetaPop construct copie d�but " << endl;
+
+ //seulement pour l'objet MetaPop:
+ _niveau_struc = popori.get_niveau();
+
+ nbpop = popori.get_nbpop();
+
+// MetaPop * Pmetapopori(&popori);
+
+ for (i=0; i < nbpop; i++) {
+ if (popori._tabPstrucpop[i]->DuType("Population")) {
+ AjouterPopulation(new Population(*(popori._tabPstrucpop[i]), this));
+ }
+ if (popori._tabPstrucpop[i]->DuType("MetaPop")) {
+ AjouterPopulation(new MetaPop(*(popori.get_Ptabmetapop(popori._tabPstrucpop[i])), this, _Pjeu));
+ }
+ }
+//cerr << "MetaPop::MetaPop construct copie fin " << endl;
+}
+
+//destructeur
+MetaPop::~MetaPop () {
+//cerr << "MetaPop::~MetaPop debut" << endl;
+
+ unsigned long i;
+
+ for (i=0;i < _tabPstrucpop.size();i++) delete _tabPstrucpop[i];
+//cerr << "MetaPop::~MetaPop fin" << endl;
+}
+
+bool MetaPop::DuType(const string & nom) const {
+ if (nom == "MetaPop") return(true);
+ else return(false);
+}
+
+void MetaPop::ifAjouterIndividu(const Individu * Pind) {
+}
+
+void MetaPop::AjouterIndividu(Individu * Pind) {
+ //ajout d'un individu dans une MetaPopulation
+
+ _tabPind.push_back(Pind);
+
+ if (_niveau_struc !=0) _Pmetapop->AjouterIndividu(Pind);
+
+}
+
+void MetaPop::AjouterPopulation(Population * Ppop) {
+
+ _tabPstrucpop.push_back(Ppop);
+ _Pjeu->AjouterTabPop(Ppop);
+}
+
+void MetaPop::AjouterPopulation(MetaPop * Pmetapop) {
+ _tabPstrucpop.push_back(Pmetapop);
+ _tabPmetapop.push_back(Pmetapop);
+}
+
+MetaPop * MetaPop::NewMetaPop(const biolib::vecteurs::ChaineCar & nom) {
+ MetaPop * Pmetapop;
+ unsigned long i;
+
+ for (i=0; i < _tabPmetapop.size(); i++) {
+ //si ma m�tapop existe d�j�:
+ if (_tabPmetapop[i]->get_nom() == nom) return (_tabPmetapop[i]);
+ }
+ Pmetapop = new MetaPop(this);
+ Pmetapop->set_nom(nom);
+ AjouterPopulation(Pmetapop);
+ return (Pmetapop);
+}
+
+void MetaPop::get_nomniveauxstruc(Titre & nom_niveaux) const{
+
+ unsigned long i;
+
+ if (nom_niveaux.size() < (_niveau_struc + 1)) nom_niveaux.push_back(_nom);
+ else nom_niveaux[_niveau_struc] = nom_niveaux[_niveau_struc] + " " + _nom;
+
+ for (i = 0; i < _tabPstrucpop.size(); i++) {
+ _tabPstrucpop[i]->get_nomniveauxstruc(nom_niveaux);
+ }
+
+}
+
+void MetaPop::set_nploidie() {
+ _nploidie = _Pjeu->get_nploidie();
+ _nbloc = _Pjeu->get_nbloc();
+
+ unsigned long i;
+//cerr << "MetaPop::set_nploidie() " << _nploidie << endl;
+
+ for (i=0; i < _tabPstrucpop.size(); i++) {
+ _tabPstrucpop[i]->set_nploidie();
+ }
+//cerr << "MetaPop::set_nploidie() fin" << _nploidie << endl;
+}
+
+void MetaPop::reset() {
+ // remise � z�ro
+ unsigned long i;
+
+ StrucPop::reset();
+
+ for (i=0 ; i < _tabPstrucpop.size(); i++) {
+ delete _tabPstrucpop[i];
+ }
+ _tabPstrucpop.resize(0);
+ _tabPmetapop.resize(0);
+
+}
+
+MetaPop * MetaPop::get_Ptabmetapop(const StrucPop * Pstrucpop) const {
+ unsigned long i;
+
+ for (i=0; i < _tabPmetapop.size(); i++) {
+ if (_tabPmetapop[i] == Pstrucpop) return (_tabPmetapop[i]);
+ }
+// pos = _tabPmetapop.Position(Pstrucpop);
+ return (0);
+}
+
+void MetaPop::f_rempliTabStrucPop(Vecteur<StrucPop*> & tabStrucPop, unsigned int niveau) {
+ unsigned long i;
+
+//cerr << "MetaPop::f_rempliTabStrucPop(Vecteur<StrucPop*> & tabStrucPop, unsigned int niveau)" << endl;
+// if (get_niveau() > niveau) return;
+
+ if (get_niveau() == niveau) {
+//cerr << get_niveau() << " " << niveau << endl;
+ tabStrucPop.push_back(this);
+ return;
+ }
+ for (i = 0; i < _tabPstrucpop.size(); i++) {
+ _tabPstrucpop[i]->f_rempliTabStrucPop(tabStrucPop, niveau);
+ }
+}
+
+long double MetaPop::f_Mheterozygotieatt(unsigned long locus) const {
+//moyenne de l'h�t�rozygotie attendue sur les sous populations
+//pour ce locus (Hs barre)
+// ok verifie le 11/10/2000
+
+ long unsigned nbpop(get_nbpop()),k, nbpopcalc;
+ long double MoyHS(0);
+
+ nbpopcalc = nbpop;
+ for (k=0; k < nbpop; k++) {
+ MoyHS += _tabPstrucpop[k]->f_heterozygotieatt(locus, &nbpopcalc);
+ }
+ if ((nbpopcalc == 0) || (nbpopcalc > 100000)) return(0);
+
+ MoyHS /= (long double) nbpopcalc;
+
+ return(MoyHS);
+
+}
+
+long double MetaPop::f_Mheterozygotieobs(unsigned long locus) const {
+//moyenne de l'h�t�rozygotie observ�e sur les sous populations
+//HI h�t�rozygotie individuelle pour ce locus
+// ok verifie le 11/10/2000
+
+ long unsigned nbpop(get_nbpop()),k, nbpopcalc;
+ long double MoyHI(0);
+
+ nbpopcalc = nbpop;
+ for (k=0; k < nbpop; k++) {
+ MoyHI += _tabPstrucpop[k]->f_heterozygotieobs(locus, &nbpopcalc);
+ }
+ if ((nbpopcalc == 0) || (nbpopcalc > 100000)) return(0);
+
+ MoyHI /= (long double) nbpopcalc;
+
+ return(MoyHI);
+
+}
+
+long double MetaPop::f_Mheterozygotietotale(unsigned long locus) const {
+// h�t�rozygotie totale (Ht) attendue, � partir des fr�quences all�liques
+// moyennes sur la m�tapopulation pour ce locus
+// ok verifie le 11/10/2000
+
+ long unsigned i,nballloc,allnonnuls;
+ long double sfreqcarre(0), freq;//, Hs;
+ long unsigned nbpop(get_nbpop()),k;
+ Allele * Pall;
+
+ nballloc = _Pjeu->get_Plocus(locus)->get_nball();
+ for (i=0; i < nballloc; i++) {
+ for (freq=0,k=0; k < nbpop; k++) {
+ allnonnuls = _tabPstrucpop[k]->r_nballnonnuls(locus);
+ if (allnonnuls == 0) continue;
+
+ Pall = _Pjeu->get_Pall(locus,i);
+ if (Pall->r_estnul()) continue;
+ freq += ((long double) _tabPstrucpop[k]->r_nbcopall(Pall)) / ((long double) allnonnuls);
+ }
+ freq /= (long double) nbpop; //fr�quence moyenne
+ sfreqcarre += (freq * freq);
+ }
+ //Hs += (long double) 1 - sfreqcarre;
+ return ((long double) 1 - sfreqcarre);
+
+
+}
+
+long double MetaPop::f_M_Fis(unsigned long locus) const {
+// indice de Wright Fis pour ce locus
+// ok verifie le 11/10/2000
+// Fis = (Hs barre - Hi) / Hs barre
+ if (locus > (unsigned long)get_nbloc()) throw Anomalie(7);
+
+//cerr << "MetaPop::f_M_Fis Hi:" << f_Mheterozygotieobs(locus) << endl;
+ long double Hsbarre(f_Mheterozygotieatt(locus));
+//cerr << "MetaPop::f_M_Fis Hsbarre:" << Hsbarre << endl;
+
+ return ((Hsbarre - f_Mheterozygotieobs(locus))/ Hsbarre);
+}
+
+long double MetaPop::f_M_Fst(unsigned long locus) const {
+// indice de Wright Fst pour ce locus
+// ok verifie le 11/10/2000
+// Fst = (Ht - Hs barre) / Ht
+//cerr << "MetaPop::f_M_Fst" << endl;
+//cerr << locus << " " << get_nbloc() << endl;
+ if (locus > get_nbloc()) throw Anomalie(7);
+
+ long double Ht(f_Mheterozygotietotale(locus));
+
+//cerr << "MetaPop::f_M_Fst Ht " << Ht << endl;
+//cerr << "MetaPop::f_M_Fst Hsbarre " << f_Mheterozygotieatt(locus) << endl;
+
+ return ((Ht - f_Mheterozygotieatt(locus))/ Ht);
+}
+
+
+long double MetaPop::f_M_Fit(unsigned long locus) const {
+// indice de Wright Fit pour ce locus
+// ok verifie le 11/10/2000
+// Fit = (Ht - Hi) / Ht
+//cerr << "MetaPop::f_M_Fit" << endl;
+//cerr << locus << " " << get_nbloc() << endl;
+
+ if (locus > get_nbloc()) throw Anomalie(7);
+
+ long double Ht(f_Mheterozygotietotale(locus));
+
+ return ((Ht - f_Mheterozygotieobs(locus))/ Ht);
+}
+
+/** Suppression de la Population Ppop */
+void MetaPop::SupprPop(StrucPop * Ppop){
+//cerr << "MetaPop::SupprPop debut" << endl;
+ unsigned long nbpop(_tabPstrucpop.size()),p;
+ bool ok(false);
+
+ for (p=0; p < nbpop; p++) {
+ if (Ppop == _tabPstrucpop[p]) {
+//cerr << "MetaPop::SupprPop efface" << endl;
+ delete Ppop;
+ _tabPstrucpop.erase(_tabPstrucpop.begin()+p);
+ p--;
+ nbpop--;
+ ok = true;
+ }
+ }
+//cerr << "MetaPop::SupprPop debut 2" << endl;
+
+ if (ok) {
+ nbpop = _tabPmetapop.size();
+ for (p=0; p < nbpop; p++) {
+ if (Ppop == _tabPmetapop[p]) {
+ _tabPmetapop.erase(_tabPmetapop.begin()+p);
+ }
+ }
+//cerr << "MetaPop::SupprPop debut 3 " << "ok" << endl;
+ }
+ else {
+ for (p=0; p < nbpop; p++) _tabPstrucpop[p]->SupprPop(Ppop);
+ }
+//cerr << "MetaPop::SupprPop fin" << endl;
+
+}
+/** Retourne vrai, si l'allele n'est pas pr�sent dans MetaPop */
+bool MetaPop::r_allelenonpresent(Allele * Pall) const{
+ if (r_nbcopall(Pall) > 0) return (false);
+ else return(true);
+}
+/** r�affectation du nombre de locus
+ */
+void MetaPop::set_nbloc(){
+ unsigned int i;
+ _nbloc = _Pjeu->get_nbloc();
+
+ for (i = 0; i < _tabPstrucpop.size(); i ++) _tabPstrucpop[i]->set_nbloc();
+}
+
+void MetaPop::oPopulationsXML(unsigned int id, ostream & sortie, ostream & infos) {
+ unsigned int i, nbpop(_tabPstrucpop.size());
+ biolib::vecteurs::ChaineCar idXML;
+
+ sortie << "<metapopulation";
+ idXML = "mp";
+ idXML.AjEntier(id);
+ idXML += "le";
+ idXML.AjEntier(get_niveau());
+ sortie << " id=\"" << idXML << "\"";
+ sortie << " name=\"" << get_nom() << "\"";
+ sortie << ">" << endl;
+
+
+ for (i=0; i < nbpop; i++) {
+ _tabPstrucpop[i]->oPopulationsXML(i, sortie, infos);
+ }
+
+ sortie << "</metapopulation>" << endl;
+
+}
+
+Population * MetaPop::new_population(string & nom) {
+ Population * Ppop(new Population(this));
+
+ Ppop->set_nom(nom);
+ AjouterPopulation(Ppop);
+ return (Ppop);
+}
+
diff --git a/src/metapop.h b/src/metapop.h
new file mode 100644
index 0000000..ab31554
--- /dev/null
+++ b/src/metapop.h
@@ -0,0 +1,93 @@
+
+/***************************************************************************
+ MetaPop.h - Librairie d'objets permettant de manipuler des données
+ spécifiques aux populations
+ -------------------
+ begin : ven sep 01 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+// population
+
+#ifndef METAPOP_H
+#define METAPOP_H
+
+#include "locus.h"
+#include "strucpop.h"
+#include "population.h"
+#include "vecteurs.h"
+
+using namespace biolib::vecteurs;
+
+class MetaPop: public StrucPop {
+public:
+ MetaPop(Jeupop * pdonnees);
+ MetaPop(MetaPop * pmetapopsup);
+ MetaPop(const MetaPop & popori, MetaPop * Pmetapop, Jeupop * Pjeu);
+ ~MetaPop();
+
+ bool DuType(const string & nom) const;
+ friend class Jeupop;
+
+ void AjouterIndividu(Individu * Pind);
+ void AjouterPopulation(MetaPop * );
+ void AjouterPopulation(Population * );
+
+ MetaPop * NewMetaPop(const biolib::vecteurs::ChaineCar & nom);
+ Population * new_population(string & nom);
+
+ unsigned long get_nbpop() const {return(_tabPstrucpop.size());};
+ unsigned long get_nbmetapop() const {return(_tabPmetapop.size());};
+ const MetaPop * get_tabPmetapop(unsigned int i) const {return (_tabPmetapop[i]);};
+ const string & get_nompop(unsigned int i) const {return(_tabPstrucpop[i]->get_nom());};
+ void get_nomniveauxstruc(Titre & nom_niveaux) const;
+ unsigned int get_niveau() const {return (_niveau_struc);};
+
+ void set_nploidie();
+
+ void f_rempliTabStrucPop(Vecteur<StrucPop*> &, unsigned int);
+
+ long double f_Mheterozygotieobs(unsigned long locus) const;
+ long double f_Mheterozygotieatt(unsigned long locus) const;
+ long double f_Mheterozygotietotale(unsigned long locus) const;
+
+ long double f_M_Fis(unsigned long locus) const;
+ long double f_M_Fst(unsigned long locus) const;
+ long double f_M_Fit(unsigned long locus) const;
+
+ void oPopulationsXML(unsigned int id, ostream & sortie, ostream & infos) ;
+
+ /** Retourne vrai, si l'allele n'est pas présent dans MetaPop */
+ bool r_allelenonpresent(Allele * Pall) const;
+protected:
+ /** Suppression de la Population Ppop */
+ void SupprPop(StrucPop * Ppop);
+ MetaPop * get_Ptabmetapop(const StrucPop *) const;
+
+ void ifAjouterIndividu(const Individu * Pind);
+
+ void reset();
+
+ /** réaffectation du nombre de locus
+ */
+ void set_nbloc();
+ unsigned int _niveau_struc;
+
+ vector<StrucPop *> _tabPstrucpop;
+
+ vector<MetaPop *> _tabPmetapop;
+
+};
+
+#endif
+
diff --git a/src/population.cpp b/src/population.cpp
new file mode 100644
index 0000000..ff3558a
--- /dev/null
+++ b/src/population.cpp
@@ -0,0 +1,231 @@
+
+/***************************************************************************
+ population.cpp - Librairie d'objets permettant de manipuler des données
+ spécifiques aux populations
+ -------------------
+ begin : ven sep 01 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "population.h"
+#include "jeupop.h"
+
+//constructeur
+Population::Population(Jeupop * pdonnees):StrucPop(pdonnees){
+ // ******************** Traitement des Metapops ***********
+ // *********** 5/9/2000
+ _Pmetapop = pdonnees->_Pracinepops; //par défaut
+ //
+ //
+ //
+ //_Pmetapop->AjouterPopulation(this);
+
+}
+
+//constructeur
+Population::Population(MetaPop * Pmetapop):StrucPop(Pmetapop->get_Pjeu()){
+ // ******************** Traitement des Metapops ***********
+ // *********** 5/9/2000
+ _Pmetapop = Pmetapop;
+ //
+ //
+ //_Pmetapop->AjouterPopulation(this);
+
+}
+
+
+//constructeur de copies
+Population::Population (const StrucPop & popori, MetaPop * Pmetapop):StrucPop(popori, Pmetapop, Pmetapop->get_Pjeu()){
+ unsigned long i;
+//cerr << "Population::Population construct copie début " << _nom << endl;
+ Individu * Poriind;
+
+ //seulement pour l'objet Population:
+// _nbind = popori.get_nbind();
+//cerr << "Population::Population construct copie _nbind " << popori.get_nbind() << endl;
+
+ for (i=0; i < popori.get_nbind(); i++) {
+ Poriind = popori.get_Pind(i);
+//cerr << "Population::Population construct copie _nomind " << Poriind->get_nom() << endl;
+ Poriind = new Individu(*Poriind, this);
+//cerr << "Population::Population construct copie _nomind " << Poriind->get_nom() << endl;
+
+ AjouterIndividu(Poriind);
+ }
+//cerr << "Population::Population construct copie fin " << endl;
+}
+
+
+//destructeur
+Population::~Population () {
+
+ while (_tabPind.size() > 0) {
+//cerr << "Population::~Population " <<_tabPind[0]->get_nom() << endl;
+ SupprIndividu(_tabPind[0]);
+ }
+
+}
+
+bool Population::DuType(const string & nom) const {
+ if (nom == "Population") return(true);
+ else return(false);
+}
+
+void Population::AjouterIndividu(Individu * Pind) {
+ //ajout d'un individu dans une Population
+//cerr << "Population::AjouterIndividu(Individu * Pind) début" << endl;
+ _tabPind.push_back(Pind);
+
+ _nbind++;
+//cerr << "Population::AjouterIndividu " << _nbind << endl;
+ _Pmetapop->AjouterIndividu(Pind);
+//cerr << "Population::AjouterIndividu(Individu * Pind) fin" << endl;
+
+}
+
+void Population::ifAjouterIndividu(const Individu * Pind) {
+ //ajout d'un individu dans une Population, avec les alleles correspondants
+ // => recherche d'un individu deja définis
+ long i, taille(get_nbind()), nbind(-1);
+ const string nomind(Pind->get_nom());
+
+ _nbloc = _Pjeu->get_nbloc();
+
+ for (i = 0 ; i < taille; i++) {
+ if (nomind == get_nomind(i)) {
+ nbind = i;
+ break;
+ }
+ }
+
+ if (nbind >= 0) { //l'individu existe deja
+ //il faut ajouter les locus (les alleles)
+ // que l'original n'a pas
+ // pb à résoudre: incohérence entre alleles d'un meme locus,
+ // d'un meme individu...
+ get_Pind(nbind)->ifFusionnerIndividu(*Pind);
+ }
+ else { //il faut creer un nouvel individu
+ _tabPind.push_back(new Individu(this, nomind));
+ // et le remplir
+ _tabPind.back()->ifFusionnerIndividu(*Pind);
+ }
+}
+
+void Population::get_nomniveauxstruc(Titre & nom_niveaux) const{
+
+ unsigned long niveau(get_niveau());
+
+ if (nom_niveaux.size() < (niveau + 1)) nom_niveaux.push_back(_nom);
+ else nom_niveaux[niveau] = nom_niveaux[niveau] + " " + _nom;
+
+}
+
+unsigned int Population::get_niveau() const {
+ return (_Pmetapop->get_niveau()+1);
+}
+
+void Population::set_nploidie() {
+ _nploidie = _Pjeu->get_nploidie();
+ _nbloc = _Pjeu->get_nbloc();
+
+ unsigned long i;
+
+//cerr << "Population::set_nploidie() " << _nploidie << endl;
+ for (i=0; i < _tabPind.size(); i++) {
+ _tabPind[i]->resize_alleles();
+ }
+//cerr << "Population::set_nploidie() fin" << _nploidie << endl;
+//cin >> i;
+}
+
+void Population::set_nploidie(unsigned int nploidie) {
+ if (_nploidie == 0) {
+ _nploidie = nploidie;
+ _Pjeu->set_nploidie(nploidie);
+ }
+ else if (_nploidie != nploidie) throw Anomalie(2);
+
+}
+
+string Population::get_nom_chemin() const {
+ MetaPop * Pmetapop(_Pmetapop);
+
+ string nom_complet(_nom);
+ string separateur("/");
+
+ while ((Pmetapop != 0) && (Pmetapop->get_niveau() != 0)) {
+ nom_complet = Pmetapop->get_nom() + separateur + nom_complet;
+ Pmetapop = Pmetapop->get_Pmetapop();
+ }
+
+ return (nom_complet);
+}
+
+void Population::f_rempliTabStrucPop(Vecteur<StrucPop*> & tabStrucPop, unsigned int niveau) {
+ tabStrucPop.push_back(this);
+}
+/** Suppression de la Population */
+void Population::SupprPop(StrucPop * Ppop){
+ if (Ppop != this) return;
+
+ unsigned long nbind (get_nbind()), i;
+
+ for (i = 0; i < nbind; i++) {
+
+ }
+}
+/** Suppression d'un individu dans une Population */
+void Population::SupprIndividu(Individu * Pind) {
+ SupprtabIndividu(Pind);
+ delete (Pind);
+//cerr << "Population::SupprIndividu fin" << endl;
+}
+
+void Population::oPopulationsXML(unsigned int id, ostream & sortie, ostream & infos) {
+ unsigned int i, nbind(get_nbind());
+ biolib::vecteurs::ChaineCar idXML;
+
+ sortie << "<population";
+ idXML = "p";
+ idXML.AjEntier(id);
+ idXML += "le";
+ idXML.AjEntier(get_niveau());
+ set_idXML(idXML);
+ sortie << " id=\"" << idXML << "\"";
+ sortie << " name=\"" << get_nom() << "\"";
+ sortie << ">" << endl;
+
+
+ for (i=0; i < nbind; i++) {
+ get_Pind(i)->oPopulationsXML(i, sortie, infos);
+ }
+
+ sortie << "</population>" << endl;
+
+}
+
+Individu * Population::new_individual(string & name, unsigned int nploidie) {
+ if (get_nploidie() == 0) set_nploidie(nploidie);
+ else if (get_nploidie() != nploidie) {
+ throw Anomalie(2);
+ }
+
+ Individu * Pind(new Individu(this, name));
+
+ AjouterIndividu(Pind);
+
+
+ return (Pind);
+}
+
diff --git a/src/population.h b/src/population.h
new file mode 100644
index 0000000..e10ff03
--- /dev/null
+++ b/src/population.h
@@ -0,0 +1,66 @@
+
+/***************************************************************************
+ population.h - Librairie d'objets permettant de manipuler des données
+ spécifiques aux populations
+ -------------------
+ begin : ven sep 01 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+// population
+#ifndef POPULATION_H
+#define POPULATION_H
+
+#include "strucpop.h"
+#include "metapop.h"
+#include "vecteurs.h"
+
+class Population: public StrucPop {
+public:
+// Population(Jeupop * pdonnees, long nbind);
+// Population(Jeupop * pdonnees, MetaPop * Pmetapop, long nbind);
+ Population(Jeupop * pdonnees);
+ Population(MetaPop * Pmetapop);
+// Population(Jeupop * pdonnees, const StrucPop & popori): StrucPop(pdonnees,popori){};
+// Population(Jeupop * pdonnees, const Population & popori);
+ Population(const StrucPop & popori, MetaPop * Pmetapop);
+ virtual ~Population();
+
+ bool DuType(const string &) const;
+
+ void set_nploidie();
+ void set_nploidie(unsigned int nploidie);
+
+ Individu * new_individual(string & name, unsigned int nploidie);
+ void AjouterIndividu(Individu * Pind);
+ void get_nomniveauxstruc(Titre & nom_niveaux) const;
+ unsigned int get_niveau() const;
+ string get_nom_chemin() const;
+
+ void f_rempliTabStrucPop(Vecteur<StrucPop*> &, unsigned int);
+
+ /** Suppression de la Population */
+ void SupprPop(StrucPop * Ppop);
+ friend class Jeupop;
+ /** Suppression d'un individu dans une Population */
+ void SupprIndividu(Individu * Pind) ;
+
+ void oPopulationsXML(unsigned int id, ostream & sortie, ostream & infos) ;
+
+protected:
+ virtual void ifAjouterIndividu(const Individu * Pind);
+
+
+};
+
+#endif
diff --git a/src/populations b/src/populations
new file mode 100755
index 0000000..c59dff5
Binary files /dev/null and b/src/populations differ
diff --git a/src/populations.cpp b/src/populations.cpp
new file mode 100644
index 0000000..5e2fbac
--- /dev/null
+++ b/src/populations.cpp
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Olivier Langella *
+ * olivier.langella at moulon.inra.fr *
+ * *
+ * 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. *
+ ***************************************************************************/
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <cstdlib>
+#include "applpopulations.h"
+
+using namespace std;
+
+int main(int argc, char *argv[])
+{
+ //setlocale (LC_ALL, "");
+ //setlocale (LC_NUMERIC, "en_US");
+ //bindtextdomain (PACKAGE,LOCALEDIR);
+ //bindtextdomain (PACKAGE,"/usr/share/locale");
+ //textdomain (PACKAGE);
+ //textdomain("populations");
+ ApplPopulations application;
+
+// cout << argc[1] << " " << argv;
+ application.lancement(argc, argv);
+
+// return(0);
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/qtpop/qtpopulations.cpp b/src/qtpop/qtpopulations.cpp
new file mode 100644
index 0000000..c1b102b
--- /dev/null
+++ b/src/qtpop/qtpopulations.cpp
@@ -0,0 +1,24 @@
+#include <qapplication.h>
+#include "mainwindow.h"
+
+int main(int argc, char * * argv) {
+ QApplication a(argc, argv);
+
+ abif the_data;
+ //string filename("../../doc/test.fsa");
+ string filename("");
+ //string svgfilename("test.svg");
+ if (argc == 2) {
+ filename = argv[1];
+ }
+ MainWindow w;
+ w.show();
+
+ if (filename != "") {
+ the_data.read_abif_file(filename);
+
+ w.addAbif(the_data);
+ }
+
+ return a.exec();
+}
diff --git a/src/strucpop.cpp b/src/strucpop.cpp
new file mode 100644
index 0000000..5afe196
--- /dev/null
+++ b/src/strucpop.cpp
@@ -0,0 +1,443 @@
+
+/***************************************************************************
+ strucpop.cpp - Librairie d'objets permettant de manipuler des données
+ spécifiques aux StrucPops
+ -------------------
+ begin : ven sep 01 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+//constructeur
+
+
+#include"locus.h"
+#include"jeupop.h"
+#include "strucpop.h"
+
+StrucPop::StrucPop (Jeupop * pdonnees) {
+//cerr << "StrucPop::StrucPop (Jeupop * pdonnees) constructeur debut" << endl;
+
+ _nom.assign("_");
+ _Pjeu = pdonnees;
+ _nbind = 0;
+
+ _nploidie = _Pjeu->get_nploidie();
+ _nbloc = _Pjeu->get_nbloc();
+//cerr << "StrucPop::StrucPop (Jeupop * pdonnees) constructeur fin" << endl;
+
+}
+
+
+StrucPop::StrucPop(const StrucPop & rval,MetaPop * Pmetapop, Jeupop * Pjeu) {
+ // constructeur de copies
+ // vérifié le 11/09/2000
+ unsigned long i;
+
+//cerr << "StrucPop(const StrucPop & rval,MetaPop * Pmetapop, Jeupop * Pjeu) début" << endl;
+ //if (popori.get_nploidie() != _nploidie) throw Anomalie(2);
+ // => effacer l'ancien contenu
+ reset();
+
+ _nom = rval._nom;
+ _Pjeu = Pjeu;
+ _Pmetapop = Pmetapop;
+ _nbloc = rval.get_nbloc();
+ _nploidie = rval.get_nploidie();
+
+ _tabAllIntrogressant.resize(rval._tabAllIntrogressant.size());
+
+ for (i=0; i < _tabAllIntrogressant.size(); i++) {
+ _tabAllIntrogressant[i] = get_Pall(rval._tabAllIntrogressant[i]->get_NomLocus(),rval._tabAllIntrogressant[i]->get_Nom());
+ }
+//cerr << "StrucPop(const StrucPop & rval,MetaPop * Pmetapop, Jeupop * Pjeu) fin" << endl;
+
+}
+
+StrucPop::~StrucPop () {
+}
+
+void StrucPop::reset() {
+ // remise à zéro
+ unsigned long i;
+
+ _tabAllIntrogressant.resize(0);
+ _VcalcInd.resize(0);
+
+ for (i=0; i < _tabPind.size();i++) delete _tabPind[i];
+
+ _tabPind.resize(0);
+ _nbind = 0;
+ _nbloc = 0;
+
+}
+
+
+void StrucPop::r_alldiff(int numlocus, Vecteur<Allele *> &tabPall) const {
+//num locus, tableau sur les Alleles differents de ce locus
+ unsigned int i, j;
+ unsigned int nbind(get_nbind());
+
+ tabPall.resize(0);
+ tabPall.push_back(_tabPind[0]->_tabPall[numlocus * _nploidie]);
+ for (i=0;i < nbind;i++) {
+ for (j=0;j < _nploidie;j++) {
+ if (tabPall.Existe(_tabPind[i]->_tabPall[(numlocus * _nploidie) + j])) {}
+ else {
+ tabPall.push_back(_tabPind[i]->_tabPall[(numlocus * _nploidie) + j]);
+ }
+ }
+ }
+
+// return(tabPall.size());
+}
+
+unsigned long StrucPop::r_nballnonnulsBootInd(unsigned long locus) const {
+ // retourne le nb de copies d'allèles non nuls pour un locus
+ //spécifique aux calculs avec bootstrap sur les individus
+ unsigned long resultat(0);
+ unsigned long nbind(_VcalcInd.size());
+ unsigned long nploidie(get_nploidie());
+ unsigned long i, j;
+
+ for (i=0;i < nbind;i++) {
+ for (j=0;j < nploidie;j++) {
+ if (_VcalcInd[i]->_tabPall[(locus * nploidie) + j]->_miss) continue;
+ resultat++;
+ }
+ }
+
+ return(resultat);
+}
+
+void StrucPop::f_bootstrap() {
+ //bootstrap sur les individus
+ unsigned long nbind(_tabPind.size());
+ unsigned long j, tirage;
+
+ if (_VcalcInd.size() != nbind) _VcalcInd.resize(nbind);
+
+ // tirage des individus
+ for (j = 0; j < nbind; j ++ ) {
+ tirage = (unsigned long) (nbind * ((long double)rand() / ((long double) RAND_MAX)));
+ _VcalcInd[j] = _tabPind[tirage];
+ }
+}
+
+double StrucPop::r_rare(unsigned long nreduit, unsigned int numlocus) const{
+ //nouvelle diversité allèlique pour un échantillon
+ // réduit: nreduit, pour un locus
+// cerr << "coucou";
+// cerr << nreduit << " " << numlocus << " " << get_nbind() << endl;
+ int i;
+ long double resultat(0);
+ long double inter;
+// long double inter2;
+ int nploidie(get_nploidie());
+ Vecteur<Allele *> tabPallDiff;
+
+ //taille de l'échantillon allèlique
+ unsigned long nechall(get_nbind() * nploidie);
+ nreduit *= nploidie;
+ if (nreduit > nechall) return(resultat);
+
+ //nombre d'allèles différents
+ r_alldiff(numlocus, tabPallDiff);
+// cerr << "coucou";
+ int nball(tabPallDiff.size());
+
+//cerr << nball << endl;
+ // ne compte pas les allèles nuls (manquants)
+ for (i=0;i<nball;i++) {
+ if (tabPallDiff[i]->_miss) {
+ nechall -= (unsigned long) r_nbcopall(tabPallDiff[i]);
+ tabPallDiff.Suppr(i);
+ nball--;
+ if (nreduit > nechall) return(resultat);
+ break;
+ }
+ }
+//cerr << nball << endl;
+//cerr << endl;
+
+// if (nreduit == nechall) return(nball);
+
+ //nombre de copies d'un allèle
+ unsigned long ncopies;
+
+ for (i=0;i<nball;i++) {
+ ncopies = (unsigned long) r_nbcopall(tabPallDiff[i]);
+/* inter = comb ((nechall - ncopies) , nreduit);
+ inter2 = comb(nechall , nreduit);
+ inter = inter / inter2;*/
+
+ if (nreduit < ncopies) {
+ inter = fact((int) (nechall - ncopies), (int) ((nechall - ncopies) - nreduit)) * fact((int) (nechall - nreduit) , (int) nechall);
+ }
+ else {
+ inter = fact((int) (nechall - nreduit), (int) ((nechall - ncopies) - nreduit)) * fact((int) (nechall - ncopies) , (int) nechall);
+ }
+ resultat = resultat + (1 - inter);
+//cerr << nechall << " " << nreduit << endl;
+//cerr << inter2 << endl;
+//cerr << inter << endl;
+//cerr << inter2 << endl;
+//cerr << resultat << endl;
+//cin >> ncopies;
+ }
+
+ return((double) resultat);
+}
+
+
+void StrucPop::ifAjouterIndividu(const Individu * Pind) {
+
+}
+
+
+Allele* StrucPop::get_Pall(unsigned long ind, unsigned long locus, unsigned int numall) const {
+ unsigned long index;
+ unsigned int nploidie(get_nploidie());
+
+ if (locus >= get_nbloc()) throw Anomalie(1);
+ if (numall >= nploidie) throw Anomalie(1);
+
+ index = (locus * nploidie) + numall;
+ return(_tabPind[ind]->_tabPall[index]);
+}
+
+
+Allele * StrucPop::get_Pall(const string & nomlocus, const string & nomall) const {
+ //recherche l'allele correspondant dans son propre jeu de pop:
+ /// n'utiliser que lors d'une copie
+ Allele * res;
+ Locus * lelocus;
+
+ lelocus = _Pjeu->get_Plocus(nomlocus);
+ if (lelocus==0) throw Anomalie (5);
+
+ res = 0;
+//cerr << "get_Pall debut " << lelocus << " " << lelocus->get_nom() << " " << nomall << endl;
+ res = lelocus->getPall(nomall);
+//cerr << "get_Pall allele fin" << res << " " << nomlocus << " " << nomall << endl;
+
+ if (res==0) throw Anomalie (6);
+
+ return(res);
+}
+
+
+void StrucPop::resize_loc() {
+ // allocation de mémoire pour un changement de nb de locus
+ /// ATTENTION, ne marche que pour agrandir _tabPall !!!
+ unsigned long i, j, k;
+ vector<Allele*> tabPallnuls;
+
+ if (_nbloc == _Pjeu->get_nbloc()) return;
+
+ if (_Pjeu->get_nploidie() != _nploidie) throw Anomalie(2);
+
+ _nbind = _tabPind.size();
+// _nploidie = _Pjeu->get_nploidie();
+
+ _nbloc = _Pjeu->get_nbloc();
+
+
+ tabPallnuls.resize(_nbloc);
+ for (j = 0; j < _nbloc; j++) {
+ tabPallnuls[j] = _Pjeu->get_Plocus(j)->getPallNul();
+ }
+
+ for (i=0;i < _nbind;i++) {
+ //on remplit les nouveaux alleles des individus
+ // par des alleles nuls
+
+ for (j = 0; j < _nbloc; j++) {
+ for (k = 0; k < _nploidie; k++) {
+ if (((j * _nploidie) + k) >= _tabPind[i]->_tabPall.size()) {
+
+ _tabPind[i]->_tabPall.push_back(tabPallnuls[j]);
+ }
+ }
+ }
+ }
+
+}
+
+inline Allele* StrucPop::get_Pall(unsigned long ind,unsigned long all) const {
+ return(_tabPind[ind]->_tabPall[all]);
+}
+
+const string & StrucPop::get_nomind(long nbind) const {
+ // donne le nom de l'individu nbind
+//cerr << "StrucPop::get_nomind(long nbind) " << nbind << endl;
+ return (_tabPind[nbind]->get_nom());
+}
+
+void StrucPop::AjouterAllIntrogressant(Allele * Pall) {
+ if (_tabAllIntrogressant.Existe(Pall) == false) {
+//cerr << "StrucPop::AjouterAllIntrogressant" << endl;
+ _tabAllIntrogressant.push_back(Pall);
+ }
+}
+
+long double StrucPop::f_heterozygotieatt(unsigned long locus, unsigned long * Pnbpopcalc) const {
+//Calcul de l'heterozygotie attendue pour un locus
+// Hs expected heterozygosity
+// 1- somme des frequences au carre de chaque allele
+// ok verifie le 11/10/2000
+
+ long unsigned i,nballloc,allnonnuls;
+ long double sfreqcarre, freq;//, Hs;
+ Allele * Pall;
+
+ nballloc = _Pjeu->get_Plocus(locus)->get_nball();
+ allnonnuls = r_nballnonnuls(locus);
+ if (allnonnuls == 0) {
+ *Pnbpopcalc -= 1;
+ return (0); // a verifier
+ }
+
+ for (sfreqcarre=0,i=0; i < nballloc; i++) {
+ Pall = _Pjeu->get_Pall(locus,i);
+ if (Pall->_miss) continue;
+ freq = ((long double) r_nbcopall(Pall)) / ((long double) allnonnuls);
+ sfreqcarre += (freq * freq);
+//cerr <<"StrucPop::f_heterozygotieatt freq" << freq << endl;
+ }
+ //Hs += (long double) 1 - sfreqcarre;
+//cerr <<"StrucPop::f_heterozygotieatt Hs" << ((long double) 1) - sfreqcarre << endl;
+ return (((long double) 1) - sfreqcarre);
+}
+
+long double StrucPop::f_heterozygotieobs(unsigned long locus, unsigned long * Pnbpopcalc) const {
+//Calcul de l'heterozygotie observée pour un locus
+//frequence des hétérozygotes dans cette population à ce locus
+// verifie le 11/10/2000 "génétique et Evolution" Solignac
+
+ long unsigned i, nbindcalc, nbind(get_nbind()),nbhetero;
+
+ for (nbindcalc=1, i=0, nbhetero = 0; i < nbind; i++,nbindcalc++) {
+ try {
+ if (_tabPind[i]->r_esthetero(locus)) nbhetero++;
+ }
+ catch (Individu::Anomalie pb) {
+ switch (pb.le_pb) {
+ case 13:
+ //cerr << _("tt ERROR in Individu object: ") << pb.le_pb << endl;
+ nbindcalc--;
+ break;
+ default:
+ cerr << _("ERROR in Individu object: ") << pb.le_pb << endl;
+ break;
+ }
+ }
+
+ }
+ nbindcalc--;
+// cerr << "StrucPop::f_heterozygotieobs" << endl;
+// cerr << locus << " nbindcalc : " << nbindcalc << " nbhetero : " << nbhetero << endl;
+
+ if (nbindcalc == 0) {
+ *Pnbpopcalc -= 1;
+ return(0);
+ }
+//cerr <<"StrucPop::f_heterozygotieobs Hi" << ((long double) nbhetero) / ((long double) nbind) << endl;
+//cerr <<"StrucPop::f_heterozygotieobs nbhetero" << nbhetero << " nbind" << nbind << endl;
+ return (((long double) nbhetero) / ((long double) nbindcalc));
+}
+
+long double StrucPop::f_calcfreq(Allele * Pall) const {
+ //calcul de la fréquence de l'allèle Pall dans cette population
+ long double nballnonnuls(r_nballnonnuls(_Pjeu->get_numloc(Pall->get_Ploc())));
+
+// r_nballnonnuls(_Pjeu->get_numloc(Pall->get_Ploc());
+
+ return(((long double) r_nbcopall(Pall)) / nballnonnuls);
+}
+
+
+void StrucPop::set_nom(const string & nom) {
+// int pos;
+
+ _nom.assign(nom);
+
+/* pos = _nom.find(" ", 0);
+ while (pos != -1) {
+ _nom.replace(pos, _nom.size(), "_");
+ pos = _nom.find(" ", 0);
+ }
+ */
+}
+
+/*
+const StrucPop& StrucPop::operator= (const StrucPop & rval) {
+ long i;
+ long nbind(rval.get_nbind());
+
+//cerr << "operator = pop, debut " << nbind << " " << rval._nom << endl;
+ if (get_nploidie() != rval.get_nploidie()) throw Anomalie(2);
+ if (get_nbloc() != rval.get_nbloc()) throw Anomalie(3);
+
+ reset(_Pjeu, nbind);
+
+ _nom = rval._nom;
+
+ try {
+ for (i=0; i < nbind; i++) {
+//cerr << "operator = pop, individu " << endl;
+ *(_tabPind[i]) = *(rval._tabPind[i]);
+ }
+ }
+ catch (Individu::Anomalie pb) {
+ cerr << "erreur de type: " << pb.le_pb << " dans l'operateur = de Population" << endl;
+ }
+//cerr << "operator = pop, coucou2 " << endl;
+
+ _tabAllIntrogressant.resize(rval._tabAllIntrogressant.size());
+
+ for (i=0; i < rval._tabAllIntrogressant.size(); i++) {
+ _tabAllIntrogressant[i] = get_Pall(rval._tabAllIntrogressant[i]->get_NomLocus(),rval._tabAllIntrogressant[i]->get_Nom());
+ }
+//cerr << "operator = pop, fin " << endl;
+
+ return(*this);
+}
+
+*/
+
+
+/** Supprime l'individu Pind du tableau */
+void StrucPop::SupprtabIndividu(Individu * Pind){
+//cerr << "StrucPop::SupprtabIndividu debut" << endl;
+ unsigned long i;
+ for (i = 0 ; i < _tabPind.size(); i++) {
+ if (_tabPind[i] == Pind) {
+//cerr << "StrucPop::SupprtabIndividu" << Pind->get_nom() << endl;
+ _tabPind.erase(_tabPind.begin() + i);
+ _nbind--;
+ }
+ }
+ if (get_niveau() !=0) _Pmetapop->SupprtabIndividu(Pind);
+//cerr << "StrucPop::SupprtabIndividu fin" << endl;
+}
+
+long StrucPop::f_calcfreqabsolue(Allele * Pall) const {
+ //calcul de la fréquence absolue de l'allèle Pall dans cette population
+
+ return(r_nbcopall(Pall));
+}
+/** réaffectation du nombre de locus */
+void StrucPop::set_nbloc(){
+ _nbloc = _Pjeu->get_nbloc();
+}
+
+
diff --git a/src/strucpop.h b/src/strucpop.h
new file mode 100644
index 0000000..8bf7fa3
--- /dev/null
+++ b/src/strucpop.h
@@ -0,0 +1,222 @@
+
+/***************************************************************************
+ strucpop.h - Librairie d'objets permettant de manipuler des données
+ spécifiques aux StrucPops
+ -------------------
+ begin : ven sep 01 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef STRUCPOP_H
+#define STRUCPOP_H
+
+
+//#include"arbres.h"
+#include "vecteurs.h"
+#include "individu.h"
+
+//typedef biolib::vecteurs::ChaineCar ChaineCar;
+
+class Jeupop;
+class MetaPop;
+
+
+class StrucPop { //StrucPops structurée
+public :
+ StrucPop(Jeupop * pdonnees);
+//constructeur de copies
+ StrucPop(const StrucPop & popori, MetaPop * Pmetapop, Jeupop * Pjeu);
+ //allocation et désallocation
+// StrucPop(int nbind = 0);
+// StrucPop(Jeupop * pdonnees, long nbind);
+// StrucPop(Jeupop * pdonnees, const StrucPop & popori);
+// StrucPop(const StrucPop &);
+ virtual ~StrucPop();
+
+ virtual bool DuType(const string &) const {return(false);};
+
+ virtual void AjouterIndividu(Individu * Pind) {};
+// virtual void AjouterPopulation(StrucPop * Pstrucpop) {};
+ virtual void AjouterPopulation(MetaPop * ) {};
+ virtual void AjouterPopulation(Population * ) {};
+
+ void AjouterAllIntrogressant(Allele * Pall);
+ //génétique
+
+ //**** fonctions de base
+ Allele* get_Pall(unsigned long ind,unsigned long all) const;
+ Allele* get_Pall(unsigned long ind, unsigned long locus, unsigned int numall) const;
+ Allele * get_Pall(const string & nomlocus, const string & nomall) const;
+ //nombre d'individus
+ unsigned long get_nbind() const {return(_tabPind.size());};
+// long get_nbloc() const {return(_nbloc = _Pjeu->get_nbloc());};
+ unsigned long get_nbloc() const {return(_nbloc);};
+// unsigned long get_nballloc(unsigned long i) const {return(_Pjeu->get_Plocus(i)->get_nball());};
+ unsigned int get_nploidie() const {return(_nploidie);};
+ virtual Individu* get_Pind(unsigned long i) const {return(_tabPind[i]);};
+ inline Jeupop* get_Pjeu() const;
+ //nom de la StrucPop
+ //const char * get_nom() {return(_nom.c_str());};
+ const string & get_nom() const {return(_nom);};
+ const string & get_couleur() const {return(_couleur);};
+ const string & get_nomind(long nbind) const;
+ virtual void get_nomniveauxstruc(Titre & nom_niveaux) const {};
+ virtual unsigned int get_niveau() const {return(0);};
+ virtual unsigned long get_nbpop() const {return(0);};
+ virtual MetaPop* get_Pmetapop() const {return(_Pmetapop);};
+ virtual const string & get_idXML() const {return(_idXML);};
+
+ virtual void set_nploidie() {};
+ virtual void set_nom(const string & nom);
+
+ //nombres d'allèles pour un locus
+ void r_alldiff(int, Vecteur<Allele*>&) const; //num locus, tableau sur les Alleles differents de ce locus
+ //nombres de copies d'un allèle d'un locus
+ //pointeur sur allèle
+// Allele* r_Pall(int, int) const; //num locus, num allèle
+ inline unsigned long r_nbcopall(Allele *) const; //num locus, num allèle
+ inline unsigned long r_nbcopallBootInd(Allele *) const; //num locus, num allèle
+ inline unsigned long r_nballnonnuls(unsigned long locus) const; //nombre d'alleles non nuls pour un locus
+ unsigned long r_nballnonnulsBootInd(unsigned long locus) const;
+
+ long double f_heterozygotieatt(unsigned long locus, unsigned long * Pnbpopcalc) const; //Hs
+ long double f_heterozygotieobs(unsigned long locus, unsigned long * Pnbpopcalc) const;
+ long double f_calcfreq(Allele * Pall) const;
+ long f_calcfreqabsolue(Allele * Pall) const;
+
+ //**** fonctions évoluées
+ //raréfaction de l'effectif d'une StrucPop
+ double r_rare(unsigned long, unsigned int) const; //nouvel effectif, num locus
+
+
+ virtual void f_rempliTabStrucPop(Vecteur<StrucPop*> &, unsigned int) {};
+ //const StrucPop& operator= (const StrucPop &);
+ /** Suppression de la population */
+ virtual void SupprPop(StrucPop * Ppop) {};
+
+ /** réaffectation du nombre de locus */
+ virtual void set_nbloc();
+
+ virtual void oPopulationsXML(unsigned int id, ostream & sortie, ostream & infos) {};
+
+
+ friend class DistancesGnt;
+ friend class Jeupop;
+ friend class Individu;
+
+protected :
+ virtual void set_idXML(const string & id) {_idXML=id;};
+// void sort_all();//tri de _tabPall par loci
+ void resize_loc();
+ virtual void reset();
+
+ void f_bootstrap(); //bootstrap sur les individus
+
+ virtual void ifAjouterIndividu(const Individu * Pind);
+
+ /** Supprime l'individu Pind du tableau */
+ void SupprtabIndividu(Individu * Pind);
+
+ unsigned int _nploidie;
+// string _nom;
+ string _nom;
+ Jeupop * _Pjeu;
+ MetaPop * _Pmetapop;
+
+ unsigned long _nbind; //nb d'individus dans cette pop
+
+ vector<Individu*> _tabPind;
+ unsigned long _nbloc; //nb de loci
+// vector<Allele*> _tabPall;
+
+ Vecteur<Allele*> _tabAllIntrogressant;
+
+ vector<Individu*> _VcalcInd;
+
+ string _couleur;
+
+ string _idXML;
+
+
+public:
+
+ struct Anomalie{
+ // 1-> acces hors borne dans alleles
+ // 2-> copie impossible: nploidie differents
+ // 3-> copie impossible: nbloc differents
+ // 5-> copie impossible: nom d'allele non present dans le jeu de donnees
+ // 6-> copie impossible: nom de locus non present dans le jeu de donnees
+ // 7-> acces hors borne dans les locus
+ int le_pb;
+ Anomalie (int i):le_pb(i){};
+ };
+
+};
+
+
+
+unsigned long StrucPop::r_nbcopallBootInd(Allele * Pall) const {
+ // retourne le nb de copies d'un allèle pour un locus
+ // specifique aux calculs avec bootstrap sur individus
+ unsigned long resultat(0);
+ unsigned long nbind(_VcalcInd.size());
+ unsigned long i;
+
+ for (i=0;i < nbind;i++) {
+// resultat += _VcalcInd[i]->_tabPall.getNbOccurence(Pall);
+ resultat += _VcalcInd[i]->r_nbcopall(Pall);
+ }
+
+ return(resultat);
+}
+
+inline unsigned long StrucPop::r_nbcopall(Allele * Pall) const {
+ // retourne le nb de copies d'un allèle pour un locus
+ unsigned long resultat(0);
+ unsigned long nbind(_tabPind.size());
+ unsigned long i;
+
+ for (i=0;i < nbind;i++) {
+ resultat += _tabPind[i]->_tabPall.getNbOccurence(Pall);
+// resultat += _tabPind[i]->r_nbcopall(Pall);
+ }
+
+ return(resultat);
+}
+
+
+inline unsigned long StrucPop::r_nballnonnuls(unsigned long locus) const {
+ // retourne le nb de copies d'allèles non nuls pour un locus
+ unsigned long resultat(0);
+ unsigned long nbind(_tabPind.size());
+ unsigned long nploidie(get_nploidie());
+ unsigned long i, j;
+
+ for (i=0;i < nbind;i++) {
+ for (j=0;j < nploidie;j++) {
+ if (_tabPind[i]->_tabPall[(locus * nploidie) + j]->_miss) continue;
+ resultat++;
+ }
+ }
+
+ return(resultat);
+}
+
+
+inline Jeupop* StrucPop::get_Pjeu() const {
+ return(_Pjeu);
+}
+
+#endif
+
diff --git a/src/vecteurs.cpp b/src/vecteurs.cpp
new file mode 100644
index 0000000..2f1efb8
--- /dev/null
+++ b/src/vecteurs.cpp
@@ -0,0 +1,497 @@
+/***************************************************************************
+ vecteurs.cpp - Librairie d'objets permettant de manipuler des vecteurs
+ -------------------
+ begin : ven aug 14 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+//#include <strstream>
+
+//using namespace std;
+
+#include"vecteurs.h"
+
+namespace biolib {
+namespace vecteurs {
+
+void GetLigneFlot(istream& entree, string & ligne) {
+ char car;
+ ligne.assign("");
+ car = entree.peek();
+ while (((car != 10) & (car != 13)) & (entree.good()) & (entree.eof() == 0)) {
+ entree.get(car);
+ ligne += car;
+ car = entree.peek();
+ }
+ while (((car == 10) | (car == 12) | (car == 13)) & entree.good()
+ & (entree.eof() == 0)) {
+ entree.get(car);
+ car = entree.peek();
+ }
+}
+
+void ChaineCar::GetLigneFlot(istream& entree) {
+ //cerr << "ChaineCar::GetLigneFlot debut" << endl;
+
+ char car;
+
+ assign("");
+ car = entree.peek();
+ //cerr << "ChaineCar::GetLigneFlot debut " << car << endl;
+ while (((car != 10) && (car != 13)) && (entree.good())) {
+
+ entree.clear();
+
+ entree.get(car);
+
+ //cerr << "ChaineCar::GetLigneFlot car" << car << endl;
+ assign(*this + car);
+ car = entree.peek();
+ }
+ while (((car == 10) || (car == 13)) && (entree.good())) {
+ entree.get(car);
+ car = entree.peek();
+ }
+
+ //cerr << "ChaineCar::GetLigneFlot fin" << endl;
+}
+
+void ChaineCar::assigner(const string& chorigine, signed long deb,
+ signed long fin) {
+ //assigne seuleument une partie de la chorigine
+ // de deb a fin inclus
+
+ signed long i;
+
+ assign("");
+ if (deb < 0)
+ deb = 0;
+
+ for (i = deb; i <= fin; i++) {
+ if (i >= (signed long) chorigine.size())
+ break;
+ *this += chorigine[i];
+ // cout << chorigine[i];
+ }
+ // cout << endl;
+}
+
+bool ChaineCar::EstUnChiffre() const {
+ unsigned long i;
+
+ //cerr << "ChaineCar::EstUnChiffre()" << endl;
+ for (i = 0; i < size(); i++) {
+ if ((operator[](i) < 48) || (operator[](i) > 57))
+ return (false);
+ }
+
+ //cerr << "ChaineCar::EstUnChiffre() vrai" << endl;
+ return (true);
+}
+
+ChaineCar& ChaineCar::AjEntier(long i) {
+ //conversion automatique en base 10 et concaténation
+ int unite;
+ long facteur;
+ char chiffre;
+ bool debut(false);
+
+ if (i == 0) {
+ this->string::operator+=("0");
+ } else
+ for (facteur = 1000000; facteur > 0; facteur = facteur / 10) {
+
+ unite = i / facteur;
+
+ if ((debut) || (unite > 0)) {
+ debut = true;
+ i = i - (unite * facteur);
+ chiffre = unite + 48;
+ this->string::operator+=(chiffre);
+ }
+ }
+ return (*this);
+}
+
+long ChaineCar::GetNbMots() const {
+ //retourne le nombre de mots contenus
+ // dans la chaine (séparateur= ' ' ou '/t')
+ long resultat(0);
+ long i, taille;
+ bool change(true);
+ bool quote(false);
+
+ taille = this->size();
+
+ //cerr << "ChaineCar::GetNbMots()" << *this <<"Fin" << endl;
+ for (i = 0; i < taille; i++) {
+ if (this->operator[](i) == '\'')
+ quote = !(quote);
+ if ((quote == false) && (this->operator[](i) > 32)) {
+ if (change) {
+ //cerr << this->operator[](i) << endl;
+ resultat++;
+ change = false;
+ }
+ } else {
+ change = true;
+ }
+ }
+
+ //cerr << *this << endl;
+ //cerr << "ChaineCar::GetNbMots()" << resultat << endl;
+ return (resultat);
+}
+
+void ChaineCar::GetMot(unsigned int numero, string &mot) const {
+ //retourne le numeroième mot contenu
+ // dans la chaine (séparateur= ' ' ou '/t')
+ if (numero < 1) {
+ mot = "";
+ return;
+ }
+
+ unsigned int resultat(0);
+ unsigned int i, taille, debut(0), fin(0);
+ bool change(true);
+ bool quote(false);
+
+ taille = this->size();
+
+ //cerr << "mot:" << *this <<"Fin" << endl;
+ for (i = 0; i < taille; i++) {
+ //cerr << this->operator[](i) << endl;
+ if (this->operator[](i) == '\'') {
+ if ((resultat == numero) && (quote)) {
+ fin = (i - 1);
+ break;
+ }
+ quote = !(quote);
+ if ((resultat == numero) && (quote)) {
+ debut = (i + 1);
+ // break;
+ }
+ }
+ if ((quote) || (this->operator[](i) > 32)) {
+ //caractere normal
+ if (change) {
+ change = false;
+ resultat++;
+ debut = i;
+ if (quote)
+ debut++;
+ }
+ fin = i;
+ } else {
+ if (resultat == numero)
+ break;
+ change = true;
+ }
+ }
+ fin++;
+
+ if (resultat != numero) {
+ mot = "";
+ return;
+ }
+
+ mot = substr(debut, (fin - debut));
+ //cerr << "mot:" << mot <<"Fin" << endl;
+
+}
+
+const Titre& Titre::operator=(const Titre &rval) {
+ unsigned long t(rval.size());
+ unsigned long i;
+
+ for (i = 0; i < size(); i++) {
+ delete vector<ChaineCar*>::operator[](i);
+ // delete at(i);
+ }
+
+ erase(begin(), end());
+ reserve(t);
+ for (i = 0; i < t; i++) {
+ push_back(rval.GetTitre(i));
+ }
+ return (*this);
+}
+
+Titre::~Titre() {
+ unsigned long i;
+
+ for (i = 0; i < size(); i++) {
+ delete vector<ChaineCar*>::operator[](i);
+ // delete at(i);
+ }
+}
+
+long Titre::Position(const ChaineCar& chaine) const {
+ unsigned long i;
+ signed long res(-1);
+
+ for (i = 0; i < size(); i++) {
+ if (!(chaine.compare(GetTitre(i)))) {
+ //cerr << chaine << GetTitre(i) << "_" << endl;
+ // if (chaine.compare(GetTitre(i)) == 0) {
+ res = i;
+ break;
+ }
+ }
+
+ return (res);
+}
+;
+
+void Titre::GetArguments(const string & ligne) {
+ //doit se comporter comme le shell
+ // sépare les mots, et accepte les ' ou les "
+ unsigned int i;
+ bool quote(false), vide(false);
+
+ push_back("");
+
+ for (i = 0; i < ligne.size(); i++) {
+ if ((quote == false) && ((back().size() > 0) || vide) && ((ligne[i]
+ == ' ') || (ligne[i] == '\t'))) {//séparateur
+ push_back("");
+ vide = false;
+ } else {
+ if ((ligne[i] == '"') || (ligne[i] == '\'')) {
+ if ((quote) && (back().size() == 0))
+ vide = true;
+ quote = !(quote);
+ } else
+ back() += ligne[i];
+ }
+ }
+ /*
+ cerr << "Titre::GetArguments(const string & ligne)" << endl;
+ for (i=0; i < size(); i++) {
+ cerr << get_titre(i) << endl;
+ }
+ */
+}
+
+bool Titre::operator==(const Titre &rval) {
+ // comparaison de deux titres
+ unsigned long i;
+
+ if (rval.size() != size())
+ return (false);
+
+ for (i = 0; i < size(); i++) {
+ if (GetTitre(i).compare(rval.GetTitre(i)) != 0)
+ return (false);
+ }
+
+ return (true);
+}
+
+Titre::Titre(char ** commandes, int nbcommandes) {
+ long i;
+
+ for (i = 0; i < nbcommandes; i++) {
+ push_back(commandes[i]);
+ }
+}
+
+/*
+ Titre::Titre(const Titre& rval) {
+
+ *this = rval;
+
+ }
+ */
+
+void Titre::resize(long nouvtaille) {
+ //on efface:
+ long i, taille(size());
+
+ for (i = 0; i < taille; i++)
+ delete vector<ChaineCar*>::operator[](i);
+
+ //on réalloue
+ vector<ChaineCar*>::resize(nouvtaille);
+ for (i = 0; i < nouvtaille; i++)
+ vector<ChaineCar*>::operator[](i) = new ChaineCar;
+
+}
+
+Titre Titre::operator+(const Titre &rval) const {
+ //marche pas...
+ long i, taille(rval.size());
+ Titre Resultat;
+
+ Resultat = *this;
+
+ for (i = 0; i < taille; i++) {
+ //cerr << rval.GetTitre(i);
+ Resultat.push_back(rval.GetTitre(i));
+ }
+
+ return Resultat;
+}
+
+void ChaineCar::fmajus() {
+ //convertit la chaine en majuscules
+ // après une lecture par exemple
+ int taille(size());
+ int i;
+
+ for (i = 0; i < taille; i++) {
+ if ((operator[](i) > 96) && (operator[](i) < 124))
+ operator[](i) = operator[](i) - 32;
+ }
+}
+
+void ChaineCar::fsupprchiffres() {
+ //supprime les chiffres contenu dans une chaine
+ // après une lecture par exemple
+ int taille(size() - 1);
+ int car, i;
+
+ for (i = taille; i >= 0; i--) {
+ car = operator[](i);
+ if ((car > 47) && (car < 58))
+ erase(i, 1);
+ }
+}
+
+void ChaineCar::fsupprgauche() {
+ //supprime les espaces ou tabulations à gauche
+ // unsigned int i;
+ //cerr << "ChaineCar::fsupprgauche() [" << (int) operator[](0) << "]" << *this << endl;
+
+ // i = 0;
+ // while (((operator[](i) == ' ')||(operator[](i) == '\t')) && (i < size())) {
+ while (((operator[](0) == ' ') || (operator[](0) == '\t')) && (size() > 0)) {
+ //while ((operator[](i) < 33) && (i < size())) {
+ erase(0, 1);
+ // i++;
+ }
+ //cerr << "ChaineCar::fsupprgauche() [" << *this << endl;
+}
+
+void ChaineCar::fsupprdroite() {
+ //supprime les espaces ou tabulations à droite
+ signed int i;
+
+ i = size() - 1;
+ while (((operator[](i) == ' ') || (operator[](i) == '\t')) && (i >= 0)) {
+ //while ((operator[](i) < 33) && (i >= 0)) {
+ erase(i, 1);
+ i--;
+ }
+}
+
+void ChaineCar::fnettoie(const string & mot) {
+ //supprime de la chaine de caractere toutes les occurences de "mot"
+
+ int pos;
+
+ pos = find(mot, 0);
+ while (pos != -1) {
+ replace(pos, mot.size(), "");
+ pos = find(mot, 0);
+ }
+}
+
+unsigned long ChaineCar::GetNbMots(const string & separateur) const {
+ //retourne le nombre de mot separes par separateur
+
+ long pos;
+ unsigned long iteration(0);
+
+ if (size() == 0)
+ return (0);
+
+ pos = find(separateur, 0);
+ while (pos != -1) {
+ pos = find(separateur, pos + 1);
+ iteration++;
+ }
+
+ return (iteration + 1);
+}
+
+void ChaineCar::GetMot(unsigned int numero, string &mot,
+ const string & separateur) const {
+ //retourne le nieme mot separe par separateur
+
+ signed int debut(0);
+ int fin(-1);
+ unsigned int iteration(1);
+ int taillesep(separateur.size());
+ mot.assign("");
+
+ fin = find(separateur, 0);
+ if ((fin == -1) && (numero < 2)) {
+ mot.assign(*this);
+ return;
+ }
+ if (fin == -1)
+ fin = size();
+ while ((debut != -1) && (iteration < numero)) {
+ debut = fin + taillesep;
+ //cerr << "debut " << debut << endl;
+ fin = find(separateur, debut);
+ if (fin == -1)
+ fin = size();
+ //else fin = pos;
+ iteration++;
+ }
+
+ if (debut == -1)
+ return;
+ if (debut > (signed int) size())
+ return;
+ if (fin > (signed int) size())
+ return;
+ if (debut > fin)
+ return;
+
+ mot = substr(debut, (fin - debut));
+}
+
+ChaineCar& Titre::GetTitre(long i) const {
+ return (*(vector<ChaineCar*>::operator[](i)));
+}
+
+void Titre::Suppr(unsigned long pos) {
+ if (pos >= size())
+ throw Anomalie(1);
+ delete (vector<ChaineCar*>::operator[](pos));
+ erase(begin() + pos);
+}
+
+/** remplacer les occurences de "couper" par "coller" */
+void ChaineCar::Remplacer(const string & couper, const string & coller) {
+
+ int pos;
+
+ pos = find(couper, 0);
+ while (pos != -1) {
+ replace(pos, couper.size(), coller);
+ pos = find(couper, 0);
+ }
+}
+
+int ChaineCar::Position(const string & motif) const {
+ return (find(motif, 0));
+}
+
+}//namespace biolib {
+}//namespace vecteurs {
+
+
diff --git a/src/vecteurs.h b/src/vecteurs.h
new file mode 100644
index 0000000..2279570
--- /dev/null
+++ b/src/vecteurs.h
@@ -0,0 +1,232 @@
+/***************************************************************************
+ vecteurs.h - Librairie d'objets permettant
+ de manipuler des vecteurs
+ -------------------
+ begin : ven aug 14 10:25:55 CEST 2000
+ copyright : (C) 2000 by Olivier Langella CNRS UPR9034
+ email : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+// Objets permettant de manipuler des vecteurs
+// Olivier Langella le 12/5/99
+// langella at pge.cnrs-gif.fr
+
+#ifndef VECTEUR_H
+#define VECTEUR_H
+
+//#define __ENABLE_WSTRING
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <iostream>
+#include <vector>
+#include <string>
+#include <iomanip>
+
+using namespace std;
+
+namespace biolib {
+namespace vecteurs {
+
+class VecteurLD: public vector<long double> {
+};
+
+template<class T> class Vecteur: public vector<T> {
+public:
+
+ unsigned long getNbOccurence(const T& element) const {
+ unsigned long i;
+ unsigned long res(0);
+
+ for (i = 0; i < vector<T>::size(); i++) {
+ if (vector<T>::operator[](i) == element)
+ res++;
+ // if (this->operator[](i) == element) res++;
+ }
+
+ return (res);
+ }
+
+ bool Existe(const T& element) const {
+ unsigned long i;
+ bool res(false);
+
+ for (i = 0; i < vector<T>::size(); i++) {
+ if (vector<T>::operator[](i) == element) {
+ res = true;
+ break;
+ }
+ }
+
+ return (res);
+ }
+
+ signed long Position(const T& element) const {
+ unsigned long i;
+ signed long res(-1);
+
+ // long taille(vector<T>::size());
+
+ for (i = 0; i < vector<T>::size(); i++) {
+ if (vector<T>::operator[](i) == element) {
+ res = i;
+ break;
+ }
+ }
+ return (res);
+ }
+
+ void Suppr(unsigned long pos) {
+ erase(vector<T>::begin() + pos);
+ }
+
+};
+
+class ChaineCar: public string {
+public:
+ ChaineCar() {
+ assign("");
+ }
+
+ ChaineCar(long i) {
+ AjEntier(i);
+ }
+
+ ChaineCar(const char * tag) {
+ assign(tag);
+ }
+
+ ChaineCar(const string& chaine) {
+ assign(chaine);
+ }
+
+ ~ChaineCar() {
+ }
+
+ void assigner(const string& chaine, signed long deb, signed long fin);
+
+ operator double() const {
+ return (atof(c_str()));
+ }
+
+ operator int() const {
+ return (atoi(c_str()));
+ }
+
+ operator unsigned int() const {
+ return (atoi(c_str()));
+ }
+
+ void GetLigneFlot(istream& entree);
+
+ long GetNbMots() const; //retourne le nombre de mots contenus
+ void GetMot(unsigned int numero, string &mot) const;
+ // dans la chaine (s�parateur= ' ' ou '/t')
+ unsigned long GetNbMots(const string & separateur) const; //retourne le nombre de mots contenus
+ void
+ GetMot(unsigned int numero, string &mot, const string & separateur) const;
+
+ const char * GetStr() {
+ return (c_str());
+ }
+ ;
+
+ ChaineCar& AjEntier(long i); //conversion automatique en base 10 et concat�nation
+ // ChaineCar& operator+= (char car) {return (string::operator+=(car));};
+ bool EstUnChiffre() const;
+
+ void fmajus();
+ void fsupprchiffres();
+ void fsupprgauche();
+ void fsupprdroite();
+ void fnettoie(const string &);
+ /** remplacer les occurences de "couper" par "coller" */
+ void Remplacer(const string & couper, const string & coller);
+ int Position(const string & motif) const;
+
+ // const ChaineCar& operator= (const string &rval) {*this = (ChaineCar) rval; return (*this);};
+
+ // const ChaineCar& operator= (const char * chaine) ;
+};
+
+class Titre: public vector<ChaineCar*> {
+
+public:
+ ~Titre();
+ Titre() {
+ }
+
+ // Titre(const Titre& rval);
+ Titre(char ** commandes, int nbcommandes);
+
+ //d�pr�ci�:
+ const ChaineCar& get_titre(long i) const {
+ return (*(vector<ChaineCar*>::operator[](i)));
+ }
+
+ ChaineCar& GetTitre(long i) const;
+ void GetArguments(const string &);
+ ChaineCar& operator[](unsigned long i) const {
+ if (i >= size())
+ throw Anomalie(1);
+ return (GetTitre(i));
+ }
+
+ ChaineCar& back() {
+ return (*(vector<ChaineCar*>::back()));
+ }
+
+ long Position(const ChaineCar& chaine) const;
+
+ void push_back(const char * pcar) {
+ vector<ChaineCar*>::push_back(new ChaineCar(pcar));
+ }
+ ;
+ void push_back(const string & chaine) {
+ vector<ChaineCar*>::push_back(new ChaineCar(chaine.c_str()));
+ }
+
+ void pop_back() {
+ delete vector<ChaineCar*>::back();
+ vector<ChaineCar*>::pop_back();
+ }
+
+ void resize(long nouvtaille);
+
+ // void Suppr (unsigned long pos) {if (pos >= size()) throw Anomalie(1); delete (operator[](pos)); erase(begin()+pos);};
+ void Suppr(unsigned long pos);
+
+ const Titre& operator=(const Titre &rval);
+ bool operator==(const Titre &rval);
+ Titre operator+(const Titre &rval) const;
+
+ //string & affiche() const;
+
+public:
+
+ struct Anomalie {
+ Anomalie(int i) :
+ le_pb(i) {
+ }
+
+ // 1-> titre inexistant
+ int le_pb;
+ };
+};
+
+void GetLigneFlot(istream& entree, string & ligne);
+
+} //namespace biolib {
+} //namespace vecteurs {
+
+#endif
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/populations.git
More information about the debian-med-commit
mailing list