view release on metacpan or search on metacpan
lib/Bio/Graphics/Glyph/decorated_gene.pm view on Meta::CPAN
@subparts = $feature->get_SeqFeatures($class->option('sub_part'));
}
elsif ($feature->primary_tag =~ /^mRNA/i) {
@subparts = $feature->get_SeqFeatures(qw(CDS five_prime_UTR three_prime_UTR UTR));
}
else {
@subparts = $feature->get_SeqFeatures('exon');
}
# 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,$_;
}
}
# fall back to drawing a solid box if no subparts and level 0
lib/Bio/Graphics/Glyph/decorated_gene.pm view on Meta::CPAN
# my @subparts;
# if ($class->option('sub_part')) {
# @subparts = $feature->get_SeqFeatures($class->option('sub_part'));
# }
# else {
#
# @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;
lib/Bio/Graphics/Glyph/decorated_transcript.pm view on Meta::CPAN
'boolean',
'false',
'Specifies whether decorations should be visible or not. For selective display of individual',
'decorations, specify a callback function and return 1 or 0 after inspecting the active',
'decoration of the glyph. '],
decoration_color => [
'color',
undef,
'Decoration background color. If no color is specified, colors are assigned automatically',
'by decoration type and name, whereas decorations of identical type and name are assigned',
'the same color. A special color \'transparent\' can be used here in combination with',
'the option \'decoration_border\' to draw decorations as outlines.'],
decoration_border => [
['none', 'solid', 'dashed'],
'none',
'Decoration border style. By default, decorations are drawn without border (\'none\' or',
'0). Other valid options here include \'solid\' or \'dashed\'.'],
decoration_border_color => [
'color',
'black',
'Color of decoration border.'],
lib/Bio/Graphics/Glyph/decorated_transcript.pm view on Meta::CPAN
decoration_label_position => [
['inside', 'above', 'below'],
'inside',
'Position of decoration label. Labels can be drawn \'inside\' decorations (default)',
'or \'above\' and \'below\' decorations.'],
decoration_label_color => [
'color',
'undef',
'Decoration label color. If not specified, this color is complementary to',
'decoration_color (e.g., yellow text on blue background, white on black, etc.). If the',
'decoration background color is transparent and no decoration label color is specified,',
'the foreground color of the underlying transcript glyph is used as default.'],
additional_decorations => [
'string',
undef,
'Additional decorations to those specified in the GFF file. Expected is a',
'comma-separated string in the same format as described above for GFF files.',
'Example string: "SignalP40:SP:1:23:0:my_comment,TMHMM:TM:187:209:0"',
'This parameter is intended',
'to be used as callback function, which inspects the currently processed transcript',
'feature (first parameter to callback) and returns additional protein decorations',
lib/Bio/Graphics/Glyph/decorated_transcript.pm view on Meta::CPAN
return $decoration_label_color
if ( defined $decoration_label_color
and $decoration_label_color ne 'auto'
and $decoration_label_color ne '' );
my $decoration_color = $self->decoration_color($decoration);
return $self->fgcolor
if ((!$decoration_label_color or $decoration_label_color eq 'auto')
and $decoration_color eq "transparent");
# assign color complementary to decoration color
my ( $red, $green, $blue ) =
Bio::Graphics::Panel->color_name_to_rgb($decoration_color);
$decoration_label_color =
sprintf( "#%02X%02X%02X", 255 - $red, 255 - $green, 255 - $blue ); # background complement
return $decoration_label_color;
}
lib/Bio/Graphics/Glyph/decorated_transcript.pm view on Meta::CPAN
if (DEBUG == 2);
my ($h_left, $h_top, $h_right, $h_bottom) = $self->_map_decoration($gd, $dx, $dy, $mh, $nt_start, $nt_end);
my $color = $self->decoration_color($mh);
# don't draw over borders; not supported by SVG
$gd->clip( $left + 1, $h_top, $right - 1, $h_bottom )
if ( !$gd->isa("GD::SVG::Image") );
if ($color ne 'transparent')
{
warn "filledRectangle: left=$h_left,top=$h_top,right=$h_right,bottom=$h_bottom\n"
if (DEBUG == 2);
$gd->filledRectangle( $h_left, $h_top, $h_right, $h_bottom,
$self->factory->translate_color($color) );
}
my $border_style = $self->decoration_border($mh);
if ($border_style)
{
lib/Bio/Graphics/Glyph/decorated_transcript.pm view on Meta::CPAN
decorations, specify a callback function and
return 1 or 0 after inspecting the active decoration
of the glyph.
-decoration_color <auto>
Decoration background color. If no color is
specified, colors are assigned automatically by
decoration type and name, whereas decorations of
identical type and name are assigned the same color.
A special color 'transparent' can be used here in
combination with the option 'decoration_border' to
draw decorations as outlines.
-decoration_border 0 (none)
Decoration border style. By default, decorations are
drawn without border ('none' or 0). Other valid
options here include 'solid' or 'dashed'.
-decoration_border_color black
lib/Bio/Graphics/Glyph/decorated_transcript.pm view on Meta::CPAN
Position of decoration label. Labels can be drawn
'inside' decorations (default) or 'above' and 'below'
decorations.
-decoration_label_color <auto>
Decoration label color. If not specified, this color
is complementary to decoration_color (e.g., yellow text
on blue background, white on black, etc.). If the
decoration background color is transparent and no
decoration label color is specified, the foreground color
of the underlying transcript glyph is used as default.
-additional_decorations undefined
Additional decorations to those specified in the GFF file.
Expected is a comma-separated string in the same format as
described above for GFF files, for example
"SignalP40:SP:1:23:0:my_comment,TMHMM:TM:187:209:0"
t/borders.t view on Meta::CPAN
-height => 12,
-decoration_color => 'white',
-decoration_border => 'solid',
-decoration_border_color => 'red'
);
ok(1, 'track3 added');
$panel->add_track
(
$gene_minus,
-description => sub { "transparent red border"},
-glyph => 'decorated_gene',
-decoration_visible => 1,
-height => 12,
-decoration_color => 'transparent', #special colour to make outlines
-decoration_border => 'solid',
-decoration_border_color => 'red'
);
ok(1, 'track4 added');
$panel->add_track
(
$gene_minus,
-description => sub { "border as callback"},
-glyph => 'decorated_gene',
t/heights.t view on Meta::CPAN
(
$utr_gene,
-glyph => 'decorated_gene',
-decoration_visible => 1,
-height => 12,
-decoration_color => 'black',
-decoration_height => 24
);
ok(1, 'track4 added');
#can be used with transparent boxes to show highlights
$panel->add_track
(
$gene_minus,
-glyph => 'decorated_gene',
-decoration_visible => 1,
-height => 12,
-decoration_color => 'transparent', #special colour to make outlines
-decoration_border => 'solid',
-decoration_border_color => 'red',
-decoration_height => 24
);
ok(1, 'track5 added');
$panel->add_track
(
$gene_minus,
-glyph => 'decorated_gene',
return 'white' if ($glyph->active_decoration->name eq "VTS");
},
-additional_decorations => sub {
my $feature = shift;
my ($id) = $feature->get_tag_values('load_id');
my %add_h = ( "rna_PFA0680c-1" => "test:callback:100:130:0" );
return $add_h{$id};
}
);
# decoration outside transcript boundaries, transparent background
my ($gene2) = $store->features(-name => 'test1');
{
$panel->add_track
(
$gene2,
-glyph => 'decorated_gene',
-description => sub { "Gene label and description do not bump with extended decoration boundaries" },
-label => 1,
-label_position => 'top',
-height => 12,
-decoration_visible => 1,
-decoration_border => "dashed",
-decoration_color => "transparent",
-decoration_label_position => "above",
-decoration_label => 1,
-decoration_height => 17,
-decoration_border_color => "blue"
);
}
# use of decorated_transcript glyph directly, with mRNA feature
{
my ($rna2) = $gene2->get_SeqFeatures('mRNA');
$panel->add_track
(
$gene2,
-glyph => 'decorated_gene',
-description => sub { "Gene label and description do not bump with extended decoration boundaries" },
-label => 1,
-label_position => 'top',
-height => 12,
-decoration_visible => 1,
-decoration_border => "dashed",
-decoration_color => "transparent",
-decoration_label_position => "above",
-decoration_label => 1,
-decoration_border_color => "blue",
-decoration_height => sub {
my ($feature, $option_name, $part_no, $total_parts, $glyph) = @_;
return '24' if ($glyph->active_decoration->name eq "very interesting region");
return '10';}
);
ok(1, 'track2 added');