[Gmod-tripal-devel] Adding custom links to Feature TOC

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

[Gmod-tripal-devel] Adding custom links to Feature TOC

Michael Dondrup-3
Hi,
 we have finally finished our migration of Drupal and Tripal and we have our site up again.
We are now trying to fine tune the last small issue that are remaining. I hope you can help us
with restoring this function.

In D6 we had added custom links for each feature in the Resources sidebar, e.g. a link to the feature’s Ensembl page in
themes/tripal_theme/node-chado_feature.tpl.php like so:
<li><a href="<?php print $ensemblurl.$feature->name?>” target="_blank">Show in Ensembl</a></li>

I am having problems to identify where to insert similar code into the new template structure.
I would be grateful for any hints.

Regards

Michael

Michael Dondrup
Researcher
Sea Lice Research Centre
Department of Informatics
University of Bergen
Thormøhlensgate 55, N-5008 Bergen,
Norway


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Gmod-tripal-devel] Adding custom links to Feature TOC

Stephen Ficklin-2
Hi Michael,

It's relatively easy to add links and custom panes to a Tripal v2 content type without editing the templates.   Tripal v3 will better support this, but Tripal v2 does have a 'kludgy' way to do this.  I've added a new page to the v2 User's Guide that explains how to do it.  Unfortunately, I wasn't able to add screenshots with the instructions so if you have any questions please let me know.

Here's the link:

http://tripal.info/node/288

Stephen

On 3/17/2016 1:26 AM, Michael Dondrup wrote:
Hi,
 we have finally finished our migration of Drupal and Tripal and we have our site up again.
We are now trying to fine tune the last small issue that are remaining. I hope you can help us
with restoring this function.

In D6 we had added custom links for each feature in the Resources sidebar, e.g. a link to the feature’s Ensembl page in
themes/tripal_theme/node-chado_feature.tpl.php like so:
<li><a href="<?php print $ensemblurl.$feature->name?>” target="_blank">Show in Ensembl</a></li>

I am having problems to identify where to insert similar code into the new template structure.
I would be grateful for any hints.

Regards

Michael

Michael Dondrup
Researcher
Sea Lice Research Centre
Department of Informatics
University of Bergen
Thormøhlensgate 55, N-5008 Bergen,
Norway



------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140


_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Gmod-tripal-devel] Adding custom links to Feature TOC

Michael Dondrup-3
Hi Stephen
and thank you for the additional documentation! I have tried the procedure to add external links to single genes,
and can confirm that it is working. However I need a little more automated ways to generate those links. Is it possible?

As an example, say I have all D. rerio genes with
names ENSDARG00000024771. I can generate sinlge links like:
View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=ENSDARG00000024771

Now I need to add an external reference to each gene that will be generated automatically: like so

View in $feature_name Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=$feature_name

Either by generating all the Urls by a Tripal job or by gnerating them on the fly, e.g. using the template. The template was the way
I had this implemented in Tripal 1 but I don’t know where to insert the code now.

Any ideas?

Thank you very much.
Michael


> On Mar 18, 2016, at 6:58 PM, Stephen Ficklin <[hidden email]> wrote:
>
> Hi Michael,
>
> It's relatively easy to add links and custom panes to a Tripal v2 content type without editing the templates.   Tripal v3 will better support this, but Tripal v2 does have a 'kludgy' way to do this.  I've added a new page to the v2 User's Guide that explains how to do it.  Unfortunately, I wasn't able to add screenshots with the instructions so if you have any questions please let me know.
>
> Here's the link:
>
> http://tripal.info/node/288
>
> Stephen
>
> On 3/17/2016 1:26 AM, Michael Dondrup wrote:
>> Hi,
>>  we have finally finished our migration of Drupal and Tripal and we have our site up again.
>> We are now trying to fine tune the last small issue that are remaining. I hope you can help us
>> with restoring this function.
>>
>> In D6 we had added custom links for each feature in the Resources sidebar, e.g. a link to the feature’s Ensembl page in
>> themes/tripal_theme/node-chado_feature.tpl.php like so:
>> <li><a href="<?php print $ensemblurl.$feature->name?>” target="_blank">Show in Ensembl</a></li>
>>
>> I am having problems to identify where to insert similar code into the new template structure.
>> I would be grateful for any hints.
>>
>> Regards
>>
>> Michael
>>
>> Michael Dondrup
>> Researcher
>> Sea Lice Research Centre
>> Department of Informatics
>> University of Bergen
>> Thormøhlensgate 55, N-5008 Bergen,
>> Norway
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Transform Data into Opportunity.
>> Accelerate data analysis in your applications with
>> Intel Data Analytics Acceleration Library.
>> Click to learn more.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
>>
>>
>> _______________________________________________
>> Gmod-tripal-devel mailing list
>>
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140_______________________________________________
> Gmod-tripal-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Gmod-tripal-devel] Adding custom links to Feature TOC

Stephen Ficklin-2
Hi Michael,

I now see the problem.  I just added some new functionality for the
field_resource_links fields.  It now supports tokens.   Tokens are text
in brackets (e.g. [feature.name]) that represent data values. The
appropriate value will be substituted for the value entered. So, for
example, for your links to be dynamic you can use the following for your
links:

View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=[feature.name]

You'll find a list of all possible tokens in a new expandable fieldset
just below the fields where you can enter the URLs.

To get this functionality you'll need to upgrade to the most recent
development version of Tripal.

Let me know if this works for you.

Stephen


On 3/21/2016 6:29 AM, Michael Dondrup wrote:

