Skip to content

Commit

Permalink
Merge 2cef472 into 686ab32
Browse files Browse the repository at this point in the history
  • Loading branch information
james-monkeyshines committed Oct 12, 2018
2 parents 686ab32 + 2cef472 commit 4b3204d
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sub skip_tests {
sub tests {
my ($self) = @_;
my $desc = "All the epigenomes of the current regulatory build have a segmentation file";
my $diag = "Segmentation file missing for epigenome_id";
my $diag = "Segmentation file missing";
my $sql = q/
SELECT e.epigenome_id FROM
regulatory_build rb INNER JOIN
Expand Down
2 changes: 1 addition & 1 deletion lib/Bio/EnsEMBL/DataCheck/Checks/FeatureBounds.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ sub bounds_check {
# so we would miss any problems.

my $desc = $table.'s within seq_region bounds';
my $diag = "Out-of-bounds $table";
my $diag = "Out-of-bounds features in $table";
my $sql = qq/
SELECT $table\_id FROM
$table INNER JOIN
Expand Down
2 changes: 1 addition & 1 deletion lib/Bio/EnsEMBL/DataCheck/Checks/MySQLStorageEngine.pm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sub tests {
my ($self) = @_;
my $database_name = $self->dba->dbc->dbname;
my $engine = 'MyISAM';
my $diag = "Non-$engine table:";
my $diag = "Non-$engine table";
my $desc = "All tables are using MySQL $engine storage engine";
my $sql = qq/ SELECT TABLE_NAME FROM
information_schema.tables WHERE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sub skip_tests {
sub tests {
my ($self) = @_;
my $desc = "Regulatory features have a valid activity value in at least one epigenome";
my $diag = "regulatory_feature_id";
my $diag = "Regulatory feature";
my $sql = qq/
SELECT rf.regulatory_feature_id FROM
regulatory_build rb JOIN
Expand Down
4 changes: 2 additions & 2 deletions lib/Bio/EnsEMBL/DataCheck/Checks/SequenceLevel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ sub tests {
is_rows_zero($self->dba, $sql_1, $desc_1);

my $desc_2 = 'Coordinate systems with sequence have sequence_level attribute';
my $diag_2 = 'Coordinate system has seq_regions with sequence but no sequence_level attribute';
my $diag_2 = 'No sequence_level attribute for coord_system';
my $sql_2 = qq/
SELECT DISTINCT cs.name FROM
SELECT DISTINCT cs.coord_system_id, cs.name FROM
coord_system cs INNER JOIN
seq_region s USING (coord_system_id) INNER JOIN
dna d USING (seq_region_id)
Expand Down
2 changes: 1 addition & 1 deletion lib/Bio/EnsEMBL/DataCheck/Checks/XrefTypes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ sub tests {
my $desc = 'No xrefs are associated with multiple object types';
my $diag = 'Xrefs are associated with multiple object types';
my $sql = q/
SELECT db_name FROM
SELECT external_db_id, db_name FROM
external_db INNER JOIN
xref USING (external_db_id) INNER JOIN
object_xref USING (xref_id)
Expand Down
13 changes: 9 additions & 4 deletions lib/Bio/EnsEMBL/DataCheck/Test/DataCheck.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ sub _query {

my ($count, $rows);

if ( index( uc($sql), "SELECT COUNT" ) != -1 &&
index( uc($sql), "GROUP BY" ) == -1 )
{
if ($sql =~ /^SELECT COUNT/i && $sql !~ /GROUP BY/i) {
$count = $dbc->sql_helper()->execute_single_result( -SQL => $sql );
} else {
$rows = $dbc->sql_helper()->execute( -SQL => $sql );
Expand Down Expand Up @@ -149,7 +147,14 @@ sub is_rows_zero {
my ( $count, $rows ) = _query( $dbc, $sql );

if (defined $rows) {
$diag_msg ||= 'Unexpected data';
if (!defined $diag_msg) {
$diag_msg = "Unexpected data";
}

my ($columns) = $sql =~ /SELECT(?: DISTINCT) (.*) FROM/m;
if ($columns ne '*') {
$diag_msg .= ": (".$columns.") =";
}

my $counter = 0;
foreach my $row ( @$rows ) {
Expand Down
18 changes: 9 additions & 9 deletions t/TestDataCheck.t
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ subtest 'Counting Database Rows', sub {
is_rows($dba->dbc, $sql_1, 355, 'fail: Use DBConnection instead of DBAdaptor');
},
[
{ ok => 1, depth => undef },
{ ok => 1, depth => undef, name => 'pass: SQL statement with COUNT' },
{ ok => 0, depth => undef },
{ ok => 1, depth => undef },
{ ok => 0, depth => undef },
Expand All @@ -75,7 +75,7 @@ subtest 'Counting Database Rows', sub {
cmp_rows($dba, $sql_1, '!=', 354, 'fail: Not equals comparison');
},
[
{ ok => 1, depth => undef },
{ ok => 1, depth => undef, name => 'pass: Greater than comparison' },
{ ok => 0, depth => undef },
{ ok => 1, depth => undef },
{ ok => 0, depth => undef },
Expand All @@ -91,7 +91,7 @@ subtest 'Counting Database Rows', sub {
is_rows_nonzero($dba, $sql_3, 'fail: Non-zero count');
},
[
{ ok => 1, depth => undef },
{ ok => 1, depth => undef, name => 'pass: Non-zero count' },
{ ok => 0, depth => undef },
],
'is_rows_nonzero method'
Expand All @@ -107,7 +107,7 @@ subtest 'Counting Database Rows', sub {
is_rows_zero($dba, $sql_2, 'fail: SQL statement without COUNT');
},
[
{ ok => 1, depth => undef },
{ ok => 1, depth => undef, name => 'pass: SQL statement with COUNT' },
{ ok => 0, depth => undef },
{ ok => 1, depth => undef },
{ ok => 0, depth => undef },
Expand Down Expand Up @@ -135,7 +135,7 @@ subtest 'Comparing Database Rows', sub {
row_totals($dba, undef, $sql_2, $sql_1, 0.9, 'fail: Row totals with min_proportion');
},
[
{ ok => 1, depth => undef },
{ ok => 1, depth => undef, name => 'pass: Exact row totals' },
{ ok => 0, depth => undef },
{ ok => 1, depth => undef },
{ ok => 1, depth => undef },
Expand All @@ -158,7 +158,7 @@ subtest 'Comparing Database Rows', sub {
row_subtotals($dba, undef, $sql_4, $sql_3, 0.5, 'fail: Row subtotals with min_proportion');
},
[
{ ok => 1, depth => undef },
{ ok => 1, depth => undef, name => 'pass: Row subtotals identical' },
{ ok => 1, depth => undef },
{ ok => 0, depth => undef },
{ ok => 1, depth => undef },
Expand Down Expand Up @@ -193,8 +193,8 @@ subtest 'Foreign Keys', sub {
fk($dba, $table_3, 'ensembl_id', $table_2, $col, 'ensembl_object_type = "Gene"', 'pass: additional constraint');
},
[
{ ok => 1, depth => undef },
{ ok => 1, depth => undef },
{ ok => 1, depth => undef, name => 'All transcript.gene_id rows linked to gene.gene_id rows' },
{ ok => 1, depth => undef, name => 'pass: transcript.gene_id => gene.gene_id' },
{ ok => 1, depth => undef },
],
'fk method'
Expand All @@ -215,7 +215,7 @@ subtest 'Foreign Keys', sub {
fk($dba, $table_3, 'ensembl_id', $table_2, $col, 'ensembl_object_type = "Gene"', 'fail: additional constraint');
},
[
{ ok => 0, depth => undef },
{ ok => 0, depth => undef, name => 'fail: gene.gene_id => transcript.gene_id' },
{ ok => 0, depth => undef },
{ ok => 0, depth => undef },
],
Expand Down

0 comments on commit 4b3204d

Please sign in to comment.