Skip to content
Snippets Groups Projects
Commit d5e73c6e authored by Kieron Taylor's avatar Kieron Taylor :angry:
Browse files

Added a method that lists the species in available databases. Ancestral_ are...

Added a method that lists the species in available databases. Ancestral_ are ignored, and the list is filtered to a group type, defaulting to core dbs. Testcase is less than perfect, because the test db has so few species in it.
parent e27f241d
No related branches found
No related tags found
No related merge requests found
......@@ -2663,6 +2663,32 @@ sub version_check {
return 1; # Ok
} ## end sub version_check
=head2 get_all_species
Arg [1] : String group type, such as core, or otherfeatures
Description: Method for getting all valid species names found in available
databases. This excludes the ancestral sequence databases, and
any species from a non-core database. Specifying a group allows
the list to apply to non-core database types.
Example : my @species_names = @{ $reg->get_all_species() };
Returntype : Listref of species names
=cut
sub get_all_species {
my ($self,$group) = @_;
$group ||= 'core';
my @species;
foreach my $name (keys %{$registry_register{_SPECIES}}) {
push @species, $name if (
# limit species names to given db group and no ancestral dbs
$registry_register{_SPECIES}->{$name}->{$group}
&& $name !~ /^ancestral/i
);
}
return \@species;
}
=head2 get_species_and_object_type
......
......@@ -97,4 +97,10 @@ TMPL
$tester->('verison');
}
# Test get_all_species
my @species = $reg->get_all_species();
ok(scalar(@species) == 1, "get_all_species");
ok(scalar(@{ $reg->get_all_species('cahoona') }) == 0, "get_all_species with bogus data.");
done_testing();
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment