None available.
sub process_cds_delete
{ my $cdna_del_pos_ref = shift;
my $del_len = shift;
my $exon = shift;
my $transcript = shift;
my $entire_delete = shift;
info("delete ($del_len) in cds");
my $del_start = $$cdna_del_pos_ref + 1;
my $del_end = $del_start + $del_len - 1;
my $code = StatMsg::EXON | StatMsg::DELETE | StatMsg::CDS |
Length::length2code($del_len);
my $frameshift = $del_len % 3;
if($del_start == $transcript->cdna_coding_start() &&
$del_end == $transcript->cdna_coding_end()) {
info("delete ($del_len) is all of cds");
$code |= StatMsg::ENTIRE;
$transcript->move_cdna_coding_end(-$del_len);
}
elsif($del_start == $transcript->cdna_coding_start()) {
info("delete ($del_len) at start of cds");
$code |= StatMsg::FIVE_PRIME;
$transcript->move_cdna_coding_end(-$del_len);
if($frameshift) {
$code |= StatMsg::FRAMESHIFT if($frameshift);
info("shifting cds start to restore reading frame");
$transcript->move_cdna_coding_start(3 - $frameshift);
}
}
elsif($del_end == $transcript->cdna_coding_end()) {
info("delete ($del_len) at end of cds");
$code |= StatMsg::THREE_PRIME;
$transcript->move_cdna_coding_end(-$del_len);
if($frameshift) {
$code |= StatMsg::FRAMESHIFT if($frameshift);
info("shifting cds end to restore reading frame");
$transcript->move_cdna_coding_end($frameshift-3);
}
}
elsif($del_end > $transcript->cdna_coding_start() &&
$del_start < $transcript->cdna_coding_end()) {
info("delete ($del_len) in middle of cds");
$code |= StatMsg::MIDDLE;
$transcript->move_cdna_coding_end(-$del_len);
if($frameshift && !$entire_delete) {
info("BEFORE CDS DELETE:");
print_exon($exon, $transcript);
$code |= StatMsg::FRAMESHIFT if($frameshift);
my $first_len = $del_start - $exon->cdna_start();
my $intron_len = 3 - $frameshift;
$transcript->move_cdna_coding_end(-$intron_len);
$$cdna_del_pos_ref -= $intron_len;
info("introducing frameshift intron ($intron_len) " .
"to maintain reading frame");
if($intron_len == $exon->length()) {
$exon->cdna_end($exon->cdna_end - $intron_len);
if($exon->strand() == 1) {
$exon->end($exon->end - $intron_len);
} else {
$exon->start($exon->start + $intron_len);
}
$code |= StatMsg::ALL_INTRON;
$exon->fail(1);
}
elsif($intron_len > $exon->length()) {
$code |= StatMsg::CONFUSED | StatMsg::ALL_INTRON;
$exon->cdna_end($exon->cdna_end - $intron_len);
if($exon->strand() == 1) {
$exon->end($exon->end - $intron_len);
} else {
$exon->start($exon->start + $intron_len);
}
$exon->fail(1);
}
elsif($first_len + $intron_len >= $exon->length()) {
if($exon->strand() == 1) {
$exon->end($exon->end - $intron_len);
} else {
$exon->start($exon->start + $intron_len);
}
$exon->cdna_end($exon->cdna_end - $intron_len);
} else {
if($exon->strand == 1) {
if($first_len) {
my $first_exon = InterimExon->new();
%{$first_exon} = %{$exon};
$first_exon->cdna_end($exon->cdna_start() + $first_len - 1);
$first_exon->end($first_exon->start() + $first_len - 1);
$transcript->add_Exon($first_exon);
info("FIRST EXON:");
info($first_exon, $transcript);
$exon->add_StatMsg(StatMsg->new(StatMsg::EXON | StatMsg::SPLIT));
$exon->cdna_start($first_exon->cdna_end() + 1);
$first_exon->set_split_phases($exon, $transcript);
}
$exon->start($exon->start() + $first_len + $intron_len);
$exon->cdna_end($exon->cdna_end - $intron_len);
} else {
if($first_len) {
my $first_exon = InterimExon->new();
%{$first_exon} = %{$exon};
$first_exon->cdna_end($exon->cdna_start + $first_len - 1);
$first_exon->start($exon->end() - $first_len + 1);
$transcript->add_Exon($first_exon);
info("FIRST EXON:");
print_exon($first_exon, $transcript);
$exon->add_StatMsg(StatMsg->new(StatMsg::EXON | StatMsg::SPLIT));
$exon->cdna_start($first_exon->cdna_end() + 1);
$first_exon->set_split_phases($exon, $transcript);
}
$exon->end($exon->end() - ($first_len + $intron_len));
$exon->cdna_end($exon->cdna_end - $intron_len);
}
}
info("AFTER CDS DELETE:");
print_exon($exon, $transcript);
}
}
else {
throw("Unexpected: CDS delete appears to be outside of CDS:\n" .
" del_start = $del_start\n".
" del_end = $del_end\n" .
" cdna_coding_start = ".$transcript->cdna_coding_start() . "\n".
" cdna_coding_end = ".$transcript->cdna_coding_end() . "\n");
}
$exon->add_StatMsg(StatMsg->new($code));
return;
}
1; } |
sub process_delete
{ my $cdna_del_pos_ref = shift;
my $del_len = shift;
my $exon = shift;
my $transcript = shift;
my $entire_delete = shift;
my $del_start = $$cdna_del_pos_ref + 1;
my $del_end = $del_start + $del_len - 1;
info((($entire_delete) ? 'entire ' : '')."delete ($del_len) at " .
$$cdna_del_pos_ref);
info("BEFORE cds: ". $transcript->cdna_coding_start().'-'.
$transcript->cdna_coding_end());
info("BEFORE del_start = $del_start");
if(!$entire_delete && ($del_start < $exon->cdna_start() - 1 ||
$del_start > $exon->cdna_end() + 1)) {
throw("Unexpected: deletion is outside of exon boundary\n" .
" del_start = $del_start\n" .
" cdna_exon_start =". $exon->cdna_start() .
" cdna_exon_end =". $exon->cdna_end());
}
if($del_start < $transcript->cdna_coding_start()) {
my $utr_del_len;
if($del_end >= $transcript->cdna_coding_start()) {
$utr_del_len = $transcript->cdna_coding_start() - $del_start;
} else {
$utr_del_len = $del_len;
}
process_five_prime_utr_delete($cdna_del_pos_ref, $utr_del_len,
$exon, $transcript);
$del_start = $$cdna_del_pos_ref + 1;
$del_len -= $utr_del_len;
$del_end = $del_start + $del_len - 1;
}
if($del_len == 0) {
$exon->fix_phase($transcript) if(!$entire_delete);
return;
}
if($del_end >= $transcript->cdna_coding_start() &&
$del_start <= $transcript->cdna_coding_end()) {
my $cds_del_len;
if($del_end > $transcript->cdna_coding_end()) {
$cds_del_len = $transcript->cdna_coding_end() - $del_start + 1;
} else {
$cds_del_len = $del_len;
}
process_cds_delete($cdna_del_pos_ref, $cds_del_len, $exon, $transcript,
$entire_delete);
$del_start += $$cdna_del_pos_ref + 1;
$del_len -= $cds_del_len;
$del_end = $del_start + $del_len - 1;
}
if($del_len == 0) {
$exon->fix_phase($transcript) if(!$entire_delete);;
return;
}
if($del_start <= $transcript->cdna_coding_end()) {
throw("Unexpected. 3' UTR delete starts before coding end.");
}
process_three_prime_utr_delete($cdna_del_pos_ref, $del_len, $exon,
$transcript);
$exon->fix_phase($transcript) if(!$entire_delete);
return;
}
} |
sub process_five_prime_utr_delete
{ my $cdna_del_pos_ref = shift;
my $del_len = shift;
my $exon = shift;
my $transcript = shift;
info("delete ($del_len) in 5' utr");
$transcript->move_cdna_coding_start(-$del_len);
$transcript->move_cdna_coding_end(-$del_len);
my $code = StatMsg::EXON | StatMsg::DELETE | StatMsg::FIVE_PRIME |
StatMsg::UTR | Length::length2code($del_len);
$exon->add_StatMsg(StatMsg->new($code));
return;
}
} |
sub process_three_prime_utr_delete
{ my $cdna_del_pos_ref = shift;
my $del_len = shift;
my $exon = shift;
my $transcript = shift;
info("delete ($del_len) in 3' utr");
my $code = StatMsg::EXON | StatMsg::DELETE | StatMsg::THREE_PRIME |
StatMsg::UTR | Length::length2code($del_len);
$exon->add_StatMsg(StatMsg->new($code));
return;
}
} |