1 package SGN
::Controller
::Transformation
;
4 use URI
::FromHash
'uri';
5 use SGN
::Model
::Cvterm
;
6 use CXGN
::People
::Person
;
8 use CXGN
::Transformation
::Transformation
;
10 BEGIN { extends
'Catalyst::Controller'; }
13 sub transformation_page
: Path
('/transformation') Args
(1) {
17 my $schema = $c->dbic_schema("Bio::Chado::Schema");
18 my $dbh = $c->dbc->dbh;
19 my $transformation_stock_type_id = SGN
::Model
::Cvterm
->get_cvterm_row($schema, 'transformation', 'stock_type')->cvterm_id();
21 my $transformation = $schema->resultset("Stock::Stock")->find( { stock_id
=> $id, type_id
=> $transformation_stock_type_id } );
23 my $transformation_id;
24 my $transformation_name;
25 if (!$transformation) {
26 $c->stash->{template
} = '/generic_message.mas';
27 $c->stash->{message
} = 'The requested transformation does not exist.';
30 $transformation_id = $transformation->stock_id();
31 $transformation_name = $transformation->uniquename();
34 my $transformation_obj = CXGN
::Transformation
::Transformation
->new({schema
=>$schema, dbh
=>$dbh, transformation_stock_id
=>$transformation_id});
35 my $info = $transformation_obj->get_transformation_info();
36 my $plant_material = qq{<a href
="/stock/$info->[0]->[0]/view">$info->[0]->[1]</a
>};
37 my $vector_construct = qq{<a href
="/stock/$info->[0]->[2]/view">$info->[0]->[3]</a
>};
38 my $transformation_notes = $info->[0]->[4];
39 my $result = $transformation_obj->get_transformants();
40 my $number_of_transformants = scalar(@
$result);
41 my $basename = $transformation_name.'_T';
42 my $next_new_transformant = $basename. (sprintf "%04d", $number_of_transformants + 1);
44 $c->stash->{transformation_id
} = $transformation_id;
45 $c->stash->{transformation_name
} = $transformation_name;
46 $c->stash->{next_new_transformant
} = $next_new_transformant;
47 $c->stash->{last_number
} = $number_of_transformants;
48 $c->stash->{plant_material
} = $plant_material;
49 $c->stash->{vector_construct
} = $vector_construct;
50 $c->stash->{transformation_notes
} = $transformation_notes;
51 $c->stash->{user_id
} = $c->user ?
$c->user->get_object()->get_sp_person_id() : undef;
52 $c->stash->{template
} = '/transformation/transformation.mas';