4 CXGN::Cview::Map::Tools
8 John Binns <zombieite@gmail.com>
12 Non-object-oriented quick functions for getting random bits of data about maps.
14 =head2 is_current_version
16 #example: make a new map object but only if we have the current version
17 if(CXGN::Map::Tools::is_current_version($dbh,$map_version_id))
19 my $map=CXGN::Map->new({map_version_id=>$map_version_id});
22 =head2 find_current_version
24 #example: find the current map_version_id for a map_id
25 my $map_version_id=CXGN::Map::Tools::find_current_version($dbh, $map_id);
27 =head2 current_tomato_map_id
35 package CXGN
::Cview
::Map
::Tools
;
37 sub is_current_version
39 my ($dbh,$map_version_id)=@_;
40 my $q=$dbh->prepare('select current_version from sgn.map_version where map_version_id=?');
41 $q->execute($map_version_id);
42 my ($current)=$q->fetchrow_array();
46 sub find_current_version
50 # if it is not a database-based map, the map_id and map_version_id
51 # are identical and contain the char prefix
53 if (!is_db_map
($map_id)) {
57 # otherwise we look in the database to find out.
59 my $q=$dbh->prepare("select map_version_id from sgn.map_version where current_version='t' and map_id=?");
61 my ($current)=$q->fetchrow_array();
65 sub current_tomato_map_id
{
66 # returns the current Tomato EXPEN-2000 map, which I keep changing.
70 sub find_map_id_with_version
{
72 my $map_version_id = shift;
74 # the map_id's for the maps that are not in the database are
75 # identical to their map_version_ids
77 if (!is_db_map
($map_version_id)) {
78 return $map_version_id;
81 # all other map_versions need to be retrieved from the database
83 my $q =$dbh->prepare("select map_id from sgn.map_version where map_version_id=?");
84 $q->execute($map_version_id);
85 my ($map_id) = $q->fetchrow_array();
86 # warn "[CXGN::Cview::Map::Tools] find_map_id_with_version: $map_version_id corresponds to $map_id.\n";
98 =head2 function get_physical_marker_color
101 Arguments: the physical marker association type, currently
102 one of "overgo", "computational", "manual".
103 Returns: the associated color, as a list of three ints.
104 Side effects: will be used by the comparative viewer to render
110 sub get_physical_marker_color
{
113 if (!defined($status)) { $status = ""; }
115 if ($status eq "complete") { return (20, 250, 20); }
116 if ($status eq "in_progress") { return (20, 20, 250); }
117 if (!$type) { return (0, 0, 0); }
119 if ($type eq "overgo") {
120 return (100, 100, 100);
122 if ($type eq "computational") {
123 return (200, 100, 100, );
125 if ($type eq "manual") {
126 return (200, 200, 100);
128 if ($type eq "Lpen_manual") {
129 return (50, 200, 200);