Skip to content

Commit

Permalink
Merge 76e007f into 4596b19
Browse files Browse the repository at this point in the history
  • Loading branch information
aparton committed May 5, 2021
2 parents 4596b19 + 76e007f commit 0f507eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
16 changes: 2 additions & 14 deletions modules/Bio/EnsEMBL/Variation/Variation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,8 @@ sub get_VariationFeature_by_dbID{
Arg [1] : (optional) string $source - the source of the synonyms to
return.
Arg [2] : (optional) integer $include_source - include the source of the synonyms in
the output.
Example : @dbsnp_syns = @{$v->get_all_synonyms('dbSNP')};
@all_syns = @{$v->get_all_synonyms()};
@all_syns_with_source = @{$v->get_all_synonyms('', 1)};
Description: Retrieves synonyms for this Variation. If a source argument
is provided all synonyms from that source are returned,
otherwise all synonyms are returned.
Expand All @@ -421,7 +418,6 @@ sub get_VariationFeature_by_dbID{
sub get_all_synonyms {
my $self = shift;
my $source = shift;
my $include_source = shift;

if ($source) {
$source = [$source];
Expand All @@ -431,21 +427,13 @@ sub get_all_synonyms {
}

my @synonyms;

if(!$include_source) {
map {push(@synonyms,keys(%{$self->{synonyms}{$_}}))} @{$source};
}
else {
foreach my $source (keys %{$self->{'synonyms'}}) {
my @list_synonyms = keys %{$self->{'synonyms'}->{$source}};
push(@synonyms, $source . ': ' . join(',', @list_synonyms));
}
}
map {push(@synonyms,keys(%{$self->{synonyms}{$_}}))} @{$source};

return \@synonyms;
}



=head2 get_all_synonym_sources
Arg [1] : none
Expand Down
8 changes: 0 additions & 8 deletions modules/t/variation.t
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,6 @@ ok($sources[0] eq 'TSC' &&
my @dbsnp_syns = @{$v->get_all_synonyms('dbSNP')};
ok(@{$v->get_all_synonyms()} == 4, "count synonyms");

# test variation synonyms - get_all_synonyms() returns the source name and the variation synonyms
my $var_syn_1 = $variation_adaptor->fetch_by_name('rs2299222');
my $variation_synonyms_1 = $var_syn_1->get_all_synonyms('',1);
ok(@$variation_synonyms_1[0] eq 'Archive dbSNP: rs60739517,rs17765152', 'get_all_synonyms include source - valid (source Archive dbSNP)');

my $var_syn_3 = $variation_adaptor->fetch_by_name('rs117161559');
my $variation_synonyms_3 = $var_syn_3->get_all_synonyms('',1);
ok(@$variation_synonyms_3 == 0, 'get_all_synonyms include source - no variant synonyms');


# test add_Allele, get_all_Alleles
Expand Down

0 comments on commit 0f507eb

Please sign in to comment.