Question: Visualize gff3 file
gravatar for s.saha
4.4 years ago by
United Kingdom
s.saha0 wrote:

Hi All

I am a new user of Galaxy. So please bear with me, if I am asking very obvious question.

I am trying incorporate javascript and HTML5 based tool to visualize gff3 format data. The tool runs fine from a webserver (I tried with apache). I have read your visualization tutorial and followed it. Even if I try very simple display functionality, that is read a line from gff3 file and display it, I get following error,

AttributeError: 'Bunch' object has no attribute 'template_lookup'

File '/home/shyama/workspace/galaxy-dist/eggs/WebError-0.8a-py2.7.egg/weberror/evalexception/', line 364 in respond
  app_iter = self.application(environ, detect_start_response)
File '/home/shyama/workspace/galaxy-dist/eggs/Paste-', line 84 in __call__
  return self.application(environ, start_response)
File '/home/shyama/workspace/galaxy-dist/eggs/Paste-', line 633 in __call__
  return self.application(environ, start_response)
File '/home/shyama/workspace/galaxy-dist/lib/galaxy/web/framework/', line 132 in __call__
  return self.handle_request( environ, start_response )
File '/home/shyama/workspace/galaxy-dist/lib/galaxy/web/framework/', line 190 in handle_request
  body = method( trans, **kwargs )
File '/home/shyama/workspace/galaxy-dist/lib/galaxy/web/framework/', line 98 in decorator
  return func( self, trans, *args, **kwargs )
File '/home/shyama/workspace/galaxy-dist/lib/galaxy/webapps/galaxy/controllers/', line 824 in render
  embedded=embedded, query=kwargs, vars={}, config=config, **resources )
File '/home/shyama/workspace/galaxy-dist/lib/galaxy/web/base/', line 592 in fill_template
  return trans.fill_template( template_filename, template_lookup=plugin.template_lookup, **kwargs )
AttributeError: 'Bunch' object has no attribute 'template_lookup'

Can you kindly help me with this please?


Thanks in advance.


gff • 1.9k views
ADD COMMENTlink modified 4.4 years ago by carlfeberhard390 • written 4.4 years ago by s.saha0
gravatar for carlfeberhard
4.4 years ago by
United States
carlfeberhard390 wrote:

Hi Shyama,

Thanks for trying out the visualization framework. It's not an obvious question at all and sorry for the frustration.

From the stack trace, it looks like the plugin is missing a template_lookup attribute. This is assigned in on lines 519 to 522.

Since you probably haven't altered that code, the if statement on line 519 would get 'True' for serves_templates (one of two flags for creating template_lookup). 

The other flag checks whether you have a 'templates' directory in your base plugin directory. So, if you have a plugin directory of 'config/plugins/visualizations/Genoverse', you should also have a sub-directory named templates within that: 'config/plugins/visualizations/Genoverse/templates'. (This directory should contain the mako templates that will start your visualization.)

Is that sub-directory missing?

I'm happy to diagnose further and let me know if I can help more. Looking forward to seeing your visualization!



ADD COMMENTlink written 4.4 years ago by carlfeberhard390

Hi Carl

Many Thanks for your reply. Just to let to let you know, I got your reply from the galaxy-dev as well. But I will continue to reply here. 

1. No, I have not altered I see, servers_templates is assigned to False on line 517, then in 'if' , it is set to True.

2. I have created a template folder, but just figured out that, it should be 'templates', 's' was missing.

3. After fixing some js path, I can now see the base tracks. Now I need to access the gff file content. I have read your datatype, dataProvider stuff. What I really need is an URL to gff file and pass it to my code. Here is the mako template (shorten version, so that its easier to go through)....

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>${} | ${visualization_name}</title>
<div id=genoverse></div>
<script type="text/javascript" src="/plugins/visualizations/Genoverse/static/js/genoverse.combined.js">
        container : '#genoverse', // Where to inject Genoverse (css/jQuery selector)
        // If no genome supplied, it must have at least chromosomeSize, e.g.:
        // chromosomeSize : 249250621, // chromosome 1, human
        genome    : 'grch37', // see js/genomes/
        plugins   : [ 'controlPanel', 'karyotype', 'trackControls', 'resizer', 'fileDrop' ],
        tracks    : [
            name   : 'Peptides',
            view   : Genoverse.Track.View.Transcript.extend({
              setFeatureColor : function () {}
            height : 100,

        url    : '/database/files/000/dataset_5.dat',
            model  : Genoverse.Track.Model.extend({
              dataType : 'text',
              parseData: function (text) {
                var lines = text.split('\n');
                for (var i = 0; i < lines.length; i++) {
                       #doing something to display the data

  So, I need a URL to replace the value of 'url' (in bold and italic). Or possibly if I have access to the text of the file (where newlines and other formatting are also available), I can access that from 'parseData' and manipulate it. 

Any suggestions, how I might be able to do that?


Many Thanks


ADD REPLYlink written 4.4 years ago by s.saha0

Two possible ways to get raw data over the API (a URL):


1) Use js to join the lines produced by the line dataprovider from the datasets API

Note the settings (which can be passed on the query string) which can be set to preserve whitespace, new lines, and comments.

Your final call will be something like:

GET /api/datasets/{id}?data_type=raw_data&provider=line&strip_lines=False&strip_newlines=False&provide_blank=True&comment_char=None

This will return a JSON array of the lines as strings. Join them:

xhr.done( function( response ){

    fileData = '' );



2) use the same url as the download button uses. You can hover over that button in the browser to get the specific link and generalize it based on that. In general, it's something like: 'GET /datasets/{id}/display?to_ext={file_ext}'. This has worked for folks in the past, but it's a bit of a hack.

At this point, I'd recommend the first option. Keep in mind, you can also get a partial number of lines (or paginate the data) using 'limit' and 'offset' in the query string or, alternately, use other data providers to get the columns as sub-arrays or key-value dictionaries/JSON-objects if that would make it easier to parse.

A more complete GFF3 dataprovider has been on the list a while now: I'd like to have a dataprovider that handled GFF3's nesting capability.

ADD REPLYlink modified 4.4 years ago • written 4.4 years ago by carlfeberhard390

Hi Carl

Many Thanks. It is working now. Now I am trying to achieve little more advance stuff, I will ask you if I need any help.


ADD REPLYlink written 4.4 years ago by s.saha0

Please mark Carl's answer as 'accepted' so people coming later will know it helped.

ADD REPLYlink written 4.4 years ago by Martin Čech ♦♦ 4.9k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 167 users visited in the last hour