From ecbb7e0f0bb52e84c02208a5608051fd73aeeda7 Mon Sep 17 00:00:00 2001
From: Vincent Danjean <Vincent.Danjean@ens-lyon.org>
Date: Thu, 22 Jun 2006 14:47:12 +0000
Subject: [PATCH] git-svn-id:
 svn+ssh://imag/users/huron/danjean/svnroot/claire/altree/trunk@203
 cf695345-040a-0410-a956-b889e835fe2e

---
 ALTree/Nanova.pm                              | 23 ++++++++
 ALTree/Node.pm                                | 10 ++++
 altree                                        |  6 +-
 .../ancestor_present/association/1_caco.asso  | 57 +++++++++++++++++++
 4 files changed, 94 insertions(+), 2 deletions(-)

diff --git a/ALTree/Nanova.pm b/ALTree/Nanova.pm
index 503ee6e..11502b6 100644
--- a/ALTree/Nanova.pm
+++ b/ALTree/Nanova.pm
@@ -60,6 +60,29 @@ sub Tree2mat
     return \@mat;
 }
 
+# Fille the various tabular necessary for NAnaova
+sub FillTableaux
+{
+
+    my $present_node = shift;
+    my $values = shift;
+    my $groups = shift;
+    my $nb_term = shift;
+
+    if ($present_node->NbChildren()==0)  {
+	$presentNode->GetQuantiList();
+	push @{$values}, @{$present_node->GetQuantiList()};
+	push @{$groups}, $present_node->NbQuanti(); 
+	$nb_term++;
+    } else {
+	for my $child ($present_node->GetChildrenList()) {  
+	    FillTableaux($child, $value, $groups, $nb_term);
+	}
+    }
+
+
+}
+
 sub WriteMat
 {
 
diff --git a/ALTree/Node.pm b/ALTree/Node.pm
index fce213e..f8cf43a 100644
--- a/ALTree/Node.pm
+++ b/ALTree/Node.pm
@@ -239,6 +239,16 @@ sub Name {
     }
 }
 
+sub GetQuantiList {
+    my $self=shift;
+    return @{$self->{"quanti"}};
+}
+
+sub NbQuanti {
+    my $self=shift;
+    return scalar(@{$self->{"quanti"}});
+}
+
 #Faire meme chose pour case, control et br_len (HasBrLen), level, high, sequence, label, oldfather
 #Faire oldchildren (GetOldChildren, SetOldChildren, ) 
 
diff --git a/altree b/altree
index 25e2957..06ae6bf 100755
--- a/altree
+++ b/altree
@@ -1521,8 +1521,10 @@ sub main
 		    print "TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT\n";
 		    $mat=ALTree::Nanova::Tree2mat($tree->GetRoot());
 		    ALTree::Nanova::WriteMat($mat);
-
-
+		    my $values = [];
+		    my $groups = [];
+		    my $nb_term=0;
+		    FillTableaux($tree->GetRoot(), $values, $groups, $nb_term);
 		}
 
 		$option_require->("permutations", 
diff --git a/test/paup/ancestor_present/association/1_caco.asso b/test/paup/ancestor_present/association/1_caco.asso
index 2eea4ff..ce8d9aa 100644
--- a/test/paup/ancestor_present/association/1_caco.asso
+++ b/test/paup/ancestor_present/association/1_caco.asso
@@ -1,2 +1,59 @@
 
 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
+                    /----* H002 (LEVEL: 4) case/control:8/6
+                    |    /----* H007 (LEVEL: 5) case/control:7/13
+                    |    |        Site: 12 Sens: 2-->1
+                    |    |----* H012 (LEVEL: 5) case/control:1/4
+                    |    |        Site: 11 Sens: 2-->1
+                    |----* 15 (LEVEL: 4) case/control:13/18
+                    |    |   Site: 1 Sens: 1-->2
+                    |    |   Site: 2 Sens: 1-->2
+                    |    \----* H011 (LEVEL: 5) case/control:5/1
+               /----* 17 (LEVEL: 3) case/control:66/41
+               |    |   Site: 10 Sens: 2-->1
+               |    |   Site: 9 Sens: 2-->1
+               |    |    /----* H008 (LEVEL: 5) case/control:9/2
+               |    |    |        Site: 9 Sens: 1-->2
+               |    |----* 16 (LEVEL: 4) case/control:37/15
+               |    |    |   Site: 11 Sens: 2-->1
+               |    |    \----* H006 (LEVEL: 5) case/control:28/13
+               |    \----* H009 (LEVEL: 4) case/control:8/2
+               |             Site: 12 Sens: 2-->1
+          /----* 18 (LEVEL: 2) case/control:70/43
+          |    |   Site: 8 Sens: 2-->1
+          |    |   Site: 1 Sens: 2-->1
+          |    |   Site: 2 Sens: 2-->1
+          |    \----* H014 (LEVEL: 3) case/control:4/2
+     /----* 19 (LEVEL: 1) case/control:72/47
+     |    |   Site: 6 Sens: 2-->1
+     |    |   Site: 7 Sens: 2-->1
+     |    \----* H013 (LEVEL: 2) case/control:2/4
+     |----* H001 (LEVEL: 1) case/control:11/9
+     |        Site: 1 Sens: 2-->1
+     |        Site: 2 Sens: 2-->1
+     |    /----* H003 (LEVEL: 2) case/control:5/6
+     |    |        Site: 4 Sens: 2-->1
+     |----* 20 (LEVEL: 1) case/control:12/13
+     |    |   Site: 3 Sens: 2-->1
+     |    \----* H005 (LEVEL: 2) case/control:7/7
+     |             Site: 12 Sens: 2-->1
+-----* 22+(21) (LEVEL: 0) case/control:200/200
+     | 
+     | [0] ddl=4 chi2=9.33 p_value_chi2=0.0535
+     | [1] ddl=6 chi2=11.24 p_value_chi2=0.07
+     | [2] ddl=7 chi2=11.30 p_value_chi2=0.112
+     | [3] ddl=10 chi2=19.46 p_value_chi2=0.029
+     | [4] ddl=13 chi2=25.55 p_value_chi2=0.015
+     |----* H000 (LEVEL: 1) case/control:98/126
+     \----* H010 (LEVEL: 1) case/control:7/5
+              Site: 5 Sens: 2-->1
+
+ Number of permutation: 1
+
+p_val for each level:
+level 1 p-value (non corrected) 0
+level 2 p-value (non corrected) 0
+level 3 p-value (non corrected) 0
+level 4 p-value (non corrected) 0
+level 5 p-value (non corrected) 0
+corrected minimal p_value in the tree: 0
-- 
GitLab