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

View of /FigKernelScripts/changed_starts.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (download) (as text) (annotate)
Sat Aug 20 12:32:29 2005 UTC (14 years, 9 months ago) by overbeek
Branch: MAIN
CVS Tags: caBIG-dataload-0, caBIG-00-00-00
Changes since 1.5: +2 -1 lines
fixes to calling starts

# -*- perl -*-

use FIG;
my $fig = new FIG;

$usage = "usage: changed_starts Proposed Annotations >> modified.starts";

(
 ($proposed    = shift @ARGV) && open(PROPOSED,"<$proposed") &&
 ($annotations = shift @ARGV) && open(ANN,">$annotations") 
)
    || die $usage;

$/ = "///\n";

while (defined($entry = <PROPOSED>))
{
    if ($entry =~ /ID=(\S+).*\nOLD_START_POS=(\d+)\nNEW_START_POS=(\d+).*?CONF_GAP=(\S+).*?NEW_START_LOC=(\S+)_(\d+)_(\d+)\n/s)
    {
	($peg,$old_pos,$new_pos,$conf_gap,$contig,$beg,$end) = ($1,$2,$3,$4,$5,$6,$7);

	$old_beg = ($beg < $end) ? $beg - ($new_pos-$old_pos) : $beg + ($new_pos-$old_pos);
	$old_loc = join("_",($contig,$old_beg,$end));
	$new_loc = join("_",($contig,$beg,$end));
	push(@changes,[$peg,$old_loc,$new_loc,$conf_gap]);
    }
}

foreach $_ (sort { $b->[3] <=> $a->[3] } @changes)
{
    ($peg,$old_loc,$new_loc,$conf_gap) = @$_;
    $peg =~ /\|(\d+\.\d+)/;
    $genome = $1;
    $dna    = $fig->dna_seq($genome,$new_loc);
    $trans  = $fig->translate($dna,undef,'start');
    if ((substr($trans,-1) ne "*") && (($peg =~ /^new/) || (! $fig->possibly_truncated($peg))))
    {
	print STDERR "missing STOP on $peg\n";
    }
    else
    {
	$trans =~ s/\*$//;
    }
    print join("\t",($peg,$old_loc,$new_loc,$conf_gap,$trans)),"\n";
    print ANN "$peg\tChanged start from $old_loc to $new_loc\n";
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3