Skip to content
Snippets Groups Projects
Commit 2ded5dc2 authored by Patrick Meidl's avatar Patrick Meidl
Browse files

now also merges adjacent alignment blocks

parent 3daa6a11
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,9 @@ This script removes overlapping mappings that were generated by the code in
align_nonident_regions.pl. Mappings are trimmed so that no overlaps are present
in the assembly table, because such overlaps may break the AssemblyMapper when
projecting between the two assemblies.
It also merges adjacent assembly segments which can result from alternating
alignments from clone identity and blastz alignment.
=head1 RELATED FILES
......@@ -152,8 +155,33 @@ foreach my $chr ($support->sort_chromosomes($support->get_chrlength(undef, undef
push @rows, $last;
my $i = 0;
my $j = 0;
while ($last and (my $r = $sth->fetchrow_hashref)) {
# merge adjacent assembly segments (these can result from alternating
# alignments from clone identity and blastz alignment)
if ($last->{'asm_end'} == ($r->{'asm_start'} - 1) and
$last->{'cmp_end'} == ($r->{'cmp_start'} - 1)) {
$j++;
# debug warnings
$support->log_verbose('last: '.sprintf($fmt1, map { $last->{$_} }
qw(asm_start asm_end cmp_start cmp_end ori)), 1);
$support->log_verbose('this: '.sprintf($fmt1, map { $r->{$_} }
qw(asm_start asm_end cmp_start cmp_end ori)), 1);
# remove last row
pop(@rows);
# merge segments and add new row
$last->{'asm_end'} = $r->{'asm_end'};
$last->{'cmp_end'} = $r->{'cmp_end'};
push @rows, $last;
next;
}
# look for overlaps with last segment
if ($last->{'asm_end'} >= $r->{'asm_start'}) {
......@@ -190,6 +218,7 @@ foreach my $chr ($support->sort_chromosomes($support->get_chrlength(undef, undef
}
$support->log("Fixed $i mappings.\n", 1);
$support->log("Merged $j mappings.\n", 1);
}
$sth->finish;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment