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

View of /FigKernelScripts/pg_submit_to_RAST.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Wed Feb 27 21:58:35 2013 UTC (6 years, 8 months ago) by overbeek
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
Changes since 1.2: +4 -1 lines
taxon id - not debugged

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

my $usage = "usage: pg_submit_to_RAST -u User -p Password -g genetic-code [-t taxon] -d DataDir\n";

my($username,$password);
my $genetic_code = 11;
my $dataD;
my $taxon;

my $rc  = GetOptions('d=s' => \$dataD,
		     'g=i' => \$genetic_code,
		     't=i' => \$taxon,
		     'u=s' => \$username,
		     'p=s' => \$password);

if ((! $rc) || 
    (! -d $dataD) ||
    (! $username) ||
    (! $password)) 
{ 
    print STDERR $usage; exit ;
}
system "echo $genetic_code > $dataD/genetic.code";

my $rastObject = RASTserver->new($username, $password);
my $in;
open(IN,"<","$dataD/genomes") || die "could not open $dataD/genomes";
open(OUT,">","$dataD/genomes.with.job") || die "could not open $dataD/genomes.with.job";

while (defined($in = <IN>))
{
    next if ($in !~ /\S/);
    chop $in;
    my($name,$where) = split(/\t/,$in);
    my $contigs;
    if (($where =~ /^(\d+\.\d+)$/) &&
	(-s "/vol/public-pseed/FIGdisk/FIG/Data/Organisms/$1/contigs"))
    {
	$contigs = "/vol/public-pseed/FIGdisk/FIG/Data/Organisms/$1/contigs";
    }
    elsif (-s $where)
    {
	$contigs = $where;
    }
    else
    {
	die "$in seems to have an invalid pointer to the contigs";
    }
    my $jobH = $rastObject->submit_RAST_job({-domain        => 'Bacteria',
					     -taxonomyID    => $taxon,
					     -filetype      => 'Fasta',
					     -geneticCode   => $genetic_code,
					     -organismName  => $name,
					     -keepGeneCalls => 0,
					     -geneCaller    => 'RAST',
					     -file          => $contigs});

    my $job = $jobH->{job_id};
    if (! $job) { print STDERR "$in ($contigs) failed\n" }
    print OUT "$in\t$job\n";
}
close(IN);
close(OUT);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3