[Bio] / FigWebServices / webservices_rast.cgi Repository:
ViewVC logotype

View of /FigWebServices/webservices_rast.cgi

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (annotate)
Thu May 29 23:58:31 2008 UTC (11 years, 8 months ago) by redwards
Branch: MAIN
CVS Tags: rast_rel_2009_05_18, rast_rel_2008_06_18, rast_rel_2008_06_16, rast_rel_2008_12_18, rast_2008_0924, rast_rel_2008_09_30, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, rast_rel_2009_02_05, mgrast_rel_2008_0625, rast_rel_2008_10_09, rast_release_2008_09_29, mgrast_rel_2008_0806, mgrast_rel_2008_0923, mgrast_rel_2008_0919, rast_rel_2009_07_09, mgrast_rel_2008_1110, rast_rel_2008_09_29, mgrast_rel_2008_0917, rast_rel_2008_10_29, rast_rel_2009_03_26, rast_rel_2008_11_24, rast_rel_2008_08_07
Adding new wsdl/web service components

use strict;
use Carp;
use SOAP::Lite;
use SOAP::Transport::HTTP;

-> dispatch_to('RastWebServices')     
-> handle;

package RastWebServices;

use DBMaster;
use Data::Dumper;

=begin WSDL
_IN auth $string
_IN args $string
_RETURN $string jobid
_DOC Load a fasta file to the RAST server. Input is a hash with lots of parms and a fasta file, output is a job id | error
sub load_fasta_to_rast {
	my ($class, %args) = @_;
	open FILE,  ">/tmp/foo";
	print FILE $args{file};
	#print STDERR &Dumper(\%args);
	#print STDERR "PWD ", $args{password}, "\n";
	#print STDERR "Dumped\n";
	# We have to authenticate this user first. Check with Daniel how to do that
	my $organism = {name => $args{genome_name},
		tax_id => $args{tax_id},
		lineage => $args{lineage},
		genetic_code => $args{genetic_code}
	#print STDERR &Dumper($organism);
	my $msg;
	my $user = $args{user};
	my $seed_id;
	my $project_id = "Test Project";
	my $filename = "/tmp/foo";
	my $data = prepare_data_for_create_job( $msg , $seed_id, $organism, $project_id, $filename, $user);
	# print STDERR &Dumper($data), "Data\n";
	my ($job_number,$err) = Job48->create_new_job($data);
	# print STDERR "job, err = $job_number, $err\n";
	return(join ":", $err, $job_number); 

sub prepare_data_for_create_job{
	my ( $msg , $seed_id, $organism, $project_desc, $filename, $user) = @_;
	my $meta = { "upload.timestamp" => time,
		"status.uploaded" => "complete",
		"keep_genecalls" => "0",
		"correction.automatic" => "1" ,
		#	       "submit.candidate" =>  $msg,
		#	       "replace.seedID" => $seed_id, 
  	print STDERR &Dumper($meta), "meta\n";
	open(SEQFILE , "$filename") or die "Can't open file $filename!\n";
	my $data = { taxonomy_id => $organism->{tax_id},
		metagenome => 0,
		genome => $organism->{name},
		user => $user,
		project => $project_desc,
		taxonomy => $organism->{lineage},
		genetic_code => $organism->{genetic_code},
		sequence_file => \*SEQFILE,
		meta => $meta
	# print STDERR "made data \n"; 
	#  	print STDERR &Dumper($data), "data\n";
	return $data;

=begin WSDL
_IN jobid $string
_IN username $string
_RETURN $string status
_DOC Check the status of a RAST job. Input is a RAST job id, and username  output is a status
sub check_rast_job {
	my ($class, $job_id, $login_name)  = @_;
	#print STDERR "Check $job_id, $login_name";
	$ENV{DBHOST} = 'bioseed.mcs.anl.gov';
	my $dbm = DBMaster->new(-database => 'FortyEight_WebApplication');
	my $users = $dbm->User->get_objects({ login => $login_name });
	my $user;
	if ($users && @$users) {
		$user = $users->[0];
		my ($stage, $status) = Job48->get_status_of_job($job_id, $user);
		print STDERR "stage $stage, status $status\n";
		return(join ":", $stage, $status); 
	} else {
		#	print STDERR "no users\n";
		return("No users");

=begin WSDL
_IN jobid $string
_RETURN $string
_DOC Get the output from a RAST job. Input is a RAST jobid file, output is a big file
sub get_rast_results {
	my ($class, $jobid) = @_;
	return ("this should be a big file");

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3