pairplot help

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

pairplot help

Miquel Ràmia
Hi all,

I'm trying to make an annotator plugin using the pairplot glyph. I managed to get pairplot images using the script suggested in :

http://search.cpan.org/~lds/Bio-Graphics-2.09/lib/Bio/Graphics/Glyph/pairplot.pm

But I've problems adapting the code with a feature_list object instad of a panel in the annotator plugin, no plot is displayed and no error in the error log. Here is the annotator code if someone with more knowledge can tell where I'm wrong, thanks!

sub annotate {
   my $self     = shift;
   my $segment = shift;
   my $config   = $self->configuration;
   
   my $seg_start = $segment->start;
   my $seg_stop  = $segment->stop;
   
   #Feature list
   my $feature_list = $self->new_feature_list;
   my $feature_type = "foo";
   $feature_list->add_type($feature_type => {-glyph => 'pairplot',
                                         -angle => 45,
                                         -bgcolor => 'red',
                                         -point => 1,
                                        });

   # Create one big feature using the PairFeature
   # glyph (see end of synopsis for an implementation)
   my $block = PairFeature->new(-start=>  $seg_start,
                                -end  => $seg_stop);
   
   # It will contain a series of subfeatures.
   my $start = $seg_start;
   while ($start < $seg_stop) {
     my $end = $start+120;
     $block->add_SeqFeature(Bio::Graphics::Feature->new(-start=>$start,
                                                        -end  =>$end
                                                       ),'EXPAND');
     $start += 200;
   }
   
   $feature_list->add_feature($block => $feature_type);

   return $feature_list;
}



package PairFeature;
use base 'Bio::SeqFeature::Generic';

sub pair_score {
    my $self = shift;
    my ($sf1,$sf2) = @_;
    # simple distance function
    my $dist  = $sf2->end    - $sf1->start;
    my $total = $self->end   - $self->start;
    return sprintf('%2.2f',1-$dist/$total);
}


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Gmod-gbrowse mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse
Reply | Threaded
Open this post in threaded view
|

Re: pairplot help

Roman Briskine
--- On Sun, 6/20/10, Miquel Ramia Jesus <[hidden email]> wrote:

> From: Miquel Ramia Jesus <[hidden email]>
> Subject: [Gmod-gbrowse] pairplot help
> To: [hidden email]
> Date: Sunday, June 20, 2010, 3:06 PM
> Hi all,
>
> I'm trying to make an annotator plugin using the pairplot
> glyph. I managed to get pairplot images using the script
> suggested in :
>
> http://search.cpan.org/~lds/Bio-Graphics-2.09/lib/Bio/Graphics/Glyph/pairplot.pm
>
> But I've problems adapting the code with a feature_list
> object instad of a panel in the annotator plugin, no plot is
> displayed and no error in the error log. Here is the
> annotator code if someone with more knowledge can tell where
> I'm wrong, thanks!
>
> sub annotate {
>    my $self     =
> shift;
>    my $segment = shift;
>    my $config   =
> $self->configuration;
>    
>    my $seg_start = $segment->start;
>    my $seg_stop  = $segment->stop;
>    
>    #Feature list
>    my $feature_list =
> $self->new_feature_list;
>    my $feature_type = "foo";
>    $feature_list->add_type($feature_type
> => {-glyph => 'pairplot',
>                
>                
>          -angle => 45,
>                
>                
>          -bgcolor =>
> 'red',
>                
>                
>          -point => 1,
>                
>                
>         });
>
>    # Create one big feature using the
> PairFeature
>    # glyph (see end of synopsis for an
> implementation)
>    my $block =
> PairFeature->new(-start=>  $seg_start,
>                
>                
> -end  => $seg_stop);
>    
>    # It will contain a series of
> subfeatures.
>    my $start = $seg_start;
>    while ($start < $seg_stop) {
>      my $end = $start+120;
>  
>    $block->add_SeqFeature(Bio::Graphics::Feature->new(-start=>$start,
>                
>                
>                
>         -end  =>$end
>                
>                
>                
>        ),'EXPAND');
>      $start += 200;
>    }
>    
>    $feature_list->add_feature($block
> => $feature_type);
>
>    return $feature_list;
> }
>
>
>
> package PairFeature;
> use base 'Bio::SeqFeature::Generic';
>
> sub pair_score {
>     my $self = shift;
>     my ($sf1,$sf2) = @_;
>     # simple distance function
>     my $dist  = $sf2->end    -
> $sf1->start;
>     my $total = $self->end   -
> $self->start;
>     return sprintf('%2.2f',1-$dist/$total);
> }
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to
> win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Gmod-gbrowse mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse
>