> Hi Stephen
> and thank you for the additional documentation! I have tried the procedure to add external links to single genes,
> and can confirm that it is working. However I need a little more automated ways to generate those links. Is it possible?
>
> As an example, say I have all D. rerio genes with
> names ENSDARG00000024771. I can generate sinlge links like:
> View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=ENSDARG00000024771
>
> Now I need to add an external reference to each gene that will be generated automatically: like so
>
> View in $feature_name Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=$feature_name
>
> Either by generating all the Urls by a Tripal job or by gnerating them on the fly, e.g. using the template. The template was the way
> I had this implemented in Tripal 1 but I don’t know where to insert the code now.
>
> Any ideas?
>
> Thank you very much.
> Michael
>
>
>> On Mar 18, 2016, at 6:58 PM, Stephen Ficklin <[hidden email]> wrote:
>>
>> Hi Michael,
>>
>> It's relatively easy to add links and custom panes to a Tripal v2 content type without editing the templates.   Tripal v3 will better support this, but Tripal v2 does have a 'kludgy' way to do this.  I've added a new page to the v2 User's Guide that explains how to do it.  Unfortunately, I wasn't able to add screenshots with the instructions so if you have any questions please let me know.
>>
>> Here's the link:
>>
>> http://tripal.info/node/288
>>
>> Stephen
>>
>> On 3/17/2016 1:26 AM, Michael Dondrup wrote:
>>> Hi,
>>>   we have finally finished our migration of Drupal and Tripal and we have our site up again.
>>> We are now trying to fine tune the last small issue that are remaining. I hope you can help us
>>> with restoring this function.
>>>
>>> In D6 we had added custom links for each feature in the Resources sidebar, e.g. a link to the feature’s Ensembl page in
>>> themes/tripal_theme/node-chado_feature.tpl.php like so:
>>> <li><a href="<?php print $ensemblurl.$feature->name?>” target="_blank">Show in Ensembl</a></li>
>>>
>>> I am having problems to identify where to insert similar code into the new template structure.
>>> I would be grateful for any hints.
>>>
>>> Regards
>>>
>>> Michael
>>>
>>> Michael Dondrup
>>> Researcher
>>> Sea Lice Research Centre
>>> Department of Informatics
>>> University of Bergen
>>> Thormøhlensgate 55, N-5008 Bergen,
>>> Norway
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Transform Data into Opportunity.
>>> Accelerate data analysis in your applications with
>>> Intel Data Analytics Acceleration Library.
>>> Click to learn more.
>>>
>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
>>>
>>>
>>> _______________________________________________
>>> Gmod-tripal-devel mailing list
>>>
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>> ------------------------------------------------------------------------------
>> Transform Data into Opportunity.
>> Accelerate data analysis in your applications with
>> Intel Data Analytics Acceleration Library.
>> Click to learn more.
>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140_______________________________________________
>> Gmod-tripal-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Gmod-tripal-devel] Adding custom links to Feature TOC

Stephen Ficklin-2
In reply to this post by Michael Dondrup-3
Oh, but I should also mention....  It would probably be best if you can
get your links to Ensembl in the feature.dbxref_id field or in the
feature_dbxref table of Chado. If your references are in either of these
two places then Tripal will create a new 'Cross References' link in the
sidebar which if clicked the user will see all of the locations where
this gene is also housed (e.g. Ensemble, NCBI, etc).  These links are
generated automatically for you by Tripal because they are found in the
Chado database.

Any text you add using these field_resource_links fields is not housed
in Chado.  Drupal manages those.  So, if you ever want to dump your
Chado database to send to someone and you'd like the links to ensemble
to be part of that, you'll want to store it in Chado.

So, unless you specifically need the links on the sidebar my suggestion
would be to add these cross references to the feature.dbxref_id or
feature_dbxref tables.

Stephen

On 3/21/2016 6:29 AM, Michael Dondrup wrote:

> Hi Stephen
> and thank you for the additional documentation! I have tried the procedure to add external links to single genes,
> and can confirm that it is working. However I need a little more automated ways to generate those links. Is it possible?
>
> As an example, say I have all D. rerio genes with
> names ENSDARG00000024771. I can generate sinlge links like:
> View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=ENSDARG00000024771
>
> Now I need to add an external reference to each gene that will be generated automatically: like so
>
> View in $feature_name Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=$feature_name
>
> Either by generating all the Urls by a Tripal job or by gnerating them on the fly, e.g. using the template. The template was the way
> I had this implemented in Tripal 1 but I don’t know where to insert the code now.
>
> Any ideas?
>
> Thank you very much.
> Michael
>
>
>> On Mar 18, 2016, at 6:58 PM, Stephen Ficklin <[hidden email]> wrote:
>>
>> Hi Michael,
>>
>> It's relatively easy to add links and custom panes to a Tripal v2 content type without editing the templates.   Tripal v3 will better support this, but Tripal v2 does have a 'kludgy' way to do this.  I've added a new page to the v2 User's Guide that explains how to do it.  Unfortunately, I wasn't able to add screenshots with the instructions so if you have any questions please let me know.
>>
>> Here's the link:
>>
>> http://tripal.info/node/288
>>
>> Stephen
>>
>> On 3/17/2016 1:26 AM, Michael Dondrup wrote:
>>> Hi,
>>>   we have finally finished our migration of Drupal and Tripal and we have our site up again.
>>> We are now trying to fine tune the last small issue that are remaining. I hope you can help us
>>> with restoring this function.
>>>
>>> In D6 we had added custom links for each feature in the Resources sidebar, e.g. a link to the feature’s Ensembl page in
>>> themes/tripal_theme/node-chado_feature.tpl.php like so:
>>> <li><a href="<?php print $ensemblurl.$feature->name?>” target="_blank">Show in Ensembl</a></li>
>>>
>>> I am having problems to identify where to insert similar code into the new template structure.
>>> I would be grateful for any hints.
>>>
>>> Regards
>>>
>>> Michael
>>>
>>> Michael Dondrup
>>> Researcher
>>> Sea Lice Research Centre
>>> Department of Informatics
>>> University of Bergen
>>> Thormøhlensgate 55, N-5008 Bergen,
>>> Norway
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Transform Data into Opportunity.
>>> Accelerate data analysis in your applications with
>>> Intel Data Analytics Acceleration Library.
>>> Click to learn more.
>>>
>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
>>>
>>>
>>> _______________________________________________
>>> Gmod-tripal-devel mailing list
>>>
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>> ------------------------------------------------------------------------------
>> Transform Data into Opportunity.
>> Accelerate data analysis in your applications with
>> Intel Data Analytics Acceleration Library.
>> Click to learn more.
>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140_______________________________________________
>> Gmod-tripal-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Gmod-tripal-devel] Adding custom links to Feature TOC

Michael Dondrup-3
In reply to this post by Stephen Ficklin-2
Hi Stephen,

thank you for the pointers and the update of Tripal. I still had to solve the problem of generating these db entries automatically, maybe there is a way to generate them
during during import from fasta or gff or using the UI? Instead, I resorted to inserting the xrefs using SQL. It seems to work but I am not sure if it is a generally safe way of doing this,
or i am rather sure it is not.
Please let me know if there are some concerns about them, but also they could be useful to someone:

Hack 1.

— Inserts a crossref entry with the same accession as the feature name for each feature with a given name pattern, and links them afterwards, this will
— work with Ensembl Gene IDs in my case, must have a single database entry with name ‘Ensembl’

INSERT INTO chado.dbxref(db_id, accession)  (SELECT d.db_id, f.name FROM chado.feature as f, chado.db AS d WHERE f.name LIKE 'EMLSAG%' AND d.name = 'Ensembl' );

— Now update the chado features with the corrrect xref, I bet this is bound to fail if the names are not unique
 
UPDATE chado.feature AS f SET dbxref_id = q.dbxref_id FROM (
       (SELECT d.dbxref_id, d.accession FROM chado.dbxref AS d LEFT JOIN chado.feature AS ff
             ON ff.name = d.accession )) AS q
        WHERE q.accession = f.name;  

Hack 2.

— generate a ‘Run Blast’ link for each feature appending the feature_id as an argument to the URL, by adding an entry to the field_resource_links field
— for each feature in the chado_feature table

