Bio::DOOP::Graphics::Feature - Graphical representation of the features


Bio-DOOP-DOOP documentation  | view source Contained in the Bio-DOOP-DOOP distribution.

Index


NAME

Top

Bio::DOOP::Graphics::Feature - Graphical representation of the features

VERSION

Top

Version 0.18

SYNOPSIS

Top

DESCRIPTION

Top

This object represents a picture that contains all the sequences and sequence features of a subset. The module is fast enough to use it in your CGI scripts. You can also use it to visualize the subset.

AUTHOR

Top

Tibor Nagy, Godollo, Hungary

METHODS

Top

create

Creates a new picture. Later you can add your own graphical elements to it.

Arguments: Bio::DOOP::DBSQL object and subset primary id.

Return type: Bio::DOOP::Graphics::Feature object

  $picture = Bio::DOOP::Graphics::Feature->create($db,"1234");

add_color

Add an RGB color to the specified element.

The available elements are the following : background, label, strip, utr, motif, tss, frame, fuzzres.

  $image->add_color("background",200,200,200);
  $image->set_colors;

set_colors

Sets all colors. Allocate colors previously with add_color. Use this method only ONCE after you set all the colors. If you use it more than once, the results will be strange.

add_scale

Draws the scale on the picture.

add_bck_lines

Draws scale lines through the whole image background.

add_seq

Draws a specified sequence on the picture. This is internal code, do not use it directly.

add_all_seq

Draws all sequences of the subset. The first one is the reference species.

get_png

Returns the png image. Use this when you finish the work and would like to see the result.

  open IMAGE,">picture.png";
  binmode IMAGE;
  print IMAGE $image->get_png;
  close IMAGE;

get_image

Returns the drawn image pointer. Useful for adding your own GD methods for unique picture manipulation.

get_map

Returns a hash of arrays of hash of arrays reference that contains the image map information. Here is a real world example of how to handle this method :

  use Bio::DOOP::DOOP;

  $db      = Bio::DOOP::DBSQL->connect($user,$passwd,"doop-plant-1_5","localhost");
  $cluster = Bio::DOOP::Cluster->new($db,'81001110','500');
  $image   = Bio::DOOP::Graphics::Feature->create($db,$cluster);

  for $motif (@{$image->get_map->{motif}}){
    for $motif_id (keys %{$motif}){
       @coords = @{$$motif{$motif_id}};
       # Print out the motif primary id and the four coordinates in the picture
       #        id        x1         y1         x2         y2
       print "$motif_id $coords[0] $coords[1] $coords[2] $coords[3]\n";
    }
  }

It is somewhat difficult, but if you are familiar with references and nested data structures, you will understand it.

get_motif_map

Returns only the arrayref of motif hashes.

get_motif_id_by_coord

With this, you can get a motif id, if you specify the coordinates of a pixel.

  $motif_id = $image->get_motif_id_by_coord(100,200);

draw_motif_frame

This method draws a frame around a given motif.

Arguments: motif primary id

Return type: 0 if success, -1 if the given motif id is not in the picture.

  $image->draw_motif_frame($motifid);

draw_fuzz_result

You can draw the fuzznuc result on the picture with this method.

Arguments : sequence primary id, start position, end position

To set drawing color, you can use the setcolor("fuzzres",$r,$g,$b) method. The method shows the orientation. The arrow always points to the start position.

Return value : 0 if success, -1 if the given sequence id can't be found.

  $image->draw_fuzz_result(357,20,70);


Bio-DOOP-DOOP documentation  | view source Contained in the Bio-DOOP-DOOP distribution.