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

Annotation of /FigKernelScripts/make_close.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.4 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : overbeek 1.1
19 : overbeek 1.2 # usage: make_close [G1 G2 G3 ...]
20 :    
21 : overbeek 1.1 use FIG;
22 :     my $fig = new FIG;
23 :     $dist = 5000;
24 :    
25 : overbeek 1.5 my $map_pegs = 1;
26 : overbeek 1.6 if ($ARGV[0] eq '-no-map' or $ARGV[0] eq '-nomap')
27 : overbeek 1.5 {
28 :     shift @ARGV;
29 :     $map_pegs = 0;
30 :     }
31 :    
32 : overbeek 1.2 my @genomes = (@ARGV > 0) ? @ARGV : $fig->genomes;
33 :    
34 :     foreach $genome (@genomes)
35 : overbeek 1.1 {
36 :     print STDERR "processing $genome\n";
37 :     if ($fig->is_prokaryotic($genome))
38 :     {
39 :     foreach $peg ($fig->all_features($genome,"peg"))
40 :     {
41 : overbeek 1.5 my($peg_gnum, $peg_pnum);
42 :     if ($map_pegs)
43 :     {
44 :     ($peg_gnum, $peg_pnum) = $fig->map_peg_to_ids($peg);
45 :     }
46 :    
47 : overbeek 1.1 my $loc = $fig->feature_location($peg);
48 :     if ($loc)
49 :     {
50 : parrello 1.7 my($contig,$beg,$end) = $fig->boundaries_of($loc);
51 : overbeek 1.1 if ($contig && $beg && $end)
52 :     {
53 :     my $min = &FIG::min($beg,$end) - $dist;
54 :     my $max = &FIG::max($beg,$end) + $dist;
55 :     my $feat;
56 :     ($feat,undef,undef) = $fig->genes_in_region($genome,$contig,$min,$max);
57 :     foreach $fid (@$feat)
58 :     {
59 : olson 1.3
60 : overbeek 1.1 if (($fid ne $peg) && (&FIG::ftype($fid) eq "peg"))
61 :     {
62 : overbeek 1.5 if ($map_pegs)
63 :     {
64 :     my($fgnum, $fpnum) = $fig->map_peg_to_ids($fid);
65 :     print "$peg_gnum\t$peg_pnum\t$fgnum\t$fpnum\n";
66 :     }
67 :     else
68 :     {
69 :     print "$peg\t$fid\n";
70 :     }
71 : overbeek 1.1 }
72 :     }
73 :     }
74 :     }
75 :     }
76 :     }
77 :     }
78 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3