Skip to content

Commit

Permalink
Allow to add version to gene stable id (Ensembl#1717)
Browse files Browse the repository at this point in the history
* Allow to add version to gene stable id

* Fix unit test
  • Loading branch information
nakib103 authored Jul 10, 2024
1 parent edbfbd7 commit e3a887e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ sub get_features_by_regions_uncached {

foreach my $gene(map {$_->transfer($sr_slice)} @{$sub_slice->get_all_Genes(undef, undef, 1)}) {
my $gene_stable_id = $gene->stable_id;
my $gene_version = $gene->version;
my $canonical_tr_id = $gene->{canonical_transcript_id};

# any phenotypes?
Expand Down Expand Up @@ -268,6 +269,7 @@ sub get_features_by_regions_uncached {
next if @{ $tr->get_all_Attributes("readthrough_tra") };

$tr->{_gene_stable_id} = $gene_stable_id;
$tr->{_gene_version} = $gene_version;
$tr->{_gene} = $gene;
$self->prefetch_gene_ids($tr);

Expand Down
1 change: 1 addition & 0 deletions modules/Bio/EnsEMBL/VEP/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ our @VEP_PARAMS = (
'hgnc', # add HGNC gene ID to extra column
'symbol', # add gene symbol (e.g. HGNC)
'transcript_version', # add transcript version to stable id in feature column
'gene_version', # add gene version to stable id in gene column
'gene_phenotype', # indicate if genes are phenotype-associated
'mirna', # identify miRNA structural elements overlapped by variant
'spdi', # add genomic SPDI
Expand Down
2 changes: 2 additions & 0 deletions modules/Bio/EnsEMBL/VEP/OutputFactory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ sub new {
tsl
appris
transcript_version
gene_version
gene_phenotype
mirna
ambiguity
Expand Down Expand Up @@ -1388,6 +1389,7 @@ sub BaseTranscriptVariationAllele_to_output_hash {

# get gene
$hash->{Gene} = $tr->{_gene_stable_id};
$hash->{Gene} .= '.'.$tr->{_gene_version} if $self->{gene_version} && $tr->{_gene_version} && $hash->{Gene} !~ /\.\d+$/;

# strand
$hash->{STRAND} = $tr->strand + 0;
Expand Down
1 change: 1 addition & 0 deletions t/Runner.t
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ is_deeply($runner->get_OutputFactory, bless( {
'af_gnomade' => undef,
'af_gnomadg' => undef,
'transcript_version' => undef,
'gene_version' => undef,
'cell_type' => undef,
'mirna' => undef,
'ambiguity' => undef,
Expand Down

0 comments on commit e3a887e

Please sign in to comment.