-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add web service for adding organisms to sessions
Refs #1447
- Loading branch information
1 parent
85689ef
commit 5b2e7cb
Showing
4 changed files
with
154 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package Canto::Curs::OrganismManager; | ||
|
||
=head1 NAME | ||
Canto::Curs::OrganismManager - Manage adding and removing session organism | ||
=head1 SYNOPSIS | ||
=head1 AUTHOR | ||
Kim Rutherford C<< <kmr44@cam.ac.uk> >> | ||
=head1 BUGS | ||
Please report any bugs or feature requests to C<kmr44@cam.ac.uk>. | ||
=head1 SUPPORT | ||
You can find documentation for this module with the perldoc command. | ||
perldoc Canto::Curs::OrganismManager | ||
=over 4 | ||
=back | ||
=head1 COPYRIGHT & LICENSE | ||
Copyright 2013 Kim Rutherford, all rights reserved. | ||
This program is free software; you can redistribute it and/or modify it | ||
under the same terms as Perl itself. | ||
=head1 FUNCTIONS | ||
=cut | ||
|
||
use Carp; | ||
use Moose; | ||
|
||
use Canto::Track; | ||
use Canto::CursDB::Organism; | ||
|
||
has curs_schema => (is => 'rw', isa => 'Canto::CursDB', required => 1); | ||
has organism_lookup => (is => 'ro', init_arg => undef, lazy_build => 1); | ||
|
||
with 'Canto::Role::Configurable'; | ||
|
||
sub _build_organism_lookup | ||
{ | ||
my $self = shift; | ||
|
||
return Canto::Track::get_adaptor($self->config(), 'organism'); | ||
} | ||
|
||
sub add_organism_by_taxonid | ||
{ | ||
my $self = shift; | ||
|
||
my $taxonid = shift; | ||
|
||
my $organism_details = $self->organism_lookup->lookup_by_taxonid($taxonid); | ||
|
||
if ($organism_details) { | ||
return Canto::CursDB::Organism::get_organism($self->curs_schema(), $taxonid); | ||
} else { | ||
return undef; | ||
} | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters