1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/ef4a1377fcc6/
changeset: ef4a1377fcc6
user: jgoecks
date: 2011-12-15 22:21:39
summary: Custom builds: (a) reinstitute support for len files/len entries and (b) improve UI so that it is easy to specify build definition and help is accurate.
affected #: 2 files
diff -r fdcdc0115a123aa40bc46e69df769f171837534e -r ef4a1377fcc62bad6feb11df126339c639b7e56a lib/galaxy/web/controllers/user.py
--- a/lib/galaxy/web/controllers/user.py
+++ b/lib/galaxy/web/controllers/user.py
@@ -1198,14 +1198,57 @@
# Add new custom build.
name = kwds.get('name', '')
key = kwds.get('key', '')
- dataset_id = kwds.get('dataset_id', '')
- if not name or not key or not dataset_id:
+
+ # Look for build's chrom info in len_file and len_text.
+ len_file = kwds.get( 'len_file', None )
+ if getattr( len_file, "file", None ): # Check if it's a FieldStorage object
+ len_text = len_file.file.read()
+ else:
+ len_text = kwds.get( 'len_text', None )
+
+ if not len_text:
+ # Using FASTA from history.
+ dataset_id = kwds.get('dataset_id', '')
+
+ if not name or not key or not ( len_text or dataset_id ):
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:
- dataset_id = trans.security.decode_id( dataset_id )
- dbkeys[key] = { "name": name, "fasta": dataset_id }
+ # Have everything needed; create new build.
+ build_dict = { "name": name }
+ if len_text:
+ # Create new len file
+ new_len = trans.app.model.HistoryDatasetAssociation( extension="len", create_dataset=True, sa_session=trans.sa_session )
+ trans.sa_session.add( new_len )
+ new_len.name = name
+ new_len.visible = False
+ new_len.state = trans.app.model.Job.states.OK
+ new_len.info = "custom build .len file"
+ trans.sa_session.flush()
+ counter = 0
+ f = open(new_len.file_name, "w")
+ # LEN files have format:
+ # <chrom_name><tab><chrom_length>
+ for line in len_text.split("\n"):
+ 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
+ chrom, length = lst[0], lst[1]
+ try:
+ length = int(length)
+ except ValueError:
+ lines_skipped += 1
+ continue
+ counter += 1
+ f.write("%s\t%s\n" % (chrom, length))
+ f.close()
+ build_dict.update( { "len": new_len.id, "count": counter } )
+ else:
+ dataset_id = trans.security.decode_id( dataset_id )
+ build_dict[ "fasta" ] = dataset_id
+ dbkeys[key] = build_dict
# Save builds.
# TODO: use database table to save builds.
user.preferences['dbkeys'] = to_json_string(dbkeys)
diff -r fdcdc0115a123aa40bc46e69df769f171837534e -r ef4a1377fcc62bad6feb11df126339c639b7e56a templates/user/dbkeys.mako
--- a/templates/user/dbkeys.mako
+++ b/templates/user/dbkeys.mako
@@ -40,6 +40,15 @@
padding: 10px;
}
%endif
+ div.def_tab {
+ float: left;
+ padding: 0.2em 0.5em;
+ background-color: white;
+ }
+ div.def_tab.active {
+ background-color: #CCF;
+ border: solid 1px #66A;
+ }
</style></%def>
@@ -60,6 +69,43 @@
$("#show_installed_builds").click(function() {
$("#installed_builds").show();
});
+
+ // Set up behavior for build definition tab controls.
+ $("div.def_tab > a").each(function() {
+ $(this).click(function() {
+ var tab_id = $(this).attr("id");
+
+ // Hide all build inputs, help.
+ $("div.build_definition").children(":input").hide();
+ $(".infomessagesmall > div").hide();
+
+ // Show input item, help corresponding to tab id.
+ $("#" + tab_id + "_input").show();
+ $("." + tab_id + "_help").show();
+
+ // Update tabs.
+ $("div.def_tab").removeClass("active");
+ $(this).parent().addClass("active");
+ });
+ });
+
+ ## If there are fasta HDAs available, show fasta tab; otherwise show len file tab.
+ // Set starting tab.
+ % if fasta_hdas.first():
+ $("#fasta").click();
+ % else:
+ $("#len_file").click();
+ % endif
+
+ // Before submit, remove inputs not associated with the active tab.
+ $("#submit").click(function() {
+ var id = $(".active > a").attr("id");
+ $("div.build_definition").children(":input").each(function() {
+ if ( $(this).attr("id") !== (id + "_input") ) {
+ $(this).remove();
+ }
+ });
+ });
});
</script>
@@ -70,7 +116,6 @@
</%def><%def name="body()">
-
% if message:
<div class="errormessagelarge">${message}</div>
% elif lines_skipped > 0:
@@ -123,50 +168,82 @@
<hr /><h3>Add a Custom Build</h3><form action="dbkeys" method="post" enctype="multipart/form-data">
+ ## Custom build via fasta in history.
<div class="toolForm" style="float: left;"><div class="toolFormTitle">New Build</div><div class="toolFormBody"><div class="form-row">
- <label for="name">Build Name (eg: Mouse):</label>
+ <label for="name">Name (eg: Hamster):</label><input type="text" id="name" name="name" /></div><div class="form-row">
- <label for="key">Build Key (eg: mm9):</label>
+ <label for="key">Key (eg: hamster_v1):</label><input type="text" id="key" name="key" /></div>
- <div class="form-row">
- <label for="len_file">Build Genome:</label>
- <select name="dataset_id">
+ <div class="form-row build_definition">
+ <label>Definition:</label>
+ <div class="def_tab">
+ <a id="fasta" href="javascript:void(0)">FASTA</a>
+ </div>
+ <div class="def_tab">
+ <a id="len_file" href="javascript:void(0)">Len File</a>
+ </div>
+ <div class="def_tab">
+ <a id="len_entry" href="javascript:void(0)">Len Entry</a>
+ </div>
+ <div style="clear: both; padding-bottom: 0.5em"></div>
+ <select id="fasta_input" name="dataset_id">
%for dataset in fasta_hdas:
<option value="${trans.security.encode_id( dataset.id )}">${dataset.hid}: ${dataset.name}</option>
%endfor
</select>
- </div>
-
- <div class="form-row"><input type="submit" name="add" value="Submit"/></div>
+ <input type="file" id="len_file_input" name="len_file" /></input>
+ <textarea id="len_entry_input" name="len_text" cols="30" rows="8"></textarea>
+ </div>
+ <div class="form-row"><input id="submit" type="submit" name="add" value="Submit"/></div></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>
+ <div class="fasta_help">
+ <h3>FASTA format</h3>
+ <p>
+ This is a multi-fasta file from your current history that provides the genome
+ sequences for each chromosome/contig in your build.
+ </p>
+
+ <p>
+ Here is a snippet from an example multi-fasta file:
+ <pre>
+ >chr1
+ ATTATATATAAGACCACAGAGAGAATATTTTGCCCGG...
+ >chr2
+ GGCGGCCGCGGCGATATAGAACTACTCATTATATATA...
+ ...
+ </pre>
+ </p>
+ </div>
+ <div class="len_file_help len_entry_help">
+ <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 into the box.</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 (Len File option), or directly enter the information into the box
+ (Len Entry option).</p>
+ </div></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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/fdcdc0115a12/
changeset: fdcdc0115a12
user: greg
date: 2011-12-15 16:49:40
summary: Reset repository metadata for installed tool shed repositories when a new update to the repository contents has been pulled from the tool shed.
affected #: 3 files
diff -r 13ba6909faae12b0a7efcdc76e0797c5e7903929 -r fdcdc0115a123aa40bc46e69df769f171837534e lib/galaxy/tool_shed/install_manager.py
--- a/lib/galaxy/tool_shed/install_manager.py
+++ b/lib/galaxy/tool_shed/install_manager.py
@@ -73,18 +73,19 @@
if returncode == 0:
returncode, tmp_name = update_repository( current_working_dir, relative_install_dir, changeset_revision )
if returncode == 0:
- metadata_dict = load_repository_contents( self.app,
- name,
- description,
- self.repository_owner,
- changeset_revision,
- repository_clone_url,
- self.install_tool_config,
- self.tool_path,
- tool_section,
- relative_install_dir,
- current_working_dir,
- tmp_name )
+ metadata_dict = load_repository_contents( app=self.app,
+ name=name,
+ description=description,
+ owner=self.repository_owner,
+ changeset_revision=changeset_revision,
+ tool_path=self.tool_path,
+ repository_clone_url=repository_clone_url,
+ relative_install_dir=relative_install_dir,
+ current_working_dir=current_working_dir,
+ tmp_name=tmp_name,
+ tool_section=tool_section,
+ shed_tool_conf=self.install_tool_config,
+ new_install=True )
# Add a new record to the tool_id_guid_map table for each
# tool in the repository if one doesn't already exist.
if 'tools' in metadata_dict:
diff -r 13ba6909faae12b0a7efcdc76e0797c5e7903929 -r fdcdc0115a123aa40bc46e69df769f171837534e lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -2,6 +2,7 @@
from datetime import date, datetime, timedelta
from time import strftime
from galaxy import util
+from galaxy.util.json import *
from galaxy.tools import ToolSection
from galaxy.tools.search import ToolBoxSearch
from galaxy.model.orm import *
@@ -77,7 +78,7 @@
os.chdir( current_working_dir )
tmp_stderr.close()
return returncode, tmp_name
-def create_or_undelete_tool_shed_repository( app, name, description, changeset_revision, repository_clone_url, metadata_dict, owner='' ):
+def create_or_update_tool_shed_repository( app, name, description, changeset_revision, repository_clone_url, metadata_dict, owner='' ):
# This method is used by the InstallManager, which does not have access to trans.
sa_session = app.model.context.current
tmp_url = clean_repository_clone_url( repository_clone_url )
@@ -85,16 +86,13 @@
if not owner:
owner = get_repository_owner( tmp_url )
includes_datatypes = 'datatypes_config' in metadata_dict
- flush_needed = False
tool_shed_repository = get_repository_by_shed_name_owner_changeset_revision( app, tool_shed, name, owner, changeset_revision )
if tool_shed_repository:
- if tool_shed_repository.deleted:
- tool_shed_repository.description = description
- tool_shed_repository.changeset_revision = changeset_revision
- tool_shed_repository.metadata = metadata_dict
- tool_shed_repository.includes_datatypes = includes_datatypes
- tool_shed_repository.deleted = False
- flush_needed = True
+ tool_shed_repository.description = description
+ tool_shed_repository.changeset_revision = changeset_revision
+ tool_shed_repository.metadata = metadata_dict
+ tool_shed_repository.includes_datatypes = includes_datatypes
+ tool_shed_repository.deleted = False
else:
tool_shed_repository = app.model.ToolShedRepository( tool_shed=tool_shed,
name=name,
@@ -104,10 +102,8 @@
changeset_revision=changeset_revision,
metadata=metadata_dict,
includes_datatypes=includes_datatypes )
- flush_needed = True
- if flush_needed:
- sa_session.add( tool_shed_repository )
- sa_session.flush()
+ sa_session.add( tool_shed_repository )
+ sa_session.flush()
def generate_datatypes_metadata( datatypes_config, metadata_dict ):
"""
Update the received metadata_dict with changes that have been applied
@@ -471,12 +467,17 @@
except Exception, e:
log.debug( "Exception importing datatypes code file included in installed repository: %s" % str( e ) )
app.datatypes_registry.load_datatypes( root_dir=app.config.root, config=datatypes_config, imported_module=imported_module )
-def load_repository_contents( app, name, description, owner, changeset_revision, repository_clone_url, shed_tool_conf,
- tool_path, tool_section, relative_install_dir, current_working_dir, tmp_name ):
+def load_repository_contents( app, name, description, owner, changeset_revision, tool_path, repository_clone_url, relative_install_dir,
+ current_working_dir, tmp_name, tool_section=None, shed_tool_conf=None, new_install=True ):
# This method is used by the InstallManager, which does not have access to trans.
# Generate the metadata for the installed tool shed repository. It is imperative that
# the installed repository is updated to the desired changeset_revision before metadata
- # is set because the process for setting metadata uses the repository files on disk.
+ # is set because the process for setting metadata uses the repository files on disk. This
+ # method is called when new tools have been installed (in which case values should be received
+ # for tool_section and shed_tool_conf, and new_install should be left at it's default value)
+ # and when updates have been pulled to previously installed repositories (in which case the
+ # default value None is set for tool_section and shed_tool_conf, and the value of new_install
+ # is passed as False).
metadata_dict = generate_metadata( app.toolbox, relative_install_dir, repository_clone_url )
if 'datatypes_config' in metadata_dict:
datatypes_config = os.path.abspath( metadata_dict[ 'datatypes_config' ] )
@@ -497,42 +498,38 @@
repository_tools_tups = handle_missing_index_file( app, tool_path, sample_files, repository_tools_tups )
# Handle tools that use fabric scripts to install dependencies.
handle_tool_dependencies( current_working_dir, relative_install_dir, repository_tools_tups )
- # Generate a new entry for the tool config.
- elem_list = generate_tool_panel_elem_list( name,
- repository_clone_url,
- changeset_revision,
- repository_tools_tups,
- tool_section=tool_section,
- owner=owner )
- if tool_section:
- for section_elem in elem_list:
- # Load the section into the tool panel.
- app.toolbox.load_section_tag_set( section_elem, app.toolbox.tool_panel, tool_path )
- else:
- # Load the tools into the tool panel outside of any sections.
- for tool_elem in elem_list:
- guid = tool_elem.get( 'guid' )
- app.toolbox.load_tool_tag_set( tool_elem, app.toolbox.tool_panel, tool_path=tool_path, guid=guid )
+ if new_install:
+ # Generate a new entry for the tool config.
+ elem_list = generate_tool_panel_elem_list( name,
+ repository_clone_url,
+ changeset_revision,
+ repository_tools_tups,
+ tool_section=tool_section,
+ owner=owner )
+ if tool_section:
+ for section_elem in elem_list:
+ # Load the section into the tool panel.
+ app.toolbox.load_section_tag_set( section_elem, app.toolbox.tool_panel, tool_path )
+ else:
+ # Load the tools into the tool panel outside of any sections.
+ for tool_elem in elem_list:
+ guid = tool_elem.get( 'guid' )
+ app.toolbox.load_tool_tag_set( tool_elem, app.toolbox.tool_panel, tool_path=tool_path, guid=guid )
+ for elem_entry in elem_list:
+ # Append the new entry (either section or list of tools) to the shed_tool_config file.
+ add_shed_tool_conf_entry( app, shed_tool_conf, elem_entry )
+ if app.toolbox_search.enabled:
+ # If search support for tools is enabled, index the new installed tools.
+ app.toolbox_search = ToolBoxSearch( app.toolbox )
# Remove the temporary file
try:
os.unlink( tmp_name )
except:
pass
- for elem_entry in elem_list:
- # Append the new entry (either section or list of tools) to the shed_tool_config file.
- add_shed_tool_conf_entry( app, shed_tool_conf, elem_entry )
- if app.toolbox_search.enabled:
- # If search support for tools is enabled, index the new installed tools.
- app.toolbox_search = ToolBoxSearch( app.toolbox )
# Add a new record to the tool_shed_repository table if one doesn't
# already exist. If one exists but is marked deleted, undelete it.
- log.debug( "Adding new row to tool_shed_repository table for repository '%s'" % name )
- create_or_undelete_tool_shed_repository( app,
- name,
- description,
- changeset_revision,
- repository_clone_url,
- metadata_dict )
+ log.debug( "Adding new row (or updating an existing row) for repository '%s' in the tool_shed_repository table." % name )
+ create_or_update_tool_shed_repository( app, name, description, changeset_revision, repository_clone_url, metadata_dict )
return metadata_dict
def pretty_print_xml( elem, level=0 ):
pad = ' '
diff -r 13ba6909faae12b0a7efcdc76e0797c5e7903929 -r fdcdc0115a123aa40bc46e69df769f171837534e lib/galaxy/web/controllers/admin_toolshed.py
--- a/lib/galaxy/web/controllers/admin_toolshed.py
+++ b/lib/galaxy/web/controllers/admin_toolshed.py
@@ -237,18 +237,19 @@
returncode, tmp_name = update_repository( current_working_dir, relative_install_dir, changeset_revision )
if returncode == 0:
owner = get_repository_owner( clean_repository_clone_url( repository_clone_url ) )
- metadata_dict = load_repository_contents( trans.app,
- name,
- description,
- owner,
- changeset_revision,
- repository_clone_url,
- shed_tool_conf,
- tool_path,
- tool_section,
- relative_install_dir,
- current_working_dir,
- tmp_name )
+ metadata_dict = load_repository_contents( app=trans.app,
+ name=name,
+ description=description,
+ owner=owner,
+ changeset_revision=changeset_revision,
+ tool_path=tool_path,
+ repository_clone_url=repository_clone_url,
+ relative_install_dir=relative_install_dir,
+ current_working_dir=current_working_dir,
+ tmp_name=tmp_name,
+ tool_section=tool_section,
+ shed_tool_conf=shed_tool_conf,
+ new_install=True )
installed_repository_names.append( name )
else:
tmp_stderr = open( tmp_name, 'rb' )
@@ -302,7 +303,7 @@
status = params.get( 'status', 'done' )
repository = get_repository( trans, kwd[ 'id' ] )
description = util.restore_text( params.get( 'description', repository.description ) )
- relative_install_dir = self.__get_relative_install_dir( trans, repository )
+ tool_path, relative_install_dir = self.__get_tool_path_and_relative_install_dir( trans, repository )
repo_files_dir = os.path.abspath( os.path.join( relative_install_dir, repository.name ) )
if params.get( 'edit_repository_button', False ):
if description != repository.description:
@@ -351,13 +352,28 @@
message = "The cloned tool shed repository named '%s' is current (there are no updates available)." % name
else:
current_working_dir = os.getcwd()
- relative_install_dir = self.__get_relative_install_dir( trans, repository )
+ tool_path, relative_install_dir = self.__get_tool_path_and_relative_install_dir( trans, repository )
if relative_install_dir:
repo_files_dir = os.path.join( relative_install_dir, name )
returncode, tmp_name = pull_repository( current_working_dir, repo_files_dir, name )
if returncode == 0:
returncode, tmp_name = update_repository( current_working_dir, repo_files_dir, latest_changeset_revision )
if returncode == 0:
+ # Update the repository metadata.
+ repository_clone_url = os.path.join( tool_shed_url, 'repos', owner, name )
+ metadata_dict = load_repository_contents( app=trans.app,
+ name=name,
+ description=repository.description,
+ owner=owner,
+ changeset_revision=changeset_revision,
+ tool_path=tool_path,
+ repository_clone_url=repository_clone_url,
+ relative_install_dir=relative_install_dir,
+ current_working_dir=current_working_dir,
+ tmp_name=tmp_name,
+ tool_section=None,
+ shed_tool_conf=None,
+ new_install=False )
# Update the repository changeset_revision in the database.
repository.changeset_revision = latest_changeset_revision
repository.update_available = False
@@ -408,8 +424,9 @@
metadata=metadata,
message=message,
status=status )
- def __get_relative_install_dir( self, trans, repository ):
- # Get the directory where the repository is install.
+ def __get_tool_path_and_relative_install_dir( self, trans, repository ):
+ # Return both the tool_path configured in the relative shed_tool_conf and
+ # the relative path to the directory where the repository is installed.
tool_shed = clean_tool_shed_url( repository.tool_shed )
partial_install_dir = '%s/repos/%s/%s/%s' % ( tool_shed, repository.owner, repository.name, repository.installed_changeset_revision )
# Get the relative tool installation paths from each of the shed tool configs.
@@ -420,7 +437,7 @@
relative_install_dir = os.path.join( tool_path, partial_install_dir )
if os.path.isdir( relative_install_dir ):
break
- return relative_install_dir
+ return tool_path, relative_install_dir
def __generate_tool_path( self, repository_clone_url, changeset_revision ):
"""
Generate a tool path that guarantees repositories with the same name will always be installed
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/4a39bc209487/
changeset: 4a39bc209487
user: dan
date: 2011-12-14 15:37:45
summary: Update EBI SRA tool's input action.
affected #: 1 file
diff -r 66a7957ed97403fb4e17c9c747c4624e1c1b2f3d -r 4a39bc2094875a9878f07f27f7307976e05e8b87 tools/data_source/ebi_sra.xml
--- a/tools/data_source/ebi_sra.xml
+++ b/tools/data_source/ebi_sra.xml
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
-<tool name="EBI SRA" id="ebi_sra_main" tool_type="data_source" version="1.0.0">
+<tool name="EBI SRA" id="ebi_sra_main" tool_type="data_source" version="1.0.1"><description>ENA SRA</description><!-- This paython script imports the file into Galaxy --><command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
- <!-- The URL where Galaxy will forwars the user when this tool is accessed from the Get Data menu -->
- <inputs action="http://www.ebi.ac.uk/ena/" check_values="false" method="get">
+ <!-- The URL where Galaxy will forwards the user when this tool is accessed from the Get Data menu -->
+ <inputs action="http://www.ebi.ac.uk/ena/data/search" check_values="false" method="get"><display>go to EBI SRA server $GALAXY_URL</display></inputs><uihints minwidth="800"/>
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.