[Bio] / FigKernelScripts / purge_tbl.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/purge_tbl.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : overbeek 1.1 # -*- perl -*-
2 :     #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 :    
19 :     $0 =~ m/([^\/]+)$/;
20 :     $usage = "$1 < old.tbl > purged.tbl";
21 :    
22 :     die "\n\n\tusage: $usage\n\n" if ($ARGV[0] && ($ARGV[0] =~ m/^--?h/));
23 :    
24 :     while (defined($entry = <STDIN>))
25 :     {
26 :     chomp $entry;
27 :     ($id, $locus) = split /\t/, $entry;
28 :    
29 :     $locus =~ m/^([^,]+)_(\d+)_\d+/;
30 :     ($contig, $beg) = ($1, $2);
31 :    
32 :     $locus =~ m/\S+_\d+_(\d+)$/;
33 :     $end = $1;
34 :    
35 :     $tbl{$id} = [$entry, $contig, &min($beg, $end)];
36 :     }
37 :     foreach $_ (sort { ($tbl{$a}->[1] cmp $tbl{$b}->[1])
38 :     || ($tbl{$a}->[2] <=> $tbl{$b}->[2]) } keys %tbl)
39 :     {
40 :     print "$tbl{$_}->[0]\n";
41 :     }
42 :     exit(0);
43 :    
44 :     sub min { my ($x, $y) = @_; return (($x < $y) ? $x : $y); }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3