sync w/ main trunk
[bioperl-live.git] / Bio / DB / Expression.pm
blobfad34b03e311116bc1003cab87de43b2a7fdbf8d
1 # $Id$
3 # BioPerl module for Bio::DB::Expression
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Allen Day <allenday@ucla.edu>
9 # Copyright Allen Day
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
15 =head1 NAME
17 Bio::DB::Expression - DESCRIPTION of Object
19 =head1 SYNOPSIS
21 use Bio::DB::Expression;
22 my $db = Bio::DB::Expression->new( -source => 'geo' );
23 my @platforms = $db->get_platforms();
24 foreach my $platform ( @platforms ) {
25 my @datasets = $platform->get_datasets();
26 foreach my $dataset ( @datasets ) {
27 my @samples = $dataset->get_samples();
28 foreach my $sample ( @samples ) {
29 #...
34 =head1 DESCRIPTION
36 Describe the object here
38 =head1 FEEDBACK
40 =head2 Mailing Lists
42 User feedback is an integral part of the evolution of this and other
43 Bioperl modules. Send your comments and suggestions preferably to
44 the Bioperl mailing list. Your participation is much appreciated.
46 bioperl-l@bioperl.org - General discussion
47 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
49 =head2 Support
51 Please direct usage questions or support issues to the mailing list:
53 L<bioperl-l@bioperl.org>
55 rather than to the module maintainer directly. Many experienced and
56 reponsive experts will be able look at the problem and quickly
57 address it. Please include a thorough description of the problem
58 with code and data examples if at all possible.
60 =head2 Reporting Bugs
62 Report bugs to the Bioperl bug tracking system to help us keep track
63 of the bugs and their resolution. Bug reports can be submitted via
64 the web:
66 http://bugzilla.open-bio.org/
68 =head1 AUTHOR - Allen Day
70 Email allenday@ucla.edu
72 =head1 APPENDIX
74 The rest of the documentation details each of the object methods.
75 Internal methods are usually preceded with a _
77 =cut
80 # Let the code begin...
83 package Bio::DB::Expression;
84 use strict;
85 use base qw(Bio::Root::HTTPget Bio::Root::Root);
86 use Bio::Root::HTTPget;
87 our $DefaultSource = 'geo';
89 =head2 new()
91 Usage : my $obj = Bio::DB::Expression->new();
92 Function: Builds a new Bio::DB::Expression object
93 Returns : an instance of Bio::DB::Expression
94 Args :
97 =cut
99 sub new {
100 my($class,@args) = @_;
102 if( $class =~ /Bio::DB::Expression::(\S+)/ ) {
103 my ($self) = $class->SUPER::new(@args);
104 $self->_initialize(@args);
105 return $self;
106 } else {
107 my %param = @args;
108 @param{ map { lc $_ } keys %param } = values %param; # lowercase keys
109 my $source = $param{'-source'} || $DefaultSource;
111 $source = "\L$source"; # normalize capitalization to lower case
113 # normalize capitalization
114 return unless( $class->_load_expression_module($source) );
115 return "Bio::DB::Expression::$source"->new(@args);
119 =head2 get_platforms()
121 Usage :
122 Function:
123 Example :
124 Returns : a list of Bio::Expression::Platform objects
125 Args :
127 =cut
129 sub get_platforms {
130 my ($self,@args) = @_;
131 $self->throw_not_implemented();
134 =head2 get_samples()
136 Usage :
137 Function:
138 Example :
139 Returns : a list of Bio::Expression::Sample objects
140 Args :
142 =cut
144 sub get_samples {
145 my ($self,@args) = @_;
146 $self->throw_not_implemented();
149 =head2 get_contacts()
151 Usage :
152 Function:
153 Example :
154 Returns : a list of Bio::Expression::Contact objects
155 Args :
157 =cut
159 sub get_contacts {
160 my ($self,@args) = @_;
161 $self->throw_not_implemented();
164 =head2 get_datasets()
166 Usage :
167 Function:
168 Example :
169 Returns : a list of Bio::Expression::DataSet objects
170 Args :
172 =cut
174 sub get_datasets {
175 my ($self,@args) = @_;
176 $self->throw_not_implemented();
182 =head2 _load_expression_module
184 Title : _load_expression_module
185 Usage : *INTERNAL Bio::DB::Expression stuff*
186 Function: Loads up (like use) a module at run time on demand
187 Example :
188 Returns :
189 Args :
191 =cut
193 sub _load_expression_module {
194 my ($self, $source) = @_;
195 my $module = "Bio::DB::Expression::" . $source;
196 my $ok;
198 eval { $ok = $self->_load_module($module) };
199 if ( $@ ) {
200 print STDERR $@;
201 print STDERR <<END;
202 $self: $source cannot be found
203 Exception $@
204 For more information about the Bio::DB::Expression system please see
205 the Bio::DB::Expression docs. This includes ways of checking for
206 formats at compile time, not run time.
210 return $ok;