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

View of /FigKernelScripts/make_close.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (download) (as text) (annotate)
Sun Feb 19 04:15:44 2006 UTC (14 years, 3 months ago) by overbeek
Branch: MAIN
Changes since 1.5: +1 -1 lines
minor fixes to auto_assign

#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#


# usage: make_close [G1 G2 G3 ...]

use FIG;
my $fig = new FIG;
$dist = 5000;

my $map_pegs = 1;
if ($ARGV[0] eq '-no-map' or $ARGV[0] eq '-nomap')
{
    shift @ARGV;
    $map_pegs = 0;
}

my @genomes = (@ARGV > 0) ? @ARGV : $fig->genomes;

foreach $genome (@genomes)
{
    print STDERR "processing $genome\n";
    if ($fig->is_prokaryotic($genome))
    {
	foreach $peg ($fig->all_features($genome,"peg"))
	{
	    my($peg_gnum, $peg_pnum);
	    if ($map_pegs)
	    {
		($peg_gnum, $peg_pnum) = $fig->map_peg_to_ids($peg);
	    }
	    
	    my $loc = $fig->feature_location($peg);
	    if ($loc)
	    {
		my($contig,$beg,$end) = &FIG::boundaries_of($loc);
		if ($contig && $beg && $end)
		{
		    my $min = &FIG::min($beg,$end) - $dist;
		    my $max = &FIG::max($beg,$end) + $dist;
		    my $feat;
		    ($feat,undef,undef) = $fig->genes_in_region($genome,$contig,$min,$max);
		    foreach $fid (@$feat)
		    {
			
			if (($fid ne $peg) && (&FIG::ftype($fid) eq "peg"))
			{
			    if ($map_pegs)
			    {
				my($fgnum, $fpnum) = $fig->map_peg_to_ids($fid);
				print "$peg_gnum\t$peg_pnum\t$fgnum\t$fpnum\n";
			    }
			    else
			    {
				print "$peg\t$fid\n";
			    }
			}
		    }
		}
	    }
	}
    }
}


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3