Skip to content

Commit

Permalink
Merge pull request #512 from Ensembl/update/check_annotation_source
Browse files Browse the repository at this point in the history
Update/check annotation source
  • Loading branch information
marcoooo committed Oct 17, 2022
2 parents b0c69cb + 85f6324 commit 9c82d7c
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
56 changes: 56 additions & 0 deletions lib/Bio/EnsEMBL/DataCheck/Checks/AnnotationSource.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
=head1 LICENSE
Copyright [2018-2022] 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::AnnotationSource;

use warnings;
use strict;

use Moose;
use Test::More;

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

use constant {
NAME => 'AnnotationSource',
DESCRIPTION => 'If present, the annotation_source meta key must be from an approved list',
GROUPS => ['rapid_release'],
DATACHECK_TYPE => 'critical',
DB_TYPES => ['core'],
TABLES => ['meta']
};
sub tests{
my ($self) = @_;

my $mca = $self->dba->get_adaptor('MetaContainer');

SKIP: {
my $method = $mca->single_value_by_key('genebuild.method');
if($method ne 'braker' && $method ne 'import' && $method ne 'external_annotation_import') {
skip "Annotation source key not needed for Ensembl builds", 1;
}

my $desc = "'species.annotation_source' meta_key exists";
my $annotation_source = lc($mca->single_value_by_key('species.annotation_source'));
ok($annotation_source, $desc);

my $sources = 'braker|genbank|refseq|community|flybase|wormbase|veupathdb|noninsdc';
my $source_desc = "Source is allowed";

skip 'species.annotation_source meta key does not exist', 1 unless defined $annotation_source;

like($annotation_source, qr/^$sources$/, $source_desc);
}


}
9 changes: 9 additions & 0 deletions lib/Bio/EnsEMBL/DataCheck/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@
"name" : "AnalysisWebDataFormat",
"package_name" : "Bio::EnsEMBL::DataCheck::Checks::AnalysisWebDataFormat"
},
"AnnotationSource" : {
"datacheck_type" : "critical",
"description" : "If present, the annotation_source meta key must be from an approved list",
"groups" : [
"rapid_release"
],
"name" : "AnnotationSource",
"package_name" : "Bio::EnsEMBL::DataCheck::Checks::AnnotationSource"
},
"Archive" : {
"datacheck_type" : "critical",
"description" : "Gene archive table is up to date",
Expand Down

0 comments on commit 9c82d7c

Please sign in to comment.