Created
August 3, 2009 16:40
-
-
Save cybersiddhu/160665 to your computer and use it in GitHub Desktop.
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
package DictyREST::Helper; | |
use version; our $VERSION = qv('1.0.0'); | |
# Other modules: | |
use base qw/Mojo::Base/; | |
use dicty::Gene; | |
# Module implementation | |
# | |
sub is_name { | |
my ( $self, $id ) = @_; | |
return 0 if $id =~ /^D[A-Z]+_G\d+$/; | |
return 1; | |
} | |
sub name2id { | |
my ( $self, $id ) = @_; | |
my $feat; | |
eval { $feat = dicty::Gene->new( -name => $id ); }; | |
return 0 if $@; | |
return $feat->primary_id(); | |
} | |
sub process_id { | |
my ( $self, $id ) = @_; | |
my $gene_id = $id; | |
if ( $self->is_name($id) ) { | |
$gene_id = $self->name2id($id); | |
return 0 if !$gene_id; | |
} | |
return $gene_id; | |
} | |
1; # Magic true value required at end of module | |
__END__ | |
=head1 NAME | |
<DictyREST::Helper> - [Module providing some common methods for the entire application] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment