Mercurial > repos > cristian > rbgoa
diff gomwu_a.pl @ 2:5acf9dfdfa27 draft default tip
planemo upload commit 66a856bcce69986d9a6f1a39820dd9b3f4f6b0db
author | cristian |
---|---|
date | Wed, 09 Nov 2022 08:57:54 +0000 |
parents | f7287f82602f |
children |
line wrap: on
line diff
--- a/gomwu_a.pl Tue Apr 19 08:28:43 2022 +0000 +++ b/gomwu_a.pl Wed Nov 09 08:57:54 2022 +0000 @@ -287,53 +287,53 @@ ################################ - #warn "comparing categories...\n"; +#warn "comparing categories...\n"; #my $clfile="cl_".$inname31; #if($dones!~/ $clfile /) { - use List::Util qw[min max]; - for ($g1=0;$g1<=$#gos;$g1++){ - my $go=@gos[$g1]; - next if ($gonego{$go}==1); - #warn "----------------\n$go $desc{$go} level $level{$go}\n"; - my $goos=$go; - my $lev=$level{$go}; - my $dsc=$desc{$go}; - for ($g2=$g1+1;$g2<=$#gos;$g2++){ - my $go2=@gos[$g2]; - next if ($gonego{$go2}==1); - next if ($ggi{$go2}==1); - my %seen={}; - my $count=0; - my @combo=(); - if ($lump<=1) { - foreach $g (@{$genes{$go}},@{$genes{$go2}}){ - unless($seen{$g}==1 ){ - $count++; - $seen{$g}=1; - push @combo, $g; - } - } - my $shared=$#{$genes{$go}}+1+$#{$genes{$go2}}+1-$count; - $overlap{$go,$go2}=min($shared/($#{$genes{$go}}+1),$shared/($#{$genes{$go2}}+1)); - $overlap{$go2,$go}=min($shared/($#{$genes{$go}}+1),$shared/($#{$genes{$go2}}+1)); - } - } - } +use List::Util qw[min max]; +for ($g1=0;$g1<=$#gos;$g1++){ + my $go=@gos[$g1]; + next if ($gonego{$go}==1); + #warn "----------------\n$go $desc{$go} level $level{$go}\n"; + my $goos=$go; + my $lev=$level{$go}; + my $dsc=$desc{$go}; + for ($g2=$g1+1;$g2<=$#gos;$g2++){ + my $go2=@gos[$g2]; + next if ($gonego{$go2}==1); + next if ($ggi{$go2}==1); + my %seen={}; + my $count=0; + my @combo=(); + if ($lump<=1) { + foreach $g (@{$genes{$go}},@{$genes{$go2}}){ + unless($seen{$g}==1 ){ + $count++; + $seen{$g}=1; + push @combo, $g; + } + } + my $shared=$#{$genes{$go}}+1+$#{$genes{$go2}}+1-$count; + $overlap{$go,$go2}=min($shared/($#{$genes{$go}}+1),$shared/($#{$genes{$go2}}+1)); + $overlap{$go2,$go}=min($shared/($#{$genes{$go}}+1),$shared/($#{$genes{$go2}}+1)); + } + } +} - open OUT, ">$inname31" or die "gomwu_a: cannot create output $inname31\n"; - - print {OUT} join("\t",@gos),"\n"; +open OUT, ">$inname31" or die "gomwu_a: cannot create output $inname31\n"; + +print {OUT} join("\t",@gos),"\n"; - foreach $go (@gos) { - $overlap{$go,$go}=1; - foreach $go2 (@gos){ - print {OUT} sprintf("%.3f",1-$overlap{$go,$go2});; - print {OUT} "\t" unless ($go2 eq $gos[$#gos]); - } - print {OUT} "\n"; - } - close OUT; +foreach $go (@gos) { + $overlap{$go,$go}=1; + foreach $go2 (@gos){ + print {OUT} sprintf("%.3f",1-$overlap{$go,$go2});; + print {OUT} "\t" unless ($go2 eq $gos[$#gos]); + } + print {OUT} "\n"; +} +close OUT; #} #print "calling clusteringGOs.R script ....\n";