view release on metacpan or search on metacpan
lib/Bio/Graphics/DrawTransmembrane.pm view on Meta::CPAN
                                   'default' => 80},
    'loop_heights'            => { 'private' => 'loop_heights',
                                   'default' => {}},
    'n_terminal_offset'       => { 'private' => 'n_term_offset',
                                   'default' => 0},
    'c_terminal_offset'       => { 'private' => 'c_term_offset',
                                   'default' => 0},
    ## colour scheme & display options
    'show_labels'             => { 'private' => 'labels',
                                   'default' => 'on'},
    'bold_helices'            => { 'private' => 'bold_helices',
                                   'default' => 1},
    'bold_labels'             => { 'private' => 'bold_labels',
                                   'default' => 0},
    'colour_scheme'           => { 'private' => 'scheme',
                                   'default' => 'yellow'},
    'draw_cytosol'            => { 'private' => 'draw_cytosol',
                                   'default' => 0},
    'draw_bilayer'            => { 'private' => 'draw_bilayer',
                                   'default' => 1},
    'draw_loops'              => { 'private' => 'draw_loops',
                                   'default' => 1},
    'draw_terminai'           => { 'private' => 'draw_terminai',
lib/Bio/Graphics/DrawTransmembrane.pm view on Meta::CPAN
		## draw helix, with graduated fill
		$self->{'im'}->filledRectangle($x,$y,($x + $self->{'helix_width'})-1,($y + $self->{'helix_height'})-1,$colour6);	
		$self->{'im'}->filledRectangle($x+1,$y+1,($x + $self->{'helix_width'})-1,($y + $self->{'helix_height'})-1,$colour5);
		$self->{'im'}->filledRectangle($x+2,$y+2,($x + $self->{'helix_width'})-2,($y + $self->{'helix_height'})-2,$colour4);
		$self->{'im'}->filledRectangle($x+3,$y+3,($x + $self->{'helix_width'})-3,($y + $self->{'helix_height'})-3,$colour3);
		$self->{'im'}->filledRectangle($x+4,$y+4,($x + $self->{'helix_width'})-4,($y + $self->{'helix_height'})-4,$colour2);
		$self->{'im'}->filledRectangle($x+5,$y+5,($x + $self->{'helix_width'})-5,($y + $self->{'helix_height'})-5,$colour1);
		$self->{'im'}->filledRectangle($x+6,$y+6,($x + $self->{'helix_width'})-6,($y + $self->{'helix_height'})-6,$colour);
	
		## draw a white box around it
		if ($self->{'bold_helices'}){
			$self->{'im'}->rectangle($x,$y,($x + $self->{'helix_width'}),($y + $self->{'helix_height'}),$self->{'black'});
			$self->{'im'}->rectangle($x - 1,$y - 1,($x + $self->{'helix_width'} + 1),($y + $self->{'helix_height'} + 1),$self->{'white'});
		}else{
			$self->{'im'}->rectangle($x,$y,($x + $self->{'helix_width'}),($y + $self->{'helix_height'}),$self->{'white'});
		}
		
		## this is the text on each helix
		my $text = substr($self->{'helix_label'},0,1).$_;
		## draw a white box in the centre and label the helix
lib/Bio/Graphics/DrawTransmembrane.pm view on Meta::CPAN
					if ($self->{'ttf_font'}){
						## Might need to fiddle with this
						my $size_dif = $self->{'ttf_font_size'} - 8;
						$label_length = 6 + (6 * (length $self->{'loop_labels'}{$l}) + (8 * $size_dif));
					}else{					
						$label_length = 9 + (6 * length $self->{'loop_labels'}{$l});
					}
				
					if ($_ % 2){
						if ($self->{'bold_labels'}){
							$self->{'im'}->filledRectangle(($x + ($self->{'helix_width'} / 2)) + 5,($y + ($self->{'helix_height'} / 2) - 30) + $y_mod,$label_length + ($x + ($self->{'helix_width'} / 2)) + 2,12 + ($y + ($self->{'helix_height'} / 2) - 24) + $y_mod,$self->{'...
							my $b = new GD::Polygon;
        						$b->addPt(($x + ($self->{'helix_width'} / 2)) + 4,($y + ($self->{'helix_height'} / 2) - 30) + $y_mod,$label_length + ($x + ($self->{'helix_width'} / 2)));
        						$b->addPt(($x + ($self->{'helix_width'} / 2)) - 5,($y + ($self->{'helix_height'} / 2) - 21) + $y_mod,$label_length + ($x + ($self->{'helix_width'} / 2)));
       							$b->addPt(($x + ($self->{'helix_width'} / 2)) + 4,($y + ($self->{'helix_height'} / 2) - 12) + $y_mod,$label_length + ($x + ($self->{'helix_width'} / 2)));
        						$self->{'im'}->filledPolygon($b,$self->{'black'});
						}
						## add darker box
						$self->{'im'}->filledRectangle(($x + ($self->{'helix_width'} / 2)) + 6,($y + ($self->{'helix_height'} / 2) - 29) + $y_mod,$label_length + ($x + ($self->{'helix_width'} / 2)) + 1,12 + ($y + ($self->{'helix_height'} / 2) - 25) + $y_mod,$colour6);
lib/Bio/Graphics/DrawTransmembrane.pm view on Meta::CPAN
						if ($self->{'ttf_font'}){
							$self->{'im'}->stringFT($self->{'black'},$self->{'ttf_font'},$self->{'ttf_font_size'},0,($x + ($self->{'helix_width'} / 2)) + 10,($y + ($self->{'helix_height'} / 2) - 16) + $y_mod,$self->{'loop_labels'}{$l},{linespacing=>0.6,charmap  => 'Unico...
						}else{
							$self->{'im'}->string(gdSmallFont,($x + ($self->{'helix_width'} / 2)) + 9,($y + ($self->{'helix_height'} / 2) - 27) + $y_mod,$self->{'loop_labels'}{$l},$self->{'black'});
						}
			
						$y_mod = $y_mod - 19;	
							
					}else{
						if ($self->{'bold_labels'}){
							$self->{'im'}->filledRectangle(($x + ($self->{'helix_width'} / 2)) + 5,($y + ($self->{'helix_height'} / 2) + 9) + $y_mod,$label_length + ($x + ($self->{'helix_width'} / 2)) + 2,13 + ($y + ($self->{'helix_height'} / 2) + 15) + $y_mod,$self->{'b...
				        		my $b = new GD::Polygon;
        						$b->addPt(($x + ($self->{'helix_width'} / 2)) + 4,($y + ($self->{'helix_height'} / 2) + 10) + $y_mod,$label_length + ($x + ($self->{'helix_width'} / 2)));
        						$b->addPt(($x + ($self->{'helix_width'} / 2)) - 5,($y + ($self->{'helix_height'} / 2) + 19) + $y_mod,$label_length + ($x + ($self->{'helix_width'} / 2)));
       							$b->addPt(($x + ($self->{'helix_width'} / 2)) + 4,($y + ($self->{'helix_height'} / 2) + 28) + $y_mod,$label_length + ($x + ($self->{'helix_width'} / 2)));
        						$self->{'im'}->filledPolygon($b,$self->{'black'});
						}
						## add darker box
						$self->{'im'}->filledRectangle(($x + ($self->{'helix_width'} / 2)) + 6,($y + ($self->{'helix_height'} / 2) + 11) + $y_mod,$label_length + ($x + ($self->{'helix_width'} / 2)) + 1,12 + ($y + ($self->{'helix_height'} / 2) + 15) + $y_mod,$colour6);
lib/Bio/Graphics/DrawTransmembrane.pm view on Meta::CPAN
                47 => '40 - Mutation',
                60 => 'Voltage Sensor',
                72 => '72 - Mutation 2',
                73 => '73 - Mutation 3',
                138 => '138 - Glycosylation Site',
                170 => '170 - Phosphorylation Site',
                200 => 'Last Helix');
  my $im = Bio::Graphics::DrawTransmembrane->new(-n_terminal=> 'out',
                                  -topology => \@topology,
                                  -bold_helices=> 1,
                                  -labels=> \%labels,
                                  -text_offset=> -15,
                                  -outside_label=>'Lumen',
                                  -inside_label=>'Cytoplasm',
                                  -membrane_label=>'Membrane',
                                  -vertical_padding=> 155);
  ## Parse Tmhmm data
  use Bio::Tools::Tmhmm;
  my $im = Bio::Graphics::DrawTransmembrane->new(
      -title=>'Let\'s parse some Tmhmm output...',
      -bold_helices=> 1);
  open(FILE, 'tmhmm.out');
  my $parser = new Bio::Tools::Tmhmm(-fh => \*FILE );
  while(my $tmhmm_feat = $parser->next_result ) {
	## Load features into DrawTransmembrane object
	$im->add_tmhmm_feat($tmhmm_feat);
  }
  close FILE;
  ## Now write the image to a .png file
  open(OUTPUT, ">output.png");
lib/Bio/Graphics/DrawTransmembrane.pm view on Meta::CPAN
  -labels             Label loops and helices using data from a     none
                      hash, e.g.
		      %labels = (138 => 'Glycosylation Site',
		                 190 => 'Binding Site');
		      The hash key must be numeric, ranges are 
		      not allowed.
  -bold_helices       Draws black boxes round helices               1
  -bold_labels        Draws black boxes round labels                0
  -text_offset        Shift the text labeling the loops. Use a      0 
                      negative value to shift it left, a positive
		      value to shift it right
  -helix_height       Transmembrane helix height                    130
  -helix_width        Transmembrane helix width                     50
  -loop_width         Loop width                                    20
lib/Bio/Graphics/GDWrapper.pm view on Meta::CPAN
sub _match_font {
    my $self = shift;
    my $font = shift;
    return $font unless ref $font && $font->isa('GD::Font');
    # work around older versions of GD that require useFontConfig to be called from a GD::Image instance
    $GdInit++ || eval{GD::Image->useFontConfig(1)} || GD::Image->new(10,10)->useFontConfig(1);
    my $fh     = $font->height-1;
    my $height = $Pixel2Point{$fh} || $fh;
    my $style  = $font eq GD->gdMediumBoldFont ? 'bold'
	        :$font eq GD->gdGiantFont      ? 'bold'
                :'normal';
    my $ttfont = $self->default_font;
    return "$ttfont-$height:$style";
}
1;
lib/Bio/Graphics/Glyph/allele_tower.pm view on Meta::CPAN
	my $snp = shift;
	my @d   = $snp->get_tag_values('AllelePair');
	return join "/",@d;
    }
=head2 OPTIONS
 . Glyph Colour
 . Different colour for alleles on the reverse strand
 . Print out the complement for alleles on the reverse strand
 . Major allele shown in bold
 . Horizontal histogram to show allele frequency
=head3 GLYPH COLOR
The glyph color can be configured to be different if the feature is on the plus or minus strand.  Use fgcolor to define the glyph color for the plus strand and bgcolor for the minus strand.  For example:
   fgcolor     = blue
   bgcolor     = red
For this option to work, you must also set ref_strand to return the strand of the feature:
lib/Bio/Graphics/Glyph/allele_tower.pm view on Meta::CPAN
If the alleles on the negative strand need to be the complement of what is listed in the GFF files, (e.g. A/G becomes T/C), set the complement option to have value 1
complement   = 1
For this option to work, you must also set ref_strand to return the strand of the feature:
ref_strand        = sub {shift->strand}
=head3 MAJOR/MINOR ALLELE
Use the 'minor_allele' option to return the minor allele for the SNP.  If you use this option, the major allele will appear in bold type.
=head3 ALLELE FREQUENCY HISTOGRAMS
Use the 'maf' option to return the minor allele frequency for the SNP.  If you use this option, a horizontal histogram will be drawn next to the alleles, to indicate their relative frequencies. e.g.
 A______
 C__
Note: The 'label' option must be set to 1 (i.e. on) and the
'minor_allele' option must return a valid allele for this to work.
lib/Bio/Graphics/Panel.pm view on Meta::CPAN
Panel was created without passing a true value to -truecolor, then
only GD bitmapped fonts are available to you. These include
'gdTinyFont', 'gdSmallFont', 'gdLargeFont', 'gdMediumBoldFont', and
'gdGiantFont'. If the Panel was creaed using a truevalue for
-truecolor, then you can pass the name of any truetype font installed
on the server system. Any of these formats will work:
 -font => 'Times New Roman',          # Times font, let the system pick size
 -font => 'Times New Roman-12'        # Times font, 12 points
 -font => 'Times New Roman-12:Italic' # Times font, 12 points italic
 -font => 'Times New Roman-12:Bold'   # Times font, 12 points bold
B<Font color:> The -fontcolor option controls the color of primary
text, such as labels
B<Secondary Font color:> The -font2color option controls the color of
secondary text, such as descriptions.
B<Labels:> The -label argument controls whether or not the ID of the
feature should be printed next to the feature.  It is accepted by all
glyphs.  By default, the label is printed just above the glyph and