Bump RC to 2; will tag, bag, and ship tomorrow after tests
[bioperl-live.git] / Bio / DB / Expression.pm
blobf3c4bfe3468f0292ea09623f006ce3bd200544a5
1 # $Id$
3 # BioPerl module for Bio::DB::Expression
5 # Cared for by Allen Day <allenday@ucla.edu>
7 # Copyright Allen Day
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
13 =head1 NAME
15 Bio::DB::Expression - DESCRIPTION of Object
17 =head1 SYNOPSIS
19 use Bio::DB::Expression;
20 my $db = Bio::DB::Expression->new( -source => 'geo' );
21 my @platforms = $db->get_platforms();
22 foreach my $platform ( @platforms ) {
23 my @datasets = $platform->get_datasets();
24 foreach my $dataset ( @datasets ) {
25 my @samples = $dataset->get_samples();
26 foreach my $sample ( @samples ) {
27 #...
32 =head1 DESCRIPTION
34 Describe the object here
36 =head1 FEEDBACK
38 =head2 Mailing Lists
40 User feedback is an integral part of the evolution of this and other
41 Bioperl modules. Send your comments and suggestions preferably to
42 the Bioperl mailing list. Your participation is much appreciated.
44 bioperl-l@bioperl.org - General discussion
45 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
47 =head2 Reporting Bugs
49 Report bugs to the Bioperl bug tracking system to help us keep track
50 of the bugs and their resolution. Bug reports can be submitted via
51 the web:
53 http://bugzilla.open-bio.org/
55 =head1 AUTHOR - Allen Day
57 Email allenday@ucla.edu
59 =head1 APPENDIX
61 The rest of the documentation details each of the object methods.
62 Internal methods are usually preceded with a _
64 =cut
67 # Let the code begin...
70 package Bio::DB::Expression;
71 use strict;
72 use base qw(Bio::Root::HTTPget Bio::Root::Root);
73 use Bio::Root::HTTPget;
74 our $DefaultSource = 'geo';
76 =head2 new()
78 Usage : my $obj = Bio::DB::Expression->new();
79 Function: Builds a new Bio::DB::Expression object
80 Returns : an instance of Bio::DB::Expression
81 Args :
84 =cut
86 sub new {
87 my($class,@args) = @_;
89 if( $class =~ /Bio::DB::Expression::(\S+)/ ) {
90 my ($self) = $class->SUPER::new(@args);
91 $self->_initialize(@args);
92 return $self;
93 } else {
94 my %param = @args;
95 @param{ map { lc $_ } keys %param } = values %param; # lowercase keys
96 my $source = $param{'-source'} || $DefaultSource;
98 $source = "\L$source"; # normalize capitalization to lower case
100 # normalize capitalization
101 return unless( $class->_load_expression_module($source) );
102 return "Bio::DB::Expression::$source"->new(@args);
106 =head2 get_platforms()
108 Usage :
109 Function:
110 Example :
111 Returns : a list of Bio::Expression::Platform objects
112 Args :
114 =cut
116 sub get_platforms {
117 my ($self,@args) = @_;
118 $self->throw_not_implemented();
121 =head2 get_samples()
123 Usage :
124 Function:
125 Example :
126 Returns : a list of Bio::Expression::Sample objects
127 Args :
129 =cut
131 sub get_samples {
132 my ($self,@args) = @_;
133 $self->throw_not_implemented();
136 =head2 get_contacts()
138 Usage :
139 Function:
140 Example :
141 Returns : a list of Bio::Expression::Contact objects
142 Args :
144 =cut
146 sub get_contacts {
147 my ($self,@args) = @_;
148 $self->throw_not_implemented();
151 =head2 get_datasets()
153 Usage :
154 Function:
155 Example :
156 Returns : a list of Bio::Expression::DataSet objects
157 Args :
159 =cut
161 sub get_datasets {
162 my ($self,@args) = @_;
163 $self->throw_not_implemented();
169 =head2 _load_expression_module
171 Title : _load_expression_module
172 Usage : *INTERNAL Bio::DB::Expression stuff*
173 Function: Loads up (like use) a module at run time on demand
174 Example :
175 Returns :
176 Args :
178 =cut
180 sub _load_expression_module {
181 my ($self, $source) = @_;
182 my $module = "Bio::DB::Expression::" . $source;
183 my $ok;
185 eval { $ok = $self->_load_module($module) };
186 if ( $@ ) {
187 print STDERR $@;
188 print STDERR <<END;
189 $self: $source cannot be found
190 Exception $@
191 For more information about the Bio::DB::Expression system please see
192 the Bio::DB::Expression docs. This includes ways of checking for
193 formats at compile time, not run time.
197 return $ok;