Miquel,

I believe you need to add -seq_id and -type parameters when you create PairPlot object.

my $block = PairFeature->new(
      -seq_id => $segment->seq_id,
      -start  => $seg_start,
      -end    => $seg_stop,
      -type   => $feature_type);

Also, I think -ref and -type parameters are needed when you create subfeatures.

Bio::Graphics::Feature->new(
      -ref   => $segment->seq_id,
      -start => $start,
      -end   => $end,
      -type  => $feature_type);

At least it works for me when I do it that way.

HTH,

Roman


     

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Gmod-gbrowse mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse
Reply | Threaded
Open this post in threaded view
|

Re: pairplot help

Miquel Ràmia
Thanks for your help Roman,

But didn't help... now my plugin code is:

###################

sub annotate {
   my $self     = shift;
   my $segment  = shift;
   my $config   = $self->configuration;
   
   my $seg_start = $segment->start;
   my $seg_stop  = $segment->stop;
   
   #Feature list
   my $feature_list = $self->new_feature_list;
   my $feature_type = "foo";
   $feature_list->add_type($feature_type => {-glyph => 'generic',
                                         -angle => 45,
                                         -bgcolor => 'red',
                                         -point => 1,
                                        });

   # Create one big feature using the PairFeature
   # glyph (see end of synopsis for an implementation)
   my $block = PairFeature->new(-seq_id => $segment->seq_id,
                                -start  =>  $seg_start,
                                -end    => $seg_stop,
                                -type   => $feature_type
                                );

   # It will contain a series of subfeatures.
   my $start = $seg_start;

   while ($start < $seg_stop) {
     my $end = $start+120;
     $block->add_SeqFeature(Bio::Graphics::Feature->new(
                                       -ref  => $segment->seq_id,
                                       -start=>$start,
                                       -end  =>$end,
                                       -type => $feature_type
                                                       ),'EXPAND');
     $start += 200;
   }

   $feature_list->add_feature($block => $feature_type);

   return $feature_list;

}

package PairFeature;
use base 'Bio::SeqFeature::Generic';

sub pair_score {
    my $self = shift;
    my ($sf1,$sf2) = @_;
    # simple distance function
    my $dist  = $sf2->end    - $sf1->start;
    my $total = $self->end   - $self->start;
    return sprintf('%2.2f',1-$dist/$total);
}



##################


no plot is displayed, only the track name.

Also, I've a question for my next step, hoping I solve the visualization
soon :D

I've LD data in this format:

#Pos1    #Pos2    #LD values

14169 19975 -0.002922 0.002922 -1.000000 1.000000 0.003265
14169 20064 -0.004383 0.004383 -1.000000 1.000000 0.005042
14169 20067 -0.020453 0.020453 -1.000000 1.000000 0.034783
14508 15329 0.004383 0.004383 1.000000 1.000000 0.005042
14508 19713 -0.051132 0.051132 -1.000000 1.000000 1.000000
14508 19975 -0.051132 0.051132 -1.000000 1.000000 1.000000
14508 20064 0.004383 0.004383 1.000000 1.000000 0.005042
...


What is the best way to use the pair_score method with this data??

Thanks for the help again

Miquel







On Mon, 2010-06-21 at 09:03 -0700, Roman Briskine wrote:

