Skip to content

Commit

Permalink
record insertion event and modify if that line was already inserted a…
Browse files Browse the repository at this point in the history
…t, issue #53
  • Loading branch information
suryasaha committed Jul 13, 2015
1 parent abe9af0 commit b2cec9d
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion lib/Bio/GenomeUpdate/TPF.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2011,7 +2011,29 @@ Returns the length of the accession. Added for use in switchover and trim files
}
$line_key++;
}
#print STDERR Dumper \%sequence_accessions_to_remove;

#record insertion event and modify $insert_line_number if that line was already inserted at, issue #53
if ( $insert_before_or_after eq 'before'){
if (!exist $before_insertion_counter{$insert_line_number}){
$before_insertion_counter{$insert_line_number} = 1 ;
}
else{
my $old_insert_line_number = $insert_line_number;
$insert_line_number = $insert_line_number - $before_insertion_counter{$insert_line_number};
$before_insertion_counter{$old_insert_line_number}++ ;
}
}
elsif ( $insert_before_or_after eq 'after'){
if (!exist $after_insertion_counter{$insert_line_number}){
$after_insertion_counter{$insert_line_number} = 1 ;
}
else{
my $old_insert_line_number = $insert_line_number;
$insert_line_number = $insert_line_number + $after_insertion_counter{$insert_line_number};
$after_insertion_counter{$old_insert_line_number}++ ;
}
}

my $accession = $tpfline_accession[$insert_line_number];
my $tpf_line_arr_ref = $accession_tpflines{$accession};
my @temp_arr = @$tpf_line_arr_ref;
Expand Down

0 comments on commit b2cec9d

Please sign in to comment.