None available.
sub process_insert
{ my $cdna_ins_pos_ref = shift; my $insert_len = shift;
my $exon = shift;
my $transcript = shift;
info("insert ($insert_len) at " .$$cdna_ins_pos_ref);
my $code = StatMsg::EXON | StatMsg::INSERT |
Length::length2code($insert_len);
if($$cdna_ins_pos_ref < $exon->cdna_start() ||
$$cdna_ins_pos_ref >= $exon->cdna_end()) {
if($$cdna_ins_pos_ref < $exon->cdna_start &&
$$cdna_ins_pos_ref + 3 >= $exon->cdna_start ) {
$exon->add_StatMsg(StatMsg->new($code | StatMsg::CONFUSED));
$exon->fail(1);
return;
}
throw("Unexpected: insertion is outside of exon boundary\n" .
" ins_left = $$cdna_ins_pos_ref\n" .
" ins_right = " . ($$cdna_ins_pos_ref+1) . "\n" .
" cdna_exon_start = ". $exon->cdna_start()."\n" .
" cdna_exon_end = ". $exon->cdna_end()."\n");
}
if($$cdna_ins_pos_ref >= $transcript->cdna_coding_start() &&
$$cdna_ins_pos_ref < $transcript->cdna_coding_end()) {
info("insertion in cds ($insert_len)");
info("BEFORE CDS INSERT:");
print_exon($exon, $transcript);
$code |= StatMsg::CDS;
$transcript->move_cdna_coding_end($insert_len);
my $frameshift = $insert_len % 3;
if($frameshift) {
$code |= StatMsg::FRAMESHIFT;
info("introducing frameshift intron to maintain reading frame");
my $first_len = $$cdna_ins_pos_ref - $exon->cdna_start() + 1;
my $first_exon = InterimExon->new();
%{$first_exon} = %{$exon};
$exon->add_StatMsg(StatMsg->new(StatMsg::EXON | StatMsg::SPLIT));
$first_exon->cdna_end($first_exon->cdna_start + $first_len - 1);
$exon->cdna_start($first_exon->cdna_end + 1);
$exon->cdna_end($exon->cdna_end - $frameshift);
$transcript->move_cdna_coding_end(-$frameshift);
$first_exon->set_split_phases($exon, $transcript);
$$cdna_ins_pos_ref -= $frameshift;
if($exon->strand() == 1) {
$first_exon->end($first_exon->start() + $first_len -1 );
$exon->start($exon->start() + $first_len + $frameshift);
} else {
$first_exon->start($first_exon->end() - $first_len + 1);
$exon->end($exon->end() - ($first_len + $frameshift));
}
$transcript->add_Exon($first_exon);
}
info("AFTER CDS INSERT:");
print_exon($exon, $transcript);
}
elsif($$cdna_ins_pos_ref < $transcript->cdna_coding_start()) {
info("insertion ($insert_len) in 5' utr");
$code |= StatMsg::FIVE_PRIME | StatMsg::UTR;
$transcript->move_cdna_coding_start($insert_len);
$transcript->move_cdna_coding_end($insert_len);
}
elsif($$cdna_ins_pos_ref >= $transcript->cdna_coding_end()) {
info("insert ($insert_len) in 3' utr");
$code |= StatMsg::THREE_PRIME | StatMsg::UTR;
}
else {
throw("Unexpected insert case encountered");
}
$exon->add_StatMsg(StatMsg->new($code));
$exon->fix_phase($transcript);
return;
}
1; } |