2 package SGN
::Controller
::Cvterm
;
4 use CXGN
::Chado
::Cvterm
; #DEPRECATE this !!
9 BEGIN { extends
'Catalyst::Controller' };
10 with
'Catalyst::Component::ApplicationAttribute';
14 isa
=> 'DBIx::Class::Schema',
18 shift->_app->dbic_schema( 'Bio::Chado::Schema', 'sgn_chado' )
24 Public path: /cvterm/<cvterm_id>/view
26 View a cvterm detail page.
28 Chained off of L</get_cvterm> below.
32 sub view_cvterm
: Chained
('get_cvterm') PathPart
('view') Args
(0) {
33 my ( $self, $c, $action) = @_;
34 my $cvterm = $c->stash->{cvterm
};
35 my $cvterm_id = $cvterm ?
$cvterm->cvterm_id : undef ;
37 my $bcs_cvterm = $cvterm->cvterm;
39 my $logged_user = $c->user;
40 my $person_id = $logged_user->get_object->get_sp_person_id if $logged_user;
41 my $user_role = 1 if $logged_user;
42 my $curator = $logged_user->check_roles('curator') if $logged_user;
43 my $submitter = $logged_user->check_roles('submitter') if $logged_user;
44 my $sequencer = $logged_user->check_roles('sequencer') if $logged_user;
45 my $props = $self->_cvtermprops($cvterm);
46 my $editable_cvterm_props = "trait_format,trait_default_value,trait_minimum,trait_maximum,trait_details,trait_categories";
50 template
=> '/chado/cvterm.mas',
51 cvterm
=> $cvterm, #deprecate this maybe?
53 cvterm
=> $bcs_cvterm,
55 submitter
=> $submitter,
56 sequencer
=> $sequencer,
57 person_id
=> $person_id,
59 editable_cvterm_props
=> $editable_cvterm_props,
68 Chain root for fetching a cvterm object to operate on.
70 Path part: /cvterm/<cvterm_id>
74 sub get_cvterm
: Chained
('/') PathPart
('cvterm') CaptureArgs
(1) {
75 my ($self, $c, $cvterm_id) = @_;
77 my $identifier_type = $c->stash->{identifier_type
}
78 || $cvterm_id =~ /[^-\d]/ ?
'accession' : 'cvterm_id';
81 if( $identifier_type eq 'cvterm_id' ) {
82 $cvterm = CXGN
::Cvterm
->new({ schema
=>$self->schema, cvterm_id
=> $cvterm_id } );
83 } elsif ( $identifier_type eq 'accession' ) {
84 $cvterm = CXGN
::Cvterm
->new({ schema
=>$self->schema, accession
=>$cvterm_id } ) ;
86 my $found_cvterm = $cvterm->cvterm
87 or $c->throw_404( "Cvterm $cvterm_id not found" );
89 $c->stash->{cvterm
} = $cvterm;
97 my ($self,$cvterm) = @_;
101 my $bcs_cvterm = $cvterm->cvterm;
102 if (!$bcs_cvterm) { return undef ; }
103 my $cvtermprops = $bcs_cvterm->search_related("cvtermprops");
104 while ( my $prop = $cvtermprops->next ) {
105 push @
{ $properties->{$prop->type->name} } , $prop->value ;