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

Annotation of /FigWebServices/webservices_rast.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download)

1 : redwards 1.1
2 :     use strict;
3 :     use Carp;
4 :     use SOAP::Lite;
5 :     use SOAP::Transport::HTTP;
6 :    
7 :     SOAP::Transport::HTTP::CGI
8 :     -> dispatch_to('RastWebServices')
9 :     -> handle;
10 :    
11 :    
12 :     package RastWebServices;
13 :    
14 :    
15 :     use DBMaster;
16 :     use Data::Dumper;
17 :    
18 :     =begin WSDL
19 :     _IN auth $string
20 :     _IN args $string
21 :     _RETURN $string jobid
22 :     _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
23 :     =cut
24 :     sub load_fasta_to_rast {
25 :     my ($class, %args) = @_;
26 :     open FILE, ">/tmp/foo";
27 :     print FILE $args{file};
28 :     #print STDERR &Dumper(\%args);
29 :     #print STDERR "PWD ", $args{password}, "\n";
30 :     #print STDERR "Dumped\n";
31 :    
32 :    
33 :     # We have to authenticate this user first. Check with Daniel how to do that
34 :     my $organism = {name => $args{genome_name},
35 :     tax_id => $args{tax_id},
36 :     lineage => $args{lineage},
37 :     genetic_code => $args{genetic_code}
38 :     };
39 :    
40 :     #print STDERR &Dumper($organism);
41 :     my $msg;
42 :     my $user = $args{user};
43 :     my $seed_id;
44 :     my $project_id = "Test Project";
45 :     my $filename = "/tmp/foo";
46 :    
47 :     my $data = prepare_data_for_create_job( $msg , $seed_id, $organism, $project_id, $filename, $user);
48 :     # print STDERR &Dumper($data), "Data\n";
49 :     my ($job_number,$err) = Job48->create_new_job($data);
50 :    
51 :     # print STDERR "job, err = $job_number, $err\n";
52 :     return(join ":", $err, $job_number);
53 :    
54 :     }
55 :    
56 :    
57 :    
58 :    
59 :     sub prepare_data_for_create_job{
60 :     my ( $msg , $seed_id, $organism, $project_desc, $filename, $user) = @_;
61 :    
62 :     my $meta = { "upload.timestamp" => time,
63 :     "status.uploaded" => "complete",
64 :     "keep_genecalls" => "0",
65 :     "correction.automatic" => "1" ,
66 :     # "submit.candidate" => $msg,
67 :     # "replace.seedID" => $seed_id,
68 :     };
69 :    
70 :     print STDERR &Dumper($meta), "meta\n";
71 :     open(SEQFILE , "$filename") or die "Can't open file $filename!\n";
72 :     my $data = { taxonomy_id => $organism->{tax_id},
73 :     metagenome => 0,
74 :     genome => $organism->{name},
75 :     user => $user,
76 :     project => $project_desc,
77 :     taxonomy => $organism->{lineage},
78 :     genetic_code => $organism->{genetic_code},
79 :     sequence_file => \*SEQFILE,
80 :     meta => $meta
81 :     };
82 :    
83 :     # print STDERR "made data \n";
84 :    
85 :     # print STDERR &Dumper($data), "data\n";
86 :    
87 :    
88 :     return $data;
89 :     }
90 :    
91 :    
92 :     =begin WSDL
93 :     _IN jobid $string
94 :     _IN username $string
95 :     _RETURN $string status
96 :     _DOC Check the status of a RAST job. Input is a RAST job id, and username output is a status
97 :     =cut
98 :     sub check_rast_job {
99 :     my ($class, $job_id, $login_name) = @_;
100 :    
101 :     #print STDERR "Check $job_id, $login_name";
102 :     $ENV{DBHOST} = 'bioseed.mcs.anl.gov';
103 :     my $dbm = DBMaster->new(-database => 'FortyEight_WebApplication');
104 :     my $users = $dbm->User->get_objects({ login => $login_name });
105 :     my $user;
106 :     if ($users && @$users) {
107 :     $user = $users->[0];
108 :     my ($stage, $status) = Job48->get_status_of_job($job_id, $user);
109 :     print STDERR "stage $stage, status $status\n";
110 :     return(join ":", $stage, $status);
111 :     } else {
112 :     # print STDERR "no users\n";
113 :     return("No users");
114 :     }
115 :     }
116 :    
117 :    
118 :     =begin WSDL
119 :     _IN jobid $string
120 :     _RETURN $string
121 :     _DOC Get the output from a RAST job. Input is a RAST jobid file, output is a big file
122 :     =cut
123 :     sub get_rast_results {
124 :     my ($class, $jobid) = @_;
125 :     return ("this should be a big file");
126 :     }
127 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3