1 package SGN
::View
::Stock
;
7 stock_link organism_link cvterm_link
8 stock_table related_stats
9 stock_organisms stock_types breeding_programs
16 my $name = $stock->uniquename;
17 my $id = $stock->stock_id;
18 return qq{<a href
="/stock/$id/view">$name</a
>};
23 my $id = $organism->organism_id;
24 my $species = $organism->species;
26 <span class="species_binomial">
27 <a href="/chado/organism.pl?organism_id=$id">$species</a>
33 my $name = $cvterm->name;
34 my $id = $cvterm->cvterm_id;
35 return qq{<a href
="/cvterm/$id/view">$name</a
>};
41 for my $s (@
$stocks) {
42 # Add a row for every stock
44 cvterm_link
($s->type),
56 my $total = scalar @
$stocks;
57 for my $s (@
$stocks) {
58 $stats->{cvterm_link
($s->type)}++;
61 for my $k (sort keys %$stats) {
62 push @
$data, [ $stats->{$k}, $k ];
64 if( 1 < scalar keys %$stats ) {
65 push @
$data, [ $total, "<b>Total</b>" ];
70 sub breeding_programs
{
74 map [ $_->project_id, $_->name ],
76 ->resultset('Project::Project')->search(
77 { 'type.name' => 'breeding_program',
80 join => { 'projectprops' => 'type' },
81 select => [qw
[ me
.project_id me
.name
]],
83 order_by
=> 'me.name',
93 map [ $_->organism_id, $_->species ],
95 ->resultset('Stock::Stock')
96 ->search_related('organism' , {}, {
97 select => [qw
[ organism
.organism_id species
]],
99 order_by
=> 'species',
108 map [$_->cvterm_id,$_->name],
110 ->resultset('Stock::Stock')
114 { select => [qw
[ cvterm_id type
.name
]],
115 group_by
=> [qw
[ cvterm_id type
.name
]],
116 order_by
=> 'type.name',
120 # add an empty option
121 unshift @
$ref , ['0', ''];
125 sub stock_dbxrefprops
{
126 my $stock_dbxref = shift;
127 my $props = $stock_dbxref->stock_dbxrefprops;
128 while (my $p = $props->next ) {
129 my $value = $p->value ;
130 my $type = $p->type->name;
131 my $accession = $p->type->dbxref->accession;
132 my $db_name = $p->type->dbxref->db->name;