can download plant phenotype data in the same way as plot phenotype data
[sgn.git] / lib / SGN / Feature / FeaturePages.pm
blob1fa8bf8af3fa91fd5d457386702d52c4479c2239
1 =head1 NAME
3 SGN::Feature::FeaturePages - site feature for genomic feature pages
4 (SGN::Controller::Feature, SGN::View::Feature, mason/features)
6 =head1 SYNOPSIS
8 Subclass of L<SGN::Feature>, just does all the things expected of a
9 site feature.
11 =cut
13 package SGN::Feature::FeaturePages;
14 use Moose;
16 use URI;
18 extends 'SGN::Feature';
20 has '+description' => (
21 default => 'Genomic details',
24 sub xrefs {
25 my ( $self, $query ) = @_;
27 return if ref $query;
28 $query = lc $query;
30 my $feats = $self->context->dbic_schema('Bio::Chado::Schema','sgn_chado')
31 ->resultset('Sequence::Feature')
32 ->search({},{ prefetch => 'type' });
34 my @exact =
35 map { $self->_make_xref( $_ ) }
36 ( $feats->search({
37 -or => [ { 'lower(me.uniquename)' => $query },
38 { 'lower(me.name)' => $query },
40 }),
41 $feats->search(
42 { 'lower(synonym.name)' => $query },
43 { join => { feature_synonyms => 'synonym' } },
47 return @exact;
50 sub _make_xref {
51 my ( $self, $feature ) = @_;
53 return SGN::SiteFeatures::CrossReference->new({
54 feature => $self,
56 text => $feature->name.' '.$feature->type->name.' feature details',
58 url => URI->new('/feature/'.$feature->feature_id.'/details'),
60 });
63 __PACKAGE__->meta->make_immutable;