comparison nrify_GOtable.pl @ 0:91261b42c07e draft

"planemo upload commit 25eebba0c98dd7a5a703412be90e97f13f66b5bc"
author cristian
date Thu, 14 Apr 2022 13:28:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:91261b42c07e
1 #!/usr/bin/perl
2
3 $usage= "
4
5 nrify_GOtable.pl:
6
7 removes duplicate entries for a gene from gene<tab>semicolon-separated GOterms table
8 concatenates nonredundant categories for each gene
9
10 Misha Matz July 2013, matz\@utexas.edu
11
12 ";
13
14 $inp=shift or die $usage;
15
16 open IN, $inp or die "cannot open input $inp\n";
17
18 my %gos={};
19 my $gene="";
20 my $goline="";
21
22 while(<IN>){
23 chomp;
24 ($gene,$goline)=split('\t',$_);
25 if (!$gos{$gene}) {
26 $gos{$gene}=$goline;
27 next;
28 }
29 my @goo=split(';',$goline);
30 foreach $g (@goo){
31 if ($gos{$gene}=~/$g/){next;}
32 $gos{$gene}=$gos{$gene}.";".$g;
33 }
34 }
35
36 foreach $g (keys %gos){
37 if ($g=~/HASH/){next;}
38 print $g,"\t",$gos{$g},"\n";
39 }