Bio-DB-SeqFeature
view release on metacpan or search on metacpan
lib/Bio/DB/SeqFeature/Store/LoadHelper.pm view on Meta::CPAN
}
return wantarray ? @children: \@children;
}
# this acts like each() and returns each parent id and an array ref of children
sub each_family {
my $self = shift;
my $db = tied(%{$self->{Parent2Child}});
if ($self->{_cursordone}) {
undef $self->{_cursordone};
undef $self->{_parent};
undef $self->{_child};
return;
}
# do a slightly tricky cursor search
unless (defined $self->{_parent}) {
return unless $db->seq($self->{_parent},$self->{_child},R_FIRST) == 0;
}
my $parent = $self->{_parent};
my @children = $self->{_child};
my $status;
while (($status = $db->seq($self->{_parent},$self->{_child},R_NEXT)) == 0
&& $self->{_parent} eq $parent
) {
push @children,$self->{_child};
}
$self->{_cursordone}++ if $status != 0;
return ($parent,\@children);
}
sub local_ids {
my $self = shift;
my @ids = keys %{$self->{Local2Global}}
if $self->{Local2Global};
return \@ids;
}
( run in 0.245 second using v1.01-cache-2.11-cpan-4d50c553e7e )