From 3c0a33e1157daa5beda926886fa0af0b1fffc051 Mon Sep 17 00:00:00 2001 From: Lukas Mueller Date: Tue, 9 Jul 2013 11:42:08 -0400 Subject: [PATCH] add option to link by marker name instead of marker id (to link to GBrowse etc.) --- lib/CXGN/Cview/Map.pm | 22 ++++++++++++++++++++++ lib/CXGN/Cview/Map/SGN/Genetic.pm | 15 +++++++++++++-- lib/CXGN/Cview/MapFactory/Cacao.pm | 3 ++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/lib/CXGN/Cview/Map.pm b/lib/CXGN/Cview/Map.pm index 8938c75..1d8872d 100644 --- a/lib/CXGN/Cview/Map.pm +++ b/lib/CXGN/Cview/Map.pm @@ -1027,6 +1027,28 @@ sub set_parent2_stock_name { $self->{parent2_stock_name} = shift; } +=head2 accessors get_link_by_name, set_link_by_name + + Usage: + Desc: set to true if the marker link should be constructed + using the marker name instead of the marker id + (useful for linking to gbrowse etc). + The map subclass needs to support this. + Property + Side Effects: + Example: + +=cut + +sub get_link_by_name { + my $self = shift; + return $self->{link_by_name}; +} + +sub set_link_by_name { + my $self = shift; + $self->{link_by_name} = shift; +} 1; diff --git a/lib/CXGN/Cview/Map/SGN/Genetic.pm b/lib/CXGN/Cview/Map/SGN/Genetic.pm index b0d3dac..00b9244 100644 --- a/lib/CXGN/Cview/Map/SGN/Genetic.pm +++ b/lib/CXGN/Cview/Map/SGN/Genetic.pm @@ -261,7 +261,12 @@ sub get_chromosome { #print STDERR "dataadapter baccount = $bac_count!\n"; if ($loc_type == 100) { $m -> set_frame_marker(); } - $m -> set_url( $self->get_marker_link($m->get_id())); + if ($self->get_link_by_name()) { + $m->set_url($self->get_marker_link($m->get_marker_name)); + } + else { + $m -> set_url( $self->get_marker_link($m->get_id())); + } $self->set_marker_color($m, $self->get_legend()->get_mode()); #print STDERR "CURRENT MODE IS: ".$self->get_legend()->get_mode()."\n"; @@ -406,7 +411,13 @@ sub get_chromosome_section { my $seq_bac_id=""; if (!$plausible || $plausible == 0) { $bac_count = 0; } my $m = CXGN::Cview::Marker -> new($chromosome, $marker_id, $marker_name, $marker_type, $confidence, $order_in_loc, $location_subscript, $offset, , $loc_type, 0, $overgo, $bac_count); - $m->set_url($self->get_marker_link($m->get_id())); + + if ($self->get_link_by_name()) { + $m->set_url($self->get_marker_link($m->get_marker_name())); + } + else { + $m->set_url($self->get_marker_link($m->get_id())); + } $self->set_marker_color($m, $self->get_legend()->get_mode()); #print STDERR "dataadapter baccount = $bac_count!\n"; if ($loc_type == 100) { $m -> set_frame_marker(); } diff --git a/lib/CXGN/Cview/MapFactory/Cacao.pm b/lib/CXGN/Cview/MapFactory/Cacao.pm index ebfe202..8786615 100644 --- a/lib/CXGN/Cview/MapFactory/Cacao.pm +++ b/lib/CXGN/Cview/MapFactory/Cacao.pm @@ -136,7 +136,8 @@ sub create { elsif ($map_type =~ /seq/) { print STDERR "Creating a seq map...($map_type, $id)\n"; my $map = CXGN::Cview::Map::SGN::Sequence->new($self->get_dbh(), $id); - $map->set_marker_link("http://gbrowse-cacao.sgn.cornell.edu/gb2/gbrowse/cacao1/?h_feat="); + $map->set_marker_link("http://gbrowse-cacao.sgn.cornell.edu/gb2/gbrowse/cacao1/?q="); + $map->set_link_by_name(1); return $map; } } -- 2.11.4.GIT