5 CXGN::Cview::MapFactory::Custom - a class to provide custom behaviour for the comparative viewer
9 For the interface to be implemented, see L<CXGN::Cview::MapFactory>, and for an example, see L<CXGN::Cview::MapFactory::SGN>.
13 Lukas Mueller <lam87@cornell.edu>
19 package CXGN
::Cview
::MapFactory
::Custom
;
21 use base qw
| CXGN
::DB
::Object
|;
23 use CXGN
::Cview
::Map
::SGN
::Genetic
;
24 use CXGN
::Cview
::Map
::SGN
::User
;
25 use CXGN
::Cview
::Map
::SGN
::Fish
;
26 use CXGN
::Cview
::Map
::SGN
::Sequence
;
27 use CXGN
::Cview
::Map
::SGN
::IL
;
28 use CXGN
::Cview
::Map
::SGN
::Physical
;
29 use CXGN
::Cview
::Map
::SGN
::ProjectStats
;
30 use CXGN
::Cview
::Map
::SGN
::AGP
;
31 use CXGN
::Cview
::Map
::SGN
::Contig
;
32 use CXGN
::Cview
::Map
::GMOD
::Cmap
;
38 Returns: a CXGN::Cview::MapFactory object
48 my $self = $class->SUPER::new
($dbh);
50 my $mysql = DBI
->connect("DBI:mysql:database=CMAP;host=localhost", "web_usr", "tomato");
51 $self->set_dbh($mysql);
56 =head2 function create()
58 Description: creates a map based on the hashref given, which
59 should either contain the key map_id or map_version_id
60 and an appropriate identifier. The function returns undef
61 if a map of the given id cannot be found/created.
71 if (exists($args->{map_version_id
})) {
72 $id=$args->{map_version_id
};
75 elsif (exists($args->{map_id
})) {
79 die "Need a map_id or map_version_id key in hashref\n";
82 print STDERR
"Create: Using id = $id\n";
84 my $map = CXGN
::Cview
::Map
::GMOD
::Cmap
->new($self->get_dbh(), $id);
92 =head2 function get_all_maps()
94 Synopsis: my @maps = $map_factory->get_all_maps();
96 Returns: a list of all maps currently defined, as
97 CXGN::Cview::Map objects (and subclasses)
98 Side effects: Queries the database for certain maps
105 my $query = "SELECT map_set_id FROM cmap_map_set";
106 my $sth = $self->get_dbh()->prepare($query);
109 while (my ($map_id) = $sth->fetchrow_array()) {
110 push @maps, $self->create({ map_id
=>$map_id} );
115 sub get_system_maps
{
117 return $self->get_all_maps();