seedlot upload with accession synonyms. seedlot upload works to update existing seedlots
[sgn.git] / lib / SGN / Controller / Genefamily / Manual.pm
blob917adeda40dafa5c860fc6be603ab4faab48a78e
1 package SGN::Controller::Genefamily::Manual;
4 =head1 NAME
6 SGN::Controller::Genefamily::Manual - Catalyst controller for pages dealing with
7 manually curated gene families (aka 'locusgroup')
9 =cut
11 use Moose;
13 BEGIN { extends "Catalyst::Controller"; }
14 with 'Catalyst::Component::ApplicationAttribute';
17 has 'schema' => (
18 is => 'rw',
19 isa => 'DBIx::Class::Schema',
20 lazy_build => 1,
23 sub _build_schema {
24 shift->_app->dbic_schema( 'CXGN::Phenome::Schema' )
27 =head2 view_genefamily
29 Public path: /genefamily/manual/<locusgroup_id>/view
31 View a gene family (locusgroup) detail page.
33 Chained off of L</get_genefamily> below.
35 =cut
37 sub view_genefamily : Chained('get_genefamily') PathPart('view') Args(0) {
38 my ( $self, $c, $action) = @_;
39 my $genefamily = $c->stash->{genefamily};
40 if( $genefamily ) {
41 $c->forward('get_genefamily_extended_info');
44 my $logged_user = $c->user;
45 my $person_id = $logged_user->get_object->get_sp_person_id if $logged_user;
46 my $curator = $logged_user->check_roles('curator') if $logged_user;
47 my $submitter = $logged_user->check_roles('submitter') if $logged_user;
48 my $sequencer = $logged_user->check_roles('sequencer') if $logged_user;
49 my $dbh = $c->dbc->dbh;
51 ##################
53 ###Check if a gene family page can be printed###
54 my $genefamily_id = $genefamily ? $genefamily->get_locusgroup_id : undef ;
56 # print message if locusgroup_id is not valid
57 unless ( $genefamily_id =~ m /^\d+$/ ) {
58 $c->throw_404( "No gene family exists for that identifier." );
60 unless ( $genefamily ) {
61 $c->throw_404( "No gene family exists for that identifier." );
63 ####################
64 my $is_owner;
65 my $owner_id = $c->stash->{owner_id} || undef ;
66 if ( $genefamily && ($curator || $person_id && ( $person_id == $owner_id ) ) ) {
67 $is_owner = 1;
69 my $members = $genefamily->get_locusgroup_members;
70 #########
71 ################
72 $c->stash(
73 template => '/genefamily/manual/index.mas',
74 hashref => {
75 action => $action,
76 genefamily => $genefamily,
77 curator => $curator,
78 submitter => $submitter,
79 sequencer => $sequencer,
80 person_id => $person_id,
81 user => $logged_user,
82 genefamily => $genefamily,
83 dbh => $dbh,
84 is_owner => $is_owner,
85 members => $members,
87 locus_add_uri => $c->uri_for( '/ajax/locus/associate_locus' ),
92 =head1 PRIVATE ACTIONS
94 =head2 get_genefamily
96 Chain root for fetching a locusgroup object to operate on.
98 Path part: /genefamily/manual/<locusgroup_id>
100 =cut
102 sub get_genefamily : Chained('/') PathPart('genefamily/manual') CaptureArgs(1) {
103 my ($self, $c, $locusgroup_id) = @_;
104 $c->stash->{genefamily} = CXGN::Phenome::LocusGroup->new($self->schema, $locusgroup_id);
108 sub get_genefamily_extended_info : Private {
109 my ( $self, $c ) = @_;
110 #$c->forward('get_genefamily_members');
114 __PACKAGE__->meta->make_immutable;