> Miquel,
>
> I believe you need to add -seq_id and -type parameters when you create
> PairPlot object.
>
> my $block = PairFeature->new(
>       -seq_id => $segment->seq_id,
>       -start  => $seg_start,
>       -end    => $seg_stop,
>       -type   => $feature_type);
>
> Also, I think -ref and -type parameters are needed when you create
> subfeatures.
>
> Bio::Graphics::Feature->new(
>       -ref   => $segment->seq_id,
>       -start => $start,
>       -end   => $end,
>       -type  => $feature_type);
>
> At least it works for me when I do it that way.
>
> HTH,
>
> Roman


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Gmod-gbrowse mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse
Reply | Threaded
Open this post in threaded view
|

Re: pairplot help

Roman Briskine
--- On Tue, 6/22/10, Miquel Ràmia <[hidden email]> wrote:

> From: Miquel Ràmia <[hidden email]>
> Subject: Re: [Gmod-gbrowse] pairplot help
> To: [hidden email]
> Date: Tuesday, June 22, 2010, 11:37 AM
> Thanks for your help Roman,
>
> But didn't help... now my plugin code is:
>
> ###################
>
> sub annotate {
>    my $self     =
> shift;
>    my $segment  = shift;
>    my $config   =
> $self->configuration;
>    
>    my $seg_start = $segment->start;
>    my $seg_stop  = $segment->stop;
>    
>    #Feature list
>    my $feature_list =
> $self->new_feature_list;
>    my $feature_type = "foo";
>    $feature_list->add_type($feature_type
> => {-glyph => 'generic',
>                
>                
>          -angle => 45,
>                
>                
>          -bgcolor =>
> 'red',
>                
>                
>          -point => 1,
>                
>                
>         });
>
>    # Create one big feature using the
> PairFeature
>    # glyph (see end of synopsis for an
> implementation)
>    my $block = PairFeature->new(-seq_id
> => $segment->seq_id,
>                
>                
> -start  =>  $seg_start,
>                
>                
> -end    => $seg_stop,
>                
>                
> -type   => $feature_type
>                
>                 );
>
>    # It will contain a series of
> subfeatures.
>    my $start = $seg_start;
>
>    while ($start < $seg_stop) {
>      my $end = $start+120;
>  
>    $block->add_SeqFeature(Bio::Graphics::Feature->new(
>                
>                
>        -ref  =>
> $segment->seq_id,
>                
>                
>        -start=>$start,
>                
>                
>        -end  =>$end,
>                
>                
>        -type => $feature_type
>                
>                
>                
>        ),'EXPAND');
>      $start += 200;
>    }
>
>    $feature_list->add_feature($block
> => $feature_type);
>
>    return $feature_list;
>
> }
>
> package PairFeature;
> use base 'Bio::SeqFeature::Generic';
>
> sub pair_score {
>     my $self = shift;
>     my ($sf1,$sf2) = @_;
>     # simple distance function
>     my $dist  = $sf2->end    -
> $sf1->start;
>     my $total = $self->end   -
> $self->start;
>     return sprintf('%2.2f',1-$dist/$total);
> }
>
>
>
> ##################
>
>
> no plot is displayed, only the track name.
>
> Also, I've a question for my next step, hoping I solve the
> visualization
> soon :D
>
> I've LD data in this format:
>
> #Pos1    #Pos2    #LD values
>
> 14169    19975   
> -0.002922    0.002922   
> -1.000000    1.000000   
> 0.003265
> 14169    20064   
> -0.004383    0.004383   
> -1.000000    1.000000   
> 0.005042
> 14169    20067   
> -0.020453    0.020453   
> -1.000000    1.000000   
> 0.034783
> 14508    15329   
> 0.004383    0.004383   
> 1.000000    1.000000   
> 0.005042
> 14508    19713   
> -0.051132    0.051132   
> -1.000000    1.000000   
> 1.000000
> 14508    19975   
> -0.051132    0.051132   
> -1.000000    1.000000   
> 1.000000
> 14508    20064   
> 0.004383    0.004383   
> 1.000000    1.000000   
> 0.005042
> ...
>
>
> What is the best way to use the pair_score method with this
> data??
>
> Thanks for the help again
>
> Miquel
>
>
[...]


Miquel,

