add function for retrieving treatment info by observation unit ids
[sgn.git] / lib / SGN / Controller / Variant.pm
blob0a04b20531b44bfec3c31511e0203968186b713c
1 =head1 NAME
3 SGN::Controller::Variant
5 =head1 DESCRIPTION
7 Controller for pages related to genotype markers (those stored in nd_protocolprop
8 and summarized in the marker materialized view).
10 =cut
12 package SGN::Controller::Variant;
14 use strict;
15 use Moose;
16 use CXGN::Marker::SearchMatView;
18 BEGIN { extends 'Catalyst::Controller' }
22 # VARIANT DETAIL PAGE
24 # PATH: /variant/{variant_name}/details
25 # - Get variant details
26 # - Stash the variant's marker information
27 # - Display variant detail page
29 sub get_variant_details: Chained('get_variant') PathPart('details') :Args(0) {
30 my ( $self, $c ) = @_;
31 my $schema = $c->dbic_schema("Bio::Chado::Schema");
32 my $variant_name = $c->stash->{variant_name};
34 # Get variant details
35 my $msearch = CXGN::Marker::SearchMatView->new(bcs_schema => $schema);
36 my $variant_details = $msearch->query({ variant => $variant_name });
37 my $markers = $variant_details->{'variants'}->{$variant_name};
39 # No markers found
40 if ( !$markers ) {
41 $c->stash->{template} = "generic_message.mas";
42 $c->stash->{message} = "<strong>No Markers Found</strong> for variant $variant_name<br />You can view and search for markers from the <a href='/search/variants'>Marker Search Page</a>";
43 $c->detach();
46 $c->stash->{markers} = $markers;
47 $c->stash->{template} = '/markers/genotyped/variant_details.mas';
52 # PATH: /variant/{variant_name}
53 # - Stash variant_name
55 sub get_variant: Chained('/') PathPart('variant') :CaptureArgs(1) {
56 my ( $self, $c, $variant ) = @_;
57 $c->stash->{variant_name} = $variant;