Skip to content

Commit

Permalink
Moved skip statements
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoooo committed Jun 30, 2022
1 parent 96dad5e commit a1d0a9e
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions lib/Bio/EnsEMBL/DataCheck/Checks/APPRISCompareSource.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,53 @@ use File::Spec;
extends 'Bio::EnsEMBL::DataCheck::DbCheck';

use constant {
NAME => 'APPRISCompareSource',
DESCRIPTION => 'APPRIS load match input data in files',
GROUPS => ['geneset_support_level'],
DATACHECK_TYPE => 'critical',
DB_TYPES => ['core'],
TABLES => ['transcript_attrib']
NAME => 'APPRISCompareSource',
DESCRIPTION => 'APPRIS load match input data in files',
GROUPS => [ 'geneset_support_level' ],
DATACHECK_TYPE => 'critical',
DB_TYPES => [ 'core' ],
TABLES => [ 'transcript_attrib' ]
};

sub skip_tests {
if ( ! defined($ENV{'APPRIS_FILE_PATH'}) ) {
return( 1, "No APPRIS_FILE_PATH base dit set" );
}
}

sub tests {
my ($self) = @_;
my $helper = $self->dba->dbc->sql_helper;
my $mca = $self->dba->get_adaptor('MetaContainer');
my $assembly_default = $mca->get_assemnly_default;
my $production_name = $mca->get_production_name;
my $schema_version = $mca->get_schema_version;

# TODO manage the extra parameter to pass to the test a `base_path` value.
# File format : .../Mus_musculus.GRCm38.e93.appris_data.principal.txt
my $file = File::Spec->catfile($ENV{'APPRIS_FILE_PATH'},
join('.', ucfirst($production_name), $assembly_default, "e".$schema_version, 'appris_data', 'principal', 'txt'));
my $desc_1 = 'APPRIS file content match imported transcript_attrib';
my $sql_1 = q/
SELECT UPPER(value), count(*)
FROM transcript_attrib
JOIN attrib_type a using (attrib_type_id)
WHERE a.code = 'appris'
GROUP BY value;
/;
my $attribs_counts = $helper->execute( -SQL => $sql_1 );
my $cut = `cut -f3 $file | sed -r 's/[:]+//g' |sort | uniq -c | awk '{ print $2 " " $1}' `;
my @data=split(/\n/, $cut);
my @line;
my %filecounts;
foreach my $token (@data) {
@line = split(/ /, $token);
$filecounts{$line[0]} = $line[1];
};
foreach my $attrib_count (@$attribs_counts) {
my ($count, $code) = @$attrib_count;
is($count, $filecounts{ $code }, $desc_1);
}
my ($self) = @_;
SKIP: {

my $helper = $self->dba->dbc->sql_helper;
my $mca = $self->dba->get_adaptor('MetaContainer');
my $assembly_default = $mca->get_assemnly_default;
my $production_name = $mca->get_production_name;
my $schema_version = $mca->get_schema_version;
my $file = File::Spec->catfile($ENV{'APPRIS_FILE_PATH'},
join('.', ucfirst($production_name), $assembly_default, "e" . $schema_version, 'appris_data', 'principal', 'txt'));

skip 'No APPRIS_FILE_PATH dir set', 1 unless defined($ENV{'APPRIS_FILE_PATH'});

skip 'No file for current version of database', 1 unless -e $file;
# TODO manage the extra parameter to pass to the test a `base_path` value.
# File format : .../Mus_musculus.GRCm38.e93.appris_data.principal.txt
my $desc_1 = 'APPRIS file content match imported transcript_attrib';
my $sql_1 = q/
SELECT UPPER(value), count(*)
FROM transcript_attrib
JOIN attrib_type a using (attrib_type_id)
WHERE a.code = 'appris'
GROUP BY value;/;

my $attribs_counts = $helper->execute(-SQL => $sql_1);
my $cut = `cut -f3 $file | sed -r 's/[:]+//g' |sort | uniq -c | awk '{ print $2 " " $1}' `;
my @data = split(/\n/, $cut);
my @line;
my %filecounts;
foreach my $token (@data) {
@line = split(/ /, $token);
$filecounts{$line[0]} = $line[1];
};
foreach my $attrib_count (@$attribs_counts) {
my ($count, $code) = @$attrib_count;
is($count, $filecounts{ $code }, $desc_1);
}
}
}

1;

0 comments on commit a1d0a9e

Please sign in to comment.