Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable id display xref #133

Merged
merged 2 commits into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions lib/Bio/EnsEMBL/DataCheck/Checks/StableIdDisplayXref.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
=head1 LICENSE

Copyright [2018-2019] EMBL-European Bioinformatics Institute

Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=cut

package Bio::EnsEMBL::DataCheck::Checks::StableIdDisplayXref;

use warnings;
use strict;

use Moose;
use Test::More;
use Bio::EnsEMBL::DataCheck::Test::DataCheck;

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

use constant {
NAME => 'StableIdDisplayXref',
DESCRIPTION => 'Genes/Transcript display_xref does not have display_label set as stable_id',
GROUPS => ['xref'],
DB_TYPES => ['core'],
TABLES => ['gene','transcript','xref']
};

sub tests {
my ($self) = @_;
$self->check_display_xref('gene');
$self->check_display_xref('transcript');
}

sub check_display_xref {
my ($self, $table) = @_;
my $species_id = $self->dba->species_id;
my $desc = "No $table found with stable_id set as display_xrefs";
my $diag = "$table found with stable_id set as display_xrefs";
my $sql = qq/
SELECT stable_id FROM
$table tb JOIN
xref x on (tb.display_xref_id=x.xref_id) JOIN
seq_region sr USING (seq_region_id) INNER JOIN
coord_system cs USING (coord_system_id)
WHERE x.display_label=tb.stable_id AND
cs.species_id = $species_id
/;

is_rows_zero($self->dba, $sql, $desc, $diag);
}

1;
9 changes: 9 additions & 0 deletions lib/Bio/EnsEMBL/DataCheck/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,15 @@
"name" : "StableIDUnique",
"package_name" : "Bio::EnsEMBL::DataCheck::Checks::StableIDUnique"
},
"StableIdDisplayXref" : {
"datacheck_type" : "critical",
"description" : "Genes/Transcript display_xref does not have display_label set as stable_id",
"groups" : [
"xref"
],
"name" : "StableIdDisplayXref",
"package_name" : "Bio::EnsEMBL::DataCheck::Checks::StableIdDisplayXref"
},
"StructuralVariationFeature" : {
"datacheck_type" : "critical",
"description" : "StructuralVariationFeature table data is present and correct",
Expand Down