Skip to content

Commit

Permalink
Merge pull request #233 from helensch/fix/indiv-type
Browse files Browse the repository at this point in the history
Updates to IndividualType and EmptyVariationTables
  • Loading branch information
james-monkeyshines committed Apr 22, 2020
2 parents 9680622 + f5c4132 commit 246dbce
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/Bio/EnsEMBL/DataCheck/Checks/EmptyVariationTables.pm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ sub get_tables_to_check {
# Remove citation tables for species without citation database
my @species_with_citations = qw/
bos_taurus
canis_familiaris
canis_lupus_familiaris
capra_hircus
danio_rerio
equus_caballus
Expand Down
30 changes: 25 additions & 5 deletions lib/Bio/EnsEMBL/DataCheck/Checks/IndividualType.pm
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use strict;
use Moose;
use Test::More;
use Bio::EnsEMBL::DataCheck::Test::DataCheck;
use Bio::EnsEMBL::DataCheck::Utils qw/sql_count/;

extends 'Bio::EnsEMBL::DataCheck::DbCheck';

Expand All @@ -35,6 +36,16 @@ use constant {
TABLES => ['individual'],
};

sub skip_tests {
my ($self) = @_;

my $sql = 'SELECT COUNT(*) FROM individual';

if (! sql_count($self->dba, $sql) ) {
return (1, 'No individual records.');
}
}

sub tests {
my ($self) = @_;

Expand All @@ -49,18 +60,20 @@ sub tests {
WHERE individual_type_id != 1
/;
is_rows_zero($self->dba, $sql_1, $desc, $diag);
return;
}

if($species =~ /canis_familiaris|danio_rerio|
if($species =~ /canis_lupus_familiaris|danio_rerio|
gallus_gallus|rattus_norvegicus|
bos_taurus|ornithorhynchus_anatinus|
pongo_abelii/) {
my $sql_2 = q/
my $sql_2 = q/
SELECT COUNT(*)
FROM individual
WHERE individual_type_id != 2
/;
is_rows_zero($self->dba, $sql_2, $desc, $diag);
/;
is_rows_zero($self->dba, $sql_2, $desc, $diag);
return;
}

if($species =~ /anopheles_gambiae/) {
Expand All @@ -71,6 +84,7 @@ sub tests {
AND individual_type_id != 3
/;
is_rows_zero($self->dba, $sql_3, $desc, $diag);
return;
}

if($species =~ /homo_sapiens|pan_troglodytes|tetraodon_nigroviridis/) {
Expand All @@ -80,9 +94,15 @@ sub tests {
WHERE individual_type_id != 3
/;
is_rows_zero($self->dba, $sql_4, $desc, $diag);
return;
}

# There are individual records but no species specific individual type checks
# SKIP the check so that it is not reported as a failure
SKIP: {
skip "No individual_type_id check" , 1;
}

}

1;

0 comments on commit 246dbce

Please sign in to comment.