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

View of /FigWebServices/webservices_rast.cgi

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.2 - (download) (annotate)
Sat Aug 29 22:00:03 2009 UTC (10 years, 2 months ago) by redwards
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, rast_rel_2014_0912, myrast_rel40, mgrast_dev_05262011, mgrast_dev_04082011, rast_rel_2010_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2009_0925, rast_rel_2010_0526, rast_rel_2014_0729, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, rast_rel_2011_0119, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, rast_rel_2010_0827, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_02222011, mgrast_dev_10262011, HEAD
Changes since 1.1: +1 -1 lines
updated web services

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 the following keys: file, genome_name, tax_id, lineage, genetic_code, user. 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