[Bioperl-l] About graphic rendering

Lincoln Stein lincoln.stein at gmail.com
Fri Dec 5 14:41:00 UTC 2008


Hi Paolo,

When you create each subfeature, assign it a unique source_tag, for example
use "extent" for the left and right extents of the feature, and "aligned"
for the part that aligns.. Then specify the color of each type of subfeature
this way:

-extent_color => 'grey',
-aligned_color => 'black'

Lincoln

On Fri, Dec 5, 2008 at 7:41 AM, Paolo Pavan <paolo.pavan at tecnoparco.org>wrote:

> Thank you very much Lincoln, this is what I was searching for, but I
> realize I'm a little confused still.
> Now what I've got is my $feature that paints subtle and my $pre_ and $post_
> that paint like a solid line, the best would be exactly the contrary.
> I was giong deeper with the bioperl modules documentation page for
> <http://goog_1228474077018>heterogeneous_segments<http://doc.bioperl.org/releases/bioperl-1.5.2/Bio/Graphics/Glyph/heterogeneous_segments.html>and I found that there is a way to change the color of a subfeature setting
> the property named -{source}_color => $color
> but I don't understand what is "source".
> Maybe the confusion comes from the fact I haven't understood the way of
> each feature inherit its own Glyph (because they paint differently, they
> must have their own glyph, isn't it?). Please can you explain how this
> happens and how I can set the properties for each segment?
> What are the others glyphs behave the same way of "graded_segments" (bump =
> 0) ?
>
> Thank you again, your help is much appreciated,
> Paolo
>
>
>
> 2008/12/4 Lincoln Stein <lincoln.stein at gmail.com>
>
>> My mistake. The glyph is named "heterogeneous_segments" with an "s"
>>
>> Lincoln
>>
>>
>> On Thu, Dec 4, 2008 at 1:07 PM, Paolo Pavan <paolo.pavan at tecnoparco.org>wrote:
>>
>>> Hi Lincoln, thank you for your answer.
>>> It actually seems that I don't have a glyph called
>>> "heterogeneous_segment", maybe is it a BioPerl version problem? I have 1.5.2
>>> installed.
>>> ( MSG: The requested glyph class, ``heterogeneous_segment'' is not
>>> available: Can't locate Bio/Graphics/Glyph/heterogeneous_segment.pm in
>>> @INC ... )
>>>
>>> However, I could even use a generic glyph if I can change the color of
>>> the external features. I tried to use a bump = 0 but this cause to collapse
>>> more segments I would like to add.
>>> This is the graphic initialization part of the code:
>>>
>>>         my $axis = Bio::SeqFeature::Generic-> new(
>>>                              -start => 0,
>>>                              -end => $database_seq->length
>>>                                   );
>>>
>>>         my $panel = Bio::Graphics::Panel->new (
>>>                             -length => $database_seq->length,
>>>                             -width     => $graphic_length,
>>>                             -pad_left => 10,
>>>                             -pad_right => 10
>>>                             );
>>>
>>>         $panel->add_track(            $axis,
>>>                             -glyph    =>'arrow',
>>>                             -tick    =>2,
>>>                             -fgcolor=>'black',
>>>                             -double    =>1
>>>                             );
>>>         my $track = $panel->add_track(
>>>                             -glyph     => 'generic',
>>>                             -label     => 1,
>>>                             -bgcolor =>'blue',
>>>                             #-bump =>1
>>>                             );
>>>
>>> Maybe isn't clear the idea of the final picture I would like to obtain?
>>>
>>> Thank you again.
>>>
>>> 2008/12/4 Lincoln Stein <lincoln.stein at gmail.com>
>>>
>>> Which glyph are you using to display these features? You may wish to set
>>>> the bump property to zero so that the features don't spread out vertically;
>>>> this happens automatically with some of the glyphs such as
>>>> "heterogeneous_segment"
>>>>
>>>> Lincoln
>>>>
>>>> On Wed, Dec 3, 2008 at 1:21 PM, Paolo Pavan <paolo.pavan at tecnoparco.org
>>>> > wrote:
>>>>
>>>>> Hi everybody,
>>>>> I've a question about a Bio::Graphics rendering. I would like to
>>>>> display a
>>>>> blast HSP on a track but I would like to draw the "tails" of my mapping
>>>>> sequence that don't match the subject. So I instantiate these 3 object
>>>>> that
>>>>> represent all the three segments I want to display:
>>>>>
>>>>> my $feature = Bio::SeqFeature::Generic->new(
>>>>>                                    -display_name
>>>>> =>$sequence_to_map->display_id,
>>>>>                                    -start        =>$hsp->sbjct->start,
>>>>>                                    -end        =>$hsp->sbjct->end,
>>>>>                                    );
>>>>> my $feature_pre = Bio::SeqFeature::Generic->new(
>>>>>                                    -start        =>($hsp->sbjct->start
>>>>> -
>>>>> $hsp->query->start),
>>>>>                                    -end        =>$hsp->sbjct->start-1
>>>>>                                    );
>>>>> my $feature_post = Bio::SeqFeature::Generic->new(
>>>>>                                     -start        =>
>>>>> $hsp->sbjct->end+1,
>>>>>                                     -end        => $hsp->sbjct->end +
>>>>> $sequence_to_map->length - $hsp->query->end
>>>>>                                    );
>>>>>
>>>>> now I have to add these features to my $track in a manner that the
>>>>> $feature_pre and $feature_post paint or color in a different way than
>>>>> $feature but align horizontally.
>>>>> I tried with:
>>>>>
>>>>> $feature->add_sub_SeqFeature($feature_pre, 'EXPAND');
>>>>> $feature->add_sub_SeqFeature($feature_post, 'EXPAND');
>>>>>
>>>>> $track->add_feature($feature);
>>>>>
>>>>> This does not work, because the features spread vertically, and more I
>>>>> cannot change the glyph because seems to be a track property, not a
>>>>> feature
>>>>> one.
>>>>>  Any idea?
>>>>>
>>>>> Thank you for your help,
>>>>> Paolo
>>>>> _______________________________________________
>>>>> Bioperl-l mailing list
>>>>> Bioperl-l at lists.open-bio.org
>>>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Lincoln D. Stein
>>>>
>>>> Ontario Institute for Cancer Research
>>>> 101 College St., Suite 800
>>>> Toronto, ON, Canada M5G0A3
>>>> 416 673-8514
>>>> Assistant: Stacey Quinn <Stacey.Quinn at oicr.on.ca>
>>>>
>>>> Cold Spring Harbor Laboratory
>>>> 1 Bungtown Road
>>>> Cold Spring Harbor, NY 11724 USA
>>>> (516) 367-8380
>>>> Assistant: Sandra Michelsen <michelse at cshl.edu>
>>>>
>>>
>>>
>>
>>
>> --
>> Lincoln D. Stein
>>
>> Ontario Institute for Cancer Research
>> 101 College St., Suite 800
>> Toronto, ON, Canada M5G0A3
>> 416 673-8514
>> Assistant: Stacey Quinn <Stacey.Quinn at oicr.on.ca>
>>
>> Cold Spring Harbor Laboratory
>> 1 Bungtown Road
>> Cold Spring Harbor, NY 11724 USA
>> (516) 367-8380
>> Assistant: Sandra Michelsen <michelse at cshl.edu>
>>
>
>


-- 
Lincoln D. Stein

Ontario Institute for Cancer Research
101 College St., Suite 800
Toronto, ON, Canada M5G0A3
416 673-8514
Assistant: Stacey Quinn <Stacey.Quinn at oicr.on.ca>

Cold Spring Harbor Laboratory
1 Bungtown Road
Cold Spring Harbor, NY 11724 USA
(516) 367-8380
Assistant: Sandra Michelsen <michelse at cshl.edu>



More information about the Bioperl-l mailing list