Skip to content

Commit

Permalink
Merge pull request #384 from dglemos/hgvs/fix_refseq_vep_96
Browse files Browse the repository at this point in the history
Fix HGVS refseq transcripts
  • Loading branch information
sarahhunt committed May 22, 2019
2 parents 1f67fdd + fbf2183 commit 617872b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,10 @@ sub fetch_by_hgvs_notation {
my $transcript = $transcript_adaptor->fetch_by_stable_id($reference);

my @transcripts;

if(!defined($transcript) && ($reference =~ /NM_/ || $reference =~ /XM_/)){
@transcripts = @{$transcript_adaptor->fetch_all_by_external_name($reference)};
}

#try and fetch via gene
if(!defined($transcript)) {
Expand Down Expand Up @@ -1851,6 +1855,11 @@ sub fetch_by_hgvs_notation {

my @transcripts;

# Fetch xref transcript
if(!defined($transcript) && ($reference =~ /NP/ || $reference =~ /XP/)){
@transcripts = @{$transcript_adaptor->fetch_all_by_external_name($reference)};
}

# support some malformed HGVS
if(!defined($transcript)) {
# Seeing transcripts erroneously submitted with p. changes
Expand Down
17 changes: 15 additions & 2 deletions modules/Bio/EnsEMBL/Variation/TranscriptVariationAllele.pm
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ sub hgvs_transcript_reference{

}

use Data::Dumper;

=head2 hgvs_protein
Expand Down Expand Up @@ -1022,8 +1023,20 @@ sub hgvs_protein {

## checks complete - start building term

### get reference sequence and add seq version unless LRG
$hgvs_notation->{ref_name} = $tr->translation->display_id();
### get reference sequence
### this is a temporary fix
if($tr->stable_id =~ /^ENS|^LRG/ || !defined($tr->analysis) || (defined($tr->analysis) && !defined($tr->analysis->db()))){
$hgvs_notation->{ref_name} = $tr->translation->display_id();
}
else{
### get RefSeq identifiers
my @entries = grep {$_->{dbname} eq 'GenBank'} @{$tr->translation->get_all_DBEntries};
if(scalar @entries == 1){
$hgvs_notation->{ref_name} = $entries[0]->{primary_id};
}
}

# Add seq version unless LRG
$hgvs_notation->{ref_name} .= "." . $tr->translation->version()
unless ($hgvs_notation->{ref_name}=~ /\.\d+$/ || $hgvs_notation->{ref_name} =~ /LRG/);

Expand Down

0 comments on commit 617872b

Please sign in to comment.