When you add feature type to the feature list, parameter names should be without dashes. Also, the glyph value should be 'pairplot'.

$feature_list->add_type($feature_type => {
   glyph =>'pairplot',
   angle => 45,
   bgcolor => 'red',
   point => 1});


Sorry, I don't have an answer for your second question.

Roman



     

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Gmod-gbrowse mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse
Reply | Threaded
Open this post in threaded view
|

Re: pairplot help

Miquel Ràmia
thanks Roman,

you're right, glyph must be 'pairplot', that was my mistake. I've make
sure there are no dashes but still not working :(

Since I've no errors in the error log, I've used warns all along the
code to check errors, and all the warns are displayed correctly until
the last step "$feature_list->add_feature($block=>$feature_type);".
After this line, no warn is displayed. Does this give any clue?

I attach the entire plugin code in case I've errors outside the
annotate{} block.

regards

Miquel

On Wed, 2010-06-23 at 12:49 -0700, Roman Briskine wrote:

> --- On Tue, 6/22/10, Miquel Ràmia <[hidden email]> wrote:
>
> > From: Miquel Ràmia <[hidden email]>
> > Subject: Re: [Gmod-gbrowse] pairplot help
> > To: [hidden email]
> > Date: Tuesday, June 22, 2010, 11:37 AM
> > Thanks for your help Roman,
> >
> > But didn't help... now my plugin code is:
> >
> > ###################
> >
> > sub annotate {
> >    my $self     =
> > shift;
> >    my $segment  = shift;
> >    my $config   =
> > $self->configuration;
> >    
> >    my $seg_start = $segment->start;
> >    my $seg_stop  = $segment->stop;
> >    
> >    #Feature list
> >    my $feature_list =
> > $self->new_feature_list;
> >    my $feature_type = "foo";
> >    $feature_list->add_type($feature_type
> > => {-glyph => 'generic',
> >                
> >                
> >          -angle => 45,
> >                
> >                
> >          -bgcolor =>
> > 'red',
> >                
> >                
> >          -point => 1,
> >                
> >                
> >         });
> >
> >    # Create one big feature using the
> > PairFeature
> >    # glyph (see end of synopsis for an
> > implementation)
> >    my $block = PairFeature->new(-seq_id
> > => $segment->seq_id,
> >                
> >                
> > -start  =>  $seg_start,
> >                
> >                
> > -end    => $seg_stop,
> >                
> >                
> > -type   => $feature_type
> >                
> >                 );
> >
> >    # It will contain a series of
> > subfeatures.
> >    my $start = $seg_start;
> >
> >    while ($start < $seg_stop) {
> >      my $end = $start+120;
> >  
> >    $block->add_SeqFeature(Bio::Graphics::Feature->new(
> >                
> >                
> >        -ref  =>
> > $segment->seq_id,
> >                
> >                
> >        -start=>$start,
> >                
> >                
> >        -end  =>$end,
> >                
> >                
> >        -type => $feature_type
> >                
> >                
> >                
> >        ),'EXPAND');
> >      $start += 200;
> >    }
> >
> >    $feature_list->add_feature($block
> > => $feature_type);
> >
> >    return $feature_list;
> >
> > }
> >
> > package PairFeature;
> > use base 'Bio::SeqFeature::Generic';
> >
> > sub pair_score {
> >     my $self = shift;
> >     my ($sf1,$sf2) = @_;
> >     # simple distance function
> >     my $dist  = $sf2->end    -
> > $sf1->start;
> >     my $total = $self->end   -
> > $self->start;
> >     return sprintf('%2.2f',1-$dist/$total);
> > }
> >
> >
> >
> > ##################
> >
> >
> > no plot is displayed, only the track name.
> >
> > Also, I've a question for my next step, hoping I solve the
> > visualization
> > soon :D
> >
> > I've LD data in this format:
> >
> > #Pos1    #Pos2    #LD values
> >
> > 14169    19975  
> > -0.002922    0.002922  
> > -1.000000    1.000000  
> > 0.003265
> > 14169    20064  
> > -0.004383    0.004383  
> > -1.000000    1.000000  
> > 0.005042
> > 14169    20067  
> > -0.020453    0.020453  
> > -1.000000    1.000000  
> > 0.034783
> > 14508    15329  
> > 0.004383    0.004383  
> > 1.000000    1.000000  
> > 0.005042
> > 14508    19713  
> > -0.051132    0.051132  
> > -1.000000    1.000000  
> > 1.000000
> > 14508    19975  
> > -0.051132    0.051132  
> > -1.000000    1.000000  
> > 1.000000
> > 14508    20064  
> > 0.004383    0.004383  
> > 1.000000    1.000000  
> > 0.005042
> > ...
> >
> >
> > What is the best way to use the pair_score method with this
> > data??
> >
> > Thanks for the help again
> >
> > Miquel
> >
> >
> [...]
>
>
> Miquel,
>
> When you add feature type to the feature list, parameter names should be without dashes. Also, the glyph value should be 'pairplot'.
>
> $feature_list->add_type($feature_type => {
>    glyph =>'pairplot',
>    angle => 45,
>    bgcolor => 'red',
>    point => 1});
>
>
> Sorry, I don't have an answer for your second question.
>
> Roman
>
>
>
>      


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Gmod-gbrowse mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse

