[Bioperl-guts-l] bioperl-live/Bio/Graphics/Glyph cds.pm, 1.30, 1.31 gene.pm, 1.3, 1.4
Lincoln Stein
lstein at dev.open-bio.org
Thu Jun 15 09:00:23 EDT 2006
Update of /home/repository/bioperl/bioperl-live/Bio/Graphics/Glyph
In directory dev.open-bio.org:/tmp/cvs-serv28009
Modified Files:
cds.pm gene.pm
Log Message:
fixed bug that caused stray lines to be displayed when applying the filled arrow to a very narrow feature
Index: gene.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/Bio/Graphics/Glyph/gene.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** gene.pm 8 Jun 2006 03:04:49 -0000 1.3
--- gene.pm 15 Jun 2006 13:00:21 -0000 1.4
***************
*** 67,71 ****
my $feature = shift;
return $feature->get_SeqFeatures('mRNA') if $feature->primary_tag eq 'gene';
! return $feature->get_SeqFeatures();# ('CDS',"five_prime_UTR","three_prime_UTR");
}
--- 67,71 ----
my $feature = shift;
return $feature->get_SeqFeatures('mRNA') if $feature->primary_tag eq 'gene';
! return $feature->get_SeqFeatures(qw(CDS five_prime_UTR three_prime_UTR));
}
Index: cds.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/Bio/Graphics/Glyph/cds.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** cds.pm 15 Jun 2006 02:03:35 -0000 1.30
--- cds.pm 15 Jun 2006 13:00:21 -0000 1.31
***************
*** 49,52 ****
--- 49,56 ----
}
+ sub ignore_non_cds {
+ shift->option('cds_only');
+ }
+
# figure out (in advance) the color of each component
sub draw {
***************
*** 58,61 ****
--- 62,66 ----
my $fits = $self->protein_fits;
+ my $strand = $self->feature->strand || 1;
# draw the staff (musically speaking)
***************
*** 68,72 ****
my $offset = $y1+$height*$_+1;
$gd->line($x1,$offset,$x2,$offset,$grid);
! if ($_ < 3) {
$gd->line($x2,$offset,$x2-2,$offset-2,$grid);
$gd->line($x2,$offset,$x2-2,$offset+2,$grid);
--- 73,81 ----
my $offset = $y1+$height*$_+1;
$gd->line($x1,$offset,$x2,$offset,$grid);
! # with three-frame translation, the position of the arrows changes depending on
! # the strand of the feature. With six-frame translation, we draw the first three
! # staff lines with an arrow to the right, and the second three to the left
! my $forward = ($line_count == 6) ? ($_ < 3) : ($strand > 0);
! if ($forward) {
$gd->line($x2,$offset,$x2-2,$offset-2,$grid);
$gd->line($x2,$offset,$x2-2,$offset+2,$grid);
***************
*** 92,95 ****
--- 101,105 ----
my $translate_table = Bio::Tools::CodonTable->new(-id=>$codon_table);
my $ignore_undef_phase = $self->ignore_undef_phase;
+ my $ignore_non_cds = $self->ignore_non_cds;
for (my $i=0; $i < @parts; $i++) {
***************
*** 100,103 ****
--- 110,115 ----
next if ($self->option('sub_part') && $type ne $self->option('sub_part'));
+ next if $ignore_non_cds && lc($type) ne 'cds';
+
my $pos = $feature->strand >= 0 ? $feature->start : $feature->end;
my $phase = $feature->can('phase') ? $feature->phase # bioperl uses "frame" but this is incorrect usage
***************
*** 127,136 ****
length $protein >= $feature->length/3 and last BLOCK;
($feature->length - $phase) % 3 == 0 and last BLOCK;
!
my $next_part = $parts[$i+1]
or do {
$part->{cds_splice_residue} = '?';
last BLOCK; };
!
my $next_feature = $next_part->feature or last BLOCK;
my $next_phase = eval {$next_feature->phase} or last BLOCK;
--- 139,148 ----
length $protein >= $feature->length/3 and last BLOCK;
($feature->length - $phase) % 3 == 0 and last BLOCK;
!
my $next_part = $parts[$i+1]
or do {
$part->{cds_splice_residue} = '?';
last BLOCK; };
!
my $next_feature = $next_part->feature or last BLOCK;
my $next_phase = eval {$next_feature->phase} or last BLOCK;
***************
*** 167,171 ****
$offset = $y1 + (($y2-$y1) - ($offset-$y1))-$height if $self->{flip}; # ugh. This works, but I don't know why
$gd->filledRectangle($x1,$offset,$x2,$offset+2,$color);
- # $self->filled_arrow($gd,$self->strand,$x1,$offset,$x2,$offset+2,$color,$color);
return;
}
--- 179,182 ----
***************
*** 335,338 ****
--- 346,352 ----
their phase defined.
+ -cds_only Only draw features of type false
+ 'CDS'
+
The -require_subparts option is suggested when rendering spliced
transcripts which contain multiple CDS subparts. Otherwise, the glyph
***************
*** 342,349 ****
Set the -ignore_empty_phase option to true if you wish to skip
! features that do not have a defined phase() or frame(). This is useful
if you are rendering exons that have both translated and untranslated
parts, and you wish to skip the untranslated parts.
=head1 SUGGESTED STANZA FOR GENOME BROWSER
--- 356,366 ----
Set the -ignore_empty_phase option to true if you wish to skip
! subfeatures that do not have a defined phase() or frame(). This is useful
if you are rendering exons that have both translated and untranslated
parts, and you wish to skip the untranslated parts.
+ Set the -cds_only option to true if you wish to draw the glyph only
+ for subfeatures of type 'CDS'. This is recommended.
+
=head1 SUGGESTED STANZA FOR GENOME BROWSER
More information about the Bioperl-guts-l
mailing list