1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/9e327e97acba/ changeset: r5224:9e327e97acba user: kanwei date: 2011-03-16 04:40:53 summary: Improved custom builds UI. Better help text explaining len file format. Now split on last whitespace instead of tab only so that len info can be typed into the box directly. affected #: 2 files (1.7 KB) --- a/lib/galaxy/web/controllers/user.py Tue Mar 15 15:39:35 2011 -0400 +++ b/lib/galaxy/web/controllers/user.py Tue Mar 15 23:40:53 2011 -0400 @@ -5,7 +5,7 @@ from galaxy.web.base.controller import * from galaxy.model.orm import * from galaxy import util, model -import logging, os, string, re, smtplib, socket +import logging, os, string, re, smtplib, socket, glob from random import choice from email.MIMEText import MIMEText from galaxy.web.form_builder import * @@ -53,6 +53,8 @@ class User( BaseController, UsesFormDefinitions ): user_openid_grid = UserOpenIDGrid() + installed_len_files = None + @web.expose def index( self, trans, webapp='galaxy', **kwd ): return trans.fill_template( '/user/index.mako', webapp=webapp ) @@ -1237,12 +1239,21 @@ """ Log a user action asynchronously. If user is not logged in, do nothing. """ if trans.user: trans.log_action( trans.get_user(), action, context, params ) + @web.expose @web.require_login() def dbkeys( self, trans, **kwds ): user = trans.get_user() message = None lines_skipped = 0 + if self.installed_len_files is None: + installed_builds = [] + for build in glob.glob( os.path.join(trans.app.config.len_file_path, "*.len") ): + installed_builds.append( os.path.basename(build).split(".len")[0] ) + + self.installed_len_files = ", ".join(installed_builds) + + if 'dbkeys' not in user.preferences: dbkeys = {} else: @@ -1263,6 +1274,8 @@ len_text = kwds.get('len_text', '') if not name or not key or not len_text: message = "You must specify values for all the fields." + elif key in dbkeys: + message = "There is already a custom build with that key. Delete it first if you want to replace it." else: # Create new len file new_len = trans.app.model.HistoryDatasetAssociation( extension="len", create_dataset=True, sa_session=trans.sa_session ) @@ -1278,7 +1291,7 @@ # LEN files have format: # <chrom_name><tab><chrom_length> for line in len_text.split("\n"): - lst = line.strip().split("\t") + lst = line.strip().rsplit(None, 1) # Splits at the last whitespace in the line if not lst or len(lst) < 2: lines_skipped += 1 continue @@ -1300,6 +1313,7 @@ user=user, dbkeys=dbkeys, message=message, + installed_len_files=self.installed_len_files, lines_skipped=lines_skipped, use_panels=kwds.get( 'use_panels', None ) ) @web.expose --- a/templates/user/dbkeys.mako Tue Mar 15 15:39:35 2011 -0400 +++ b/templates/user/dbkeys.mako Tue Mar 15 23:40:53 2011 -0400 @@ -61,27 +61,28 @@ </script></%def> -% if message: - <div class="errormessagelarge">${message}</div> -% elif lines_skipped > 0: - <div class="warningmessagelarge">Skipped ${lines_skipped} lines that could not be parsed</div> -% endif - <%def name="center_panel()"> ${self.body()} </%def><%def name="body()"> + + % if message: + <div class="errormessagelarge">${message}</div> + % elif lines_skipped > 0: + <div class="warningmessagelarge">Skipped ${lines_skipped} lines that could not be parsed. (Line was either blank or not 2-column, with 2nd column being an integer)</div> + % endif + <h2>Custom Database/Builds</h2> - <p>You may specify your own database/builds here.</p> + <p>Current custom builds:</p> % if dbkeys: <table id="custom_dbkeys" class="colored" cellspacing="0" cellpadding="0"><tr class="header"><th>Name</th><th>Key</th> - <th>Number of Chroms</th> + <th>Number of chroms/contigs</th><th></th></tr> % for key, dct in dbkeys.iteritems(): @@ -109,23 +110,27 @@ % else: <p>You currently have no custom builds.</p> % endif + <p>Builds with system-installed len files: <em>${installed_len_files}</em></p><br /> + <form action="dbkeys" method="post" enctype="multipart/form-data"> - <div class="toolForm"> - <div class="toolFormTitle">Add a Build</div> + <div class="toolForm" style="float: left;"> + <div class="toolFormTitle">Add a Custom Build</div> + + <div class="toolFormBody"><div class="form-row"> - <label for="name">Name (eg: Human Chromosome):</label> + <label for="name">Build Name (eg: Human Chromosome):</label><input type="text" id="name" name="name" /></div><div class="form-row"> - <label for="key">Key (eg: hg18):</label> + <label for="key">Build Key (eg: hg18):</label><input type="text" id="key" name="key" /></div><div class="form-row"><label for="len_file">Chromosome Length file upload (.len file):</label><input type="file" id="len_file" name="len_file" /><br /> - <label for="len_text">Alternatively, paste length info:</label> + <label for="len_text">Or paste length info below:</label><textarea id="len_text" name="len_text" cols="40" rows="10"></textarea></div> @@ -133,4 +138,27 @@ </div></div></form> + <div class="infomessagesmall" style="float: left; margin-left: 10px; width: 40%;"> + <h3>Length Format</h3> + <p> + The length format is two-column, separated by whitespace, of the form: + <pre>chrom/contig length of chrom/contig</pre> + </p> + <p> + For example, the first few entries of <em>mm9.len</em> are as follows: + <pre> +chr1 197195432 +chr2 181748087 +chr3 159599783 +chr4 155630120 +chr5 152537259 + </pre> + </p> + + <p>Trackster uses this information to populate the select box for chrom/contig, and + to set the maximum basepair of the track browser. You may either upload a .len file + of this format, or directly enter the information in the box. + </p> + + </div></%def> \ 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.