BioPerl
view release on metacpan or search on metacpan
Bio/Align/Graphics.pm view on Meta::CPAN
#
#Produces: An image file
#
#Revision History:
#09/01/2006 - WDM - Introduction of "wrap" flag, allowing alignment to be
# wrapped at a set base and stacked vertically
# Addition of internal members y_num and y_size for tracking
# of number of vertical panels and size of panels,
# respectively
#
#09/06/2006 - WDM - Introduction of "p_legend" flag, for printing of an optional
# colored legend when protein coloring is selected
#
#09/24/2008 - WDM - Test file created for the module
#
#03/01/2009 - YH - Introduction of "show_nonsynonymous" flag which enables
# highlighting of nonsynonymous mutations in nucleotide
# alignments. Addition of internal members codon_table and
# missense_pos for translating codons -> amino acids and for
# keeping track of missense mutation positions respectively.
#
#03/05/2009 - YH - Swapped names of subroutines x_label and y_label to match
Bio/Align/Graphics.pm view on Meta::CPAN
font => defined($options{font}) ? $FONT_TABLE{$options{font}} : $FONT_TABLE{2},
x_label => defined($options{x_label}) ? $options{x_label} : 1,
y_label => defined($options{y_label}) ? $options{y_label} : 1,
#Colors
bg_color => $options{bg_color} || 'white',
fg_color => $options{font_color} || 'black',
x_label_color => $options{x_label_color} || 'blue',
y_label_color => $options{y_label_color} || 'red',
p_color => $options{p_color} || undef,
p_legend => $options{p_legend} || undef,
p_color_table => undef,
#Sequence Defaults
reference => $options{reference} || undef,
reference_id => $options{reference_id} || undef,
match_char => $options{match_char} || ".",
block_size => defined($options{block_size}) ? $options{block_size} : 10,
block_space => defined ($options{block_space}) ? ($options{block_space} * ($options{font} ? $FONT_TABLE{$options{font}}->width : $FONT_TABLE{2}->width)) : ( ($options{font} ? ($FONT_TABLE{$options{font}}->width * 2 ) : ($FONT_TABLE{2}->width * 2)) )...
wrap => $options{wrap} || 80,
show_nonsynonymous => $options{show_nonsynonymous} || undef, # If turned on, will highlight nonsynonymous (missense) mutations. Valid only for nucleotide alignments
Bio/Align/Graphics.pm view on Meta::CPAN
$self->{seq_start_y} = ($self->{pad_top} + length($self->{seq_length_aa}) + $self->{y_label_space}) * $self->{y_char_size};
$self->{width} = $self->{seq_start_x} + ((( $self->{wrap} / $self->{block_size}) + 1) * $self->{block_space}) + ( ($self->{wrap} + $self->{pad_right}) * ($self->{x_char_size} + 1.2) ) + ( ($self->{seq_length} / 3) * 2); # Needed to add this for widt...
}else
{
$self->{seq_start_y} = ($self->{pad_top} + length($self->{seq_length}) + $self->{y_label_space}) * $self->{y_char_size};
$self->{width} = $self->{seq_start_x} + ((( $self->{wrap} / $self->{block_size}) + 1) * $self->{block_space}) + ($self->{wrap} + $self->{pad_right}) * $self->{x_char_size};
}
$self->{footer_start} = $self->{seq_start_y} + $self->{y_size} * $self->{y_num};
if(defined($self->{p_color}) && defined($self->{p_legend}) && $self->{p_legend}){
$self->{height} = $self->{seq_start_y} + $self->{footer_size} + $self->{y_size} * $self->{y_num};
}else{
$self->{height} = $self->{seq_start_y} + $self->{y_size} * $self->{y_num};
}
$self->{image} = GD::Simple->new($self->{width},$self->{height});
$self->{image}->alphaBlending(1);
$self->{image}->saveAlpha(1);
$self->{image}->bgcolor($self->{bg_color});
$self->{image}->fgcolor($self->{fg_color});
$self->{image}->rectangle(0,0,$self->{width}-1, $self->{height} - 1);
Bio/Align/Graphics.pm view on Meta::CPAN
}elsif ( defined($self->{show_nonsynonymous}) )
{
$self->{codon_table} = Bio::Tools::CodonTable->new();
$self->{missense_pos} = {};
# print STDERR "You are using option show_nonsynonymous. Option works best if wrap value is a multiple of 4.\n"
}
if(defined($self->{p_color}) && $self->{seq_format} eq "protein")
{
$self->_draw_colored_sequences();
if(defined($self->{p_legend}) && $self->{p_legend})
{
$self->_draw_legend();
}
}elsif(defined($self->{p_color}) && ($self->{seq_format} ne "protein"))
{
die "draw:Option p_color only works with Protein alignments!\n";
}else
{
$self->_draw_sequences();
}
if(defined($self->{dm_label_start}))
Bio/Align/Graphics.pm view on Meta::CPAN
}
$block_total += $block_num;
}
$block_total = 0;
}
}
}
sub _draw_legend{
my $self = shift;
my $title_font = $FONT_TABLE{3};
my @l_order = ("Negatively Charged", "Positively Charged", "Hydrophobic", "Aromatic", "Found in Loops", "Large Polar Acids");
my %legend = ("Negatively Charged" => ["D" , "E"] , "Positively Charged" => ["K", "R"] , "Hydrophobic" => ["A","F","I","L","M","V","W","Y"] ,
"Aromatic" => ["F", "H", "W", "Y"] , "Found in Loops" => ["D", "G", "P", "S", "T"] , "Large Polar Acids" => ["H", "K", "N", "Q", "R"]);
my $x1 = 2;
my $x2 = 42;
my $colors = $self->{p_color_table};
my $y_start = $self->{footer_start};
my $label = "Protein Color Legend";
$self->{image}->bgcolor($self->{bg_color});
Bio/Align/Graphics.pm view on Meta::CPAN
foreach my $c_label (@l_order)
{
if( ($count % 2) == 0)
{
$self->{image}->moveTo( $x2 * $self->{x_char_size}, $y_start + ( ($count - 1) * $self->{y_char_size}));
$self->{image}->font($self->{font});
$self->{image}->string($c_label);
my $i = 0;
foreach my $chars(@{$legend{$c_label}})
{
$self->{image}->bgcolor($$colors{$chars});
$self->{image}->fgcolor($$colors{$chars});
$self->{image}->rectangle( ($x2 + 20 + $i) * $self->{x_char_size}, $y_start + ( ($count - 2) * $self->{y_char_size}), ($x2 + 20 + $i + 1) * $self->{x_char_size}, $y_start + ( ($count -1) * $self->{y_char_size}));
$self->{image}->bgcolor($self->{bg_color});
$self->{image}->fgcolor($self->{fg_color});
$i++;
}
}else
{
$self->{image}->moveTo($x1 * $self->{x_char_size} , $y_start + ($count * $self->{y_char_size}));
$self->{image}->font($self->{font});
$self->{image}->string($c_label);
my $i = 0;
foreach my $chars(@{$legend{$c_label}})
{
$self->{image}->bgcolor($$colors{$chars});
$self->{image}->fgcolor($$colors{$chars});
$self->{image}->rectangle( ($x1 + 20 + $i) * $self->{x_char_size}, $y_start + ( ($count - 1) * $self->{y_char_size}), ($x1 + 20 + $i + 1) * $self->{x_char_size}, $y_start + ( ($count) * $self->{y_char_size}));
$self->{image}->bgcolor($self->{bg_color});
$self->{image}->fgcolor($self->{fg_color});
$i++;
}
}
Bio/Search/Tiling/MapTiling.pm view on Meta::CPAN
if (!defined $self->{"coverage_map_${type}_${context}"}) {
$self->warn("No HSPS present for type '$type' in context '$context' for this hit");
return undef;
}
return @{$self->{"coverage_map_${type}_${context}"}};
}
=head2 coverage_map_as_text
Title : coverage_map_as_text
Usage : $tiling->coverage_map_as_text($type, $legend_flag)
Function: Format a text-graphic representation of the
coverage map
Returns : an array of scalar strings, suitable for printing
Args : $type: one of 'query', 'hit', 'subject'
$context: strand/frame context string
$legend_flag: boolean; add a legend indicating
the actual interval coordinates for each component
interval and hsp (in the $type sequence context)
Example : print $tiling->coverage_map_as_text('query',1);
=cut
sub coverage_map_as_text{
my $self = shift;
my ($type, $context, $legend_q) = @_;
$self->_check_type_arg(\$type);
$self->_check_context_arg($type, \$context);
my @map = $self->coverage_map($type, $context);
my @ret;
my @hsps = $self->hit->hsps;
my %hsps_i;
require Tie::RefHash;
tie %hsps_i, 'Tie::RefHash';
@hsps_i{@hsps} = (0..$#hsps);
Bio/Search/Tiling/MapTiling.pm view on Meta::CPAN
@hspx[@hsps_i{@these_hsps}] = ('*') x @these_hsps;
$mx[$_] = \@hspx;
}
untie %hsps_i;
push @ret, "\tIntvl\n";
push @ret, "HSPS\t", join ("\t", (0..$#map)), "\n";
foreach my $h (0..$#hsps) {
push @ret, join("\t", $h, map { $mx[$_][$h] } (0..$#map) ),"\n";
}
if ($legend_q) {
push @ret, "Interval legend\n";
foreach (0..$#map) {
push @ret, sprintf("%d\t[%d, %d]\n", $_, @{$map[$_][0]});
}
push @ret, "HSP legend\n";
my @ints = get_intervals_from_hsps($type,@hsps);
foreach (0..$#hsps) {
push @ret, sprintf("%d\t[%d, %d]\n", $_, @{$ints[$_]});
}
}
return @ret;
}
=head2 hit
t/data/sv40_small.xml view on Meta::CPAN
<fullName>predetermined participant</fullName>
</names>
<xref>
<primaryRef db="psi-mi" id="MI:0396"/>
<secondaryRef db="pubmed" id="7940758"/>
<secondaryRef db="pubmed" id="14755292"/>
</xref>
</participantDetection>
<attributeList>
<attribute name="exp-modification">MAPPIT bait construct - a chimeric cytokine receptor composed of the extracellular region of homodimeric EpoR, fused to the transmembrane and cytosolic domains of the leptin receptor wherein all the tyr...
<attribute name="figure-legend">2b, 2c, 5</attribute>
<attribute name="contact-email">jan.tavernier@ugent.be</attribute>
<attribute name="author-list">Eyckerman S., Verhee A., der Heyden JV., Lemmens I., Ostade XV., Vandekerckhove J., Tavernier J.</attribute>
</attributeList>
</experimentDescription>
</experimentList>
<interactorList>
<proteinInteractor id="EBI-617698">
<names>
<shortLabel>tala_sv40</shortLabel>
<fullName>Large T antigen</fullName>
t/data/tol-2010-02-18.nhx view on Meta::CPAN
(((aquifex[&&NHX:TOL=59615],calderobacterium[&&NHX:TOL=59616],hydrogenobacter[&&NHX:TOL=59617],thermocrinis[&&NHX:TOL=59618],hydrogenothermus[&&NHX:TOL=59619],persephonella[&&NHX:TOL=59620],sulfurihydrogenibium[&&NHX:TOL=59621],balnearium[&&NHX:TOL=5...
( run in 1.460 second using v1.01-cache-2.11-cpan-49f99fa48dc )