PairplotGenericAnnotator.pm (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: pairplot help

Roman Briskine
Miquel,

I took your plugin and tested it on our server with a few minor modifications that shouldn't affect anything. The only problem I found was with subclassing Bio::SeqFeature::Generic. I always get an error message in the log and nothing is displayed. If I use Bio::Graphics::Feature as the base class for PairFeature, your plugin works properly.

We are still running v1.7, however. I'm sure there are some differences in the way plugins are handled. I was going to configure v2 on our server this week but unfortunately a few urgent tasks came up. If changing the base class doesn't help, I'll try to get back to you on Friday.

Roman


--- On Fri, 6/25/10, Miquel Ràmia <[hidden email]> wrote:

> From: Miquel Ràmia <[hidden email]>
> Subject: Re: [Gmod-gbrowse] pairplot help
> To: [hidden email]
> Date: Friday, June 25, 2010, 10:17 AM
> thanks Roman,
>
> you're right, glyph must be 'pairplot', that was my
> mistake. I've make
> sure there are no dashes but still not working :(
>
> Since I've no errors in the error log, I've used warns all
> along the
> code to check errors, and all the warns are displayed
> correctly until
> the last step
> "$feature_list->add_feature($block=>$feature_type);".
> After this line, no warn is displayed. Does this give any
> clue?
>
> I attach the entire plugin code in case I've errors outside
> the
> annotate{} block.
>
> regards
>
> Miquel
>
> On Wed, 2010-06-23 at 12:49 -0700, Roman Briskine wrote:
> > --- On Tue, 6/22/10, Miquel Ràmia <[hidden email]>
> wrote:
> >
> > > From: Miquel Ràmia <[hidden email]>
> > > Subject: Re: [Gmod-gbrowse] pairplot help
> > > To: [hidden email]
> > > Date: Tuesday, June 22, 2010, 11:37 AM
> > > Thanks for your help Roman,
> > >
> > > But didn't help... now my plugin code is:
> > >
> > > ###################
> > >
> > > sub annotate {
> > >    my $self     =
> > > shift;
> > >    my $segment  = shift;
> > >    my $config   =
> > > $self->configuration;
> > >   
> > >    my $seg_start = $segment->start;
> > >    my $seg_stop  =
> $segment->stop;
> > >   
> > >    #Feature list
> > >    my $feature_list =
> > > $self->new_feature_list;
> > >    my $feature_type = "foo";
> > >   
> $feature_list->add_type($feature_type
> > > => {-glyph => 'generic',
> > >             
>  
> > >             
>  
> > >          -angle =>
> 45,
> > >             
>  
> > >             
>  
> > >          -bgcolor =>
> > > 'red',
> > >             
>  
> > >             
>  
> > >          -point =>
> 1,
> > >             
>  
> > >             
>  
> > >         });
> > >
> > >    # Create one big feature using the
> > > PairFeature
> > >    # glyph (see end of synopsis for an
> > > implementation)
> > >    my $block =
> PairFeature->new(-seq_id
> > > => $segment->seq_id,
> > >             
>  
> > >             
>  
> > > -start  =>  $seg_start,
> > >             
>  
> > >             
>  
> > > -end    => $seg_stop,
> > >             
>  
> > >             
>  
> > > -type   => $feature_type
> > >             
>  
> > >             
>    );
> > >
> > >    # It will contain a series of
> > > subfeatures.
> > >    my $start = $seg_start;
> > >
> > >    while ($start < $seg_stop) {
> > >      my $end = $start+120;
> > > 
> > >   
> $block->add_SeqFeature(Bio::Graphics::Feature->new(
> > >             
>  
> > >             
>  
> > >        -ref  =>
> > > $segment->seq_id,
> > >             
>  
> > >             
>  
> > >        -start=>$start,
> > >             
>  
> > >             
>  
> > >        -end  =>$end,
> > >             
>  
> > >             
>  
> > >        -type =>
> $feature_type
> > >             
>  
> > >             
>  
> > >             
>  
> > >        ),'EXPAND');
> > >      $start += 200;
> > >    }
> > >
> > >   
> $feature_list->add_feature($block
> > > => $feature_type);
> > >
> > >    return $feature_list;
> > >
> > > }
> > >
> > > package PairFeature;
> > > use base 'Bio::SeqFeature::Generic';
> > >
> > > sub pair_score {
> > >     my $self = shift;
> > >     my ($sf1,$sf2) = @_;
> > >     # simple distance
> function
> > >     my $dist  =
> $sf2->end    -
> > > $sf1->start;
> > >     my $total =
> $self->end   -
> > > $self->start;
> > >     return
> sprintf('%2.2f',1-$dist/$total);
> > > }
> > >
> > >
> > >
> > > ##################
> > >
> > >
> > > no plot is displayed, only the track name.
> > >
> > > Also, I've a question for my next step, hoping I
> solve the
> > > visualization
> > > soon :D
> > >
> > > I've LD data in this format:
> > >
> > > #Pos1    #Pos2    #LD values
> > >
> > > 14169    19975   
> > > -0.002922   
> 0.002922   
> > > -1.000000   
> 1.000000   
> > > 0.003265
> > > 14169    20064   
> > > -0.004383   
> 0.004383   
> > > -1.000000   
> 1.000000   
> > > 0.005042
> > > 14169    20067   
> > > -0.020453   
> 0.020453   
> > > -1.000000   
> 1.000000   
> > > 0.034783
> > > 14508    15329   
> > > 0.004383    0.004383   
> > > 1.000000    1.000000   
> > > 0.005042
> > > 14508    19713   
> > > -0.051132   
> 0.051132   
> > > -1.000000   
> 1.000000   
> > > 1.000000
> > > 14508    19975   
> > > -0.051132   
> 0.051132   
> > > -1.000000   
> 1.000000   
> > > 1.000000
> > > 14508    20064   
> > > 0.004383    0.004383   
> > > 1.000000    1.000000   
> > > 0.005042
> > > ...
> > >
> > >
> > > What is the best way to use the pair_score method
> with this
> > > data??
> > >
> > > Thanks for the help again
> > >
> > > Miquel
> > >
> > >
> > [...]
> >
> >
> > Miquel,
> >
> > When you add feature type to the feature list,
> parameter names should be without dashes. Also, the glyph
> value should be 'pairplot'.
> >
> > $feature_list->add_type($feature_type => {
> >    glyph =>'pairplot',
> >    angle => 45,
> >    bgcolor => 'red',
> >    point => 1});
> >
> >
> > Sorry, I don't have an answer for your second
> question.
> >
> > Roman
> >
> >
> >
> >       
>
>
>
> -----Inline Attachment Follows-----
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to
> win:
> http://p.sf.net/sfu/thinkgeek-promo
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Gmod-gbrowse mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse
>


     

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Gmod-gbrowse mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse
Reply | Threaded
Open this post in threaded view
|

Re: pairplot help

Miquel Ràmia
Using Bio::Graphics::Feature as the base class for PairFeature did the
trick! now it visualizes perfectly, thank you very much!


On Tue, 2010-06-29 at 11:01 -0700, Roman Briskine wrote:

> Miquel,
>
> I took your plugin and tested it on our server with a few minor modifications that shouldn't affect anything. The only problem I found was with subclassing Bio::SeqFeature::Generic. I always get an error message in the log and nothing is displayed. If I use Bio::Graphics::Feature as the base class for PairFeature, your plugin works properly.
>
> We are still running v1.7, however. I'm sure there are some differences in the way plugins are handled. I was going to configure v2 on our server this week but unfortunately a few urgent tasks came up. If changing the base class doesn't help, I'll try to get back to you on Friday.
>
> Roman
>
>
> --- On Fri, 6/25/10, Miquel Ràmia <[hidden email]> wrote:
>
> > From: Miquel Ràmia <[hidden email]>
> > Subject: Re: [Gmod-gbrowse] pairplot help
> > To: [hidden email]
> > Date: Friday, June 25, 2010, 10:17 AM
> > thanks Roman,
> >
> > you're right, glyph must be 'pairplot', that was my
> > mistake. I've make
> > sure there are no dashes but still not working :(
> >
> > Since I've no errors in the error log, I've used warns all
> > along the
> > code to check errors, and all the warns are displayed
> > correctly until
> > the last step
> > "$feature_list->add_feature($block=>$feature_type);".
> > After this line, no warn is displayed. Does this give any
> > clue?
> >
> > I attach the entire plugin code in case I've errors outside
> > the
> > annotate{} block.
> >
> > regards
> >
> > Miquel
> >
> > On Wed, 2010-06-23 at 12:49 -0700, Roman Briskine wrote:
> > > --- On Tue, 6/22/10, Miquel Ràmia <[hidden email]>
> > wrote:
> > >
> > > > From: Miquel Ràmia <[hidden email]>
> > > > Subject: Re: [Gmod-gbrowse] pairplot help
> > > > To: [hidden email]
> > > > Date: Tuesday, June 22, 2010, 11:37 AM
> > > > Thanks for your help Roman,
> > > >
> > > > But didn't help... now my plugin code is:
> > > >
> > > > ###################
> > > >
> > > > sub annotate {
> > > >    my $self     =
> > > > shift;
> > > >    my $segment  = shift;
> > > >    my $config   =
> > > > $self->configuration;
> > > >    
> > > >    my $seg_start = $segment->start;
> > > >    my $seg_stop  =
> > $segment->stop;
> > > >    
> > > >    #Feature list
> > > >    my $feature_list =
> > > > $self->new_feature_list;
> > > >    my $feature_type = "foo";
> > > >  
> > $feature_list->add_type($feature_type
> > > > => {-glyph => 'generic',
> > > >            
> >  
> > > >            
> >  
> > > >          -angle =>
> > 45,
> > > >            
> >  
> > > >            
> >  
> > > >          -bgcolor =>
> > > > 'red',
> > > >            
> >  
> > > >            
> >  
> > > >          -point =>
> > 1,
> > > >            
> >  
> > > >            
> >  
> > > >         });
> > > >
> > > >    # Create one big feature using the
> > > > PairFeature
> > > >    # glyph (see end of synopsis for an
> > > > implementation)
> > > >    my $block =
> > PairFeature->new(-seq_id
> > > > => $segment->seq_id,
> > > >            
> >  
> > > >            
> >  
> > > > -start  =>  $seg_start,
> > > >            
> >  
> > > >            
> >  
> > > > -end    => $seg_stop,
> > > >            
> >  
> > > >            
> >  
> > > > -type   => $feature_type
> > > >            
> >  
> > > >            
> >    );
> > > >
> > > >    # It will contain a series of
> > > > subfeatures.
> > > >    my $start = $seg_start;
> > > >
> > > >    while ($start < $seg_stop) {
> > > >      my $end = $start+120;
> > > >  
> > > >  
> > $block->add_SeqFeature(Bio::Graphics::Feature->new(
> > > >            
> >  
> > > >            
> >  
> > > >        -ref  =>
> > > > $segment->seq_id,
> > > >            
> >  
> > > >            
> >  
> > > >        -start=>$start,
> > > >            
> >  
> > > >            
> >  
> > > >        -end  =>$end,
> > > >            
> >  
> > > >            
> >  
> > > >        -type =>
> > $feature_type
> > > >            
> >  
> > > >            
> >  
> > > >            
> >  
> > > >        ),'EXPAND');
> > > >      $start += 200;
> > > >    }
> > > >
> > > >  
> > $feature_list->add_feature($block
> > > > => $feature_type);
> > > >
> > > >    return $feature_list;
> > > >
> > > > }
> > > >
> > > > package PairFeature;
> > > > use base 'Bio::SeqFeature::Generic';
> > > >
> > > > sub pair_score {
> > > >     my $self = shift;
> > > >     my ($sf1,$sf2) = @_;
> > > >     # simple distance
> > function
> > > >     my $dist  =
> > $sf2->end    -
> > > > $sf1->start;
> > > >     my $total =
> > $self->end   -
> > > > $self->start;
> > > >     return
> > sprintf('%2.2f',1-$dist/$total);
> > > > }
> > > >
> > > >
> > > >
> > > > ##################
> > > >
> > > >
> > > > no plot is displayed, only the track name.
> > > >
> > > > Also, I've a question for my next step, hoping I
> > solve the
> > > > visualization
> > > > soon :D
> > > >
> > > > I've LD data in this format:
> > > >
> > > > #Pos1    #Pos2    #LD values
> > > >
> > > > 14169    19975  
> > > > -0.002922  
> > 0.002922  
> > > > -1.000000  
> > 1.000000  
> > > > 0.003265
> > > > 14169    20064  
> > > > -0.004383  
> > 0.004383  
> > > > -1.000000  
> > 1.000000  
> > > > 0.005042
> > > > 14169    20067  
> > > > -0.020453  
> > 0.020453  
> > > > -1.000000  
> > 1.000000  
> > > > 0.034783
> > > > 14508    15329  
> > > > 0.004383    0.004383  
> > > > 1.000000    1.000000  
> > > > 0.005042
> > > > 14508    19713  
> > > > -0.051132  
> > 0.051132  
> > > > -1.000000  
> > 1.000000  
> > > > 1.000000
> > > > 14508    19975  
> > > > -0.051132  
> > 0.051132  
> > > > -1.000000  
> > 1.000000  
> > > > 1.000000
> > > > 14508    20064  
> > > > 0.004383    0.004383  
> > > > 1.000000    1.000000  
> > > > 0.005042
> > > > ...
> > > >
> > > >
> > > > What is the best way to use the pair_score method
> > with this
> > > > data??
> > > >
> > > > Thanks for the help again
> > > >
> > > > Miquel
> > > >
> > > >
> > > [...]
> > >
> > >
> > > Miquel,
> > >
> > > When you add feature type to the feature list,
> > parameter names should be without dashes. Also, the glyph
> > value should be 'pairplot'.
> > >
> > > $feature_list->add_type($feature_type => {
> > >    glyph =>'pairplot',
> > >    angle => 45,
> > >    bgcolor => 'red',
> > >    point => 1});
> > >
> > >
> > > Sorry, I don't have an answer for your second
> > question.
> > >
> > > Roman
> > >
> > >
> > >
> > >      
> >
> >
> >
> > -----Inline Attachment Follows-----
> >
> > ------------------------------------------------------------------------------
> > ThinkGeek and WIRED's GeekDad team up for the Ultimate
> > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> > lucky parental unit.  See the prize list and enter to
> > win:
> > http://p.sf.net/sfu/thinkgeek-promo
> > -----Inline Attachment Follows-----
> >
> > _______________________________________________
> > Gmod-gbrowse mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse
> >
>
>
>      
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Gmod-gbrowse mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse




------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Gmod-gbrowse mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse