2 package SGN
::Controller
::Dataset
;
9 BEGIN { extends
'Catalyst::Controller'; }
11 sub dataset
:Chained
('/') Path
('dataset') Args
(1) {
14 my $dataset_id = shift;
15 my $schema = $c->dbic_schema('Bio::Chado::Schema', 'sgn_chado');
16 my $people_schema = $c->dbic_schema("CXGN::People::Schema");
22 $dataset = CXGN
::Dataset
->new({
24 people_schema
=> $people_schema,
25 sp_dataset_id
=> $dataset_id
29 $c->stash->{template
} = 'generic_message.mas';
30 $c->stash->{message
} = "The requested dataset does not exist or has been deleted.";
34 my $info = $dataset->get_dataset_data();
38 name
=> $dataset->name(),
39 description
=> $dataset->description,
43 my $lt = CXGN
::List
::Transform
->new();
44 my %transform_dict = (
45 'plots' => 'stock_ids_2_stocks',
46 'accessions' => 'stock_ids_2_stocks',
47 'traits' => 'trait_ids_2_trait_names',
48 'locations' => 'locations_ids_2_location',
49 'plants' => 'stock_ids_2_stocks',
50 'trials' => 'project_ids_2_projects',
51 'trial_types' => 'cvterm_ids_2_cvterms',
52 'breeding_programs' => 'project_ids_2_projects',
53 'genotyping_protocols' => 'nd_protocol_ids_2_protocols'
55 $html .= '<table class="table-bordered"><thead><tr>' . "\n";
56 foreach my $category (@
{$dataset_info->{info
}->{category_order
}}) {
57 $html .= '<th>' . $category . '</th>';
59 $html .= '</tr></thead><tbody><tr>' . "\n";
60 foreach my $category (@
{$dataset_info->{info
}->{category_order
}}) {
61 my $ids = $dataset_info->{info
}->{categories
}->{$category};
63 if (exists($transform_dict{$category})) {
64 my $transform = $lt->transform($schema, $transform_dict{$category}, $ids);
65 @items = @
{$transform->{transform
}};
71 $html .= "<td><div class='well well-sm'>";
72 $html .= "<select class='form-control' multiple>";
73 foreach my $item (@items) {
74 $html .= "<option value='$item' disabled>$item</option>";
77 $html .= "</td></div>\n";
81 $c->stash->{dataset_name
} = $dataset->name();
82 $c->stash->{dataset_id
} = $dataset_id;
83 $c->stash->{dataset_description
} = $dataset->description;
84 $c->stash->{dataset_contents
} = $html;
85 print STDERR
"dataset name $dataset->name()\n";
86 $c->stash->{template
} = '/dataset/index.mas';