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

Annotation of /FigKernelScripts/register_features_with_clearinghouse.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : olson 1.2 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : olson 1.1
19 :     use SOAP::Lite;
20 :     use strict;
21 :    
22 :     my $usage = "register_features_with_clearinghouse genome_id type num_features\n";
23 :    
24 :     my $service_url = "http://clearinghouse.theseed.org/Clearinghouse/clearinghouse_services.cgi";
25 :    
26 :    
27 :     my $proxy = SOAP::Lite-> uri('http://www.soaplite.com/Scripts') -> proxy($service_url);
28 :    
29 :     if (@ARGV != 3)
30 :     {
31 :     die $usage;
32 :     }
33 :    
34 :     my $genome = shift;
35 :     my $type = shift;
36 :     my $n_features = shift;
37 :    
38 :     my @valid_types = qw(peg pp rna pi);
39 :     my %valid_types;
40 :     map { $valid_types{$_}++ } @valid_types;
41 :    
42 :     if (!$valid_types{$type})
43 :     {
44 :     die "Type '$type' should be one of @valid_types\n";
45 :     }
46 :    
47 :     if ($genome !~ /^\d+\.\d+$/)
48 :     {
49 :     die "Invalid genome id '$genome'\n";
50 :     }
51 :    
52 :     if ($n_features !~ /^\d+$/ or $n_features <= 0)
53 :     {
54 :     die "Number of features '$n_features' needs to be a positive number\n";
55 :     }
56 :    
57 :     #
58 :     # Everything validated.
59 :     #
60 :    
61 :     my $response = $proxy->register_feature($genome, $type, $n_features);
62 :    
63 :     if ($response->fault)
64 :     {
65 :     die "Failed to register: ", $response->faultcode, " ", $response->faultstring, "\n";
66 :     }
67 :    
68 :     my $start = $response->result;
69 :     my $end = $start + $n_features - 1;
70 :    
71 :     print "$start\t$end\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3