1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/480b8c0003f1/ changeset: 480b8c0003f1 user: inithello date: 2012-08-08 16:37:27 summary: Improved generation and display of local genome/indexes table. Handle missing tool data table entries. affected #: 4 files diff -r 4d22e26e595a278f96b814908b8dc24b3f77a06b -r 480b8c0003f1ab6fa78f88bd7854cf978f2ed575 lib/galaxy/web/controllers/data_admin.py --- a/lib/galaxy/web/controllers/data_admin.py +++ b/lib/galaxy/web/controllers/data_admin.py @@ -30,25 +30,28 @@ @web.expose @web.require_admin def manage_data( self, trans, **kwd ): - genomes = dict() if trans.app.config.get_bool( 'enable_beta_job_managers', False ) == False: - return trans.fill_template( '/admin/data_admin/betajob.mako' ) - for line in trans.app.tool_data_tables.data_tables[ 'all_fasta' ].data: - defstate = dict( state='Generate', style=self.jobstyles[ 'new' ] ) - indexers = dict( bowtie_indexes=defstate, bowtie2_indexes=defstate, bwa_indexes=defstate, perm_base_indexes=defstate, srma_indexes=defstate, sam_fa_indexes=defstate ) - dbkey = line[0] - name = line[2] - indexers[ 'name' ] = name - indexers[ 'fapath' ] = line[3] - genomes[ dbkey ] = indexers - for table in [ 'bowtie_indexes', 'bowtie2_indexes', 'bwa_indexes', 'srma_indexes' ]: - for line in trans.app.tool_data_tables.data_tables[ table ].data: - dbkey = line[0] - genomes[ dbkey ][ table ] = dict( state='Generated', style=self.jobstyles[ 'done' ] ) - for line in trans.app.tool_data_tables.data_tables[ 'sam_fa_indexes' ].data: - genomes[ line[1] ][ 'sam_fa_indexes' ] = dict( state='Generated', style=self.jobstyles[ 'done' ] ) - for line in trans.app.tool_data_tables.data_tables[ 'perm_base_indexes' ].data: - genomes[ line[1].split(':')[0] ][ 'perm_base_indexes' ] = dict( state='Generated', style=self.jobstyles[ 'done' ] ) + return trans.fill_template( '/admin/data_admin/generic_error.mako', message='This feature requires that enable_beta_job_managers be set to True in your Galaxy configuration.' ) + if 'all_fasta' not in trans.app.tool_data_tables.data_tables: + return trans.fill_template( '/admin/data_admin/generic_error.mako', message='The local data manager requires that an all_fasta entry exists in your tool_data_table_conf.xml.' ) + indextable = {} + dbkeys = [] + labels = { 'bowtie_indexes': 'Bowtie', 'bowtie2_indexes': 'Bowtie 2', 'bwa_indexes': 'BWA', 'srma_indexes': 'Picard', 'sam_fa_indexes': 'SAM', 'perm_base_indexes': 'PerM' } + tablenames = { 'Bowtie': 'bowtie_indexes', 'Bowtie 2': 'bowtie2_indexes', 'BWA': 'bwa_indexes', 'Picard': 'srma_indexes', 'SAM': 'sam_fa_indexes', 'PerM': 'perm_base_indexes' } + indexfuncs = dict( bowtie_indexes='bowtie', bowtie2_indexes='bowtie2', bwa_indexes='bwa', srma_indexes='picard', sam_fa_indexes='sam', perm_base_indexes='perm' ) + for genome in trans.app.tool_data_tables.data_tables[ 'all_fasta' ].data: + dbkey = genome[0] + dbkeys.append( dbkey ) + indextable[ dbkey ] = dict( indexes=dict(), name=genome[2], path=genome[3] ) + for genome in indextable: + for label in labels: + indextable[ genome ][ 'indexes' ][ label ] = 'Generate' + if label not in trans.app.tool_data_tables.data_tables: + indextable[ genome ][ 'indexes' ][ label ] = 'Disabled' + else: + for row in trans.app.tool_data_tables.data_tables[ label ].data: + if genome in row or row[0].startswith( genome ): + indextable[ genome ][ 'indexes' ][ label ] = 'Generated' jobgrid = [] sa_session = trans.app.model.context.current jobs = sa_session.query( model.GenomeIndexToolData ).order_by( model.GenomeIndexToolData.created_time.desc() ).filter_by( user_id=trans.get_user().id ).group_by( model.GenomeIndexToolData.deferred ).limit( 20 ).all() @@ -65,7 +68,8 @@ jobtype = 'index' indexers = ', '.join( params['indexes'] ) jobgrid.append( dict( jobtype=jobtype, indexers=indexers, rowclass=state, deferred=job.deferred.id, state=state, intname=job.deferred.params[ 'intname' ], dbkey=job.deferred.params[ 'dbkey' ] ) ) - return trans.fill_template( '/admin/data_admin/local_data.mako', jobgrid=jobgrid, genomes=genomes ) + styles = dict( Generate=self.jobstyles['new'], Generated=self.jobstyles['ok'], Disabled=self.jobstyles['error'] ) + return trans.fill_template( '/admin/data_admin/local_data.mako', jobgrid=jobgrid, indextable=indextable, labels=labels, dbkeys=dbkeys, styles=styles, indexfuncs=indexfuncs ) @web.expose @web.require_admin diff -r 4d22e26e595a278f96b814908b8dc24b3f77a06b -r 480b8c0003f1ab6fa78f88bd7854cf978f2ed575 templates/admin/data_admin/betajob.mako --- a/templates/admin/data_admin/betajob.mako +++ /dev/null @@ -1,35 +0,0 @@ -<%inherit file="/base.mako"/> -<%namespace file="/message.mako" import="render_msg" /> -<%namespace file="/library/common/common.mako" import="common_javascripts" /> - -<%! - def inherit(context): - if context.get('use_panels'): - return '/webapps/galaxy/base_panels.mako' - else: - return '/base.mako' -%> -<%inherit file="${inherit(context)}"/> - -<%def name="init()"> -<% - self.has_left_panel=False - self.has_right_panel=False - self.message_box_visible=False - self.active_view="user" - self.overlay_visible=False - self.has_accessible_datasets = False -%> -</%def> -<%def name="stylesheets()"> - ${parent.stylesheets()} - ${h.css( "autocomplete_tagging" )} -</%def> -<%def name="javascripts()"> - ${parent.javascripts()} - ${h.js("jquery.autocomplete", "autocomplete_tagging" )} -</%def> -## -## Override methods from base.mako and base_panels.mako -## -<p class="panel-error-message">This feature requires that enable_beta_job_managers be set to True in your Galaxy configuration.</p> \ No newline at end of file diff -r 4d22e26e595a278f96b814908b8dc24b3f77a06b -r 480b8c0003f1ab6fa78f88bd7854cf978f2ed575 templates/admin/data_admin/generic_error.mako --- /dev/null +++ b/templates/admin/data_admin/generic_error.mako @@ -0,0 +1,35 @@ +<%inherit file="/base.mako"/> +<%namespace file="/message.mako" import="render_msg" /> +<%namespace file="/library/common/common.mako" import="common_javascripts" /> + +<%! + def inherit(context): + if context.get('use_panels'): + return '/webapps/galaxy/base_panels.mako' + else: + return '/base.mako' +%> +<%inherit file="${inherit(context)}"/> + +<%def name="init()"> +<% + self.has_left_panel=False + self.has_right_panel=False + self.message_box_visible=False + self.active_view="user" + self.overlay_visible=False + self.has_accessible_datasets = False +%> +</%def> +<%def name="stylesheets()"> + ${parent.stylesheets()} + ${h.css( "autocomplete_tagging" )} +</%def> +<%def name="javascripts()"> + ${parent.javascripts()} + ${h.js("jquery.autocomplete", "autocomplete_tagging" )} +</%def> +## +## Override methods from base.mako and base_panels.mako +## +<p class="panel-error-message">${message}</p> \ No newline at end of file diff -r 4d22e26e595a278f96b814908b8dc24b3f77a06b -r 480b8c0003f1ab6fa78f88bd7854cf978f2ed575 templates/admin/data_admin/local_data.mako --- a/templates/admin/data_admin/local_data.mako +++ b/templates/admin/data_admin/local_data.mako @@ -44,6 +44,7 @@ td, th { padding-left: 10px; padding-right: 10px; } td.state-color-new { text-decoration: underline; } td.panel-done-message { background-image: none; padding: 0px 10px 0px 10px; } + td.panel-error-message { background-image: none; padding: 0px 10px 0px 10px; } </style><div class="toolForm"> %if message: @@ -52,19 +53,23 @@ <div class="toolFormTitle">Currently tracked builds <a class="action-button" href="${h.url_for( controller='data_admin', action='add_genome' )}">Add new</a></div><div class="toolFormBody"><h2>Locally cached data:</h2> - <h3>NOTE: Indexers queued here will not be reflected in the table until Galaxy is restarted.</h3> + <h3>NOTE: Indexes generated here will not be reflected in the table until Galaxy is restarted.</h3><table id="locfiles"> - <tr><th>Database ID</th><th>Name</th><th>Bowtie</th><th>Bowtie 2</th><th>BWA</th><th>Sam</th><th>Picard</th><th>PerM</th></tr> - %for dbkey in sorted(genomes.keys()): + <tr> + <th>DB Key</th> + <th>Name</th> + %for label in labels: + <th>${labels[label]}</th> + %endfor + </tr> + %for dbkey in sorted(dbkeys): <tr><td>${dbkey}</td> - <td>${genomes[dbkey]['name']}</td> - <td id="${dbkey}-bowtie" class="indexcell ${genomes[dbkey]['bowtie_indexes']['style']}" data-fapath="${genomes[dbkey]['fapath']}" data-longname="${genomes[dbkey]['name']}" data-index="bowtie" data-dbkey="${dbkey}">${genomes[dbkey]['bowtie_indexes']['state']}</td> - <td id="${dbkey}-bowtie2" class="indexcell ${genomes[dbkey]['bowtie2_indexes']['style']}" data-fapath="${genomes[dbkey]['fapath']}" data-longname="${genomes[dbkey]['name']}" data-index="bowtie2" data-dbkey="${dbkey}">${genomes[dbkey]['bowtie2_indexes']['state']}</td> - <td id="${dbkey}-bwa" class="indexcell ${genomes[dbkey]['bwa_indexes']['style']}" data-fapath="${genomes[dbkey]['fapath']}" data-longname="${genomes[dbkey]['name']}" data-index="bwa" data-dbkey="${dbkey}">${genomes[dbkey]['bwa_indexes']['state']}</td> - <td id="${dbkey}-sam" class="indexcell ${genomes[dbkey]['sam_fa_indexes']['style']}" data-fapath="${genomes[dbkey]['fapath']}" data-longname="${genomes[dbkey]['name']}" data-index="sam" data-dbkey="${dbkey}">${genomes[dbkey]['sam_fa_indexes']['state']}</td> - <td id="${dbkey}-picard" class="indexcell ${genomes[dbkey]['srma_indexes']['style']}" data-fapath="${genomes[dbkey]['fapath']}" data-longname="${genomes[dbkey]['name']}" data-index="picard" data-dbkey="${dbkey}">${genomes[dbkey]['srma_indexes']['state']}</td> - <td id="${dbkey}-perm" class="indexcell ${genomes[dbkey]['perm_base_indexes']['style']}" data-fapath="${genomes[dbkey]['fapath']}" data-longname="${genomes[dbkey]['name']}" data-index="perm" data-dbkey="${dbkey}">${genomes[dbkey]['perm_base_indexes']['state']}</td> + <td>${indextable[dbkey]['name']}</td> + %for label in labels: + <td id="${dbkey}-${indexfuncs[label]}" class="indexcell ${styles[indextable[dbkey]['indexes'][label]]}" data-fapath="${indextable[dbkey]['path']}" data-longname="${indextable[dbkey]['name']}" data-index="${indexfuncs[label]}" data-dbkey="${dbkey}">${indextable[dbkey]['indexes'][label]}</td> + %endfor + </tr> %endfor </table> @@ -124,6 +129,7 @@ jsondata["name"] = $('#job-' + jobid).attr('data-name'); jsondata["dbkey"] = $('#job-' + jobid).attr('data-dbkey'); jsondata["indexes"] = $('#job-' + jobid).attr('data-indexes'); + tdid = jq(jsondata["dbkey"] + '-' + jsondata["indexes"]); newhtml = makeNewHTML(jsondata); $('#job-' + jobid).replaceWith(newhtml); if ($.inArray(jsondata["status"], finalstates) == -1) { @@ -133,7 +139,7 @@ }); } if (jsondata["status"] == 'done' || jsondata["status"] == 'ok') { - elem = $('#' + jsondata["dbkey"] + '-' + jsondata["indexes"]); + elem = $(tdid); elem.html('Generated'); elem.attr('class', 'indexcell panel-done-message'); } @@ -156,5 +162,8 @@ } }); }); - + + function jq(id) { + return '#' + id.replace(/(:|\.)/g,'\\$1'); + } </script> \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.