my ($self,$feature) = @_;
my $foundstart = 0;
my $foundend = 0;
my @pairs = $self->eachFeaturePair;
my @newfeatures;
HOMOL: while (my $sf1 = shift(@pairs)) {
my $skip = 0;
#print STDERR "Looking at cDNA exon " . $sf1->hstart . "\t" . $sf1->hend . "\t" . $sf1->strand ."\n";
$skip = 1 unless ($feature->start >= $sf1->hstart
&& $feature->start <= $sf1->hend);
if($skip){
#print STDERR "Skipping ".$sf1->hstart . "\t" . $sf1->hend . "\t" . $sf1->strand ."\n";
next HOMOL;
}
if ($feature->end >= $sf1->hstart && $feature->end <= $sf1->hend) {
$foundend = 1;
}
my $startcoord = $self->cDNA2genomic($feature->start);
my $endcoord;
if ($sf1->hstrand == 1) {
$endcoord = $sf1->end;
} else {
$endcoord = $sf1->start;
}
if ($foundend) {
$endcoord = $self->cDNA2genomic($feature->end);
}
#print STDERR "Making new genomic feature $startcoord\t$endcoord\n";
-start => $startcoord,
-end => $endcoord,
-strand => $feature->strand);
push(@newfeatures,$tmpf);
last;
}
# Now the rest of the pairs until we find the endcoord
while ((my $sf1 = shift(@pairs)) && ($foundend == 0)) {
if ($feature->end >= $sf1->hstart && $feature->end <= $sf1->hend) {
$foundend = 1;
}
my $startcoord;
my $endcoord;
if ($sf1->hstrand == 1) {
$startcoord = $sf1->start;
$endcoord = $sf1->end;
} else {
$startcoord = $sf1->end;
$endcoord = $sf1->start;
}
if ($foundend) {
$endcoord = $self->cDNA2genomic($feature->end);
}
# #print STDERR "Making new genomic feature $startcoord\t$endcoord\n";
-start => $startcoord,
-end => $endcoord,
-strand => $feature->strand);
push(@newfeatures,$tmpf);
}
#print STDERR "Have ".@newfeatures." features from ".$feature."\n";
return @newfeatures;
}