Skip to content

Commit

Permalink
Changes in rejoin_vf; Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
likhitha-surapaneni committed Dec 4, 2024
1 parent d3d655c commit df56c61
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 9 deletions.
3 changes: 2 additions & 1 deletion modules/Bio/EnsEMBL/VEP/InputBuffer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ sub split_variants {
$first->{original_allele_string} = $original_vf->{allele_string};
$first->{original_start} = $original_vf->{start};
$first->{original_end} = $original_vf->{end};
$first->{minimised} = 1
$first->{minimised} = 1;
$first->{first} = 1;
}

push @tmp, $new_vf;
Expand Down
3 changes: 2 additions & 1 deletion modules/Bio/EnsEMBL/VEP/OutputFactory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,8 @@ sub rejoin_variants_in_InputBuffer {
foreach my $vf(@{$buffer->buffer}) {

# reset original one
if(defined($vf->{original_allele_string})) {
# check $vf->{first} to get first $vf in split_variants
if(defined($vf->{first})) {

# do consequence stuff
$self->get_all_output_hashes_by_VariationFeature($vf);
Expand Down
10 changes: 10 additions & 0 deletions t/InputBuffer.t
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ is_deeply($vfs->[0], bless( {
'variation_name' => 'rs142513484',
'map_weight' => 1,
'allele_string' => 'C/T',
'nontrimmed_allele_string' => 'C/T',
'end' => 25585733,
'start' => 25585733,
'seq_region_end' => 25585733,
Expand All @@ -90,6 +91,7 @@ is_deeply($vfs->[0], bless( {
'variation_name' => 'rs148490508',
'map_weight' => 1,
'allele_string' => 'A/G',
'nontrimmed_allele_string' => 'A/G',
'end' => 25592911,
'start' => 25592911,
'seq_region_end' => 25592911,
Expand Down Expand Up @@ -418,7 +420,9 @@ is_deeply($ib->buffer, [
'chr' => '1',
'minimised' => 1,
'original_allele_string' => 'CAGAAGAAAG/TAGAAGAAAG/C',
'nontrimmed_allele_string' => 'CAGAAGAAAG/TAGAAGAAAG/C',
'original_end' => 10,
'first' => 1,
'end' => 1,
'original_start' => 1,
'strand' => 1,
Expand All @@ -439,7 +443,10 @@ is_deeply($ib->buffer, [
'variation_name' => '.',
'alt_allele' => '-',
'map_weight' => 1,
'minimised' => 1,
'allele_string' => 'AGAAGAAAG/-',
'original_allele_string' => 'CAGAAGAAAG/TAGAAGAAAG/C',
'nontrimmed_allele_string' => 'CAGAAGAAAG/TAGAAGAAAG/C',
'start' => 2,
'seq_region_start' => 2,
'seq_region_end' => 10,
Expand Down Expand Up @@ -470,7 +477,10 @@ is_deeply(
'strand' => 1,
'variation_name' => '.',
'map_weight' => 1,
'minimised' => 1,
'allele_string' => 'CAG/TAG/T',
'original_allele_string' => 'CAG/TAG/T',
'nontrimmed_allele_string' => 'CAG/TAG/T',
'end' => 3,
'start' => 1,
'seq_region_start' => 1,
Expand Down
4 changes: 3 additions & 1 deletion t/OutputFactory.t
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,9 @@ $ib = get_annotated_buffer({

is(scalar @{$ib->buffer}, 2, 'minimal - expanded count');
is($ib->buffer->[0]->allele_string, 'C/T', 'minimal - expanded first allele string');

# print("Before rejoin\n");
# use Data::Dumper;
# print(Dumper($ib->buffer));
$of->rejoin_variants_in_InputBuffer($ib);

is(scalar @{$ib->buffer}, 1, 'minimal - rejoined count');
Expand Down
2 changes: 1 addition & 1 deletion t/OutputFactory_JSON.t
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ SKIP: {
'cdna_start' => 2347,
'transcript_id' => 'NM_000484.3',
'gene_id' => '351',
'uploaded_allele' => '-/A',
'uploaded_allele' => 'G/GA',
'cds_start' => 2147,
'protein_start' => 716,
'refseq_match' => [
Expand Down
2 changes: 2 additions & 0 deletions t/Parser_Region.t
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ is_deeply($vf, bless( {
'strand' => '1',
'variation_name' => '21:25587759-25587758:1/A',
'map_weight' => 1,
'minimised' => 1,
'allele_string' => '-/A',
'original_allele_string' => '-/A',
'end' => '25587758',
'start' => '25587759',
'seq_region_end' => '25587758',
Expand Down
26 changes: 21 additions & 5 deletions t/Parser_VCF.t
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,17 @@ is_deeply($vf, bless( {
'strand' => 1,
'variation_name' => 'test',
'map_weight' => 1,
'minimised' => 1,
'allele_string' => 'A/C/GG',
'nontrimmed_allele_string' => 'A/C/GG',
'original_allele_string' => 'A/C/GG',
'end' => 25587759,
'start' => 25587759,
'seq_region_end' => 25587759,
'seq_region_start' => 25587759
}, 'Bio::EnsEMBL::Variation::VariationFeature' ), 'mixed types - different first base');

# mixed types - different first base
# mixed types - same first base
$vf = Bio::EnsEMBL::VEP::Parser::VCF->new({
config => $cfg,
file => $test_cfg->create_input_file([qw(21 25587759 test G GC,GT . . .)]),
Expand All @@ -235,8 +237,10 @@ is_deeply($vf, bless( {
'strand' => 1,
'variation_name' => 'test',
'map_weight' => 1,
'minimised' => 1,
'allele_string' => '-/C/T',
'original_allele_string' => 'A/C/GG',
'original_allele_string' => 'G/GC/GT',
'nontrimmed_allele_string' => 'G/GC/GT',
'end' => 25587759,
'start' => 25587760,
'seq_region_end' => 25587759,
Expand Down Expand Up @@ -322,8 +326,10 @@ is_deeply($vf, bless( {
'strand' => 1,
'variation_name' => 'test',
'map_weight' => 1,
'minimised' => 1,
'allele_string' => 'G/C/<DEL:*>',
'original_allele_string' => 'G/C/<DEL:*>',
'nontrimmed_allele_string' => 'G/C/<DEL:*>',
'end' => 25587759,
'start' => 25587759,
'seq_region_end' => 25587759,
Expand All @@ -342,8 +348,10 @@ is_deeply($vf, bless( {
'strand' => 1,
'variation_name' => 'test',
'map_weight' => 1,
'minimised' => 1,
'allele_string' => 'C/-/*',
'original_allele_string' => 'GC/G/*',
'nontrimmed_allele_string' => 'GC/G/*',
'end' => 25587760,
'start' => 25587760,
'seq_region_end' => 25587760,
Expand All @@ -362,8 +370,10 @@ is_deeply($vf, bless( {
'strand' => 1,
'variation_name' => 'test',
'map_weight' => 1,
'minimised' => 1,
'allele_string' => '-/C/*',
'original_allele_string' => 'G/GC/*',
'nontrimmed_allele_string' => 'G/GC/*',
'end' => 25587759,
'start' => 25587760,
'seq_region_end' => 25587759,
Expand All @@ -382,6 +392,7 @@ is_deeply($vf, bless( {
'chr' => '21',
'minimised' => 1,
'original_allele_string' => 'CAT/CCT',
'nontrimmed_allele_string' => 'CAT/CCT',
'original_end' => 25587760,
'end' => 25587759,
'seq_region_end' => 25587759,
Expand All @@ -406,8 +417,10 @@ is_deeply($vf, bless( {
'strand' => 1,
'variation_name' => 'test',
'map_weight' => 1,
'minimised' => 1,
'allele_string' => 'C/T/CAA',
'original_allele_string' => 'C/T/CAA',
'nontrimmed_allele_string' => 'C/T/CAA',
'end' => 25587758,
'start' => 25587758,
'seq_region_end' => 25587758,
Expand Down Expand Up @@ -944,7 +957,8 @@ is_deeply($tandem_RUC, bless( {
'end' => 25587769,
'seq_region_start' => 25587760,
'seq_region_end' => 25587769,
'map_weight' => 1
'map_weight' => 1,
'minimised' => 1
},
'Bio::EnsEMBL::Variation::VariationFeature' ) ,
'VariationFeature - tandem repeat using RUC');
Expand All @@ -963,7 +977,8 @@ is_deeply($tandem, bless( {
'end' => 25587769,
'seq_region_start' => 25587760,
'seq_region_end' => 25587769,
'map_weight' => 1
'map_weight' => 1,
'minimised' => 1
},
'Bio::EnsEMBL::Variation::VariationFeature' ) ,
'VariationFeature - tandem repeat with missing sequence');
Expand All @@ -987,7 +1002,8 @@ is_deeply($tandem, bless( {
'end' => 25587760,
'seq_region_start' => 25587760,
'seq_region_end' => 25587760,
'map_weight' => 1
'map_weight' => 1,
'minimised' => 1
},
'Bio::EnsEMBL::Variation::VariationFeature' ) ,
'VariationFeature - tandem repeat with missing END and SVLEN');
Expand Down

0 comments on commit df56c61

Please sign in to comment.