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

View of /FigKernelScripts/CSA_collapse_repeats.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Tue Jul 19 20:15:01 2011 UTC (8 years, 3 months ago) by overbeek
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, rast_rel_2014_0912, rast_rel_2014_0729, mgrast_release_3_1_2, mgrast_release_3_1_1, rast_rel_2011_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_10262011, HEAD
Changes since 1.2: +1 -1 lines
make sorts in local dir, not /tmp

use strict;
#
# This is a SAS Component
#
use Data::Dumper;
use gjoseqlib;
use SeedAware;
use SeedEnv;

my $repeats;
my $usage = "usage: CSA_collapse_repeats Repeats > collapsed.repeats";
(
 ($repeats = shift @ARGV)
)
    || die $usage;

open(REPEATS,"grep '+' $repeats | sort -T . -k 2 -n -k 4 |")
    || die "could not open $repeats";

my $last = <REPEATS>;
while ($last && ($last =~ /^(\S+)\t(\S+)\t\S\t(\d+)/))
{
    my $contig = $2;
    my $pos    = $3;
    my $beg = $pos;
    my $end = $pos + length($1) - 1;
    while (($last = <REPEATS>) && 
	   ($last =~ /^\S+\t(\S+)\t\S\t(\d+)/) && 
	   ($1 eq $contig) &&
	   ($2 == ($pos+1)))
    {
	$pos++;
	$end++;
    }
    print join("\t",($contig,$beg,$end)),"\n";
}


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3