[Bio] / FigMetagenomeTools / venn.pl Repository:
ViewVC logotype

Annotation of /FigMetagenomeTools/venn.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (view) (download) (as text)

1 : olson 1.1 #!/usr/bin/perl -w
2 :    
3 :     # Generate some data for a venn diagram type picture
4 :    
5 :     use strict;
6 :    
7 :     my $count;
8 :     my %pos; my $i=1;
9 :     foreach my $f (@ARGV) {
10 :     $pos{$f}=$i; $i++;
11 :     open(IN, $f) || die "Can't open $f";
12 :     while (<IN>) {
13 :     my @a=split /\t/;
14 :     $count->{$a[1]}->{$f}++;
15 :     }
16 :     }
17 :    
18 :     # set things to zero unless they exist
19 :     #foreach my $ss (keys %$count) {
20 :     # map { $count->{$ss}->{$_}=0 unless ($count->{$ss}->{$_}) } keys %pos;
21 :     #}
22 :    
23 :     my $cross; my $byf;
24 :     foreach my $f (keys %pos) {$cross->{$f}=0}
25 :     foreach my $ss (keys %$count) {
26 :     my $list=join " and ", sort {$pos{$a} <=> $pos{$b}} keys %{$count->{$ss}};
27 :     $cross->{$list}++;
28 :     push @{$byf->{$list}}, $ss;
29 :     }
30 :    
31 :     print map {"$_\t" . $cross->{$_} . "\n"} sort {$a cmp $b} keys %$cross;
32 :    
33 :     print "\n\n\n";
34 :     foreach my $f (keys %pos, "black and red", "red and black") {
35 :     print "$f: ", join "\t", @{$byf->{$f}}, "\n" if ($byf->{$f});
36 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3