Skip to content

Commit

Permalink
add more checks to ensure frequency annotation works
Browse files Browse the repository at this point in the history
  • Loading branch information
at7 committed Nov 23, 2018
1 parent 0cd42fd commit f213e6a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions G2P.pm
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ sub new {
my $class = shift;

my $self = $class->SUPER::new(@_);

# suppress warnings that the FeatureAdpators spit if using no_slice_cache
Bio::EnsEMBL::Utils::Exception::verbose(1999);

my $supported_af_keys = { map {$_ => 1} @population_wide };

my $params = $self->params_to_hash();
Expand Down Expand Up @@ -316,6 +318,8 @@ sub new {
$self->{config}->{reg} = $reg;
}

$self->{config}->{can_use_hts_pm} = $CAN_USE_HTS_PM;

my $va = $self->{config}->{reg}->get_adaptor($self->{config}->{species}, 'variation', 'variation');
$va->db->use_vcf(1) if ($CAN_USE_HTS_PM);
$va->db->include_failed_variations(1);
Expand Down Expand Up @@ -678,7 +682,7 @@ sub get_freq {
return [$cache->{$allele}->{freq}, $cache->{$allele}->{ex_variant}, $cache->{$allele}->{passed_ar}];
}

if (!$vf->{existing}) {
if (!$vf->{existing} || ! scalar @{$vf->{existing}}) {
my $failed_ars = {};
my $freqs = {};
my $passed = $self->frequencies_from_VCF($freqs, $vf, $allele, $ars, $failed_ars);
Expand Down Expand Up @@ -814,6 +818,7 @@ sub frequencies_from_VCF {
my $vf_allele = shift;
my $ars = shift;
my $failed_ars = shift;
return 1 if (!defined $self->{user_params}->{af_from_vcf});
return 1 if (!$CAN_USE_HTS_PM);
my $vca = $self->{config}->{vca};
my $collections = $vca->fetch_all;
Expand Down

0 comments on commit f213e6a

Please sign in to comment.