comparison Snmf.pl @ 10:ad5e3d3c809e draft

Uploaded
author dereeper
date Sun, 04 Feb 2024 10:07:19 +0000
parents c94c31bde773
children
comparison
equal deleted inserted replaced
9:e44eb2ba80ec 10:ad5e3d3c809e
66 close($LOG); 66 close($LOG);
67 67
68 print E "K=$k $ent\n"; 68 print E "K=$k $ent\n";
69 69
70 print $O2 "Indiv"; 70 print $O2 "Indiv";
71 print $O3 "Indiv;Group\n"; 71 print $O3 "Indiv\tGroup\n";
72 for (my $j = 0; $j <$k; $j++){ 72 for (my $j = 0; $j <$k; $j++){
73 print $O2 " Q$j"; 73 print $O2 " Q$j";
74 } 74 }
75 print $O2 "\n"; 75 print $O2 "\n";
76 76
87 my @infos = split(/\s+/,$line); 87 my @infos = split(/\s+/,$line);
88 my $group = "admix"; 88 my $group = "admix";
89 my $ind = $individuals[$i]; 89 my $ind = $individuals[$i];
90 for (my $j = 0; $j <$k; $j++){ 90 for (my $j = 0; $j <$k; $j++){
91 my $val = $infos[$j]; 91 my $val = $infos[$j];
92 if ($val > 0.5){$group = "Q$j";} 92 if ($val > ($threshold/100)){$group = "Q$j";}
93 } 93 }
94 if ($ind){ 94 if ($ind){
95 $hash_indv{$ind} = join(" ",@infos); 95 $hash_indv{$ind} = join(" ",@infos);
96 $hash_groupes{$group}{"ind"} .= ",".$ind; 96 $hash_groupes{$group}{"ind"} .= ",".$ind;
97 $group_of_ind{$ind} = $group; 97 $group_of_ind{$ind} = $group;
101 101
102 foreach my $group(sort keys(%hash_groupes)){ 102 foreach my $group(sort keys(%hash_groupes)){
103 my @inds = split(",",$hash_groupes{$group}{"ind"}); 103 my @inds = split(",",$hash_groupes{$group}{"ind"});
104 foreach my $ind(@inds){ 104 foreach my $ind(@inds){
105 if ($ind =~/\w+/){ 105 if ($ind =~/\w+/){
106 print $O3 "$ind;$group\n"; 106 print $O3 "$ind\t$group\n";
107 print $O2 $ind." ".$hash_indv{$ind}. "\n"; 107 print $O2 $ind." ".$hash_indv{$ind}. "\n";
108 } 108 }
109 } 109 }
110 } 110 }
111 111