Bio-Graphics
view release on metacpan or search on metacpan
lib/Bio/Graphics/Glyph/processed_transcript.pm view on Meta::CPAN
}
sub boxes {
my $self = shift;
$self->fixup_glyph();
$self->SUPER::boxes(@_);
}
sub is_utr {
my $self = shift;
return $self->feature->primary_tag =~ /UTR|untranslated_region/i;
}
sub thin_utr {
my $self = shift;
$self->option('thin_utr');
}
sub utr_color {
my $self = shift;
return $self->SUPER::bgcolor if $self->thin_utr;
return $self->color('utr_color') if $self->option('utr_color');
return $self->factory->translate_color(DEFAULT_UTR_COLOR);
}
sub height {
my $self = shift;
my $height = $self->SUPER::height;
return $height unless $self->thin_utr;
return $self->is_utr ? int($height/1.5+0.5) : $height;
}
sub pad_top {
my $self = shift;
my $pad_top = $self->SUPER::pad_top;
return $pad_top unless $self->thin_utr && $self->is_utr;
return $pad_top + int(0.167*$self->SUPER::height + 0.5);
}
sub bgcolor {
my $self = shift;
return $self->SUPER::bgcolor unless $self->is_utr;
return $self->utr_color;
}
sub connector {
my $self = shift;
return 'quill' if $self->option('decorate_introns');
return $self->SUPER::connector(@_);
}
sub _subfeat {
my $self = shift;
return $self->SUPER::_subfeat(@_) unless ref($self) && $self->{level} == 0 && $self->option('one_cds');
my $feature = shift;
my @subparts = $feature->get_SeqFeatures(qw(CDS five_prime_UTR three_prime_UTR UTR));
# The CDS and UTRs may be represented as a single feature with subparts or as several features
# that have different IDs. We handle both cases transparently.
my @result;
foreach (@subparts) {
if ($_->primary_tag =~ /CDS|UTR/i) {
my @cds_seg = $_->get_SeqFeatures;
if (@cds_seg > 0) { push @result,@cds_seg } else { push @result,$_ }
} else {
push @result,$_;
}
}
return @result;
}
1;
__END__
=head1 NAME
Bio::Graphics::Glyph::processed_transcript - The sequence ontology transcript glyph
=head1 SYNOPSIS
See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>.
=head1 DESCRIPTION
This glyph is used for drawing processed transcripts that have both
CDS and UTR segments. The CDS is drawn in the background color, and
the UTRs are drawn in an alternate color selected by the utr_color
option. In addition, you can make the UTRs thinner than the CDS by
setting the "thin_utr" option.
For this glyph to produce the desired results, you should pass it a
compound Bio::SeqFeature that has subfeatures of primary_tag "CDS" and
"UTR". In fact, you may give it more specific types of UTR, including
5'-UTR, 3'-UTR, or the Sequence Ontology terms "untranslated_region,"
"five_prime_untranslated_region," and
"three_prime_untranslated_region."
=head2 OPTIONS
The following options are standard among all Glyphs. See
L<Bio::Graphics::Glyph> for a full explanation.
Option Description Default
------ ----------- -------
-fgcolor Foreground color black
-outlinecolor Synonym for -fgcolor
-bgcolor Background color turquoise
-fillcolor Synonym for -bgcolor
-linewidth Line width 1
-height Height of glyph 10
-font Glyph font gdSmallFont
( run in 1.077 second using v1.01-cache-2.11-cpan-39bf76dae61 )