Skip to content

Commit

Permalink
improvements to bioperlflattener's data-fetching subs
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed Feb 21, 2012
1 parent 95e8a85 commit 4150791
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/BioperlFlattener.pm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ sub new {
$self->{getAlias} = ($style{autocomplete} =~ /alias|all/);

my $idSub = $style{idSub} || sub {
return $_[0]->can('primary_id') ? $_[0]->primary_id : $_[0]->id;
my ( $f ) = @_;
return eval { $f->load_id } || eval { $f->primary_id } || eval { $f->id };
};

my @curFeatMap = @featMap;
Expand All @@ -101,7 +102,13 @@ sub new {
}

if ($style{phase}) {
push @curFeatMap, sub {shift->phase};
push @curFeatMap, sub {
no warnings qw/ numeric uninitialized /;
my $p = shift->phase;
$p += 0;
return undef unless $p == 0 || $p == 1 || $p == 2;
return $p;
};
push @curMapHeaders, "phase";
}

Expand Down

0 comments on commit 4150791

Please sign in to comment.