2 package SGN
::Controller
::Cvterm
;
4 use CXGN
::Chado
::Cvterm
;
8 BEGIN { extends
'Catalyst::Controller' };
9 with
'Catalyst::Component::ApplicationAttribute';
14 Public path: /cvterm/<cvterm_id>/view
16 View a cvterm detail page.
18 Chained off of L</get_cvterm> below.
22 sub view_cvterm
: Chained
('get_cvterm') PathPart
('view') Args
(0) {
23 my ( $self, $c, $action) = @_;
24 my $cvterm = $c->stash->{cvterm
};
27 template
=> '/chado/cvterm.mas',
36 Chain root for fetching a cvterm object to operate on.
38 Path part: /cvterm/<cvterm_id>
42 sub get_cvterm
: Chained
('/') PathPart
('cvterm') CaptureArgs
(1) {
43 my ($self, $c, $cvterm_id) = @_;
45 my $identifier_type = $c->stash->{identifier_type
}
46 || $cvterm_id =~ /[^-\d]/ ?
'accession' : 'cvterm_id';
49 if( $identifier_type eq 'cvterm_id' ) {
50 $cvterm = CXGN
::Chado
::Cvterm
->new($c->dbc->dbh, $cvterm_id);
51 } elsif ( $identifier_type eq 'accession' ) {
52 $cvterm = CXGN
::Chado
::Cvterm
->new_with_accession ($c->dbc->dbh , $cvterm_id) ;
54 my $found_cvterm_id = $cvterm->get_cvterm_id
55 or $c->throw_404( "Cvterm not found" );
57 $c->stash->{cvterm
} = CXGN
::Chado
::Cvterm
->new($c->dbc->dbh, $found_cvterm_id);