From fe6aab1b6fb2e4b78f81f0bb0853bd951275ecce Mon Sep 17 00:00:00 2001 From: Nuno Agostinho Date: Thu, 30 Nov 2023 13:21:44 +0000 Subject: [PATCH 1/2] Fix incorrect variant end in web VEP --- modules/Bio/EnsEMBL/Variation/VariationFeature.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/Bio/EnsEMBL/Variation/VariationFeature.pm b/modules/Bio/EnsEMBL/Variation/VariationFeature.pm index 6fcf268b1..73e4d1195 100755 --- a/modules/Bio/EnsEMBL/Variation/VariationFeature.pm +++ b/modules/Bio/EnsEMBL/Variation/VariationFeature.pm @@ -2340,6 +2340,8 @@ sub to_VCF_record { $non_acgt = 1 if $allele && $allele !~ /^[ACGTN\.]+$/; } + my $INFO = $self->end ? 'END='.$self->end : '.'; + # in/del/unbalanced if($non_acgt || scalar keys %allele_lengths > 1) { @@ -2382,7 +2384,7 @@ sub to_VCF_record { $self->variation_name || '.', shift @alleles, (join ",", @alleles) || '.', - '.', '.', '.' + '.', '.', $INFO ]; } @@ -2395,7 +2397,7 @@ sub to_VCF_record { $self->variation_name || '.', shift @alleles, (join ",", @alleles) || '.', - '.', '.', '.' + '.', '.', $INFO ]; } } From da68ff64d04b455f7a7eaa14a5fbcdd98995d09c Mon Sep 17 00:00:00 2001 From: Nuno Agostinho Date: Fri, 1 Dec 2023 15:24:55 +0000 Subject: [PATCH 2/2] Fix unit tests --- modules/t/variationFeature.t | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/t/variationFeature.t b/modules/t/variationFeature.t index 137c4d16f..b75e91310 100755 --- a/modules/t/variationFeature.t +++ b/modules/t/variationFeature.t @@ -161,14 +161,14 @@ my $sr_start = $vf->seq_region_start; is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start, $vname, 'A', 'T', '.', '.', '.'], + [$chr, $sr_start, $vname, 'A', 'T', '.', '.', "END=$end"], 'to_VCF_record' ); $vf->strand(-1); is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start, $vname, 'T', 'A', '.', '.', '.'], + [$chr, $sr_start, $vname, 'T', 'A', '.', '.', "END=$end"], 'to_VCF_record - rev strand' ); $vf->strand($strand); @@ -176,35 +176,35 @@ $vf->strand($strand); $vf->allele_string('A/G/T'); is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start, $vname, 'A', 'G,T', '.', '.', '.'], + [$chr, $sr_start, $vname, 'A', 'G,T', '.', '.', "END=$end"], 'to_VCF_record - multiple alts' ); $vf->allele_string('AG/CT'); is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start, $vname, 'AG', 'CT', '.', '.', '.'], + [$chr, $sr_start, $vname, 'AG', 'CT', '.', '.', "END=$end"], 'to_VCF_record - balanced non-SNP' ); $vf->allele_string('A/-'); is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start - 1, $vname, 'NA', 'N', '.', '.', '.'], + [$chr, $sr_start - 1, $vname, 'NA', 'N', '.', '.', "END=$end"], 'to_VCF_record - deletion' ); $vf->allele_string('-/A'); is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start - 1, $vname, 'N', 'NA', '.', '.', '.'], + [$chr, $sr_start - 1, $vname, 'N', 'NA', '.', '.', "END=$end"], 'to_VCF_record - insertion' ); $vf->allele_string('A/-/G'); is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start - 1, $vname, 'NA', 'N,NG', '.', '.', '.'], + [$chr, $sr_start - 1, $vname, 'NA', 'N,NG', '.', '.', "END=$end"], 'to_VCF_record - mixed' ); @@ -213,21 +213,21 @@ $vf->allele_string('HGMD_MUTATION'); $vf->{class_SO_term} = 'SNV'; is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start, $vname, 'N', 'N', '.', '.', '.'], + [$chr, $sr_start, $vname, 'N', 'N', '.', '.', "END=$end"], 'to_VCF_record - unknown alleles SNV' ); $vf->{class_SO_term} = 'insertion'; is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start - 1, $vname, 'N', '', '.', '.', '.'], + [$chr, $sr_start - 1, $vname, 'N', '', '.', '.', "END=$end"], 'to_VCF_record - unknown alleles insertion' ); $vf->{class_SO_term} = 'deletion'; is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start - 1, $vname, 'NN', 'N', '.', '.', '.'], + [$chr, $sr_start - 1, $vname, 'NN', 'N', '.', '.', "END=$end"], 'to_VCF_record - unknown alleles deletion' ); @@ -242,14 +242,14 @@ my $fully_justified_allele_str = 'ACGTGGACG/ACG/ACGTGGACGTGGACG'; $vf->allele_string($fully_justified_allele_str); is_deeply( $vf->to_VCF_record(), - [$chr, $sr_start, $vname, 'ACGTGGA', 'A,ACGTGGACGTGGA', '.', '.', '.'], + [$chr, $sr_start, $vname, 'ACGTGGA', 'A,ACGTGGACGTGGA', '.', '.', "END=$end"], 'to_VCF_record - fully justified allele string clipped' ); is_deeply( $vf->to_VCF_record(1), - [$chr, $sr_start, $vname, 'ACGTGGACG', 'ACG,ACGTGGACGTGGACG', '.', '.', '.'], + [$chr, $sr_start, $vname, 'ACGTGGACG', 'ACG,ACGTGGACGTGGACG', '.', '.', "END=$end"], 'to_VCF_record - fully justified allele string not clipped' );