Skip to content

Commit

Permalink
Merge branch 'postreleasefix/110' into release/110
Browse files Browse the repository at this point in the history
  • Loading branch information
likhitha-surapaneni committed May 18, 2023
2 parents 8bfc5fb + abcb2b3 commit 498c619
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2068,10 +2068,8 @@ sub _hgvs_from_components {

# take alternate allele from genomic reference & coordinates if not supplied in HGVS string for a duplication
if($description =~ /dup/){
## special case: handle as insertion for ensembl object purposes
$start = $end ;
if($strand == 1){ $start++; }
else{ $end--; }
## special case: handle as insertion for ensembl object purposes
$start = $end + 1;

$ref_allele = "-" ;
$alt_allele = $refseq_allele;
Expand Down
6 changes: 5 additions & 1 deletion modules/Bio/EnsEMBL/Variation/TranscriptVariationAllele.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1387,14 +1387,17 @@ sub hgvs_transcript {

return undef if (($self->{_slice}->end - $self->{_slice}->start + 1) < ($self->{_slice_end} + $offset_to_add));
#return undef if (length($self->{_slice}->seq()) < ($self->{_slice_end} + $offset_to_add));

my $dup_lookup_direction = ($refseq_strand == -1 && !$offset_to_add) ? 1 : -1;
$hgvs_notation = hgvs_variant_notation(
$variation_feature_sequence, ### alt_allele,
$self->{_slice}->seq(), ### using this to extract ref allele
$self->{_slice_start} + $offset_to_add,
$self->{_slice_end} + $offset_to_add,
"",
"",
$var_name
$var_name,
$dup_lookup_direction
);

### This should not happen
Expand All @@ -1403,6 +1406,7 @@ sub hgvs_transcript {
return undef;
}


## check for the same bases in ref and alt strings before or after the variant
$hgvs_notation = _clip_alleles($hgvs_notation) unless $hgvs_notation->{'type'} eq 'dup';

Expand Down
20 changes: 15 additions & 5 deletions modules/Bio/EnsEMBL/Variation/Utils/Sequence.pm
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,15 @@ sub hgvs_variant_notation {
my $display_start = shift;
my $display_end = shift;
my $var_name = shift;
my $dup_lookup_direction = shift;

# If display_start and display_end were not specified, use ref_start and ref_end
$display_start ||= $ref_start;
$display_end ||= $ref_end;

# the direction to look for ref seq match with alt allele to see if it is dup type
$dup_lookup_direction ||= -1;

#Throw an exception if the lengths of the display interval and reference interval are different
throw("The coordinate interval for display is of different length than for the reference allele") if (($display_end - $display_start) != ($ref_end - $ref_start));

Expand All @@ -526,7 +530,6 @@ sub hgvs_variant_notation {
#warn "\nError in HGVS calculation for $var_name: alt allele ($alt_allele) is the same as the reference allele ($ref_allele) - potential strand or allele ordering problem - skipping\n";
return undef ;
}

# Store the notation in a hash that will be returned
my %notation;
$notation{'start'} = $display_start;
Expand Down Expand Up @@ -567,14 +570,20 @@ sub hgvs_variant_notation {
if (!$ref_length) {

# Get the same number of nucleotides preceding the insertion as the length of the insertion
my $prev_str = substr($ref_sequence,($ref_end-$alt_length),$alt_length);
my $prev_str = $dup_lookup_direction == -1 ?
substr($ref_sequence,($ref_end-$alt_length),$alt_length) :
substr($ref_sequence,$ref_end,$alt_length);

# If they match, this is a duplication
if ($prev_str eq $alt_allele) {

$notation{'start'} = ($display_end - $alt_length + 1);

if ($dup_lookup_direction == -1){
$notation{'start'} = ($display_end - $alt_length + 1);
}
else{
$notation{'end'} = $display_start + $alt_length - 1;
}
$notation{'type'} = 'dup';

# Return the notation
return \%notation;
}
Expand Down Expand Up @@ -605,6 +614,7 @@ sub hgvs_variant_notation {

# Else, it's gotta be a delins
$notation{'type'} = 'delins';

return \%notation;
}

Expand Down
10 changes: 5 additions & 5 deletions modules/t/hgvs_parser.t
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ my %test_input = (
);

my %test_input_shifted = (
28 => ["X:g.131215392_131215393insA",
28 => ["X:g.131215393_131215394insA",
"ENST00000298542.4:c.905+998dup",
"X:g.131215401dup",
],
Expand Down Expand Up @@ -530,9 +530,9 @@ my %test_input_shifted = (

## results which change on left-shifting - not shifted
my %test_output_no_shift = (
1 => ["X:g.131215393dup",
1 => ["X:g.131215394dup",
"A",
"ENST00000298542.4:c.905+997dup",
"ENST00000298542.4:c.905+997dup",
"T",
"",
"duplication, intronic rc transcript"
Expand Down Expand Up @@ -586,8 +586,8 @@ my %test_output_no_shift = (


my %test_input_no_shift = (
1 => ["X:g.131215393dup",
"ENST00000298542.4:c.905+997dup",
1 => ["X:g.131215394dup",
"ENST00000298542.4:c.905+997dup",
],
2 => ["NC_000011.9:g.32417913_32417914insCCTACGAGTACTACC",
"ENST00000530998.1:c.451_452insGGTAGTACTCGTAGG",
Expand Down

0 comments on commit 498c619

Please sign in to comment.