[Bio] / FigKernelPackages / SproutFIG.pm Repository:
ViewVC logotype

Annotation of /FigKernelPackages/SproutFIG.pm

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.10 #
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 package SproutFIG;
19 :    
20 :     #
21 : parrello 1.7 # This package returns a FIG object or a Sprout object translated to use the
22 :     # FIG API, depending on whether or not the constructor has any operands.
23 : olson 1.1 #
24 : parrello 1.7 # my $sprout_or_fig = SproutFig->new()
25 :     #
26 :     # creates a FIG object.
27 :     #
28 :     # my $sprout_or_fig = SproutFig->new('', '')
29 :     #
30 :     # creates a translated Sprout object.
31 : olson 1.1
32 :     use strict;
33 : olson 1.9 use Carp;
34 :    
35 :     #
36 :     # Safely import Sprout.
37 :     #
38 :     my $sproutAvail;
39 :     eval {
40 :     require Sprout;
41 :     import Sprout;
42 :     require SFXlate;
43 :     import SFXlate;
44 :     $sproutAvail = 1;
45 :     };
46 :    
47 :     if ($@)
48 :     {
49 :     #
50 :     # Croak on errors other than can't find sprout.
51 :     #
52 :     if ($@ !~ /Can\'t locate Sprout.pm/)
53 :     {
54 :     die $@;
55 :     }
56 :     }
57 : olson 1.1
58 :     use FIG_Config;
59 :     use SeedDas;
60 :    
61 :     sub new
62 :     {
63 : parrello 1.7 my($class, $sproutDB, $sproutData) = @_;
64 : olson 1.9 my $fig = FIG->new();
65 :    
66 :     if (!defined $sproutDB)
67 :     {
68 :     return $fig;
69 :     }
70 :     elsif ($sproutAvail)
71 :     {
72 : olson 1.8 my $sprout = SFXlate->new($fig, $sproutDB, $sproutData);
73 : olson 1.9 return $sprout;
74 :     }
75 :     else
76 :     {
77 :     confess "SproutFIG: Attempt to use Sprout database when Sprout code is not available\n";
78 :     }
79 : olson 1.4 }
80 :    
81 : olson 1.1
82 : olson 1.8 1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3