[Gmod-ajax] How can I display each feature name/tag/id/description next to it?

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

[Gmod-ajax] How can I display each feature name/tag/id/description next to it?

David Breimann
Currently, all my features show only the glyph, with no name/description next (or no) them.
How can I control this?

Thanks,
David

------------------------------------------------------------------------------
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-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: How can I display each feature name/tag/id/description next to it?

Mitch Skinner
With flatfile-to-json.pl, add the --getLabels command line argument.  I'm starting to think that should be the default.

Mitch

On 07/02/2010 06:50 AM, David Breimann wrote:
Currently, all my features show only the glyph, with no name/description next (or no) them.
How can I control this?

Thanks,
David
------------------------------------------------------------------------------ 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-ajax mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gmod-ajax


------------------------------------------------------------------------------
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-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: How can I display each feature name/tag/id/description next to it?

Mitch Skinner
On 07/02/2010 07:28 AM, David Breimann wrote:
> I think it should be the default.
>
> Is it possible to do that using a config file?
> Also, I can I control the content of the label (e.g. define a sub that
> uses the some fields in the last col of GFF to generate a nice looking
> text, like done in GBrowse)?

For biodb-to-json.pl, it is the default; if you're not seeing labels
then there may be something else going on.  By default, labels aren't
shown until you're zoomed in beyond a certain point.  The threshold
where labels are shown is configurable with the "clientConfig" setting
in the config file.

You can define a sub to control the content of the label with the
"label" setting in the config file.

Here's an example config file track setup showing both of those things:

     {
       "track": "gene",
       "key": "Gene Span",
       "feature": ["gene"],
       "autocomplete": "all",
       "class": "feature2",
       "category": "Gene Model features",
       "urlTemplate": "http://flybase.org/cgi-bin/fbidq.html?{load_id}",
       "extraData": {"load_id": "sub {shift->attributes(\"load_id\");}"},
       "label": "sub { return \"foo\" . $_[0]->display_name; }",
       "clientConfig": {
         "labelScale": 2
       }
     },

For the "label" setting, the value should be a string containing a perl
callback; the first argument to the sub will be the feature object.  The
callback should return the label that you want.

For the "clientConfig" entry, the "labelScale" setting controls the
threshold where labels are shown; higher numbers make the threshold more
zoomed-in, lower numbers make the threshold more zoomed-out.

The actual units for the "labelScale" setting are pixels/feature.  That
value is multiplied by the average feature density (i.e., the number of
features in the track / the refseq length) to get the scale threshold in
pixels per base.  For example, if the labelScale is 2, and a track has
100 features, then labels will be shown if you're zoomed in far enough
that the entire refseq would be at least 200 pixels wide.

Practically speaking, the default labelScale is 50, and if you want the
threshold to be more zoomed out, set labelScale lower until you see
labels at the zoom level you want.

Mitch

------------------------------------------------------------------------------
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-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: How can I display each feature name/tag/id/description next to it?

Mitch Skinner
On 07/02/2010 09:57 AM, David Breimann wrote:
> Thank you!
>
> 1. Is it possible to call a subroutine defined in extraData from label
> (e.g. "label": "load_id")? I tried playing with the syntax, but
> couldn't figure it out.
>    

The "label" callback and the "extraData" callback both operate on
bioperl feature objects.  So data doesn't go from the extraData outputs
to the label callback, as you seem to be assuming.  Instead, in your
"label" callback you get data straight from the source.  So, for
example, you could so something like

"label": "sub { return \"foo\" . $_[0]->attributes(\"load_id\"); }",

to get whatever information you wanted, directly from the bioperl
feature object.

> 2. What is the structure of a feature object (read from a GFF)?
>    

That's a bioperl thing; refer to the bioperl documentation.  When I want
to experiment to learn a perl API, I often use Devel::REPL (installed
from cpan), something like this:

$ re.pl

$ use Bio::DB::SeqFeature::Store

$ my $db = Bio::DB::SeqFeature::Store->new(-dsn => "dbi:mysql:dmel_5_13")
$Bio_DB_SeqFeature_Store_DBI_mysql1 =
Bio::DB::SeqFeature::Store::DBI::mysql=HASH(0x97cae84);

$ my @genes = $db->features(-seq_id => "4", -type => "gene")

$ $genes[0]->attributes("load_id")
FBgn0040037


Mitch

------------------------------------------------------------------------------
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-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: How can I display each feature name/tag/id/description next to it?

David Breimann
Thanks a lot Mitch.

On Fri, Jul 2, 2010 at 7:26 PM, Mitch Skinner
<[hidden email]> wrote:

> On 07/02/2010 09:57 AM, David Breimann wrote:
>>
>> Thank you!
>>
>> 1. Is it possible to call a subroutine defined in extraData from label
>> (e.g. "label": "load_id")? I tried playing with the syntax, but
>> couldn't figure it out.
>>
>
> The "label" callback and the "extraData" callback both operate on bioperl
> feature objects.  So data doesn't go from the extraData outputs to the label
> callback, as you seem to be assuming.  Instead, in your "label" callback you
> get data straight from the source.  So, for example, you could so something
> like
>
> "label": "sub { return \"foo\" . $_[0]->attributes(\"load_id\"); }",
>
> to get whatever information you wanted, directly from the bioperl feature
> object.
>
>> 2. What is the structure of a feature object (read from a GFF)?
>>
>
> That's a bioperl thing; refer to the bioperl documentation.  When I want to
> experiment to learn a perl API, I often use Devel::REPL (installed from
> cpan), something like this:
>
> $ re.pl
>
> $ use Bio::DB::SeqFeature::Store
>
> $ my $db = Bio::DB::SeqFeature::Store->new(-dsn => "dbi:mysql:dmel_5_13")
> $Bio_DB_SeqFeature_Store_DBI_mysql1 =
> Bio::DB::SeqFeature::Store::DBI::mysql=HASH(0x97cae84);
>
> $ my @genes = $db->features(-seq_id => "4", -type => "gene")
>
> $ $genes[0]->attributes("load_id")
> FBgn0040037
>
>
> Mitch
>

------------------------------------------------------------------------------
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-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax