Skip to content

Commit

Permalink
Merge pull request #249 from Ensembl/bugfix/go_xrefs
Browse files Browse the repository at this point in the history
Update datachecks related to GO xrefs
  • Loading branch information
james-monkeyshines committed May 18, 2020
2 parents f96c296 + 77f5e8f commit 7d5987c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
25 changes: 16 additions & 9 deletions lib/Bio/EnsEMBL/DataCheck/Checks/GOXrefEvidence.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,28 @@ use constant {
DESCRIPTION => 'All GO xrefs have an evidence',
GROUPS => ['xref', 'core'],
DB_TYPES => ['core'],
TABLES => ['object_xref','xref', 'external_db', 'ontology_xref']
TABLES => ['coord_system', 'external_db', 'object_xref', 'ontology_xref', 'seq_region', 'transcript', 'xref']
};

sub tests {
my ($self) = @_;
my $species_id = $self->dba->species_id;

my $desc = "All GO xrefs have an evidence";
my $sql = qq/
SELECT COUNT(*) FROM
object_xref ox JOIN
xref x using (xref_id) JOIN
external_db e using (external_db_id) LEFT JOIN
ontology_xref oox using (object_xref_id)
WHERE
e.db_name='GO' AND
oox.object_xref_id is null
SELECT COUNT(*) FROM
transcript t INNER JOIN
object_xref ox ON t.transcript_id = ox.ensembl_id INNER JOIN
xref x using (xref_id) INNER JOIN
external_db e using (external_db_id) LEFT OUTER JOIN
ontology_xref oox using (object_xref_id) INNER JOIN
seq_region USING (seq_region_id) INNER JOIN
coord_system USING (coord_system_id)
WHERE
ox.ensembl_object_type = 'Transcript' AND
e.db_name = 'GO' AND
oox.object_xref_id IS NULL AND
species_id = $species_id
/;
is_rows_zero($self->dba, $sql, $desc);
}
Expand Down
21 changes: 17 additions & 4 deletions lib/Bio/EnsEMBL/DataCheck/Checks/XrefTypes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ use constant {
sub tests {
my ($self) = @_;

my $desc = 'No xrefs are associated with multiple object types';
my $diag = 'Xrefs are associated with multiple object types';
my $sql = q/
my $desc_1 = 'No xrefs are associated with multiple object types';
my $diag_1 = 'Xrefs are associated with multiple object types';
my $sql_1 = q/
SELECT external_db_id, db_name FROM
external_db INNER JOIN
xref USING (external_db_id) INNER JOIN
Expand All @@ -51,7 +51,20 @@ sub tests {
HAVING COUNT(DISTINCT ensembl_object_type) > 1
/;

is_rows_zero($self->dba, $sql, $desc, $diag);
is_rows_zero($self->dba, $sql_1, $desc_1, $diag_1);

my $desc_2 = 'GO xrefs are only associated with transcripts';
my $sql_2 = q/
SELECT COUNT(*) FROM
external_db INNER JOIN
xref USING (external_db_id) INNER JOIN
object_xref USING (xref_id)
WHERE
db_name = 'GO' AND
ensembl_object_type <> 'Transcript'
/;

is_rows_zero($self->dba, $sql_2, $desc_2);
}

1;

0 comments on commit 7d5987c

Please sign in to comment.