Skip to content

Commit

Permalink
Changes to allow bug-free creation/deletion of GeneStructure objects
Browse files Browse the repository at this point in the history
svn path=/bioperl-gui/trunk/; revision=740
  • Loading branch information
dblock committed Oct 23, 2001
1 parent 49dde23 commit fa76171
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
8 changes: 5 additions & 3 deletions Bio/Tk/SeqCanvas.pm
Expand Up @@ -2281,11 +2281,13 @@ sub deleteFeatures {
if ($gene) {
my $unmapped=$self->unmapFeatures([$geneobj->FID]);
return unless $unmapped;
$self->MapSeq->delete_feature($SCF->Feature,$transcript,$gene);
$self->mapFeatures(undef,[$gene]);
my $remapped=$self->MapSeq->delete_feature($SCF->Feature,$transcript,$gene); #this needs to be implemented in Bio::Seq
$self->mapFeatures(undef,[$gene]) if $gene->entire_seq; #only remap if the gene still exists
$self->mapFeatures(undef,$remapped);
} else {
my $unmapped=$self->unmapFeatures([$FeatureID]);
$self->MapSeq->delete_feature($SCF->Feature,$transcript,$gene);
my $remapped=$self->MapSeq->delete_feature($SCF->Feature,$transcript,$gene); #this needs to be implemented in Bio::Seq
$self->mapFeatures(undef,$remapped);
}
}
}
Expand Down
30 changes: 15 additions & 15 deletions Bio/Tk/SeqCanvasFeature.pm
Expand Up @@ -194,19 +194,19 @@ sub _drawThyselfOnFinished {
my $model = 0; # ordinal number of transcript (needed for offset calculation)
foreach my $transcript ($SCF_GENE->Feature->transcripts) { # take each transcript
++$model;
my $SCF = Bio::Tk::SeqCanvasFeature->new( SeqCanvas => $SeqCanvas,
Feature => $transcript, # this fills all of the FeatureI methods
canvas_name => 'finished',
canvas => $SeqCanvas->FinishedCanvas,
map => $SeqCanvas->FinishedMap,
label => $SeqCanvas->label,
); # create a new SeqcanvasFeature object for this feature
my $SCF_transcript = Bio::Tk::SeqCanvasFeature->new( SeqCanvas => $SeqCanvas,
Feature => $transcript, # this fills all of the FeatureI methods
canvas_name => 'finished',
canvas => $SeqCanvas->FinishedCanvas,
map => $SeqCanvas->FinishedMap,
label => $SeqCanvas->label,
); # create a new SeqcanvasFeature object for this feature
# it is assigned an FID during creation
$SCF->offset($SeqCanvas->current_offsets->{"transcript$model"}); # assign standard color and offset according to ordinal number
$SCF->color($SCF->transcript_color); # get the transcript default color
$SCF->_draw;
$SCF->parent_gene($SCF_GENE);
push @transcripts, $SCF;
$SCF_transcript->offset($SeqCanvas->current_offsets->{"transcript$model"}); # assign standard color and offset according to ordinal number
$SCF_transcript->color($SCF_transcript->transcript_color); # get the transcript default color
$SCF_transcript->_draw;
$SCF_transcript->parent_gene($SCF_GENE);
push @transcripts, $SCF_transcript;

foreach my $exon ($transcript->exons) {
my $SCF = Bio::Tk::SeqCanvasFeature->new( SeqCanvas => $SeqCanvas,
Expand All @@ -221,7 +221,7 @@ sub _drawThyselfOnFinished {
$SCF->color($SeqCanvas->current_colors->{$SCF->source}); # assign color according to the source tag
$SCF->_draw;
$SCF->parent_gene($SCF_GENE);
$SCF->parent_transcript($transcript);
$SCF->parent_transcript($SCF_transcript);
push @exons, $SCF;

}
Expand All @@ -238,7 +238,7 @@ sub _drawThyselfOnFinished {
$SCF->color($SeqCanvas->current_colors->{$SCF->source}); # assign color by source tag
$SCF->_draw;
$SCF->parent_gene($SCF_GENE);
$SCF->parent_transcript($transcript);
$SCF->parent_transcript($SCF_transcript);
push @promotors, $SCF;

}
Expand All @@ -256,7 +256,7 @@ sub _drawThyselfOnFinished {
$SCF->color($SeqCanvas->current_colors->{$SCF->source}); # assign color by source tag
$SCF->_draw;
$SCF->parent_gene($SCF_GENE);
$SCF->parent_transcript($transcript);
$SCF->parent_transcript($SCF_transcript);
push @polyAs, $SCF;

}
Expand Down

0 comments on commit fa76171

Please sign in to comment.