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

View of /FigKernelScripts/pg_get_consistency_before_after.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Sun Apr 7 13:32:09 2013 UTC (6 years, 7 months ago) by overbeek
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
Changes since 1.1: +6 -2 lines
handle no assignments

use strict;
use Data::Dumper;
use Getopt::Long;
use gjoseqlib;

my $usage = "usage: pg_get_consistency_before_after -d Data\n";
my $dataD;
my $rc  = GetOptions('d=s' => \$dataD,);

if ((! $rc) || (! -d $dataD)) { print STDERR $usage; exit }

my @rast_dirs = map { ($_ =~ /^(\S+)\t(\S+)$/) ? "/vol/rast-prod/jobs/$1/rp/$2" : () } 
                `cut -f3,4 $dataD/genomes.with.job.and.genomeID`;
open(BEFORE,">$dataD/consistency.from.initial.RAST.fasta") 
    || die "could not open $dataD/consistency.from.initial.RAST.fasta";
open(AFTER,">$dataD/consistency.after.manual.curation.fasta") 
    || die "could not open $dataD/consistency.after.manual.curation.fasta";

foreach my $rastD (@rast_dirs)
{
    my %funcsB   = map { ($_ =~ /^(fig\|\d+\.\d+\.peg\.\d+)\t(\S[^\t]*\S)/) ? ($1 => $2) : () }
                  `cat $rastD/proposed_functions $rastD/proposed_non_ff_functions`;
    my %assigned;
    if (-s "$rastD/proposed_user_functions")
    {
	%assigned = map { ($_ =~ /^(fig\|\d+\.\d+\.peg\.\d+)\t(\S[^\t]*\S)/) ? ($1 => $2) : () }
	            `cat $rastD/proposed_user_functions`;
    }

    my @seqs = &gjoseqlib::read_fasta("$rastD/Features/peg/fasta");
    foreach my $tuple (@seqs)
    {
	my($peg,undef,$prot_seq) = @$tuple;
	my $func1 = $funcsB{$peg};
	$func1 = $func1 ? $func1 : '';
	print BEFORE ">$peg $func1\n$prot_seq\n";
	if ($_ = $assigned{$peg})
	{
	    $func1 = $_;
	}
	print AFTER ">$peg $func1\n$prot_seq\n";
    }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3