Skip to content
Snippets Groups Projects
Commit 80e8a271 authored by Magali Ruffier's avatar Magali Ruffier
Browse files

ENSCORESW-1193: added is_empty method to check if there is genome data available

parent 607d302f
No related branches found
No related tags found
No related merge requests found
......@@ -632,6 +632,36 @@ sub _get_statistic {
return \@results;
}
=head2 is_empty
Arg [1] : none
Example : $results = $genome->is_empty;
Description: Boolean to check if there is data in the genome container
Returntype : Boolean
Exceptions : none
Caller : general
Status : Stable
=cut
sub is_empty {
my $self = shift;
my $db = $self->db;
my $species_id = $self->db->species_id();
my $is_empty = 0;
my $count_sql = q{
SELECT count(*) FROM genome_statistics
};
my $sth = $self->prepare($count_sql);
$sth->execute();
if ($sth->fetchrow()) {
$is_empty = 1;
}
$sth->finish();
return $is_empty;
}
=head2 get_attrib
Arg [1] : statistic
......
......@@ -173,6 +173,14 @@ is(0, $empty_genome->has_karyotype, "Empty db does not have chromosomes");
is(1, $genome->is_high_coverage, "Human genebuild is high coverage");
is(0, $empty_genome->is_high_coverage, "Empty db is not high coverage");
#
# Test if there is data
#
is(1, $genome->is_empty, "Human core database has genome data");
is(0, $empty_genome->is_empty, "Empty database has no genome data");
#
# Test polyploid genome support
#
......
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