INSERT INTO field_data_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
       (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|__BLASTURL__' || cf.feature_id  FROM public.chado_feature AS cf  )

— Not sure if this is necessary

INSERT INTO field_revision_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
       (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|__BLASTURL__' || cf.feature_id  FROM public.chado_feature AS cf  )







> On Mar 21, 2016, at 10:15 PM, Stephen Ficklin <[hidden email]> wrote:
>
> Hi Michael,
>
> I now see the problem.  I just added some new functionality for the field_resource_links fields.  It now supports tokens.   Tokens are text in brackets (e.g. [feature.name]) that represent data values. The appropriate value will be substituted for the value entered. So, for example, for your links to be dynamic you can use the following for your links:
>
> View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=[feature.name]
>
> You'll find a list of all possible tokens in a new expandable fieldset just below the fields where you can enter the URLs.
>
> To get this functionality you'll need to upgrade to the most recent development version of Tripal.
>
> Let me know if this works for you.
>
> Stephen
>
>
> On 3/21/2016 6:29 AM, Michael Dondrup wrote:
>> Hi Stephen
>> and thank you for the additional documentation! I have tried the procedure to add external links to single genes,
>> and can confirm that it is working. However I need a little more automated ways to generate those links. Is it possible?
>>
>> As an example, say I have all D. rerio genes with
>> names ENSDARG00000024771. I can generate sinlge links like:
>> View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=ENSDARG00000024771
>>
>> Now I need to add an external reference to each gene that will be generated automatically: like so
>>
>> View in $feature_name Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=$feature_name
>>
>> Either by generating all the Urls by a Tripal job or by gnerating them on the fly, e.g. using the template. The template was the way
>> I had this implemented in Tripal 1 but I don’t know where to insert the code now.
>>
>> Any ideas?
>>
>> Thank you very much.
>> Michael
>>
>>
>>> On Mar 18, 2016, at 6:58 PM, Stephen Ficklin <[hidden email]> wrote:
>>>
>>> Hi Michael,
>>>
>>> It's relatively easy to add links and custom panes to a Tripal v2 content type without editing the templates.   Tripal v3 will better support this, but Tripal v2 does have a 'kludgy' way to do this.  I've added a new page to the v2 User's Guide that explains how to do it.  Unfortunately, I wasn't able to add screenshots with the instructions so if you have any questions please let me know.
>>>
>>> Here's the link:
>>>
>>> http://tripal.info/node/288
>>>
>>> Stephen
>>>
>>> On 3/17/2016 1:26 AM, Michael Dondrup wrote:
>>>> Hi,
>>>>  we have finally finished our migration of Drupal and Tripal and we have our site up again.
>>>> We are now trying to fine tune the last small issue that are remaining. I hope you can help us
>>>> with restoring this function.
>>>>
>>>> In D6 we had added custom links for each feature in the Resources sidebar, e.g. a link to the feature’s Ensembl page in
>>>> themes/tripal_theme/node-chado_feature.tpl.php like so:
>>>> <li><a href="<?php print $ensemblurl.$feature->name?>” target="_blank">Show in Ensembl</a></li>
>>>>
>>>> I am having problems to identify where to insert similar code into the new template structure.
>>>> I would be grateful for any hints.
>>>>
>>>> Regards
>>>>
>>>> Michael
>>>>
>>>> Michael Dondrup
>>>> Researcher
>>>> Sea Lice Research Centre
>>>> Department of Informatics
>>>> University of Bergen
>>>> Thormøhlensgate 55, N-5008 Bergen,
>>>> Norway
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Transform Data into Opportunity.
>>>> Accelerate data analysis in your applications with
>>>> Intel Data Analytics Acceleration Library.
>>>> Click to learn more.
>>>>
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
>>>>
>>>>
>>>> _______________________________________________
>>>> Gmod-tripal-devel mailing list
>>>>
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>>> ------------------------------------------------------------------------------
>>> Transform Data into Opportunity.
>>> Accelerate data analysis in your applications with
>>> Intel Data Analytics Acceleration Library.
>>> Click to learn more.
>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140_______________________________________________
>>> Gmod-tripal-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Gmod-tripal-devel] Adding custom links to Feature TOC

Stephen Ficklin-2
Hi Michael,

I think the following SQL statements might do the trick for you.  I
don't have the data to test it all works without side effects, so you
might want to try it on a dev site first.

Stephen

-- If you don't already have the Ensembl record in the db table. Note,
this adds the urlprefix field which is needed
-- by Tripal to build the URLs.
INSERT INTO chado.db
   (name, description, url, urlprefix)
VALUES
   ('Ensembl',
    'The Ensembl project produces genome databases for vertebrates and
other eukaryotic species, and makes this information freely available
online.',
    'http://www.ensembl.org/',
'http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g='
   );


-- Add the Ensemble IDs to the dbxref table
INSERT INTO chado.dbxref
   (db_id, accession)
   (SELECT
      (SELECT db_id FROM chado.db WHERE name = 'Ensembl') as db_id,
      F.name
    FROM chado.feature F
    WHERE F.name like 'EMLSAG%')

-- Update the feature.dbxref_id fieldfor features whose name matches the
-- same accession in the dbxref table.
UPDATE chado.feature F
SET dbxref_id = (
   SELECT dbxref_id
   FROM chado.dbxref DBX
     INNER JOIN chado.db DB on DB.db_id = DBX.db_id
   WHERE DBX.accession = F.name and DB.name = 'Ensembl')
WHERE F.name like 'EMLSAG%'

On 3/22/2016 8:42 AM, Michael Dondrup wrote:

> Hi Stephen,
>
> thank you for the pointers and the update of Tripal. I still had to solve the problem of generating these db entries automatically, maybe there is a way to generate them
> during during import from fasta or gff or using the UI? Instead, I resorted to inserting the xrefs using SQL. It seems to work but I am not sure if it is a generally safe way of doing this,
> or i am rather sure it is not.
> Please let me know if there are some concerns about them, but also they could be useful to someone:
>
> Hack 1.
>
> — Inserts a crossref entry with the same accession as the feature name for each feature with a given name pattern, and links them afterwards, this will
> — work with Ensembl Gene IDs in my case, must have a single database entry with name ‘Ensembl’
>
> INSERT INTO chado.dbxref(db_id, accession)  (SELECT d.db_id, f.name FROM chado.feature as f, chado.db AS d WHERE f.name LIKE 'EMLSAG%' AND d.name = 'Ensembl' );
>
> — Now update the chado features with the corrrect xref, I bet this is bound to fail if the names are not unique
>  
> UPDATE chado.feature AS f SET dbxref_id = q.dbxref_id FROM (
>         (SELECT d.dbxref_id, d.accession FROM chado.dbxref AS d LEFT JOIN chado.feature AS ff
>               ON ff.name = d.accession )) AS q
>          WHERE q.accession = f.name;
>
> Hack 2.
>
> — generate a ‘Run Blast’ link for each feature appending the feature_id as an argument to the URL, by adding an entry to the field_resource_links field
> — for each feature in the chado_feature table
>
> INSERT INTO field_data_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
>         (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|__BLASTURL__' || cf.feature_id  FROM public.chado_feature AS cf  )
>
> — Not sure if this is necessary
>
> INSERT INTO field_revision_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
>         (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|__BLASTURL__' || cf.feature_id  FROM public.chado_feature AS cf  )
>
>
>
>
>
>
>
>> On Mar 21, 2016, at 10:15 PM, Stephen Ficklin <[hidden email]> wrote:
>>
>> Hi Michael,
>>
>> I now see the problem.  I just added some new functionality for the field_resource_links fields.  It now supports tokens.   Tokens are text in brackets (e.g. [feature.name]) that represent data values. The appropriate value will be substituted for the value entered. So, for example, for your links to be dynamic you can use the following for your links:
>>
>> View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=[feature.name]
>>
>> You'll find a list of all possible tokens in a new expandable fieldset just below the fields where you can enter the URLs.
>>
>> To get this functionality you'll need to upgrade to the most recent development version of Tripal.
>>
>> Let me know if this works for you.
>>
>> Stephen
>>
>>
>> On 3/21/2016 6:29 AM, Michael Dondrup wrote:
>>> Hi Stephen
>>> and thank you for the additional documentation! I have tried the procedure to add external links to single genes,
>>> and can confirm that it is working. However I need a little more automated ways to generate those links. Is it possible?
>>>
>>> As an example, say I have all D. rerio genes with
>>> names ENSDARG00000024771. I can generate sinlge links like:
>>> View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=ENSDARG00000024771
>>>
>>> Now I need to add an external reference to each gene that will be generated automatically: like so
>>>
>>> View in $feature_name Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=$feature_name
>>>
>>> Either by generating all the Urls by a Tripal job or by gnerating them on the fly, e.g. using the template. The template was the way
>>> I had this implemented in Tripal 1 but I don’t know where to insert the code now.
>>>
>>> Any ideas?
>>>
>>> Thank you very much.
>>> Michael
>>>
>>>
>>>> On Mar 18, 2016, at 6:58 PM, Stephen Ficklin <[hidden email]> wrote:
>>>>
>>>> Hi Michael,
>>>>
>>>> It's relatively easy to add links and custom panes to a Tripal v2 content type without editing the templates.   Tripal v3 will better support this, but Tripal v2 does have a 'kludgy' way to do this.  I've added a new page to the v2 User's Guide that explains how to do it.  Unfortunately, I wasn't able to add screenshots with the instructions so if you have any questions please let me know.
>>>>
>>>> Here's the link:
>>>>
>>>> http://tripal.info/node/288
>>>>
>>>> Stephen
>>>>
>>>> On 3/17/2016 1:26 AM, Michael Dondrup wrote:
>>>>> Hi,
>>>>>   we have finally finished our migration of Drupal and Tripal and we have our site up again.
>>>>> We are now trying to fine tune the last small issue that are remaining. I hope you can help us
>>>>> with restoring this function.
>>>>>
>>>>> In D6 we had added custom links for each feature in the Resources sidebar, e.g. a link to the feature’s Ensembl page in
>>>>> themes/tripal_theme/node-chado_feature.tpl.php like so:
>>>>> <li><a href="<?php print $ensemblurl.$feature->name?>” target="_blank">Show in Ensembl</a></li>
>>>>>
>>>>> I am having problems to identify where to insert similar code into the new template structure.
>>>>> I would be grateful for any hints.
>>>>>
>>>>> Regards
>>>>>
>>>>> Michael
>>>>>
>>>>> Michael Dondrup
>>>>> Researcher
>>>>> Sea Lice Research Centre
>>>>> Department of Informatics
>>>>> University of Bergen
>>>>> Thormøhlensgate 55, N-5008 Bergen,
>>>>> Norway
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Transform Data into Opportunity.
>>>>> Accelerate data analysis in your applications with
>>>>> Intel Data Analytics Acceleration Library.
>>>>> Click to learn more.
>>>>>
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Gmod-tripal-devel mailing list
>>>>>
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>>>> ------------------------------------------------------------------------------
>>>> Transform Data into Opportunity.
>>>> Accelerate data analysis in your applications with
>>>> Intel Data Analytics Acceleration Library.
>>>> Click to learn more.
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140_______________________________________________
>>>> Gmod-tripal-devel mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Gmod-tripal-devel] Adding custom links to Feature TOC

Stephen Ficklin-2
I failed to respond to one of your questions.  The GFF3 importer for
Tripal does support the Dbxref attribute.  So, if you can set the Dbxref
attribute in your GFF3 file for each of these features then the dbxref
record will be added and properly associated to the feature when the
GFF3 file is imported.

On 3/22/2016 10:09 AM, Stephen Ficklin wrote:

> Hi Michael,
>
> I think the following SQL statements might do the trick for you. I
> don't have the data to test it all works without side effects, so you
> might want to try it on a dev site first.
>
> Stephen
>
> -- If you don't already have the Ensembl record in the db table. Note,
> this adds the urlprefix field which is needed
> -- by Tripal to build the URLs.
> INSERT INTO chado.db
>   (name, description, url, urlprefix)
> VALUES
>   ('Ensembl',
>    'The Ensembl project produces genome databases for vertebrates and
> other eukaryotic species, and makes this information freely available
> online.',
>    'http://www.ensembl.org/',
> 'http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g='
>   );
>
>
> -- Add the Ensemble IDs to the dbxref table
> INSERT INTO chado.dbxref
>   (db_id, accession)
>   (SELECT
>      (SELECT db_id FROM chado.db WHERE name = 'Ensembl') as db_id,
>      F.name
>    FROM chado.feature F
>    WHERE F.name like 'EMLSAG%')
>
> -- Update the feature.dbxref_id fieldfor features whose name matches the
> -- same accession in the dbxref table.
> UPDATE chado.feature F
> SET dbxref_id = (
>   SELECT dbxref_id
>   FROM chado.dbxref DBX
>     INNER JOIN chado.db DB on DB.db_id = DBX.db_id
>   WHERE DBX.accession = F.name and DB.name = 'Ensembl')
> WHERE F.name like 'EMLSAG%'
>
> On 3/22/2016 8:42 AM, Michael Dondrup wrote:
>> Hi Stephen,
>>
>> thank you for the pointers and the update of Tripal. I still had to
>> solve the problem of generating these db entries automatically, maybe
>> there is a way to generate them
>> during during import from fasta or gff or using the UI? Instead, I
>> resorted to inserting the xrefs using SQL. It seems to work but I am
>> not sure if it is a generally safe way of doing this,
>> or i am rather sure it is not.
>> Please let me know if there are some concerns about them, but also
>> they could be useful to someone:
>>
>> Hack 1.
>>
>> — Inserts a crossref entry with the same accession as the feature
>> name for each feature with a given name pattern, and links them
>> afterwards, this will
>> — work with Ensembl Gene IDs in my case, must have a single database
>> entry with name ‘Ensembl’
>>
>> INSERT INTO chado.dbxref(db_id, accession)  (SELECT d.db_id, f.name
>> FROM chado.feature as f, chado.db AS d WHERE f.name LIKE 'EMLSAG%'
>> AND d.name = 'Ensembl' );
>>
>> — Now update the chado features with the corrrect xref, I bet this is
>> bound to fail if the names are not unique
>>   UPDATE chado.feature AS f SET dbxref_id = q.dbxref_id FROM (
>>         (SELECT d.dbxref_id, d.accession FROM chado.dbxref AS d LEFT
>> JOIN chado.feature AS ff
>>               ON ff.name = d.accession )) AS q
>>          WHERE q.accession = f.name;
>>
>> Hack 2.
>>
>> — generate a ‘Run Blast’ link for each feature appending the
>> feature_id as an argument to the URL, by adding an entry to the
>> field_resource_links field
>> — for each feature in the chado_feature table
>>
>> INSERT INTO field_data_field_resource_links(entity_type, bundle,
>> entity_id, revision_id, delta, "language", field_resource_links_value)
>>         (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und',
>> 'Run Blast|__BLASTURL__' || cf.feature_id  FROM public.chado_feature
>> AS cf  )
>>
>> — Not sure if this is necessary
>>
>> INSERT INTO field_revision_field_resource_links(entity_type, bundle,
>> entity_id, revision_id, delta, "language", field_resource_links_value)
>>         (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und',
>> 'Run Blast|__BLASTURL__' || cf.feature_id  FROM public.chado_feature
>> AS cf  )
>>
>>
>>
>>
>>
>>
>>
>>> On Mar 21, 2016, at 10:15 PM, Stephen Ficklin <[hidden email]>
>>> wrote:
>>>
>>> Hi Michael,
>>>
>>> I now see the problem.  I just added some new functionality for the
>>> field_resource_links fields.  It now supports tokens.   Tokens are
>>> text in brackets (e.g. [feature.name]) that represent data values.
>>> The appropriate value will be substituted for the value entered. So,
>>> for example, for your links to be dynamic you can use the following
>>> for your links:
>>>
>>> View in
>>> Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=[feature.name]
>>>
>>> You'll find a list of all possible tokens in a new expandable
>>> fieldset just below the fields where you can enter the URLs.
>>>
>>> To get this functionality you'll need to upgrade to the most recent
>>> development version of Tripal.
>>>
>>> Let me know if this works for you.
>>>
>>> Stephen
>>>
>>>
>>> On 3/21/2016 6:29 AM, Michael Dondrup wrote:
>>>> Hi Stephen
>>>> and thank you for the additional documentation! I have tried the
>>>> procedure to add external links to single genes,
>>>> and can confirm that it is working. However I need a little more
>>>> automated ways to generate those links. Is it possible?
>>>>
>>>> As an example, say I have all D. rerio genes with
>>>> names ENSDARG00000024771. I can generate sinlge links like:
>>>> View in
>>>> Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=ENSDARG00000024771
>>>>
>>>> Now I need to add an external reference to each gene that will be
>>>> generated automatically: like so
>>>>
>>>> View in $feature_name
>>>> Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=$feature_name
>>>>
>>>> Either by generating all the Urls by a Tripal job or by gnerating
>>>> them on the fly, e.g. using the template. The template was the way
>>>> I had this implemented in Tripal 1 but I don’t know where to insert
>>>> the code now.
>>>>
>>>> Any ideas?
>>>>
>>>> Thank you very much.
>>>> Michael
>>>>
>>>>
>>>>> On Mar 18, 2016, at 6:58 PM, Stephen Ficklin <[hidden email]>
>>>>> wrote:
>>>>>
>>>>> Hi Michael,
>>>>>
>>>>> It's relatively easy to add links and custom panes to a Tripal v2
>>>>> content type without editing the templates. Tripal v3 will better
>>>>> support this, but Tripal v2 does have a 'kludgy' way to do this.  
>>>>> I've added a new page to the v2 User's Guide that explains how to
>>>>> do it. Unfortunately, I wasn't able to add screenshots with the
>>>>> instructions so if you have any questions please let me know.
>>>>>
>>>>> Here's the link:
>>>>>
>>>>> http://tripal.info/node/288
>>>>>
>>>>> Stephen
>>>>>
>>>>> On 3/17/2016 1:26 AM, Michael Dondrup wrote:
>>>>>> Hi,
>>>>>>   we have finally finished our migration of Drupal and Tripal and
>>>>>> we have our site up again.
>>>>>> We are now trying to fine tune the last small issue that are
>>>>>> remaining. I hope you can help us
>>>>>> with restoring this function.
>>>>>>
>>>>>> In D6 we had added custom links for each feature in the Resources
>>>>>> sidebar, e.g. a link to the feature’s Ensembl page in
>>>>>> themes/tripal_theme/node-chado_feature.tpl.php like so:
>>>>>> <li><a href="<?php print $ensemblurl.$feature->name?>”
>>>>>> target="_blank">Show in Ensembl</a></li>
>>>>>>
>>>>>> I am having problems to identify where to insert similar code
>>>>>> into the new template structure.
>>>>>> I would be grateful for any hints.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Michael
>>>>>>
>>>>>> Michael Dondrup
>>>>>> Researcher
>>>>>> Sea Lice Research Centre
>>>>>> Department of Informatics
>>>>>> University of Bergen
>>>>>> Thormøhlensgate 55, N-5008 Bergen,
>>>>>> Norway
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>>
>>>>>> Transform Data into Opportunity.
>>>>>> Accelerate data analysis in your applications with
>>>>>> Intel Data Analytics Acceleration Library.
>>>>>> Click to learn more.
>>>>>>
>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Gmod-tripal-devel mailing list
>>>>>>
>>>>>> [hidden email]
>>>>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>>>>> ------------------------------------------------------------------------------
>>>>>
>>>>> Transform Data into Opportunity.
>>>>> Accelerate data analysis in your applications with
>>>>> Intel Data Analytics Acceleration Library.
>>>>> Click to learn more.
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140_______________________________________________ 
>>>>>
>>>>> Gmod-tripal-devel mailing list
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Gmod-tripal-devel] Adding custom links to Feature TOC

Michael Dondrup-3
Hi Stephen,
Thank you very much.
I can confirm that the sql works and we have created cross references to ensembl metazoa for each gene, transcript and protein.
We created three databases for transcript, gene, and protein, because each uses different url parameters in ensembl (g=, t=, p=), it might be possible to left join via the sequence relationship between features also, but I didn’t want to make it more complicated.


Wit respect to adding links to the TOC, we found that the way mentioned before seems to work fine and allows to add arbitrary links to any or all feature pages. So, in the  example we added links to GBrowse (uses feature name as parameter) and a Blast script (uses feature id as parameter to retrieve the sequence). Hope this is useful for someone.

Best
Michael


— Add a link ‘Run Blast’ to a cgi script adding the feature id
BEGIN TRANSACTION;
INSERT INTO field_data_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
       (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|/blast/cgi-bin/blast.pl?o=C&feature_id=' || cf.feature_id  FROM public.chado_feature AS cf  );


INSERT INTO field_revision_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
       (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|/blast/cgi-bin/blast.pl?o=C&feature_id=' || cf.feature_id  FROM public.chado_feature AS cf  );
COMMIT;
— note the value for delta needs to be incremented for each new link
— I think to be safe the value should be selected using something like SELECT max(delta) + 1 …
— Add a link ’Show in GBrowse’ with the feature name
BEGIN TRANSACTION;
INSERT INTO field_data_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
       (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 1, 'und', 'Show in GBrowse|/fgb2/gbrowse/lsalmonis/?q=' || ccf.name  FROM public.chado_feature AS cf LEFT JOIN chado.feature AS ccf ON cf.feature_id = ccf.feature_id  );

INSERT INTO field_revision_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
       (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 1, 'und', 'Show in GBrowse|/fgb2/gbrowse/lsalmonis/?q=' || ccf.name  FROM public.chado_feature AS cf LEFT JOIN chado.feature AS ccf ON cf.feature_id = ccf.feature_id  );
COMMIT;






> On Mar 22, 2016, at 6:51 PM, Stephen Ficklin <[hidden email]> wrote:
>
> I failed to respond to one of your questions.  The GFF3 importer for Tripal does support the Dbxref attribute.  So, if you can set the Dbxref attribute in your GFF3 file for each of these features then the dbxref record will be added and properly associated to the feature when the GFF3 file is imported.
>
> On 3/22/2016 10:09 AM, Stephen Ficklin wrote:
>> Hi Michael,
>>
>> I think the following SQL statements might do the trick for you. I don't have the data to test it all works without side effects, so you might want to try it on a dev site first.
>>
>> Stephen
>>
>> -- If you don't already have the Ensembl record in the db table. Note, this adds the urlprefix field which is needed
>> -- by Tripal to build the URLs.
>> INSERT INTO chado.db
>>  (name, description, url, urlprefix)
>> VALUES
>>  ('Ensembl',
>>   'The Ensembl project produces genome databases for vertebrates and other eukaryotic species, and makes this information freely available online.',
>>   'http://www.ensembl.org/',
>> 'http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g='
>>  );
>>
>>
>> -- Add the Ensemble IDs to the dbxref table
>> INSERT INTO chado.dbxref
>>  (db_id, accession)
>>  (SELECT
>>     (SELECT db_id FROM chado.db WHERE name = 'Ensembl') as db_id,
>>     F.name
>>   FROM chado.feature F
>>   WHERE F.name like 'EMLSAG%')
>>
>> -- Update the feature.dbxref_id fieldfor features whose name matches the
>> -- same accession in the dbxref table.
>> UPDATE chado.feature F
>> SET dbxref_id = (
>>  SELECT dbxref_id
>>  FROM chado.dbxref DBX
>>    INNER JOIN chado.db DB on DB.db_id = DBX.db_id
>>  WHERE DBX.accession = F.name and DB.name = 'Ensembl')
>> WHERE F.name like 'EMLSAG%'
>>
>> On 3/22/2016 8:42 AM, Michael Dondrup wrote:
>>> Hi Stephen,
>>>
>>> thank you for the pointers and the update of Tripal. I still had to solve the problem of generating these db entries automatically, maybe there is a way to generate them
>>> during during import from fasta or gff or using the UI? Instead, I resorted to inserting the xrefs using SQL. It seems to work but I am not sure if it is a generally safe way of doing this,
>>> or i am rather sure it is not.
>>> Please let me know if there are some concerns about them, but also they could be useful to someone:
>>>
>>> Hack 1.
>>>
>>> — Inserts a crossref entry with the same accession as the feature name for each feature with a given name pattern, and links them afterwards, this will
>>> — work with Ensembl Gene IDs in my case, must have a single database entry with name ‘Ensembl’
>>>
>>> INSERT INTO chado.dbxref(db_id, accession)  (SELECT d.db_id, f.name FROM chado.feature as f, chado.db AS d WHERE f.name LIKE 'EMLSAG%' AND d.name = 'Ensembl' );
>>>
>>> — Now update the chado features with the corrrect xref, I bet this is bound to fail if the names are not unique
>>>  UPDATE chado.feature AS f SET dbxref_id = q.dbxref_id FROM (
>>>        (SELECT d.dbxref_id, d.accession FROM chado.dbxref AS d LEFT JOIN chado.feature AS ff
>>>              ON ff.name = d.accession )) AS q
>>>         WHERE q.accession = f.name;
>>>
>>> Hack 2.
>>>
>>> — generate a ‘Run Blast’ link for each feature appending the feature_id as an argument to the URL, by adding an entry to the field_resource_links field
>>> — for each feature in the chado_feature table
>>>
>>> INSERT INTO field_data_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
>>>        (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|__BLASTURL__' || cf.feature_id  FROM public.chado_feature AS cf  )
>>>
>>> — Not sure if this is necessary
>>>
>>> INSERT INTO field_revision_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
>>>        (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|__BLASTURL__' || cf.feature_id  FROM public.chado_feature AS cf  )
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>> On Mar 21, 2016, at 10:15 PM, Stephen Ficklin <[hidden email]> wrote:
>>>>
>>>> Hi Michael,
>>>>
>>>> I now see the problem.  I just added some new functionality for the field_resource_links fields.  It now supports tokens.   Tokens are text in brackets (e.g. [feature.name]) that represent data values. The appropriate value will be substituted for the value entered. So, for example, for your links to be dynamic you can use the following for your links:
>>>>
>>>> View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=[feature.name]
>>>>
>>>> You'll find a list of all possible tokens in a new expandable fieldset just below the fields where you can enter the URLs.
>>>>
>>>> To get this functionality you'll need to upgrade to the most recent development version of Tripal.
>>>>
>>>> Let me know if this works for you.
>>>>
>>>> Stephen
>>>>
>>>>
>>>> On 3/21/2016 6:29 AM, Michael Dondrup wrote:
>>>>> Hi Stephen
>>>>> and thank you for the additional documentation! I have tried the procedure to add external links to single genes,
>>>>> and can confirm that it is working. However I need a little more automated ways to generate those links. Is it possible?
>>>>>
>>>>> As an example, say I have all D. rerio genes with
>>>>> names ENSDARG00000024771. I can generate sinlge links like:
>>>>> View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=ENSDARG00000024771
>>>>>
>>>>> Now I need to add an external reference to each gene that will be generated automatically: like so
>>>>>
>>>>> View in $feature_name Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=$feature_name
>>>>>
>>>>> Either by generating all the Urls by a Tripal job or by gnerating them on the fly, e.g. using the template. The template was the way
>>>>> I had this implemented in Tripal 1 but I don’t know where to insert the code now.
>>>>>
>>>>> Any ideas?
>>>>>
>>>>> Thank you very much.
>>>>> Michael
>>>>>
>>>>>
>>>>>> On Mar 18, 2016, at 6:58 PM, Stephen Ficklin <[hidden email]> wrote:
>>>>>>
>>>>>> Hi Michael,
>>>>>>
>>>>>> It's relatively easy to add links and custom panes to a Tripal v2 content type without editing the templates. Tripal v3 will better support this, but Tripal v2 does have a 'kludgy' way to do this.  I've added a new page to the v2 User's Guide that explains how to do it. Unfortunately, I wasn't able to add screenshots with the instructions so if you have any questions please let me know.
>>>>>>
>>>>>> Here's the link:
>>>>>>
>>>>>> http://tripal.info/node/288
>>>>>>
>>>>>> Stephen
>>>>>>
>>>>>> On 3/17/2016 1:26 AM, Michael Dondrup wrote:
>>>>>>> Hi,
>>>>>>>  we have finally finished our migration of Drupal and Tripal and we have our site up again.
>>>>>>> We are now trying to fine tune the last small issue that are remaining. I hope you can help us
>>>>>>> with restoring this function.
>>>>>>>
>>>>>>> In D6 we had added custom links for each feature in the Resources sidebar, e.g. a link to the feature’s Ensembl page in
>>>>>>> themes/tripal_theme/node-chado_feature.tpl.php like so:
>>>>>>> <li><a href="<?php print $ensemblurl.$feature->name?>” target="_blank">Show in Ensembl</a></li>
>>>>>>>
>>>>>>> I am having problems to identify where to insert similar code into the new template structure.
>>>>>>> I would be grateful for any hints.
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Michael
>>>>>>>
>>>>>>> Michael Dondrup
>>>>>>> Researcher
>>>>>>> Sea Lice Research Centre
>>>>>>> Department of Informatics
>>>>>>> University of Bergen
>>>>>>> Thormøhlensgate 55, N-5008 Bergen,
>>>>>>> Norway
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Transform Data into Opportunity.
>>>>>>> Accelerate data analysis in your applications with
>>>>>>> Intel Data Analytics Acceleration Library.
>>>>>>> Click to learn more.
>>>>>>>
>>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Gmod-tripal-devel mailing list
>>>>>>>
>>>>>>> [hidden email]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>>>>>> ------------------------------------------------------------------------------
>>>>>> Transform Data into Opportunity.
>>>>>> Accelerate data analysis in your applications with
>>>>>> Intel Data Analytics Acceleration Library.
>>>>>> Click to learn more.
>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140_______________________________________________ 
>>>>>> Gmod-tripal-devel mailing list
>>>>>> [hidden email]
>>>>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>>
>


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Gmod-tripal-devel] Adding custom links to Feature TOC

Stephen Ficklin-2
Great. I'm glad things are working.  Thanks for the update.

Stephen

On 4/1/2016 4:58 AM, Michael Dondrup wrote:

> Hi Stephen,
> Thank you very much.
> I can confirm that the sql works and we have created cross references to ensembl metazoa for each gene, transcript and protein.
> We created three databases for transcript, gene, and protein, because each uses different url parameters in ensembl (g=, t=, p=), it might be possible to left join via the sequence relationship between features also, but I didn’t want to make it more complicated.
>
>
> Wit respect to adding links to the TOC, we found that the way mentioned before seems to work fine and allows to add arbitrary links to any or all feature pages. So, in the  example we added links to GBrowse (uses feature name as parameter) and a Blast script (uses feature id as parameter to retrieve the sequence). Hope this is useful for someone.
>
> Best
> Michael
>
>
> — Add a link ‘Run Blast’ to a cgi script adding the feature id
> BEGIN TRANSACTION;
> INSERT INTO field_data_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
>         (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|/blast/cgi-bin/blast.pl?o=C&feature_id=' || cf.feature_id  FROM public.chado_feature AS cf  );
>
>
> INSERT INTO field_revision_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
>         (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|/blast/cgi-bin/blast.pl?o=C&feature_id=' || cf.feature_id  FROM public.chado_feature AS cf  );
> COMMIT;
> — note the value for delta needs to be incremented for each new link
> — I think to be safe the value should be selected using something like SELECT max(delta) + 1 …
> — Add a link ’Show in GBrowse’ with the feature name
> BEGIN TRANSACTION;
> INSERT INTO field_data_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
>         (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 1, 'und', 'Show in GBrowse|/fgb2/gbrowse/lsalmonis/?q=' || ccf.name  FROM public.chado_feature AS cf LEFT JOIN chado.feature AS ccf ON cf.feature_id = ccf.feature_id  );
>
> INSERT INTO field_revision_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
>         (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 1, 'und', 'Show in GBrowse|/fgb2/gbrowse/lsalmonis/?q=' || ccf.name  FROM public.chado_feature AS cf LEFT JOIN chado.feature AS ccf ON cf.feature_id = ccf.feature_id  );
> COMMIT;
>
>
>
>
>
>
>> On Mar 22, 2016, at 6:51 PM, Stephen Ficklin <[hidden email]> wrote:
>>
>> I failed to respond to one of your questions.  The GFF3 importer for Tripal does support the Dbxref attribute.  So, if you can set the Dbxref attribute in your GFF3 file for each of these features then the dbxref record will be added and properly associated to the feature when the GFF3 file is imported.
>>
>> On 3/22/2016 10:09 AM, Stephen Ficklin wrote:
>>> Hi Michael,
>>>
>>> I think the following SQL statements might do the trick for you. I don't have the data to test it all works without side effects, so you might want to try it on a dev site first.
>>>
>>> Stephen
>>>
>>> -- If you don't already have the Ensembl record in the db table. Note, this adds the urlprefix field which is needed
>>> -- by Tripal to build the URLs.
>>> INSERT INTO chado.db
>>>   (name, description, url, urlprefix)
>>> VALUES
>>>   ('Ensembl',
>>>    'The Ensembl project produces genome databases for vertebrates and other eukaryotic species, and makes this information freely available online.',
>>>    'http://www.ensembl.org/',
>>> 'http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g='
>>>   );
>>>
>>>
>>> -- Add the Ensemble IDs to the dbxref table
>>> INSERT INTO chado.dbxref
>>>   (db_id, accession)
>>>   (SELECT
>>>      (SELECT db_id FROM chado.db WHERE name = 'Ensembl') as db_id,
>>>      F.name
>>>    FROM chado.feature F
>>>    WHERE F.name like 'EMLSAG%')
>>>
>>> -- Update the feature.dbxref_id fieldfor features whose name matches the
>>> -- same accession in the dbxref table.
>>> UPDATE chado.feature F
>>> SET dbxref_id = (
>>>   SELECT dbxref_id
>>>   FROM chado.dbxref DBX
>>>     INNER JOIN chado.db DB on DB.db_id = DBX.db_id
>>>   WHERE DBX.accession = F.name and DB.name = 'Ensembl')
>>> WHERE F.name like 'EMLSAG%'
>>>
>>> On 3/22/2016 8:42 AM, Michael Dondrup wrote:
>>>> Hi Stephen,
>>>>
>>>> thank you for the pointers and the update of Tripal. I still had to solve the problem of generating these db entries automatically, maybe there is a way to generate them
>>>> during during import from fasta or gff or using the UI? Instead, I resorted to inserting the xrefs using SQL. It seems to work but I am not sure if it is a generally safe way of doing this,
>>>> or i am rather sure it is not.
>>>> Please let me know if there are some concerns about them, but also they could be useful to someone:
>>>>
>>>> Hack 1.
>>>>
>>>> — Inserts a crossref entry with the same accession as the feature name for each feature with a given name pattern, and links them afterwards, this will
>>>> — work with Ensembl Gene IDs in my case, must have a single database entry with name ‘Ensembl’
>>>>
>>>> INSERT INTO chado.dbxref(db_id, accession)  (SELECT d.db_id, f.name FROM chado.feature as f, chado.db AS d WHERE f.name LIKE 'EMLSAG%' AND d.name = 'Ensembl' );
>>>>
>>>> — Now update the chado features with the corrrect xref, I bet this is bound to fail if the names are not unique
>>>>   UPDATE chado.feature AS f SET dbxref_id = q.dbxref_id FROM (
>>>>         (SELECT d.dbxref_id, d.accession FROM chado.dbxref AS d LEFT JOIN chado.feature AS ff
>>>>               ON ff.name = d.accession )) AS q
>>>>          WHERE q.accession = f.name;
>>>>
>>>> Hack 2.
>>>>
>>>> — generate a ‘Run Blast’ link for each feature appending the feature_id as an argument to the URL, by adding an entry to the field_resource_links field
>>>> — for each feature in the chado_feature table
>>>>
>>>> INSERT INTO field_data_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
>>>>         (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|__BLASTURL__' || cf.feature_id  FROM public.chado_feature AS cf  )
>>>>
>>>> — Not sure if this is necessary
>>>>
>>>> INSERT INTO field_revision_field_resource_links(entity_type, bundle, entity_id, revision_id, delta, "language", field_resource_links_value)
>>>>         (SELECT 'node', 'chado_feature', cf.nid, cf.vid, 0, 'und', 'Run Blast|__BLASTURL__' || cf.feature_id  FROM public.chado_feature AS cf  )
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> On Mar 21, 2016, at 10:15 PM, Stephen Ficklin <[hidden email]> wrote:
>>>>>
>>>>> Hi Michael,
>>>>>
>>>>> I now see the problem.  I just added some new functionality for the field_resource_links fields.  It now supports tokens.   Tokens are text in brackets (e.g. [feature.name]) that represent data values. The appropriate value will be substituted for the value entered. So, for example, for your links to be dynamic you can use the following for your links:
>>>>>
>>>>> View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=[feature.name]
>>>>>
>>>>> You'll find a list of all possible tokens in a new expandable fieldset just below the fields where you can enter the URLs.
>>>>>
>>>>> To get this functionality you'll need to upgrade to the most recent development version of Tripal.
>>>>>
>>>>> Let me know if this works for you.
>>>>>
>>>>> Stephen
>>>>>
>>>>>
>>>>> On 3/21/2016 6:29 AM, Michael Dondrup wrote:
>>>>>> Hi Stephen
>>>>>> and thank you for the additional documentation! I have tried the procedure to add external links to single genes,
>>>>>> and can confirm that it is working. However I need a little more automated ways to generate those links. Is it possible?
>>>>>>
>>>>>> As an example, say I have all D. rerio genes with
>>>>>> names ENSDARG00000024771. I can generate sinlge links like:
>>>>>> View in Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=ENSDARG00000024771
>>>>>>
>>>>>> Now I need to add an external reference to each gene that will be generated automatically: like so
>>>>>>
>>>>>> View in $feature_name Ensembl|http://www.ensembl.org/Danio_rerio/Gene/Summary?db=core;g=$feature_name
>>>>>>
>>>>>> Either by generating all the Urls by a Tripal job or by gnerating them on the fly, e.g. using the template. The template was the way
>>>>>> I had this implemented in Tripal 1 but I don’t know where to insert the code now.
>>>>>>
>>>>>> Any ideas?
>>>>>>
>>>>>> Thank you very much.
>>>>>> Michael
>>>>>>
>>>>>>
>>>>>>> On Mar 18, 2016, at 6:58 PM, Stephen Ficklin <[hidden email]> wrote:
>>>>>>>
>>>>>>> Hi Michael,
>>>>>>>
>>>>>>> It's relatively easy to add links and custom panes to a Tripal v2 content type without editing the templates. Tripal v3 will better support this, but Tripal v2 does have a 'kludgy' way to do this.  I've added a new page to the v2 User's Guide that explains how to do it. Unfortunately, I wasn't able to add screenshots with the instructions so if you have any questions please let me know.
>>>>>>>
>>>>>>> Here's the link:
>>>>>>>
>>>>>>> http://tripal.info/node/288
>>>>>>>
>>>>>>> Stephen
>>>>>>>
>>>>>>> On 3/17/2016 1:26 AM, Michael Dondrup wrote:
>>>>>>>> Hi,
>>>>>>>>   we have finally finished our migration of Drupal and Tripal and we have our site up again.
>>>>>>>> We are now trying to fine tune the last small issue that are remaining. I hope you can help us
>>>>>>>> with restoring this function.
>>>>>>>>
>>>>>>>> In D6 we had added custom links for each feature in the Resources sidebar, e.g. a link to the feature’s Ensembl page in
>>>>>>>> themes/tripal_theme/node-chado_feature.tpl.php like so:
>>>>>>>> <li><a href="<?php print $ensemblurl.$feature->name?>” target="_blank">Show in Ensembl</a></li>
>>>>>>>>
>>>>>>>> I am having problems to identify where to insert similar code into the new template structure.
>>>>>>>> I would be grateful for any hints.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>> Michael
>>>>>>>>
>>>>>>>> Michael Dondrup
>>>>>>>> Researcher
>>>>>>>> Sea Lice Research Centre
>>>>>>>> Department of Informatics
>>>>>>>> University of Bergen
>>>>>>>> Thormøhlensgate 55, N-5008 Bergen,
>>>>>>>> Norway
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> Transform Data into Opportunity.
>>>>>>>> Accelerate data analysis in your applications with
>>>>>>>> Intel Data Analytics Acceleration Library.
>>>>>>>> Click to learn more.
>>>>>>>>
>>>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Gmod-tripal-devel mailing list
>>>>>>>>
>>>>>>>> [hidden email]
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Transform Data into Opportunity.
>>>>>>> Accelerate data analysis in your applications with
>>>>>>> Intel Data Analytics Acceleration Library.
>>>>>>> Click to learn more.
>>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140_______________________________________________
>>>>>>> Gmod-tripal-devel mailing list
>>>>>>> [hidden email]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
Gmod-tripal-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel